Your IP : 216.73.216.213


Current Path : /opt/alt/python37/share/doc/alt-python37-pyparsing-doc/html/.doctrees/
Upload File :
Current File : //opt/alt/python37/share/doc/alt-python37-pyparsing-doc/html/.doctrees/HowToUsePyparsing.doctree

���docutils.nodes��document���)��}�(�	rawsource����children�]�h�section���)��}�(hhh]�(h�title���)��}�(h�Using the pyparsing module�h]�(h�	generated���)��}�(hhh]�h�Text����1   �����}�(hh�parent�hhh�source�N�line�Nuba�
attributes�}�(�ids�]��classes�]��sectnum�a�names�]��dupnames�]��backrefs�]�u�tagname�hhhhhh Nh!Nubh�Using the pyparsing module�����}�(hhhhhhh Nh!Nubeh"}�(h$]�h&]�h)]�h+]�h-]��auto�K�refid��id1�uh/hhhhhh �@/builddir/build/BUILD/pyparsing-3.0.9/docs/HowToUsePyparsing.rst�h!Kubh�
field_list���)��}�(hhh]�(h�field���)��}�(hhh]�(h�
field_name���)��}�(h�author�h]�h�author�����}�(hhLhhJubah"}�(h$]�h&]�h)]�h+]�h-]�uh/hHhhEh h=h!Kubh�
field_body���)��}�(h�Paul McGuire�h]�h�	paragraph���)��}�(hh\h]�h�Paul McGuire�����}�(hh\hh`ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!KhhZubah"}�(h$]�h&]�h)]�h+]�h-]�uh/hXhhEubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/hCh h=h!Khh@hhubhD)��}�(hhh]�(hI)��}�(h�address�h]�h�address�����}�(hh~hh|ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/hHhhyh h=h!KubhY)��}�(h�ptmcg.pm+pyparsing@gmail.com
�h]�h_)��}�(h�ptmcg.pm+pyparsing@gmail.com�h]�h�	reference���)��}�(hh�h]�h�ptmcg.pm+pyparsing@gmail.com�����}�(hhhh�ubah"}�(h$]�h&]�h)]�h+]�h-]��refuri��#mailto:ptmcg.pm+pyparsing@gmail.com�uh/h�hh�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!Khh�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/hXhhyubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/hCh h=h!Khh@hhubhD)��}�(hhh]�(hI)��}�(h�revision�h]�h�revision�����}�(hh�hh�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/hHhh�h h=h!KubhY)��}�(h�3.0.0�h]�h_)��}�(hh�h]�h�3.0.0�����}�(hh�hh�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!Khh�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/hXhh�ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/hCh h=h!Khh@hhubhD)��}�(hhh]�(hI)��}�(h�date�h]�h�date�����}�(hh�hh�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/hHhh�h h=h!KubhY)��}�(h�October, 2021
�h]�h_)��}�(h�
October, 2021�h]�h�
October, 2021�����}�(hh�hh�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!K	hh�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/hXhh�ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/hCh h=h!K	hh@hhubhD)��}�(hhh]�(hI)��}�(h�	copyright�h]�h�	copyright�����}�(hjhjubah"}�(h$]�h&]�h)]�h+]�h-]�uh/hHhjh h=h!KubhY)��}�(h�)Copyright |copy| 2003-2022 Paul McGuire.
�h]�h_)��}�(h�(Copyright |copy| 2003-2022 Paul McGuire.�h]�(h�
Copyright �����}�(h�
Copyright �hj'ubh�©�����}�(hhhj'ubh� 2003-2022 Paul McGuire.�����}�(h� 2003-2022 Paul McGuire.�hj'ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!Khj#ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/hXhjubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/hCh h=h!Khh@hhubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h>hhhhh h=h!Kubh�substitution_definition���)��}�(h�.. |copy| unicode:: 0xA9
�h]�h�©�����}�(hhhjSubah"}�(h$]�h&]�h)]��copy�ah+]�h-]�uh/jQh h=h!K
hhhhubh?)��}�(hhh]�hD)��}�(hhh]�(hI)��}�(h�abstract�h]�h�abstract�����}�(hjjhjhubah"}�(h$]�h&]�h)]�h+]�h-]�uh/hHhjeh h=h!KubhY)��}�(hX=This document provides how-to instructions for the
pyparsing library, an easy-to-use Python module for constructing
and executing basic text parsers.  The pyparsing module is useful
for evaluating user-definable
expressions, processing custom application language commands, or
extracting data from formatted reports.
�h]�h_)��}�(hX<This document provides how-to instructions for the
pyparsing library, an easy-to-use Python module for constructing
and executing basic text parsers.  The pyparsing module is useful
for evaluating user-definable
expressions, processing custom application language commands, or
extracting data from formatted reports.�h]�hX<This document provides how-to instructions for the
pyparsing library, an easy-to-use Python module for constructing
and executing basic text parsers.  The pyparsing module is useful
for evaluating user-definable
expressions, processing custom application language commands, or
extracting data from formatted reports.�����}�(hj|hjzubah"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!Khjvubah"}�(h$]�h&]�h)]�h+]�h-]�uh/hXhjeubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/hCh h=h!Khjbhhubah"}�(h$]�h&]�h)]�h+]�h-]�uh/h>hhhhh h=h!Kubh�topic���)��}�(hhh]�(h)��}�(h�Contents�h]�h�Contents�����}�(hhhj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/hhj�h h=h!Kubh�bullet_list���)��}�(hhh]�h�	list_item���)��}�(hhh]�(h_)��}�(hhh]�h�)��}�(hhh]�(h)��}�(hhh]�h�1   �����}�(hhhj�ubah"}�(h$]�h&]�h(ah)]�h+]�h-]�uh/hh Nh!Nhj�ubh�Using the pyparsing module�����}�(hhhj�ubeh"}�(h$]�h<ah&]�h)]�h+]�h-]��refid��using-the-pyparsing-module�uh/h�hj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/h^hj�ubj�)��}�(hhh]�(j�)��}�(hhh]�(h_)��}�(hhh]�h�)��}�(hhh]�(h)��}�(hhh]�h�	1.1   �����}�(hhhj�ubah"}�(h$]�h&]�h(ah)]�h+]�h-]�uh/hh Nh!Nhj�ubh�Steps to follow�����}�(h�Steps to follow�hj�ubeh"}�(h$]��id2�ah&]�h)]�h+]�h-]��refid��steps-to-follow�uh/h�hj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/h^hj�ubj�)��}�(hhh]�(j�)��}�(hhh]�h_)��}�(hhh]�h�)��}�(hhh]�(h)��}�(hhh]�h�1.1.1   �����}�(hhhjubah"}�(h$]�h&]�h(ah)]�h+]�h-]�uh/hh Nh!Nhjubh�
Hello, World!�����}�(h�
Hello, World!�hjubeh"}�(h$]��id3�ah&]�h)]�h+]�h-]��refid��hello-world�uh/h�hjubah"}�(h$]�h&]�h)]�h+]�h-]�uh/h^hjubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj	ubj�)��}�(hhh]�h_)��}�(hhh]�h�)��}�(hhh]�(h)��}�(hhh]�h�1.1.2   �����}�(hhhjEubah"}�(h$]�h&]�h(ah)]�h+]�h-]�uh/hh Nh!NhjBubh�Usage notes�����}�(h�Usage notes�hjBubeh"}�(h$]��id4�ah&]�h)]�h+]�h-]��refid��usage-notes�uh/h�hj?ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/h^hj<ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj	ubeh"}�(h$]�h&]��auto-toc�ah)]�h+]�h-]�uh/j�hj�ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubj�)��}�(hhh]�(h_)��}�(hhh]�h�)��}�(hhh]�(h)��}�(hhh]�h�	1.2   �����}�(hhhj�ubah"}�(h$]�h&]�h(ah)]�h+]�h-]�uh/hh Nh!Nhjubh�Classes�����}�(h�Classes�hjubeh"}�(h$]��id5�ah&]�h)]�h+]�h-]��refid��classes�uh/h�hj|ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/h^hjyubj�)��}�(hhh]�(j�)��}�(hhh]�h_)��}�(hhh]�h�)��}�(hhh]�(h)��}�(hhh]�h�1.2.1   �����}�(hhhj�ubah"}�(h$]�h&]�h(ah)]�h+]�h-]�uh/hh Nh!Nhj�ubh�Classes in the pyparsing module�����}�(h�Classes in the pyparsing module�hj�ubeh"}�(h$]��id6�ah&]�h)]�h+]�h-]��refid��classes-in-the-pyparsing-module�uh/h�hj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/h^hj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubj�)��}�(hhh]�h_)��}�(hhh]�h�)��}�(hhh]�(h)��}�(hhh]�h�1.2.2   �����}�(hhhj�ubah"}�(h$]�h&]�h(ah)]�h+]�h-]�uh/hh Nh!Nhj�ubh�Basic ParserElement subclasses�����}�(h�Basic ParserElement subclasses�hj�ubeh"}�(h$]��id7�ah&]�h)]�h+]�h-]��refid��basic-parserelement-subclasses�uh/h�hj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/h^hj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubj�)��}�(hhh]�h_)��}�(hhh]�h�)��}�(hhh]�(h)��}�(hhh]�h�1.2.3   �����}�(hhhjubah"}�(h$]�h&]�h(ah)]�h+]�h-]�uh/hh Nh!Nhjubh�Expression subclasses�����}�(h�Expression subclasses�hjubeh"}�(h$]��id8�ah&]�h)]�h+]�h-]��refid��expression-subclasses�uh/h�hj	ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/h^hjubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubj�)��}�(hhh]�h_)��}�(hhh]�h�)��}�(hhh]�(h)��}�(hhh]�h�1.2.4   �����}�(hhhj?ubah"}�(h$]�h&]�h(ah)]�h+]�h-]�uh/hh Nh!Nhj<ubh�Expression operators�����}�(h�Expression operators�hj<ubeh"}�(h$]��id9�ah&]�h)]�h+]�h-]��refid��expression-operators�uh/h�hj9ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/h^hj6ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubj�)��}�(hhh]�h_)��}�(hhh]�h�)��}�(hhh]�(h)��}�(hhh]�h�1.2.5   �����}�(hhhjoubah"}�(h$]�h&]�h(ah)]�h+]�h-]�uh/hh Nh!Nhjlubh�Positional subclasses�����}�(h�Positional subclasses�hjlubeh"}�(h$]��id10�ah&]�h)]�h+]�h-]��refid��positional-subclasses�uh/h�hjiubah"}�(h$]�h&]�h)]�h+]�h-]�uh/h^hjfubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubj�)��}�(hhh]�h_)��}�(hhh]�h�)��}�(hhh]�(h)��}�(hhh]�h�1.2.6   �����}�(hhhj�ubah"}�(h$]�h&]�h(ah)]�h+]�h-]�uh/hh Nh!Nhj�ubh�Converter subclasses�����}�(h�Converter subclasses�hj�ubeh"}�(h$]��id11�ah&]�h)]�h+]�h-]��refid��converter-subclasses�uh/h�hj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/h^hj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubj�)��}�(hhh]�h_)��}�(hhh]�h�)��}�(hhh]�(h)��}�(hhh]�h�1.2.7   �����}�(hhhj�ubah"}�(h$]�h&]�h(ah)]�h+]�h-]�uh/hh Nh!Nhj�ubh�Special subclasses�����}�(h�Special subclasses�hj�ubeh"}�(h$]��id12�ah&]�h)]�h+]�h-]��refid��special-subclasses�uh/h�hj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/h^hj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubj�)��}�(hhh]�h_)��}�(hhh]�h�)��}�(hhh]�(h)��}�(hhh]�h�1.2.8   �����}�(hhhj�ubah"}�(h$]�h&]�h(ah)]�h+]�h-]�uh/hh Nh!Nhj�ubh�
Other classes�����}�(h�
Other classes�hj�ubeh"}�(h$]��id13�ah&]�h)]�h+]�h-]��refid��
other-classes�uh/h�hj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/h^hj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubj�)��}�(hhh]�h_)��}�(hhh]�h�)��}�(hhh]�(h)��}�(hhh]�h�1.2.9   �����}�(hhhj/ubah"}�(h$]�h&]�h(ah)]�h+]�h-]�uh/hh Nh!Nhj,ubh�%Exception classes and Troubleshooting�����}�(h�%Exception classes and Troubleshooting�hj,ubeh"}�(h$]��id14�ah&]�h)]�h+]�h-]��refid��%exception-classes-and-troubleshooting�uh/h�hj)ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/h^hj&ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubeh"}�(h$]�h&]�joah)]�h+]�h-]�uh/j�hjyubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubj�)��}�(hhh]�(h_)��}�(hhh]�h�)��}�(hhh]�(h)��}�(hhh]�h�	1.3   �����}�(hhhjkubah"}�(h$]�h&]�h(ah)]�h+]�h-]�uh/hh Nh!Nhjhubh�$Miscellaneous attributes and methods�����}�(h�$Miscellaneous attributes and methods�hjhubeh"}�(h$]��id15�ah&]�h)]�h+]�h-]��refid��$miscellaneous-attributes-and-methods�uh/h�hjeubah"}�(h$]�h&]�h)]�h+]�h-]�uh/h^hjbubj�)��}�(hhh]�(j�)��}�(hhh]�h_)��}�(hhh]�h�)��}�(hhh]�(h)��}�(hhh]�h�1.3.1   �����}�(hhhj�ubah"}�(h$]�h&]�h(ah)]�h+]�h-]�uh/hh Nh!Nhj�ubh�Helper methods�����}�(h�Helper methods�hj�ubeh"}�(h$]��id16�ah&]�h)]�h+]�h-]��refid��helper-methods�uh/h�hj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/h^hj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubj�)��}�(hhh]�h_)��}�(hhh]�h�)��}�(hhh]�(h)��}�(hhh]�h�1.3.2   �����}�(hhhj�ubah"}�(h$]�h&]�h(ah)]�h+]�h-]�uh/hh Nh!Nhj�ubh�Helper parse actions�����}�(h�Helper parse actions�hj�ubeh"}�(h$]��id17�ah&]�h)]�h+]�h-]��refid��helper-parse-actions�uh/h�hj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/h^hj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubj�)��}�(hhh]�h_)��}�(hhh]�h�)��}�(hhh]�(h)��}�(hhh]�h�1.3.3   �����}�(hhhj�ubah"}�(h$]�h&]�h(ah)]�h+]�h-]�uh/hh Nh!Nhj�ubh�!Common string and token constants�����}�(h�!Common string and token constants�hj�ubeh"}�(h$]��id18�ah&]�h)]�h+]�h-]��refid��!common-string-and-token-constants�uh/h�hj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/h^hj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubj�)��}�(hhh]�h_)��}�(hhh]�h�)��}�(hhh]�(h)��}�(hhh]�h�1.3.4   �����}�(hhhj(ubah"}�(h$]�h&]�h(ah)]�h+]�h-]�uh/hh Nh!Nhj%ubh�0Unicode character sets for international parsing�����}�(h�0Unicode character sets for international parsing�hj%ubeh"}�(h$]��id19�ah&]�h)]�h+]�h-]��refid��0unicode-character-sets-for-international-parsing�uh/h�hj"ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/h^hjubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubeh"}�(h$]�h&]�joah)]�h+]�h-]�uh/j�hjbubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubj�)��}�(hhh]�(h_)��}�(hhh]�h�)��}�(hhh]�(h)��}�(hhh]�h�	1.4   �����}�(hhhjdubah"}�(h$]�h&]�h(ah)]�h+]�h-]�uh/hh Nh!Nhjaubh�Generating Railroad Diagrams�����}�(h�Generating Railroad Diagrams�hjaubeh"}�(h$]��id20�ah&]�h)]�h+]�h-]��refid��generating-railroad-diagrams�uh/h�hj^ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/h^hj[ubj�)��}�(hhh]�(j�)��}�(hhh]�h_)��}�(hhh]�h�)��}�(hhh]�(h)��}�(hhh]�h�1.4.1   �����}�(hhhj�ubah"}�(h$]�h&]�h(ah)]�h+]�h-]�uh/hh Nh!Nhj�ubh�Usage�����}�(h�Usage�hj�ubeh"}�(h$]��id21�ah&]�h)]�h+]�h-]��refid��usage�uh/h�hj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/h^hj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubj�)��}�(hhh]�h_)��}�(hhh]�h�)��}�(hhh]�(h)��}�(hhh]�h�1.4.2   �����}�(hhhj�ubah"}�(h$]�h&]�h(ah)]�h+]�h-]�uh/hh Nh!Nhj�ubh�Example�����}�(h�Example�hj�ubeh"}�(h$]��id22�ah&]�h)]�h+]�h-]��refid��example�uh/h�hj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/h^hj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubj�)��}�(hhh]�h_)��}�(hhh]�h�)��}�(hhh]�(h)��}�(hhh]�h�1.4.3   �����}�(hhhj�ubah"}�(h$]�h&]�h(ah)]�h+]�h-]�uh/hh Nh!Nhj�ubh�
Naming tip�����}�(h�
Naming tip�hj�ubeh"}�(h$]��id23�ah&]�h)]�h+]�h-]��refid��
naming-tip�uh/h�hj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/h^hj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubj�)��}�(hhh]�h_)��}�(hhh]�h�)��}�(hhh]�(h)��}�(hhh]�h�1.4.4   �����}�(hhhj!ubah"}�(h$]�h&]�h(ah)]�h+]�h-]�uh/hh Nh!Nhjubh�
Customization�����}�(h�
Customization�hjubeh"}�(h$]��id24�ah&]�h)]�h+]�h-]��refid��
customization�uh/h�hjubah"}�(h$]�h&]�h)]�h+]�h-]�uh/h^hjubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubeh"}�(h$]�h&]�joah)]�h+]�h-]�uh/j�hj[ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubeh"}�(h$]�h&]�joah)]�h+]�h-]�uh/j�hj�ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubah"}�(h$]�h&]�joah)]�h+]�h-]�uh/j�hj�hhh Nh!Nubeh"}�(h$]��contents�ah&]��contents�ah)]��contents�ah+]�h-]�uh/j�h h=h!Khhhhubh_)��}�(hX�Note: While this content is still valid, there are more detailed
descriptions and extensive examples at the `online doc server
<https://pyparsing-docs.readthedocs.io/en/latest/pyparsing.html>`_, and
in the online help for the various pyparsing classes and methods (viewable
using the Python interpreter's built-in ``help()`` function). You will also
find many example scripts in the `examples <https://github.com/pyparsing/pyparsing/tree/master/examples>`_
directory of the pyparsing GitHub repo.�h]�(h�lNote: While this content is still valid, there are more detailed
descriptions and extensive examples at the �����}�(h�lNote: While this content is still valid, there are more detailed
descriptions and extensive examples at the �hjohhh Nh!Nubh�)��}�(h�U`online doc server
<https://pyparsing-docs.readthedocs.io/en/latest/pyparsing.html>`_�h]�h�online doc server�����}�(hhhjxubah"}�(h$]�h&]�h)]�h+]�h-]��name��online doc server��refuri��>https://pyparsing-docs.readthedocs.io/en/latest/pyparsing.html�uh/h�hjoubh�target���)��}�(h�A
<https://pyparsing-docs.readthedocs.io/en/latest/pyparsing.html>�h]�h"}�(h$]��online-doc-server�ah&]�h)]��online doc server�ah+]�h-]��refuri�j�uh/j��
referenced�Khjoubh�{, and
in the online help for the various pyparsing classes and methods (viewable
using the Python interpreter’s built-in �����}�(h�y, and
in the online help for the various pyparsing classes and methods (viewable
using the Python interpreter's built-in �hjohhh Nh!Nubh�literal���)��}�(h�
``help()``�h]�h�help()�����}�(hhhj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjoubh�; function). You will also
find many example scripts in the �����}�(h�; function). You will also
find many example scripts in the �hjohhh Nh!Nubh�)��}�(h�I`examples <https://github.com/pyparsing/pyparsing/tree/master/examples>`_�h]�h�examples�����}�(hhhj�ubah"}�(h$]�h&]�h)]�h+]�h-]��name��examples�j��;https://github.com/pyparsing/pyparsing/tree/master/examples�uh/h�hjoubj�)��}�(h�> <https://github.com/pyparsing/pyparsing/tree/master/examples>�h]�h"}�(h$]��examples�ah&]�h)]��examples�ah+]�h-]��refuri�j�uh/j�j�Khjoubh�(
directory of the pyparsing GitHub repo.�����}�(h�(
directory of the pyparsing GitHub repo.�hjohhh Nh!Nubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!Khhhhubh�
transition���)��}�(h�-----------�h]�h"}�(h$]�h&]�h)]�h+]�h-]�uh/j�h h=h!K"hhhhubh_)��}�(hX�**Note**: *In pyparsing 3.0, many method and function names which were
originally written using camelCase have been converted to PEP8-compatible
snake_case. So ``parseString()`` is being renamed to ``parse_string()``,
``delimitedList`` to ``delimited_list``, and so on. You may see the old
names in legacy parsers, and they will be supported for a time with
synonyms, but the synonyms will be removed in a future release.*�h]�(h�strong���)��}�(h�**Note**�h]�h�Note�����}�(hhhj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubh�: �����}�(h�: �hj�hhh Nh!Nubh�emphasis���)��}�(hX�*In pyparsing 3.0, many method and function names which were
originally written using camelCase have been converted to PEP8-compatible
snake_case. So ``parseString()`` is being renamed to ``parse_string()``,
``delimitedList`` to ``delimited_list``, and so on. You may see the old
names in legacy parsers, and they will be supported for a time with
synonyms, but the synonyms will be removed in a future release.*�h]�hX�In pyparsing 3.0, many method and function names which were
originally written using camelCase have been converted to PEP8-compatible
snake_case. So ``parseString()`` is being renamed to ``parse_string()``,
``delimitedList`` to ``delimited_list``, and so on. You may see the old
names in legacy parsers, and they will be supported for a time with
synonyms, but the synonyms will be removed in a future release.�����}�(hhhjubah"}�(h$]�h&]�h)]�h+]�h-]�uh/jhj�ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!K$hhhhubh_)��}�(hXC*If you are using this documentation, but working with a 2.4.x version of pyparsing,
you'll need to convert methods and arguments from the documented snake_case
names to the legacy camelCase names. In pyparsing 3.0.x, both forms are
supported, but the legacy forms are deprecated; they will be dropped in a
future release.*�h]�j)��}�(hjh]�hXCIf you are using this documentation, but working with a 2.4.x version of pyparsing,
you’ll need to convert methods and arguments from the documented snake_case
names to the legacy camelCase names. In pyparsing 3.0.x, both forms are
supported, but the legacy forms are deprecated; they will be dropped in a
future release.�����}�(hhhjubah"}�(h$]�h&]�h)]�h+]�h-]�uh/jhjubah"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!K+hhhhubj�)��}�(h�-----------�h]�h"}�(h$]�h&]�h)]�h+]�h-]�uh/j�h h=h!K1hhhhubh
)��}�(hhh]�(h)��}�(hj�h]�(h)��}�(hhh]�h�	1.1   �����}�(hhhj?hhh Nh!Nubah"}�(h$]�h&]�h(ah)]�h+]�h-]�uh/hhj<hhh Nh!Nubh�Steps to follow�����}�(hj�hj<hhh Nh!Nubeh"}�(h$]�h&]�h)]�h+]�h-]�h:Kh;j�uh/hhj9hhh h=h!K5ubh_)��}�(h�JTo parse an incoming data string, the client code must follow these steps:�h]�h�JTo parse an incoming data string, the client code must follow these steps:�����}�(hjXhjVhhh Nh!Nubah"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!K7hj9hhubh�enumerated_list���)��}�(hhh]�(j�)��}�(h��First define the tokens and patterns to be matched, and assign
this to a program variable.  Optional results names or parse
actions can also be defined at this time.
�h]�h_)��}�(h��First define the tokens and patterns to be matched, and assign
this to a program variable.  Optional results names or parse
actions can also be defined at this time.�h]�h��First define the tokens and patterns to be matched, and assign
this to a program variable.  Optional results names or parse
actions can also be defined at this time.�����}�(hjohjmubah"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!K9hjiubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjfhhh h=h!Nubj�)��}�(hXCall ``parse_string()`` or ``scan_string()`` on this variable, passing in
the string to
be parsed.  During the matching process, whitespace between
tokens is skipped by default (although this can be changed).
When token matches occur, any defined parse action methods are
called.
�h]�h_)��}�(hXCall ``parse_string()`` or ``scan_string()`` on this variable, passing in
the string to
be parsed.  During the matching process, whitespace between
tokens is skipped by default (although this can be changed).
When token matches occur, any defined parse action methods are
called.�h]�(h�Call �����}�(h�Call �hj�ubj�)��}�(h�``parse_string()``�h]�h�parse_string()�����}�(hhhj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubh� or �����}�(h� or �hj�ubj�)��}�(h�``scan_string()``�h]�h�
scan_string()�����}�(hhhj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubh�� on this variable, passing in
the string to
be parsed.  During the matching process, whitespace between
tokens is skipped by default (although this can be changed).
When token matches occur, any defined parse action methods are
called.�����}�(h�� on this variable, passing in
the string to
be parsed.  During the matching process, whitespace between
tokens is skipped by default (although this can be changed).
When token matches occur, any defined parse action methods are
called.�hj�ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!K=hj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjfhhh h=h!Nubj�)��}�(hX9Process the parsed results, returned as a ParseResults_ object.
The ParseResults_ object can be accessed as if it were a list of
strings. Matching results may also be accessed as named attributes of
the returned results, if names are defined in the definition of
the token pattern, using ``set_results_name()``.

�h]�h_)��}�(hX7Process the parsed results, returned as a ParseResults_ object.
The ParseResults_ object can be accessed as if it were a list of
strings. Matching results may also be accessed as named attributes of
the returned results, if names are defined in the definition of
the token pattern, using ``set_results_name()``.�h]�(h�*Process the parsed results, returned as a �����}�(h�*Process the parsed results, returned as a �hj�ubh�)��}�(h�
ParseResults_�h]�h�ParseResults�����}�(hhhj�ubah"}�(h$]�h&]�h)]�h+]�h-]��name��ParseResults�h;�parseresults�uh/h�hj��resolved�Kubh�
 object.
The �����}�(h�
 object.
The �hj�ubh�)��}�(h�
ParseResults_�h]�h�ParseResults�����}�(hhhj�ubah"}�(h$]�h&]�h)]�h+]�h-]��name��ParseResults�h;j�uh/h�hj�j�Kubh�� object can be accessed as if it were a list of
strings. Matching results may also be accessed as named attributes of
the returned results, if names are defined in the definition of
the token pattern, using �����}�(h�� object can be accessed as if it were a list of
strings. Matching results may also be accessed as named attributes of
the returned results, if names are defined in the definition of
the token pattern, using �hj�ubj�)��}�(h�``set_results_name()``�h]�h�set_results_name()�����}�(hhhj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubh�.�����}�(h�.�hj�ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!KDhj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjfhhh h=h!Nubeh"}�(h$]�h&]�h)]�h+]�h-]��enumtype��arabic��prefix�h�suffix�juh/jdhj9hhh h=h!K9ubh
)��}�(hhh]�(h)��}�(hj&h]�(h)��}�(hhh]�h�1.1.1   �����}�(hhhj(hhh Nh!Nubah"}�(h$]�h&]�h(ah)]�h+]�h-]�uh/hhj%hhh Nh!Nubh�
Hello, World!�����}�(hj&hj%hhh Nh!Nubeh"}�(h$]�h&]�h)]�h+]�h-]�h:Kh;j)uh/hhj"hhh h=h!KLubh_)��}�(h��The following complete Python program will parse the greeting ``"Hello, World!"``,
or any other greeting of the form "<salutation>, <addressee>!"::�h]�(h�>The following complete Python program will parse the greeting �����}�(h�>The following complete Python program will parse the greeting �hj?hhh Nh!Nubj�)��}�(h�``"Hello, World!"``�h]�h�"Hello, World!"�����}�(hhhjHubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj?ubh�E,
or any other greeting of the form “<salutation>, <addressee>!”:�����}�(h�A,
or any other greeting of the form "<salutation>, <addressee>!":�hj?hhh Nh!Nubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!KNhj"hhubh�
literal_block���)��}�(hX,import pyparsing as pp

greet = pp.Word(pp.alphas) + "," + pp.Word(pp.alphas) + "!"
for greeting_str in [
            "Hello, World!",
            "Bonjour, Monde!",
            "Hola, Mundo!",
            "Hallo, Welt!",
        ]:
    greeting = greet.parse_string(greeting_str)
    print(greeting)�h]�hX,import pyparsing as pp

greet = pp.Word(pp.alphas) + "," + pp.Word(pp.alphas) + "!"
for greeting_str in [
            "Hello, World!",
            "Bonjour, Monde!",
            "Hola, Mundo!",
            "Hallo, Welt!",
        ]:
    greeting = greet.parse_string(greeting_str)
    print(greeting)�����}�(hhhjcubah"}�(h$]�h&]�h)]�h+]�h-]��	xml:space��preserve�uh/jah!KQhj"hhh h=ubh_)��}�(h�6The parsed tokens are returned in the following form::�h]�h�5The parsed tokens are returned in the following form:�����}�(h�5The parsed tokens are returned in the following form:�hjshhh Nh!Nubah"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!K]hj"hhubjb)��}�(h�s['Hello', ',', 'World', '!']
['Bonjour', ',', 'Monde', '!']
['Hola', ',', 'Mundo', '!']
['Hallo', ',', 'Welt', '!']�h]�h�s['Hello', ',', 'World', '!']
['Bonjour', ',', 'Monde', '!']
['Hola', ',', 'Mundo', '!']
['Hallo', ',', 'Welt', '!']�����}�(hhhj�ubah"}�(h$]�h&]�h)]�h+]�h-]�jqjruh/jah!K_hj"hhh h=ubeh"}�(h$]�j/ah&]�h)]��
hello, world!�ah+]�h-]�uh/h	hj9hhh h=h!KLubh
)��}�(hhh]�(h)��}�(hjVh]�(h)��}�(hhh]�h�1.1.2   �����}�(hhhj�hhh Nh!Nubah"}�(h$]�h&]�h(ah)]�h+]�h-]�uh/hhj�hhh Nh!Nubh�Usage notes�����}�(hjVhj�hhh Nh!Nubeh"}�(h$]�h&]�h)]�h+]�h-]�h:Kh;jYuh/hhj�hhh h=h!Kfubj�)��}�(hhh]�(j�)��}�(hXwThe pyparsing module can be used to interpret simple command
strings or algebraic expressions, or can be used to extract data
from text reports with complicated format and structure ("screen
or report scraping").  However, it is possible that your defined
matching patterns may accept invalid inputs.  Use pyparsing to
extract data from strings assumed to be well-formatted.
�h]�h_)��}�(hXvThe pyparsing module can be used to interpret simple command
strings or algebraic expressions, or can be used to extract data
from text reports with complicated format and structure ("screen
or report scraping").  However, it is possible that your defined
matching patterns may accept invalid inputs.  Use pyparsing to
extract data from strings assumed to be well-formatted.�h]�hXzThe pyparsing module can be used to interpret simple command
strings or algebraic expressions, or can be used to extract data
from text reports with complicated format and structure (“screen
or report scraping”).  However, it is possible that your defined
matching patterns may accept invalid inputs.  Use pyparsing to
extract data from strings assumed to be well-formatted.�����}�(hj�hj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!Khhj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�hhh h=h!Nubj�)��}�(hX�To keep up the readability of your code, use operators_  such as ``+``, ``|``,
``^``, and ``~`` to combine expressions.  You can also combine
string literals with ``ParseExpressions`` - they will be
automatically converted to Literal_ objects.  For example::

  integer  = Word(nums)            # simple unsigned integer
  variable = Char(alphas)          # single letter variable, such as x, z, m, etc.
  arith_op = one_of("+ - * /")      # arithmetic operators
  equation = variable + "=" + integer + arith_op + integer    # will match "x=2+2", etc.

In the definition of ``equation``, the string ``"="`` will get added as
a ``Literal("=")``, but in a more readable way.
�h]�(h_)��}�(hXTo keep up the readability of your code, use operators_  such as ``+``, ``|``,
``^``, and ``~`` to combine expressions.  You can also combine
string literals with ``ParseExpressions`` - they will be
automatically converted to Literal_ objects.  For example::�h]�(h�-To keep up the readability of your code, use �����}�(h�-To keep up the readability of your code, use �hj�ubh�)��}�(h�
operators_�h]�h�	operators�����}�(hhhj�ubah"}�(h$]�h&]�h)]�h+]�h-]��name��	operators�h;�	operators�uh/h�hj�j�Kubh�
  such as �����}�(h�
  such as �hj�ubj�)��}�(h�``+``�h]�h�+�����}�(hhhj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubh�, �����}�(h�, �hj�ubj�)��}�(h�``|``�h]�h�|�����}�(hhhj	ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubh�,
�����}�(h�,
�hj�ubj�)��}�(h�``^``�h]�h�^�����}�(hhhj	ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubh�, and �����}�(h�, and �hj�ubj�)��}�(h�``~``�h]�h�~�����}�(hhhj+	ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubh�D to combine expressions.  You can also combine
string literals with �����}�(h�D to combine expressions.  You can also combine
string literals with �hj�ubj�)��}�(h�``ParseExpressions``�h]�h�ParseExpressions�����}�(hhhj>	ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubh�+ - they will be
automatically converted to �����}�(h�+ - they will be
automatically converted to �hj�ubh�)��}�(h�Literal_�h]�h�Literal�����}�(hhhjQ	ubah"}�(h$]�h&]�h)]�h+]�h-]��name��Literal�h;�literal�uh/h�hj�j�Kubh� objects.  For example:�����}�(h� objects.  For example:�hj�ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!Kohj�ubjb)��}�(hXinteger  = Word(nums)            # simple unsigned integer
variable = Char(alphas)          # single letter variable, such as x, z, m, etc.
arith_op = one_of("+ - * /")      # arithmetic operators
equation = variable + "=" + integer + arith_op + integer    # will match "x=2+2", etc.�h]�hXinteger  = Word(nums)            # simple unsigned integer
variable = Char(alphas)          # single letter variable, such as x, z, m, etc.
arith_op = one_of("+ - * /")      # arithmetic operators
equation = variable + "=" + integer + arith_op + integer    # will match "x=2+2", etc.�����}�(hhhjm	ubah"}�(h$]�h&]�h)]�h+]�h-]�jqjruh/jah!Kthj�h h=ubh_)��}�(h�wIn the definition of ``equation``, the string ``"="`` will get added as
a ``Literal("=")``, but in a more readable way.�h]�(h�In the definition of �����}�(h�In the definition of �hj{	ubj�)��}�(h�``equation``�h]�h�equation�����}�(hhhj�	ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj{	ubh�
, the string �����}�(h�
, the string �hj{	ubj�)��}�(h�``"="``�h]�h�"="�����}�(hhhj�	ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj{	ubh� will get added as
a �����}�(h� will get added as
a �hj{	ubj�)��}�(h�``Literal("=")``�h]�h�Literal("=")�����}�(hhhj�	ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj{	ubh�, but in a more readable way.�����}�(h�, but in a more readable way.�hj{	ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!Kyhj�ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�hhh h=h!Nubj�)��}�(hXOThe pyparsing module's default behavior is to ignore whitespace.  This is the
case for 99% of all parsers ever written.  This allows you to write simple, clean,
grammars, such as the above ``equation``, without having to clutter it up with
extraneous ``ws`` markers.  The ``equation`` grammar will successfully parse all of the
following statements::

  x=2+2
  x = 2+2
  a = 10   *   4
  r= 1234/ 100000

Of course, it is quite simple to extend this example to support more elaborate expressions, with
nesting with parentheses, floating point numbers, scientific notation, and named constants
(such as ``e`` or ``pi``).  See `fourFn.py <https://github.com/pyparsing/pyparsing/blob/master/examples/fourFn.py>`_,
and `simpleArith.py <https://github.com/pyparsing/pyparsing/blob/master/examples/simpleArith.py>`_
included in the examples directory.
�h]�(h_)��}�(hX^The pyparsing module's default behavior is to ignore whitespace.  This is the
case for 99% of all parsers ever written.  This allows you to write simple, clean,
grammars, such as the above ``equation``, without having to clutter it up with
extraneous ``ws`` markers.  The ``equation`` grammar will successfully parse all of the
following statements::�h]�(h��The pyparsing module’s default behavior is to ignore whitespace.  This is the
case for 99% of all parsers ever written.  This allows you to write simple, clean,
grammars, such as the above �����}�(h��The pyparsing module's default behavior is to ignore whitespace.  This is the
case for 99% of all parsers ever written.  This allows you to write simple, clean,
grammars, such as the above �hj�	ubj�)��}�(h�``equation``�h]�h�equation�����}�(hhhj�	ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�	ubh�2, without having to clutter it up with
extraneous �����}�(h�2, without having to clutter it up with
extraneous �hj�	ubj�)��}�(h�``ws``�h]�h�ws�����}�(hhhj�	ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�	ubh� markers.  The �����}�(h� markers.  The �hj�	ubj�)��}�(h�``equation``�h]�h�equation�����}�(hhhj�	ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�	ubh�A grammar will successfully parse all of the
following statements:�����}�(h�A grammar will successfully parse all of the
following statements:�hj�	ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!K|hj�	ubjb)��}�(h�,x=2+2
x = 2+2
a = 10   *   4
r= 1234/ 100000�h]�h�,x=2+2
x = 2+2
a = 10   *   4
r= 1234/ 100000�����}�(hhhj
ubah"}�(h$]�h&]�h)]�h+]�h-]�jqjruh/jah!K�hj�	h h=ubh_)��}�(hX�Of course, it is quite simple to extend this example to support more elaborate expressions, with
nesting with parentheses, floating point numbers, scientific notation, and named constants
(such as ``e`` or ``pi``).  See `fourFn.py <https://github.com/pyparsing/pyparsing/blob/master/examples/fourFn.py>`_,
and `simpleArith.py <https://github.com/pyparsing/pyparsing/blob/master/examples/simpleArith.py>`_
included in the examples directory.�h]�(h��Of course, it is quite simple to extend this example to support more elaborate expressions, with
nesting with parentheses, floating point numbers, scientific notation, and named constants
(such as �����}�(h��Of course, it is quite simple to extend this example to support more elaborate expressions, with
nesting with parentheses, floating point numbers, scientific notation, and named constants
(such as �hj#
ubj�)��}�(h�``e``�h]�h�e�����}�(hhhj,
ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj#
ubh� or �����}�(h� or �hj#
ubj�)��}�(h�``pi``�h]�h�pi�����}�(hhhj?
ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj#
ubh�).  See �����}�(h�).  See �hj#
ubh�)��}�(h�T`fourFn.py <https://github.com/pyparsing/pyparsing/blob/master/examples/fourFn.py>`_�h]�h�	fourFn.py�����}�(hhhjR
ubah"}�(h$]�h&]�h)]�h+]�h-]��name��	fourFn.py�j��Ehttps://github.com/pyparsing/pyparsing/blob/master/examples/fourFn.py�uh/h�hj#
ubj�)��}�(h�H <https://github.com/pyparsing/pyparsing/blob/master/examples/fourFn.py>�h]�h"}�(h$]��	fourfn-py�ah&]�h)]��	fourfn.py�ah+]�h-]��refuri�jb
uh/j�j�Khj#
ubh�,
and �����}�(h�,
and �hj#
ubh�)��}�(h�^`simpleArith.py <https://github.com/pyparsing/pyparsing/blob/master/examples/simpleArith.py>`_�h]�h�simpleArith.py�����}�(hhhju
ubah"}�(h$]�h&]�h)]�h+]�h-]��name��simpleArith.py�j��Jhttps://github.com/pyparsing/pyparsing/blob/master/examples/simpleArith.py�uh/h�hj#
ubj�)��}�(h�M <https://github.com/pyparsing/pyparsing/blob/master/examples/simpleArith.py>�h]�h"}�(h$]��simplearith-py�ah&]�h)]��simplearith.py�ah+]�h-]��refuri�j�
uh/j�j�Khj#
ubh�$
included in the examples directory.�����}�(h�$
included in the examples directory.�hj#
ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!K�hj�	ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�hhh h=h!Nubj�)��}�(hX�To modify pyparsing's default whitespace skipping, you can use one or
more of the following methods:

- use the static method ``ParserElement.set_default_whitespace_chars``
  to override the normal set of whitespace chars (``' \t\n'``).  For instance
  when defining a grammar in which newlines are significant, you should
  call ``ParserElement.set_default_whitespace_chars(' \t')`` to remove
  newline from the set of skippable whitespace characters.  Calling
  this method will affect all pyparsing expressions defined afterward.

- call ``leave_whitespace()`` on individual expressions, to suppress the
  skipping of whitespace before trying to match the expression

- use ``Combine`` to require that successive expressions must be
  adjacent in the input string.  For instance, this expression::

    real = Word(nums) + '.' + Word(nums)

  will match "3.14159", but will also match "3 . 12".  It will also
  return the matched results as ['3', '.', '14159'].  By changing this
  expression to::

    real = Combine(Word(nums) + '.' + Word(nums))

  it will not match numbers with embedded spaces, and it will return a
  single concatenated string '3.14159' as the parsed token.
�h]�(h_)��}�(h�dTo modify pyparsing's default whitespace skipping, you can use one or
more of the following methods:�h]�h�fTo modify pyparsing’s default whitespace skipping, you can use one or
more of the following methods:�����}�(hj�
hj�
ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!K�hj�
ubj�)��}�(hhh]�(j�)��}�(hX�use the static method ``ParserElement.set_default_whitespace_chars``
to override the normal set of whitespace chars (``' \t\n'``).  For instance
when defining a grammar in which newlines are significant, you should
call ``ParserElement.set_default_whitespace_chars(' \t')`` to remove
newline from the set of skippable whitespace characters.  Calling
this method will affect all pyparsing expressions defined afterward.
�h]�h_)��}�(hX�use the static method ``ParserElement.set_default_whitespace_chars``
to override the normal set of whitespace chars (``' \t\n'``).  For instance
when defining a grammar in which newlines are significant, you should
call ``ParserElement.set_default_whitespace_chars(' \t')`` to remove
newline from the set of skippable whitespace characters.  Calling
this method will affect all pyparsing expressions defined afterward.�h]�(h�use the static method �����}�(h�use the static method �hj�
ubj�)��}�(h�.``ParserElement.set_default_whitespace_chars``�h]�h�*ParserElement.set_default_whitespace_chars�����}�(hhhj�
ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�
ubh�1
to override the normal set of whitespace chars (�����}�(h�1
to override the normal set of whitespace chars (�hj�
ubj�)��}�(h�``' \t\n'``�h]�h�' \t\n'�����}�(hhhj�
ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�
ubh�\).  For instance
when defining a grammar in which newlines are significant, you should
call �����}�(h�\).  For instance
when defining a grammar in which newlines are significant, you should
call �hj�
ubj�)��}�(h�5``ParserElement.set_default_whitespace_chars(' \t')``�h]�h�1ParserElement.set_default_whitespace_chars(' \t')�����}�(hhhj�
ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�
ubh�� to remove
newline from the set of skippable whitespace characters.  Calling
this method will affect all pyparsing expressions defined afterward.�����}�(h�� to remove
newline from the set of skippable whitespace characters.  Calling
this method will affect all pyparsing expressions defined afterward.�hj�
ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!K�hj�
ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�
ubj�)��}�(h��call ``leave_whitespace()`` on individual expressions, to suppress the
skipping of whitespace before trying to match the expression
�h]�h_)��}�(h��call ``leave_whitespace()`` on individual expressions, to suppress the
skipping of whitespace before trying to match the expression�h]�(h�call �����}�(h�call �hjubj�)��}�(h�``leave_whitespace()``�h]�h�leave_whitespace()�����}�(hhhjubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjubh�h on individual expressions, to suppress the
skipping of whitespace before trying to match the expression�����}�(h�h on individual expressions, to suppress the
skipping of whitespace before trying to match the expression�hjubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!K�hjubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�
ubj�)��}�(hX�use ``Combine`` to require that successive expressions must be
adjacent in the input string.  For instance, this expression::

  real = Word(nums) + '.' + Word(nums)

will match "3.14159", but will also match "3 . 12".  It will also
return the matched results as ['3', '.', '14159'].  By changing this
expression to::

  real = Combine(Word(nums) + '.' + Word(nums))

it will not match numbers with embedded spaces, and it will return a
single concatenated string '3.14159' as the parsed token.
�h]�(h_)��}�(h�}use ``Combine`` to require that successive expressions must be
adjacent in the input string.  For instance, this expression::�h]�(h�use �����}�(h�use �hj;ubj�)��}�(h�``Combine``�h]�h�Combine�����}�(hhhjDubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj;ubh�m to require that successive expressions must be
adjacent in the input string.  For instance, this expression:�����}�(h�m to require that successive expressions must be
adjacent in the input string.  For instance, this expression:�hj;ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!K�hj7ubjb)��}�(h�$real = Word(nums) + '.' + Word(nums)�h]�h�$real = Word(nums) + '.' + Word(nums)�����}�(hhhj]ubah"}�(h$]�h&]�h)]�h+]�h-]�jqjruh/jah!K�hj7h h=ubh_)��}�(h��will match "3.14159", but will also match "3 . 12".  It will also
return the matched results as ['3', '.', '14159'].  By changing this
expression to::�h]�h��will match “3.14159”, but will also match “3 . 12”.  It will also
return the matched results as [‘3’, ‘.’, ‘14159’].  By changing this
expression to:�����}�(h��will match "3.14159", but will also match "3 . 12".  It will also
return the matched results as ['3', '.', '14159'].  By changing this
expression to:�hjkubah"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!K�hj7ubjb)��}�(h�-real = Combine(Word(nums) + '.' + Word(nums))�h]�h�-real = Combine(Word(nums) + '.' + Word(nums))�����}�(hhhjzubah"}�(h$]�h&]�h)]�h+]�h-]�jqjruh/jah!K�hj7h h=ubh_)��}�(h�~it will not match numbers with embedded spaces, and it will return a
single concatenated string '3.14159' as the parsed token.�h]�h��it will not match numbers with embedded spaces, and it will return a
single concatenated string ‘3.14159’ as the parsed token.�����}�(hj�hj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!K�hj7ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�
ubeh"}�(h$]�h&]�h)]�h+]�h-]��bullet��-�uh/j�h h=h!K�hj�
ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�hhh Nh!Nubj�)��}�(hXlRepetition of expressions can be indicated using ``*`` or ``[]`` notation.  An
expression may be multiplied by an integer value (to indicate an exact
repetition count), or indexed with a tuple, representing min and max repetitions
(with ``...`` representing no min or no max, depending whether it is the first or
second tuple element).  See the following examples, where n is used to
indicate an integer value:

- ``expr*3`` is equivalent to ``expr + expr + expr``

- ``expr[2, 3]`` is equivalent to ``expr + expr + Opt(expr)``

- ``expr[n, ...]`` or ``expr[n,]`` is equivalent
  to ``expr*n + ZeroOrMore(expr)`` (read as "at least n instances of expr")

- ``expr[... ,n]`` is equivalent to ``expr*(0, n)``
  (read as "0 to n instances of expr")

- ``expr[...]`` and ``expr[0, ...]`` are equivalent to ``ZeroOrMore(expr)``

- ``expr[1, ...]`` is equivalent to ``OneOrMore(expr)``

Note that ``expr[..., n]`` does not raise an exception if
more than n exprs exist in the input stream; that is,
``expr[..., n]`` does not enforce a maximum number of expr
occurrences.  If this behavior is desired, then write
``expr[..., n] + ~expr``.
�h]�(h_)��}�(hX�Repetition of expressions can be indicated using ``*`` or ``[]`` notation.  An
expression may be multiplied by an integer value (to indicate an exact
repetition count), or indexed with a tuple, representing min and max repetitions
(with ``...`` representing no min or no max, depending whether it is the first or
second tuple element).  See the following examples, where n is used to
indicate an integer value:�h]�(h�1Repetition of expressions can be indicated using �����}�(h�1Repetition of expressions can be indicated using �hj�ubj�)��}�(h�``*``�h]�h�*�����}�(hhhj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubh� or �����}�(h� or �hj�ubj�)��}�(h�``[]``�h]�h�[]�����}�(hhhj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubh�� notation.  An
expression may be multiplied by an integer value (to indicate an exact
repetition count), or indexed with a tuple, representing min and max repetitions
(with �����}�(h�� notation.  An
expression may be multiplied by an integer value (to indicate an exact
repetition count), or indexed with a tuple, representing min and max repetitions
(with �hj�ubj�)��}�(h�``...``�h]�h�...�����}�(hhhj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubh�� representing no min or no max, depending whether it is the first or
second tuple element).  See the following examples, where n is used to
indicate an integer value:�����}�(h�� representing no min or no max, depending whether it is the first or
second tuple element).  See the following examples, where n is used to
indicate an integer value:�hj�ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!K�hj�ubj�)��}�(hhh]�(j�)��}�(h�3``expr*3`` is equivalent to ``expr + expr + expr``
�h]�h_)��}�(h�2``expr*3`` is equivalent to ``expr + expr + expr``�h]�(j�)��}�(h�
``expr*3``�h]�h�expr*3�����}�(hhhjubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubh� is equivalent to �����}�(h� is equivalent to �hj�ubj�)��}�(h�``expr + expr + expr``�h]�h�expr + expr + expr�����}�(hhhjubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!K�hj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubj�)��}�(h�<``expr[2, 3]`` is equivalent to ``expr + expr + Opt(expr)``
�h]�h_)��}�(h�;``expr[2, 3]`` is equivalent to ``expr + expr + Opt(expr)``�h]�(j�)��}�(h�``expr[2, 3]``�h]�h�
expr[2, 3]�����}�(hhhj6ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj2ubh� is equivalent to �����}�(h� is equivalent to �hj2ubj�)��}�(h�``expr + expr + Opt(expr)``�h]�h�expr + expr + Opt(expr)�����}�(hhhjIubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj2ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!K�hj.ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubj�)��}�(h�y``expr[n, ...]`` or ``expr[n,]`` is equivalent
to ``expr*n + ZeroOrMore(expr)`` (read as "at least n instances of expr")
�h]�h_)��}�(h�x``expr[n, ...]`` or ``expr[n,]`` is equivalent
to ``expr*n + ZeroOrMore(expr)`` (read as "at least n instances of expr")�h]�(j�)��}�(h�``expr[n, ...]``�h]�h�expr[n, ...]�����}�(hhhjkubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjgubh� or �����}�(h� or �hjgubj�)��}�(h�``expr[n,]``�h]�h�expr[n,]�����}�(hhhj~ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjgubh� is equivalent
to �����}�(h� is equivalent
to �hjgubj�)��}�(h�``expr*n + ZeroOrMore(expr)``�h]�h�expr*n + ZeroOrMore(expr)�����}�(hhhj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjgubh�- (read as “at least n instances of expr”)�����}�(h�) (read as "at least n instances of expr")�hjgubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!K�hjcubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubj�)��}�(h�W``expr[... ,n]`` is equivalent to ``expr*(0, n)``
(read as "0 to n instances of expr")
�h]�h_)��}�(h�V``expr[... ,n]`` is equivalent to ``expr*(0, n)``
(read as "0 to n instances of expr")�h]�(j�)��}�(h�``expr[... ,n]``�h]�h�expr[... ,n]�����}�(hhhj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubh� is equivalent to �����}�(h� is equivalent to �hj�ubj�)��}�(h�``expr*(0, n)``�h]�h�expr*(0, n)�����}�(hhhj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubh�)
(read as “0 to n instances of expr”)�����}�(h�%
(read as "0 to n instances of expr")�hj�ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!K�hj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubj�)��}�(h�J``expr[...]`` and ``expr[0, ...]`` are equivalent to ``ZeroOrMore(expr)``
�h]�h_)��}�(h�I``expr[...]`` and ``expr[0, ...]`` are equivalent to ``ZeroOrMore(expr)``�h]�(j�)��}�(h�
``expr[...]``�h]�h�	expr[...]�����}�(hhhj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubh� and �����}�(h� and �hj�ubj�)��}�(h�``expr[0, ...]``�h]�h�expr[0, ...]�����}�(hhhj
ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubh� are equivalent to �����}�(h� are equivalent to �hj�ubj�)��}�(h�``ZeroOrMore(expr)``�h]�h�ZeroOrMore(expr)�����}�(hhhj
ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!K�hj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubj�)��}�(h�6``expr[1, ...]`` is equivalent to ``OneOrMore(expr)``
�h]�h_)��}�(h�5``expr[1, ...]`` is equivalent to ``OneOrMore(expr)``�h]�(j�)��}�(h�``expr[1, ...]``�h]�h�expr[1, ...]�����}�(hhhj:
ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj6
ubh� is equivalent to �����}�(h� is equivalent to �hj6
ubj�)��}�(h�``OneOrMore(expr)``�h]�h�OneOrMore(expr)�����}�(hhhjM
ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj6
ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!K�hj2
ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubeh"}�(h$]�h&]�h)]�h+]�h-]�j�j�uh/j�h h=h!K�hj�ubh_)��}�(h��Note that ``expr[..., n]`` does not raise an exception if
more than n exprs exist in the input stream; that is,
``expr[..., n]`` does not enforce a maximum number of expr
occurrences.  If this behavior is desired, then write
``expr[..., n] + ~expr``.�h]�(h�
Note that �����}�(h�
Note that �hjm
ubj�)��}�(h�``expr[..., n]``�h]�h�expr[..., n]�����}�(hhhjv
ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjm
ubh�V does not raise an exception if
more than n exprs exist in the input stream; that is,
�����}�(h�V does not raise an exception if
more than n exprs exist in the input stream; that is,
�hjm
ubj�)��}�(h�``expr[..., n]``�h]�h�expr[..., n]�����}�(hhhj�
ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjm
ubh�a does not enforce a maximum number of expr
occurrences.  If this behavior is desired, then write
�����}�(h�a does not enforce a maximum number of expr
occurrences.  If this behavior is desired, then write
�hjm
ubj�)��}�(h�``expr[..., n] + ~expr``�h]�h�expr[..., n] + ~expr�����}�(hhhj�
ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjm
ubh�.�����}�(hjhjm
ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!K�hj�ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�hhh h=h!Nubj�)��}�(hX�MatchFirst_ expressions are matched left-to-right, and the first
match found will skip all later expressions within, so be sure
to define less-specific patterns after more-specific patterns.
If you are not sure which expressions are most specific, use Or_
expressions (defined using the ``^`` operator) - they will always
match the longest expression, although they are more
compute-intensive.
�h]�h_)��}�(hX�MatchFirst_ expressions are matched left-to-right, and the first
match found will skip all later expressions within, so be sure
to define less-specific patterns after more-specific patterns.
If you are not sure which expressions are most specific, use Or_
expressions (defined using the ``^`` operator) - they will always
match the longest expression, although they are more
compute-intensive.�h]�(h�)��}�(h�MatchFirst_�h]�h�
MatchFirst�����}�(hhhj�
ubah"}�(h$]�h&]�h)]�h+]�h-]��name��
MatchFirst�h;�
matchfirst�uh/h�hj�
j�Kubh�� expressions are matched left-to-right, and the first
match found will skip all later expressions within, so be sure
to define less-specific patterns after more-specific patterns.
If you are not sure which expressions are most specific, use �����}�(h�� expressions are matched left-to-right, and the first
match found will skip all later expressions within, so be sure
to define less-specific patterns after more-specific patterns.
If you are not sure which expressions are most specific, use �hj�
ubh�)��}�(h�Or_�h]�h�Or�����}�(hhhj�
ubah"}�(h$]�h&]�h)]�h+]�h-]��name��Or�h;�or�uh/h�hj�
j�Kubh� 
expressions (defined using the �����}�(h� 
expressions (defined using the �hj�
ubj�)��}�(h�``^``�h]�h�^�����}�(hhhj�
ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�
ubh�e operator) - they will always
match the longest expression, although they are more
compute-intensive.�����}�(h�e operator) - they will always
match the longest expression, although they are more
compute-intensive.�hj�
ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!K�hj�
ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�hhh h=h!Nubj�)��}�(h��Or_ expressions will evaluate all of the specified subexpressions
to determine which is the "best" match, that is, which matches
the longest string in the input data.  In case of a tie, the
left-most expression in the Or_ list will win.
�h]�h_)��}�(h��Or_ expressions will evaluate all of the specified subexpressions
to determine which is the "best" match, that is, which matches
the longest string in the input data.  In case of a tie, the
left-most expression in the Or_ list will win.�h]�(h�)��}�(h�Or_�h]�h�Or�����}�(hhhjubah"}�(h$]�h&]�h)]�h+]�h-]��name��Or�h;j�
uh/h�hjj�Kubh�� expressions will evaluate all of the specified subexpressions
to determine which is the “best” match, that is, which matches
the longest string in the input data.  In case of a tie, the
left-most expression in the �����}�(h�� expressions will evaluate all of the specified subexpressions
to determine which is the "best" match, that is, which matches
the longest string in the input data.  In case of a tie, the
left-most expression in the �hjubh�)��}�(h�Or_�h]�h�Or�����}�(hhhj*ubah"}�(h$]�h&]�h)]�h+]�h-]��name��Or�h;j�
uh/h�hjj�Kubh� list will win.�����}�(h� list will win.�hjubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!K�hj
ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�hhh h=h!Nubj�)��}�(h�xIf parsing the contents of an entire file, pass it to the
``parse_file`` method using::

  expr.parse_file(source_file)
�h]�(h_)��}�(h�WIf parsing the contents of an entire file, pass it to the
``parse_file`` method using::�h]�(h�:If parsing the contents of an entire file, pass it to the
�����}�(h�:If parsing the contents of an entire file, pass it to the
�hjOubj�)��}�(h�``parse_file``�h]�h�
parse_file�����}�(hhhjXubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjOubh� method using:�����}�(h� method using:�hjOubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!K�hjKubjb)��}�(h�expr.parse_file(source_file)�h]�h�expr.parse_file(source_file)�����}�(hhhjqubah"}�(h$]�h&]�h)]�h+]�h-]�jqjruh/jah!K�hjKh h=ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�hhh h=h!Nubj�)��}�(hX�``ParseExceptions`` will report the location where an expected token
or expression failed to match.  For example, if we tried to use our
"Hello, World!" parser to parse "Hello World!" (leaving out the separating
comma), we would get an exception, with the message::

  pyparsing.ParseException: Expected "," (6), (1,7)

In the case of complex
expressions, the reported location may not be exactly where you
would expect.  See more information under ParseException_ .
�h]�(h_)��}�(hX	``ParseExceptions`` will report the location where an expected token
or expression failed to match.  For example, if we tried to use our
"Hello, World!" parser to parse "Hello World!" (leaving out the separating
comma), we would get an exception, with the message::�h]�(j�)��}�(h�``ParseExceptions``�h]�h�ParseExceptions�����}�(hhhj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubh�� will report the location where an expected token
or expression failed to match.  For example, if we tried to use our
“Hello, World!” parser to parse “Hello World!” (leaving out the separating
comma), we would get an exception, with the message:�����}�(h�� will report the location where an expected token
or expression failed to match.  For example, if we tried to use our
"Hello, World!" parser to parse "Hello World!" (leaving out the separating
comma), we would get an exception, with the message:�hj�ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!K�hj�ubjb)��}�(h�1pyparsing.ParseException: Expected "," (6), (1,7)�h]�h�1pyparsing.ParseException: Expected "," (6), (1,7)�����}�(hhhj�ubah"}�(h$]�h&]�h)]�h+]�h-]�jqjruh/jah!K�hj�h h=ubh_)��}�(h��In the case of complex
expressions, the reported location may not be exactly where you
would expect.  See more information under ParseException_ .�h]�(h��In the case of complex
expressions, the reported location may not be exactly where you
would expect.  See more information under �����}�(h��In the case of complex
expressions, the reported location may not be exactly where you
would expect.  See more information under �hj�ubh�)��}�(h�ParseException_�h]�h�ParseException�����}�(hhhj�ubah"}�(h$]�h&]�h)]�h+]�h-]��name��ParseException�h;�parseexception�uh/h�hj�j�Kubh� .�����}�(h� .�hj�ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!K�hj�ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�hhh h=h!Nubj�)��}�(h��Use the ``Group`` class to enclose logical groups of tokens within a
sublist.  This will help organize your results into more
hierarchical form (the default behavior is to return matching
tokens as a flat list of matching input strings).
�h]�h_)��}�(h��Use the ``Group`` class to enclose logical groups of tokens within a
sublist.  This will help organize your results into more
hierarchical form (the default behavior is to return matching
tokens as a flat list of matching input strings).�h]�(h�Use the �����}�(h�Use the �hj�ubj�)��}�(h�	``Group``�h]�h�Group�����}�(hhhj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubh�� class to enclose logical groups of tokens within a
sublist.  This will help organize your results into more
hierarchical form (the default behavior is to return matching
tokens as a flat list of matching input strings).�����}�(h�� class to enclose logical groups of tokens within a
sublist.  This will help organize your results into more
hierarchical form (the default behavior is to return matching
tokens as a flat list of matching input strings).�hj�ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!K�hj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�hhh h=h!Nubj�)��}�(hX�Punctuation may be significant for matching, but is rarely of
much interest in the parsed results.  Use the ``suppress()`` method
to keep these tokens from cluttering up your returned lists of
tokens.  For example, ``delimited_list()`` matches a succession of
one or more expressions, separated by delimiters (commas by
default), but only returns a list of the actual expressions -
the delimiters are used for parsing, but are suppressed from the
returned output.
�h]�h_)��}�(hX�Punctuation may be significant for matching, but is rarely of
much interest in the parsed results.  Use the ``suppress()`` method
to keep these tokens from cluttering up your returned lists of
tokens.  For example, ``delimited_list()`` matches a succession of
one or more expressions, separated by delimiters (commas by
default), but only returns a list of the actual expressions -
the delimiters are used for parsing, but are suppressed from the
returned output.�h]�(h�lPunctuation may be significant for matching, but is rarely of
much interest in the parsed results.  Use the �����}�(h�lPunctuation may be significant for matching, but is rarely of
much interest in the parsed results.  Use the �hjubj�)��}�(h�``suppress()``�h]�h�
suppress()�����}�(hhhjubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjubh�] method
to keep these tokens from cluttering up your returned lists of
tokens.  For example, �����}�(h�] method
to keep these tokens from cluttering up your returned lists of
tokens.  For example, �hjubj�)��}�(h�``delimited_list()``�h]�h�delimited_list()�����}�(hhhj+ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjubh�� matches a succession of
one or more expressions, separated by delimiters (commas by
default), but only returns a list of the actual expressions -
the delimiters are used for parsing, but are suppressed from the
returned output.�����}�(h�� matches a succession of
one or more expressions, separated by delimiters (commas by
default), but only returns a list of the actual expressions -
the delimiters are used for parsing, but are suppressed from the
returned output.�hjubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!K�hjubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�hhh h=h!Nubj�)��}�(h�mParse actions can be used to convert values from strings to
other data types (ints, floats, booleans, etc.).
�h]�h_)��}�(h�lParse actions can be used to convert values from strings to
other data types (ints, floats, booleans, etc.).�h]�h�lParse actions can be used to convert values from strings to
other data types (ints, floats, booleans, etc.).�����}�(hjPhjNubah"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!K�hjJubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�hhh h=h!Nubj�)��}�(hXhResults names are recommended for retrieving tokens from complex
expressions.  It is much easier to access a token using its field
name than using a positional index, especially if the expression
contains optional elements.  You can also shortcut
the ``set_results_name`` call::

  stats = ("AVE:" + real_num.set_results_name("average")
           + "MIN:" + real_num.set_results_name("min")
           + "MAX:" + real_num.set_results_name("max"))

can more simply and cleanly be written as this::

  stats = ("AVE:" + real_num("average")
           + "MIN:" + real_num("min")
           + "MAX:" + real_num("max"))
�h]�(h_)��}�(hXResults names are recommended for retrieving tokens from complex
expressions.  It is much easier to access a token using its field
name than using a positional index, especially if the expression
contains optional elements.  You can also shortcut
the ``set_results_name`` call::�h]�(h��Results names are recommended for retrieving tokens from complex
expressions.  It is much easier to access a token using its field
name than using a positional index, especially if the expression
contains optional elements.  You can also shortcut
the �����}�(h��Results names are recommended for retrieving tokens from complex
expressions.  It is much easier to access a token using its field
name than using a positional index, especially if the expression
contains optional elements.  You can also shortcut
the �hjfubj�)��}�(h�``set_results_name``�h]�h�set_results_name�����}�(hhhjoubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjfubh� call:�����}�(h� call:�hjfubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!K�hjbubjb)��}�(h��stats = ("AVE:" + real_num.set_results_name("average")
         + "MIN:" + real_num.set_results_name("min")
         + "MAX:" + real_num.set_results_name("max"))�h]�h��stats = ("AVE:" + real_num.set_results_name("average")
         + "MIN:" + real_num.set_results_name("min")
         + "MAX:" + real_num.set_results_name("max"))�����}�(hhhj�ubah"}�(h$]�h&]�h)]�h+]�h-]�jqjruh/jah!K�hjbh h=ubh_)��}�(h�0can more simply and cleanly be written as this::�h]�h�/can more simply and cleanly be written as this:�����}�(h�/can more simply and cleanly be written as this:�hj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!K�hjbubjb)��}�(h�nstats = ("AVE:" + real_num("average")
         + "MIN:" + real_num("min")
         + "MAX:" + real_num("max"))�h]�h�nstats = ("AVE:" + real_num("average")
         + "MIN:" + real_num("min")
         + "MAX:" + real_num("max"))�����}�(hhhj�ubah"}�(h$]�h&]�h)]�h+]�h-]�jqjruh/jah!K�hjbh h=ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�hhh h=h!Nubj�)��}�(hXBe careful when defining parse actions that modify global variables or
data structures (as in fourFn.py_), especially for low level tokens
or expressions that may occur within an And_ expression; an early element
of an And_ may match, but the overall expression may fail.

�h]�h_)��}�(hXBe careful when defining parse actions that modify global variables or
data structures (as in fourFn.py_), especially for low level tokens
or expressions that may occur within an And_ expression; an early element
of an And_ may match, but the overall expression may fail.�h]�(h�^Be careful when defining parse actions that modify global variables or
data structures (as in ������/}�(h�^Be careful when defining parse actions that modify global variables or
data structures (as in �hj�ubh�)��}�(h�
fourFn.py_�h]�h�	fourFn.py�����}�(hhhj�ubah"}�(h$]�h&]�h)]�h+]�h-]��name��	fourFn.py�j�jb
uh/h�hj�j�Kubh�K), especially for low level tokens
or expressions that may occur within an �����}�(h�K), especially for low level tokens
or expressions that may occur within an �hj�ubh�)��}�(h�And_�h]�h�And�����}�(hhhj�ubah"}�(h$]�h&]�h)]�h+]�h-]��name��And�h;�and�uh/h�hj�j�Kubh�$ expression; an early element
of an �����}�(h�$ expression; an early element
of an �hj�ubh�)��}�(h�And_�h]�h�And�����}�(hhhj�ubah"}�(h$]�h&]�h)]�h+]�h-]��name��And�h;j�uh/h�hj�j�Kubh�0 may match, but the overall expression may fail.�����}�(h�0 may match, but the overall expression may fail.�hj�ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!Mhj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�hhh h=h!Nubeh"}�(h$]�h&]�h)]�h+]�h-]�j�j�uh/j�h h=h!Khhj�hhubeh"}�(h$]�j_ah&]�h)]��usage notes�ah+]�h-]�uh/h	hj9hhh h=h!Kfubeh"}�(h$]�jah&]�h)]��steps to follow�ah+]�h-]�uh/h	hhhhh h=h!K5ubh
)��}�(hhh]�(h)��}�(hj�h]�(h)��}�(hhh]�h�	1.2   �����}�(hhhj,hhh Nh!Nubah"}�(h$]�h&]�h(ah)]�h+]�h-]�uh/hhj)hhh Nh!Nubh�Classes�����}�(hj�hj)hhh Nh!Nubeh"}�(h$]�h&]�h)]�h+]�h-]�h:Kh;j�uh/hhj&hhh h=h!Mubh
)��}�(hhh]�(h)��}�(hj�h]�(h)��}�(hhh]�h�1.2.1   �����}�(hhhjIhhh Nh!Nubah"}�(h$]�h&]�h(ah)]�h+]�h-]�uh/hhjFhhh Nh!Nubh�Classes in the pyparsing module�����}�(hj�hjFhhh Nh!Nubeh"}�(h$]�h&]�h)]�h+]�h-]�h:Kh;j�uh/hhjChhh h=h!Mubh_)��}�(h�_``ParserElement`` - abstract base class for all pyparsing classes;
methods for code to use are:�h]�(j�)��}�(h�``ParserElement``�h]�h�
ParserElement�����}�(hhhjdubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj`ubh�N - abstract base class for all pyparsing classes;
methods for code to use are:�����}�(h�N - abstract base class for all pyparsing classes;
methods for code to use are:�hj`hhh Nh!Nubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M
hjChhubj�)��}�(hhh]�(j�)��}�(hX�``parse_string(source_string, parse_all=False)`` - only called once, on the overall
matching pattern; returns a ParseResults_ object that makes the
matched tokens available as a list, and optionally as a dictionary,
or as an object with named attributes; if ``parse_all`` is set to True, then
``parse_string`` will raise a ParseException_ if the grammar does not process
the complete input string.
�h]�h_)��}�(hX�``parse_string(source_string, parse_all=False)`` - only called once, on the overall
matching pattern; returns a ParseResults_ object that makes the
matched tokens available as a list, and optionally as a dictionary,
or as an object with named attributes; if ``parse_all`` is set to True, then
``parse_string`` will raise a ParseException_ if the grammar does not process
the complete input string.�h]�(j�)��}�(h�0``parse_string(source_string, parse_all=False)``�h]�h�,parse_string(source_string, parse_all=False)�����}�(hhhj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubh�@ - only called once, on the overall
matching pattern; returns a �����}�(h�@ - only called once, on the overall
matching pattern; returns a �hj�ubh�)��}�(h�
ParseResults_�h]�h�ParseResults�����}�(hhhj�ubah"}�(h$]�h&]�h)]�h+]�h-]��name��ParseResults�h;j�uh/h�hj�j�Kubh�� object that makes the
matched tokens available as a list, and optionally as a dictionary,
or as an object with named attributes; if �����}�(h�� object that makes the
matched tokens available as a list, and optionally as a dictionary,
or as an object with named attributes; if �hj�ubj�)��}�(h�
``parse_all``�h]�h�	parse_all�����}�(hhhj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubh� is set to True, then
�����}�(h� is set to True, then
�hj�ubj�)��}�(h�``parse_string``�h]�h�parse_string�����}�(hhhj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubh� will raise a �����}�(h� will raise a �hj�ubh�)��}�(h�ParseException_�h]�h�ParseException�����}�(hhhj�ubah"}�(h$]�h&]�h)]�h+]�h-]��name��ParseException�h;j�uh/h�hj�j�Kubh�; if the grammar does not process
the complete input string.�����}�(h�; if the grammar does not process
the complete input string.�hj�ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!Mhj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj}hhh h=h!Nubj�)��}�(h��``parse_file(source_file)`` - a convenience function, that accepts an
input file object or filename.  The file contents are passed as a
string to ``parse_string()``.  ``parse_file`` also supports the ``parse_all`` argument.
�h]�h_)��}�(h��``parse_file(source_file)`` - a convenience function, that accepts an
input file object or filename.  The file contents are passed as a
string to ``parse_string()``.  ``parse_file`` also supports the ``parse_all`` argument.�h]�(j�)��}�(h�``parse_file(source_file)``�h]�h�parse_file(source_file)�����}�(hhhj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubh�w - a convenience function, that accepts an
input file object or filename.  The file contents are passed as a
string to �����}�(h�w - a convenience function, that accepts an
input file object or filename.  The file contents are passed as a
string to �hj�ubj�)��}�(h�``parse_string()``�h]�h�parse_string()�����}�(hhhjubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubh�.  �����}�(h�.  �hj�ubj�)��}�(h�``parse_file``�h]�h�
parse_file�����}�(hhhj%ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubh� also supports the �����}�(h� also supports the �hj�ubj�)��}�(h�
``parse_all``�h]�h�	parse_all�����}�(hhhj8ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubh�
 argument.�����}�(h�
 argument.�hj�ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!Mhj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj}hhh h=h!Nubj�)��}�(hX``scan_string(source_string)`` - generator function, used to find and
extract matching text in the given source string; for each matched text,
returns a tuple of:

- matched tokens (packaged as a ParseResults_ object)

- start location of the matched text in the given source string

- end location in the given source string

``scan_string`` allows you to scan through the input source string for
random matches, instead of exhaustively defining the grammar for the entire
source text (as would be required with ``parse_string``).
�h]�(h_)��}�(h��``scan_string(source_string)`` - generator function, used to find and
extract matching text in the given source string; for each matched text,
returns a tuple of:�h]�(j�)��}�(h�``scan_string(source_string)``�h]�h�scan_string(source_string)�����}�(hhhj_ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj[ubh�� - generator function, used to find and
extract matching text in the given source string; for each matched text,
returns a tuple of:�����}�(h�� - generator function, used to find and
extract matching text in the given source string; for each matched text,
returns a tuple of:�hj[ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!MhjWubj�)��}�(hhh]�(j�)��}�(h�4matched tokens (packaged as a ParseResults_ object)
�h]�h_)��}�(h�3matched tokens (packaged as a ParseResults_ object)�h]�(h�matched tokens (packaged as a �����}�(h�matched tokens (packaged as a �hjubh�)��}�(h�
ParseResults_�h]�h�ParseResults�����}�(hhhj�ubah"}�(h$]�h&]�h)]�h+]�h-]��name��ParseResults�h;j�uh/h�hjj�Kubh� object)�����}�(h� object)�hjubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!Mhj{ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjxubj�)��}�(h�>start location of the matched text in the given source string
�h]�h_)��}�(h�=start location of the matched text in the given source string�h]�h�=start location of the matched text in the given source string�����}�(hj�hj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M!hj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjxubj�)��}�(h�(end location in the given source string
�h]�h_)��}�(h�'end location in the given source string�h]�h�'end location in the given source string�����}�(hj�hj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M#hj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjxubeh"}�(h$]�h&]�h)]�h+]�h-]�j�j�uh/j�h h=h!MhjWubh_)��}�(h��``scan_string`` allows you to scan through the input source string for
random matches, instead of exhaustively defining the grammar for the entire
source text (as would be required with ``parse_string``).�h]�(j�)��}�(h�``scan_string``�h]�h�scan_string�����}�(hhhj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubh�� allows you to scan through the input source string for
random matches, instead of exhaustively defining the grammar for the entire
source text (as would be required with �����}�(h�� allows you to scan through the input source string for
random matches, instead of exhaustively defining the grammar for the entire
source text (as would be required with �hj�ubj�)��}�(h�``parse_string``�h]�h�parse_string�����}�(hhhj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubh�).�����}�(h�).�hj�ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M%hjWubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj}hhh h=h!Nubj�)��}�(h��``transform_string(source_string)`` - convenience wrapper function for
``scan_string``, to process the input source string, and replace matching
text with the tokens returned from parse actions defined in the grammar
(see set_parse_action_).
�h]�h_)��}�(h��``transform_string(source_string)`` - convenience wrapper function for
``scan_string``, to process the input source string, and replace matching
text with the tokens returned from parse actions defined in the grammar
(see set_parse_action_).�h]�(j�)��}�(h�#``transform_string(source_string)``�h]�h�transform_string(source_string)�����}�(hhhjubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjubh�$ - convenience wrapper function for
�����}�(h�$ - convenience wrapper function for
�hjubj�)��}�(h�``scan_string``�h]�h�scan_string�����}�(hhhj0ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjubh��, to process the input source string, and replace matching
text with the tokens returned from parse actions defined in the grammar
(see �����}�(h��, to process the input source string, and replace matching
text with the tokens returned from parse actions defined in the grammar
(see �hjubh�)��}�(h�set_parse_action_�h]�h�set_parse_action�����}�(hhhjCubah"}�(h$]�h&]�h)]�h+]�h-]��name��set_parse_action�h;�set-parse-action�uh/h�hjj�Kubh�).�����}�(h�).�hjubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M)hjubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj}hhh h=h!Nubj�)��}�(h��``search_string(source_string)`` - another convenience wrapper function for
``scan_string``, returns a list of the matching tokens returned from each
call to ``scan_string``.
�h]�h_)��}�(h��``search_string(source_string)`` - another convenience wrapper function for
``scan_string``, returns a list of the matching tokens returned from each
call to ``scan_string``.�h]�(j�)��}�(h� ``search_string(source_string)``�h]�h�search_string(source_string)�����}�(hhhjmubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjiubh�, - another convenience wrapper function for
�����}�(h�, - another convenience wrapper function for
�hjiubj�)��}�(h�``scan_string``�h]�h�scan_string�����}�(hhhj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjiubh�C, returns a list of the matching tokens returned from each
call to �����}�(h�C, returns a list of the matching tokens returned from each
call to �hjiubj�)��}�(h�``scan_string``�h]�h�scan_string�����}�(hhhj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjiubh�.�����}�(hjhjiubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M.hjeubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj}hhh h=h!Nubj�)��}�(h��``set_name(name)`` - associate a short descriptive name for this
element, useful in displaying exceptions and trace information
�h]�h_)��}�(h�``set_name(name)`` - associate a short descriptive name for this
element, useful in displaying exceptions and trace information�h]�(j�)��}�(h�``set_name(name)``�h]�h�set_name(name)�����}�(hhhj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubh�m - associate a short descriptive name for this
element, useful in displaying exceptions and trace information�����}�(h�m - associate a short descriptive name for this
element, useful in displaying exceptions and trace information�hj�ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M2hj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj}hhh h=h!Nubj�)��}�(hX�``run_tests(tests_string)`` - useful development and testing method on
expressions, to pass a multiline string of sample strings to test against
the expression. Comment lines (beginning with ``#``) can be inserted
and they will be included in the test output::

  digits = Word(nums).set_name("numeric digits")
  real_num = Combine(digits + '.' + digits)
  real_num.run_tests("""\
      # valid number
      3.14159

      # no integer part
      .00001

      # no decimal
      101

      # no decimal value
      101.
      """)

will print::

  # valid number
  3.14159
  ['3.14159']

  # no integer part
  .00001
  ^
  FAIL: Expected numeric digits, found '.'  (at char 0), (line:1, col:1)

  # no decimal
  101
     ^
  FAIL: Expected ".", found end of text  (at char 3), (line:1, col:4)

  # no decimal value
  101.
      ^
  FAIL: Expected numeric digits, found end of text  (at char 4), (line:1, col:5)
�h]�(h_)��}�(hX``run_tests(tests_string)`` - useful development and testing method on
expressions, to pass a multiline string of sample strings to test against
the expression. Comment lines (beginning with ``#``) can be inserted
and they will be included in the test output::�h]�(j�)��}�(h�``run_tests(tests_string)``�h]�h�run_tests(tests_string)�����}�(hhhj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubh�� - useful development and testing method on
expressions, to pass a multiline string of sample strings to test against
the expression. Comment lines (beginning with �����}�(h�� - useful development and testing method on
expressions, to pass a multiline string of sample strings to test against
the expression. Comment lines (beginning with �hj�ubj�)��}�(h�``#``�h]�h�#�����}�(hhhj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubh�?) can be inserted
and they will be included in the test output:�����}�(h�?) can be inserted
and they will be included in the test output:�hj�ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M5hj�ubjb)��}�(h��digits = Word(nums).set_name("numeric digits")
real_num = Combine(digits + '.' + digits)
real_num.run_tests("""\
    # valid number
    3.14159

    # no integer part
    .00001

    # no decimal
    101

    # no decimal value
    101.
    """)�h]�h��digits = Word(nums).set_name("numeric digits")
real_num = Combine(digits + '.' + digits)
real_num.run_tests("""\
    # valid number
    3.14159

    # no integer part
    .00001

    # no decimal
    101

    # no decimal value
    101.
    """)�����}�(hhhjubah"}�(h$]�h&]�h)]�h+]�h-]�jqjruh/jah!M:hj�h h=ubh_)��}�(h�will print::�h]�h�will print:�����}�(h�will print:�hjubah"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!MJhj�ubjb)��}�(hXN# valid number
3.14159
['3.14159']

# no integer part
.00001
^
FAIL: Expected numeric digits, found '.'  (at char 0), (line:1, col:1)

# no decimal
101
   ^
FAIL: Expected ".", found end of text  (at char 3), (line:1, col:4)

# no decimal value
101.
    ^
FAIL: Expected numeric digits, found end of text  (at char 4), (line:1, col:5)�h]�hXN# valid number
3.14159
['3.14159']

# no integer part
.00001
^
FAIL: Expected numeric digits, found '.'  (at char 0), (line:1, col:1)

# no decimal
101
   ^
FAIL: Expected ".", found end of text  (at char 3), (line:1, col:4)

# no decimal value
101.
    ^
FAIL: Expected numeric digits, found end of text  (at char 4), (line:1, col:5)�����}�(hhhj)ubah"}�(h$]�h&]�h)]�h+]�h-]�jqjruh/jah!MLhj�h h=ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj}hhh h=h!Nubj�)��}�(hX�``set_results_name(string, list_all_matches=False)`` - name to be given
to tokens matching
the element; if multiple tokens within
a repetition group (such as ``ZeroOrMore`` or ``delimited_list``) the
default is to return only the last matching token - if ``list_all_matches``
is set to True, then a list of all the matching tokens is returned.

``expr.set_results_name("key")`` can also be written ``expr("key")``
(a results name with a trailing '*' character will be
interpreted as setting ``list_all_matches`` to ``True``).

Note:
``set_results_name`` returns a *copy* of the element so that a single
basic element can be referenced multiple times and given
different names within a complex grammar.
�h]�(h_)��}�(hXW``set_results_name(string, list_all_matches=False)`` - name to be given
to tokens matching
the element; if multiple tokens within
a repetition group (such as ``ZeroOrMore`` or ``delimited_list``) the
default is to return only the last matching token - if ``list_all_matches``
is set to True, then a list of all the matching tokens is returned.�h]�(j�)��}�(h�4``set_results_name(string, list_all_matches=False)``�h]�h�0set_results_name(string, list_all_matches=False)�����}�(hhhjEubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjAubh�j - name to be given
to tokens matching
the element; if multiple tokens within
a repetition group (such as �����}�(h�j - name to be given
to tokens matching
the element; if multiple tokens within
a repetition group (such as �hjAubj�)��}�(h�``ZeroOrMore``�h]�h�
ZeroOrMore�����}�(hhhjXubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjAubh� or �����}�(h� or �hjAubj�)��}�(h�``delimited_list``�h]�h�delimited_list�����}�(hhhjkubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjAubh�=) the
default is to return only the last matching token - if �����}�(h�=) the
default is to return only the last matching token - if �hjAubj�)��}�(h�``list_all_matches``�h]�h�list_all_matches�����}�(hhhj~ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjAubh�D
is set to True, then a list of all the matching tokens is returned.�����}�(h�D
is set to True, then a list of all the matching tokens is returned.�hjAubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M_hj=ubh_)��}�(h��``expr.set_results_name("key")`` can also be written ``expr("key")``
(a results name with a trailing '*' character will be
interpreted as setting ``list_all_matches`` to ``True``).�h]�(j�)��}�(h� ``expr.set_results_name("key")``�h]�h�expr.set_results_name("key")�����}�(hhhj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubh� can also be written �����}�(h� can also be written �hj�ubj�)��}�(h�``expr("key")``�h]�h�expr("key")�����}�(hhhj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubh�R
(a results name with a trailing ‘*’ character will be
interpreted as setting �����}�(h�N
(a results name with a trailing '*' character will be
interpreted as setting �hj�ubj�)��}�(h�``list_all_matches``�h]�h�list_all_matches�����}�(hhhj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubh� to �����}�(h� to �hj�ubj�)��}�(h�``True``�h]�h�True�����}�(hhhj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubh�).�����}�(h�).�hj�ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!Mfhj=ubh_)��}�(h��Note:
``set_results_name`` returns a *copy* of the element so that a single
basic element can be referenced multiple times and given
different names within a complex grammar.�h]�(h�Note:
�����}�(h�Note:
�hj�ubj�)��}�(h�``set_results_name``�h]�h�set_results_name�����}�(hhhj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubh� returns a �����}�(h� returns a �hj�ubj)��}�(h�*copy*�h]�h�copy�����}�(hhhj	ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/jhj�ubh�� of the element so that a single
basic element can be referenced multiple times and given
different names within a complex grammar.�����}�(h�� of the element so that a single
basic element can be referenced multiple times and given
different names within a complex grammar.�hj�ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!Mjhj=ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj}hhh h=h!Nubeh"}�(h$]�h&]�h)]�h+]�h-]�j�j�uh/j�h h=h!MhjChhubj�)��}�(h�.. _set_parse_action:�h]�h"}�(h$]�h&]�h)]�h+]�h-]�h;jSuh/j�h!MohjChhh h=j�Kubj�)��}�(hhh]�(j�)��}�(hX�``set_parse_action(*fn)`` - specify one or more functions to call after successful
matching of the element; each function is defined as ``fn(s, loc, toks)``, where:

- ``s`` is the original parse string

- ``loc`` is the location in the string where matching started

- ``toks`` is the list of the matched tokens, packaged as a ParseResults_ object

Parse actions can have any of the following signatures::

  fn(s: str, loc: int, tokens: ParseResults)
  fn(loc: int, tokens: ParseResults)
  fn(tokens: ParseResults)
  fn()

Multiple functions can be attached to a ``ParserElement`` by specifying multiple
arguments to ``set_parse_action``, or by calling ``add_parse_action``. Calls to ``set_parse_action``
will replace any previously defined parse actions. ``set_parse_action(None)`` will clear
all previously defined parse actions.

Each parse action function can return a modified ``toks`` list, to perform conversion, or
string modifications.  For brevity, ``fn`` may also be a
lambda - here is an example of using a parse action to convert matched
integer tokens from strings to integers::

  int_number = Word(nums).set_parse_action(lambda s, l, t: [int(t[0])])

If ``fn`` modifies the ``toks`` list in-place, it does not need to return
and pyparsing will use the modified ``toks`` list.

If ``set_parse_action`` is called with an argument of ``None``, then this clears all parse actions
attached to that expression.

A nice short-cut for calling ``set_parse_action`` is to use it as a decorator::

  identifier = Word(alphas, alphanums+"_")

  @identifier.set_parse_action
  def resolve_identifier(results: ParseResults):
      return variable_values.get(results[0])

(Posted by @MisterMiyagi in this SO answer: https://stackoverflow.com/a/63031959/165216)
�h]�(h_)��}�(h��``set_parse_action(*fn)`` - specify one or more functions to call after successful
matching of the element; each function is defined as ``fn(s, loc, toks)``, where:�h]�(j�)��}�(h�``set_parse_action(*fn)``�h]�h�set_parse_action(*fn)�����}�(hhhjCubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj?ubh�o - specify one or more functions to call after successful
matching of the element; each function is defined as �����}�(h�o - specify one or more functions to call after successful
matching of the element; each function is defined as �hj?ubj�)��}�(h�``fn(s, loc, toks)``�h]�h�fn(s, loc, toks)�����}�(hhhjVubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj?ubh�, where:�����}�(h�, where:�hj?ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!Mqhj;ubj�)��}�(hhh]�(j�)��}�(h�#``s`` is the original parse string
�h]�h_)��}�(h�"``s`` is the original parse string�h]�(j�)��}�(h�``s``�h]�h�s�����}�(hhhjzubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjvubh� is the original parse string�����}�(h� is the original parse string�hjvubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!Mthjrubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjoubj�)��}�(h�=``loc`` is the location in the string where matching started
�h]�h_)��}�(h�<``loc`` is the location in the string where matching started�h]�(j�)��}�(h�``loc``�h]�h�loc�����}�(hhhj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubh�5 is the location in the string where matching started�����}�(h�5 is the location in the string where matching started�hj�ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!Mvhj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjoubj�)��}�(h�O``toks`` is the list of the matched tokens, packaged as a ParseResults_ object
�h]�h_)��}�(h�N``toks`` is the list of the matched tokens, packaged as a ParseResults_ object�h]�(j�)��}�(h�``toks``�h]�h�toks�����}�(hhhj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubh�2 is the list of the matched tokens, packaged as a �����}�(h�2 is the list of the matched tokens, packaged as a �hj�ubh�)��}�(h�
ParseResults_�h]�h�ParseResults�����}�(hhhj�ubah"}�(h$]�h&]�h)]�h+]�h-]��name��ParseResults�h;j�uh/h�hj�j�Kubh� object�����}�(h� object�hj�ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!Mxhj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjoubeh"}�(h$]�h&]�h)]�h+]�h-]�j�j�uh/j�h h=h!Mthj;ubh_)��}�(h�8Parse actions can have any of the following signatures::�h]�h�7Parse actions can have any of the following signatures:�����}�(h�7Parse actions can have any of the following signatures:�hjubah"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!Mzhj;ubjb)��}�(h�kfn(s: str, loc: int, tokens: ParseResults)
fn(loc: int, tokens: ParseResults)
fn(tokens: ParseResults)
fn()�h]�h�kfn(s: str, loc: int, tokens: ParseResults)
fn(loc: int, tokens: ParseResults)
fn(tokens: ParseResults)
fn()�����}�(hhhjubah"}�(h$]�h&]�h)]�h+]�h-]�jqjruh/jah!M|hj;h h=ubh_)��}�(hX4Multiple functions can be attached to a ``ParserElement`` by specifying multiple
arguments to ``set_parse_action``, or by calling ``add_parse_action``. Calls to ``set_parse_action``
will replace any previously defined parse actions. ``set_parse_action(None)`` will clear
all previously defined parse actions.�h]�(h�(Multiple functions can be attached to a �����}�(h�(Multiple functions can be attached to a �hjubj�)��}�(h�``ParserElement``�h]�h�
ParserElement�����}�(hhhj(ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjubh�% by specifying multiple
arguments to �����}�(h�% by specifying multiple
arguments to �hjubj�)��}�(h�``set_parse_action``�h]�h�set_parse_action�����}�(hhhj;ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjubh�, or by calling �����}�(h�, or by calling �hjubj�)��}�(h�``add_parse_action``�h]�h�add_parse_action�����}�(hhhjNubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjubh�. Calls to �����}�(h�. Calls to �hjubj�)��}�(h�``set_parse_action``�h]�h�set_parse_action�����}�(hhhjaubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjubh�4
will replace any previously defined parse actions. �����}�(h�4
will replace any previously defined parse actions. �hjubj�)��}�(h�``set_parse_action(None)``�h]�h�set_parse_action(None)�����}�(hhhjtubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjubh�1 will clear
all previously defined parse actions.�����}�(h�1 will clear
all previously defined parse actions.�hjubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M�hj;ubh_)��}�(hXEach parse action function can return a modified ``toks`` list, to perform conversion, or
string modifications.  For brevity, ``fn`` may also be a
lambda - here is an example of using a parse action to convert matched
integer tokens from strings to integers::�h]�(h�1Each parse action function can return a modified �����}�(h�1Each parse action function can return a modified �hj�ubj�)��}�(h�``toks``�h]�h�toks�����}�(hhhj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubh�E list, to perform conversion, or
string modifications.  For brevity, �����}�(h�E list, to perform conversion, or
string modifications.  For brevity, �hj�ubj�)��}�(h�``fn``�h]�h�fn�����}�(hhhj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubh�~ may also be a
lambda - here is an example of using a parse action to convert matched
integer tokens from strings to integers:�����}�(h�~ may also be a
lambda - here is an example of using a parse action to convert matched
integer tokens from strings to integers:�hj�ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M�hj;ubjb)��}�(h�Eint_number = Word(nums).set_parse_action(lambda s, l, t: [int(t[0])])�h]�h�Eint_number = Word(nums).set_parse_action(lambda s, l, t: [int(t[0])])�����}�(hhhj�ubah"}�(h$]�h&]�h)]�h+]�h-]�jqjruh/jah!M�hj;h h=ubh_)��}�(h�|If ``fn`` modifies the ``toks`` list in-place, it does not need to return
and pyparsing will use the modified ``toks`` list.�h]�(h�If �����}�(h�If �hj�ubj�)��}�(h�``fn``�h]�h�fn�����}�(hhhj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubh� modifies the �����}�(h� modifies the �hj�ubj�)��}�(h�``toks``�h]�h�toks�����}�(hhhj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubh�O list in-place, it does not need to return
and pyparsing will use the modified �����}�(h�O list in-place, it does not need to return
and pyparsing will use the modified �hj�ubj�)��}�(h�``toks``�h]�h�toks�����}�(hhhj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubh� list.�����}�(h� list.�hj�ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M�hj;ubh_)��}�(h�If ``set_parse_action`` is called with an argument of ``None``, then this clears all parse actions
attached to that expression.�h]�(h�If �����}�(h�If �hjubj�)��}�(h�``set_parse_action``�h]�h�set_parse_action�����}�(hhhj!ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjubh� is called with an argument of �����}�(h� is called with an argument of �hjubj�)��}�(h�``None``�h]�h�None�����}�(hhhj4ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjubh�A, then this clears all parse actions
attached to that expression.�����}�(h�A, then this clears all parse actions
attached to that expression.�hjubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M�hj;ubh_)��}�(h�OA nice short-cut for calling ``set_parse_action`` is to use it as a decorator::�h]�(h�A nice short-cut for calling �����}�(h�A nice short-cut for calling �hjMubj�)��}�(h�``set_parse_action``�h]�h�set_parse_action�����}�(hhhjVubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjMubh� is to use it as a decorator:�����}�(h� is to use it as a decorator:�hjMubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M�hj;ubjb)��}�(h��identifier = Word(alphas, alphanums+"_")

@identifier.set_parse_action
def resolve_identifier(results: ParseResults):
    return variable_values.get(results[0])�h]�h��identifier = Word(alphas, alphanums+"_")

@identifier.set_parse_action
def resolve_identifier(results: ParseResults):
    return variable_values.get(results[0])�����}�(hhhjoubah"}�(h$]�h&]�h)]�h+]�h-]�jqjruh/jah!M�hj;h h=ubh_)��}�(h�X(Posted by @MisterMiyagi in this SO answer: https://stackoverflow.com/a/63031959/165216)�h]�(h�,(Posted by @MisterMiyagi in this SO answer: �����}�(h�,(Posted by @MisterMiyagi in this SO answer: �hj}ubh�)��}�(h�+https://stackoverflow.com/a/63031959/165216�h]�h�+https://stackoverflow.com/a/63031959/165216�����}�(hhhj�ubah"}�(h$]�h&]�h)]�h+]�h-]��refuri�j�uh/h�hj}ubh�)�����}�(h�)�hj}ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M�hj;ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj8hhh h=h!Nubj�)��}�(h��``add_parse_action`` - similar to ``set_parse_action``, but instead of replacing any
previously defined parse actions, will append the given action or actions to the
existing defined parse actions.
�h]�h_)��}�(h��``add_parse_action`` - similar to ``set_parse_action``, but instead of replacing any
previously defined parse actions, will append the given action or actions to the
existing defined parse actions.�h]�(j�)��}�(h�``add_parse_action``�h]�h�add_parse_action�����}�(hhhj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubh� - similar to �����}�(h� - similar to �hj�ubj�)��}�(h�``set_parse_action``�h]�h�set_parse_action�����}�(hhhj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubh��, but instead of replacing any
previously defined parse actions, will append the given action or actions to the
existing defined parse actions.�����}�(h��, but instead of replacing any
previously defined parse actions, will append the given action or actions to the
existing defined parse actions.�hj�ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M�hj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj8hhh h=h!Nubj�)��}�(hXA``add_condition`` - a simplified form of ``add_parse_action`` if the purpose
of the parse action is to simply do some validation, and raise an exception
if the validation fails. Takes a method that takes the same arguments,
but simply returns ``True`` or ``False``. If ``False`` is returned, an exception will be
raised.
�h]�h_)��}�(hX@``add_condition`` - a simplified form of ``add_parse_action`` if the purpose
of the parse action is to simply do some validation, and raise an exception
if the validation fails. Takes a method that takes the same arguments,
but simply returns ``True`` or ``False``. If ``False`` is returned, an exception will be
raised.�h]�(j�)��}�(h�``add_condition``�h]�h�
add_condition�����}�(hhhj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubh� - a simplified form of �����}�(h� - a simplified form of �hj�ubj�)��}�(h�``add_parse_action``�h]�h�add_parse_action�����}�(hhhj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubh�� if the purpose
of the parse action is to simply do some validation, and raise an exception
if the validation fails. Takes a method that takes the same arguments,
but simply returns �����}�(h�� if the purpose
of the parse action is to simply do some validation, and raise an exception
if the validation fails. Takes a method that takes the same arguments,
but simply returns �hj�ubj�)��}�(h�``True``�h]�h�True�����}�(hhhjubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubh� or �����}�(h� or �hj�ubj�)��}�(h�	``False``�h]�h�False�����}�(hhhj!ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubh�. If �����}�(h�. If �hj�ubj�)��}�(h�	``False``�h]�h�False�����}�(hhhj4ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubh�* is returned, an exception will be
raised.�����}�(h�* is returned, an exception will be
raised.�hj�ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M�hj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj8hhh h=h!Nubj�)��}�(h��``set_break(break_flag=True)`` - if ``break_flag`` is ``True``, calls ``pdb.set_break()``
as this expression is about to be parsed
�h]�h_)��}�(h��``set_break(break_flag=True)`` - if ``break_flag`` is ``True``, calls ``pdb.set_break()``
as this expression is about to be parsed�h]�(j�)��}�(h�``set_break(break_flag=True)``�h]�h�set_break(break_flag=True)�����}�(hhhj[ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjWubh� - if �����}�(h� - if �hjWubj�)��}�(h�``break_flag``�h]�h�
break_flag�����}�(hhhjnubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjWubh� is �����}�(h� is �hjWubj�)��}�(h�``True``�h]�h�True�����}�(hhhj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjWubh�, calls �����}�(h�, calls �hjWubj�)��}�(h�``pdb.set_break()``�h]�h�pdb.set_break()�����}�(hhhj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjWubh�)
as this expression is about to be parsed�����}�(h�)
as this expression is about to be parsed�hjWubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M�hjSubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj8hhh h=h!Nubj�)��}�(h��``copy()`` - returns a copy of a ``ParserElement``; can be used to use the same
parse expression in different places in a grammar, with different parse actions
attached to each; a short-form ``expr()`` is equivalent to ``expr.copy()``
�h]�h_)��}�(h��``copy()`` - returns a copy of a ``ParserElement``; can be used to use the same
parse expression in different places in a grammar, with different parse actions
attached to each; a short-form ``expr()`` is equivalent to ``expr.copy()``�h]�(j�)��}�(h�
``copy()``�h]�h�copy()�����}�(hhhj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubh� - returns a copy of a �����}�(h� - returns a copy of a �hj�ubj�)��}�(h�``ParserElement``�h]�h�
ParserElement�����}�(hhhj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubh��; can be used to use the same
parse expression in different places in a grammar, with different parse actions
attached to each; a short-form �����}�(h��; can be used to use the same
parse expression in different places in a grammar, with different parse actions
attached to each; a short-form �hj�ubj�)��}�(h�
``expr()``�h]�h�expr()�����}�(hhhj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubh� is equivalent to �����}�(h� is equivalent to �hj�ubj�)��}�(h�``expr.copy()``�h]�h�expr.copy()�����}�(hhhj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M�hj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj8hhh h=h!Nubj�)��}�(h��``leave_whitespace()`` - change default behavior of skipping
whitespace before starting matching (mostly used internally to the
pyparsing module, rarely used by client code)
�h]�h_)��}�(h��``leave_whitespace()`` - change default behavior of skipping
whitespace before starting matching (mostly used internally to the
pyparsing module, rarely used by client code)�h]�(j�)��}�(h�``leave_whitespace()``�h]�h�leave_whitespace()�����}�(hhhjubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjubh�� - change default behavior of skipping
whitespace before starting matching (mostly used internally to the
pyparsing module, rarely used by client code)�����}�(h�� - change default behavior of skipping
whitespace before starting matching (mostly used internally to the
pyparsing module, rarely used by client code)�hjubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M�hjubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj8hhh h=h!Nubj�)��}�(h��``set_whitespace_chars(chars)`` - define the set of chars to be ignored
as whitespace before trying to match a specific ``ParserElement``, in place of the
default set of whitespace (space, tab, newline, and return)
�h]�h_)��}�(h��``set_whitespace_chars(chars)`` - define the set of chars to be ignored
as whitespace before trying to match a specific ``ParserElement``, in place of the
default set of whitespace (space, tab, newline, and return)�h]�(j�)��}�(h�``set_whitespace_chars(chars)``�h]�h�set_whitespace_chars(chars)�����}�(hhhj=ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj9ubh�Y - define the set of chars to be ignored
as whitespace before trying to match a specific �����}�(h�Y - define the set of chars to be ignored
as whitespace before trying to match a specific �hj9ubj�)��}�(h�``ParserElement``�h]�h�
ParserElement�����}�(hhhjPubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj9ubh�M, in place of the
default set of whitespace (space, tab, newline, and return)�����}�(h�M, in place of the
default set of whitespace (space, tab, newline, and return)�hj9ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M�hj5ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj8hhh h=h!Nubj�)��}�(hXp``set_default_whitespace_chars(chars)`` - class-level method to override
the default set of whitespace chars for all subsequently created ParserElements
(including copies); useful when defining grammars that treat one or more of the
default whitespace characters as significant (such as a line-sensitive grammar, to
omit newline from the list of ignorable whitespace)
�h]�h_)��}�(hXo``set_default_whitespace_chars(chars)`` - class-level method to override
the default set of whitespace chars for all subsequently created ParserElements
(including copies); useful when defining grammars that treat one or more of the
default whitespace characters as significant (such as a line-sensitive grammar, to
omit newline from the list of ignorable whitespace)�h]�(j�)��}�(h�'``set_default_whitespace_chars(chars)``�h]�h�#set_default_whitespace_chars(chars)�����}�(hhhjwubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjsubhXH - class-level method to override
the default set of whitespace chars for all subsequently created ParserElements
(including copies); useful when defining grammars that treat one or more of the
default whitespace characters as significant (such as a line-sensitive grammar, to
omit newline from the list of ignorable whitespace)�����}�(hXH - class-level method to override
the default set of whitespace chars for all subsequently created ParserElements
(including copies); useful when defining grammars that treat one or more of the
default whitespace characters as significant (such as a line-sensitive grammar, to
omit newline from the list of ignorable whitespace)�hjsubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M�hjoubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj8hhh h=h!Nubj�)��}�(h��``suppress()`` - convenience function to suppress the output of the
given element, instead of wrapping it with a ``Suppress`` object.
�h]�h_)��}�(h��``suppress()`` - convenience function to suppress the output of the
given element, instead of wrapping it with a ``Suppress`` object.�h]�(j�)��}�(h�``suppress()``�h]�h�
suppress()�����}�(hhhj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubh�c - convenience function to suppress the output of the
given element, instead of wrapping it with a �����}�(h�c - convenience function to suppress the output of the
given element, instead of wrapping it with a �hj�ubj�)��}�(h�``Suppress``�h]�h�Suppress�����}�(hhhj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubh� object.�����}�(h� object.�hj�ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M�hj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj8hhh h=h!Nubj�)��}�(h��``ignore(expr)`` - function to specify parse expression to be
ignored while matching defined patterns; can be called
repeatedly to specify multiple expressions; useful to specify
patterns of comment syntax, for example
�h]�h_)��}�(h��``ignore(expr)`` - function to specify parse expression to be
ignored while matching defined patterns; can be called
repeatedly to specify multiple expressions; useful to specify
patterns of comment syntax, for example�h]�(j�)��}�(h�``ignore(expr)``�h]�h�ignore(expr)�����}�(hhhj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubh�� - function to specify parse expression to be
ignored while matching defined patterns; can be called
repeatedly to specify multiple expressions; useful to specify
patterns of comment syntax, for example�����}�(h�� - function to specify parse expression to be
ignored while matching defined patterns; can be called
repeatedly to specify multiple expressions; useful to specify
patterns of comment syntax, for example�hj�ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M�hj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj8hhh h=h!Nubj�)��}�(h�m``set_debug(debug_flag=True)`` - function to enable/disable tracing output
when trying to match this element
�h]�h_)��}�(h�l``set_debug(debug_flag=True)`` - function to enable/disable tracing output
when trying to match this element�h]�(j�)��}�(h�``set_debug(debug_flag=True)``�h]�h�set_debug(debug_flag=True)�����}�(hhhj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubh�N - function to enable/disable tracing output
when trying to match this element�����}�(h�N - function to enable/disable tracing output
when trying to match this element�hj�ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M�hj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj8hhh h=h!Nubj�)��}�(h�n``validate()`` - function to verify that the defined grammar does not
contain infinitely recursive constructs
�h]�h_)��}�(h�m``validate()`` - function to verify that the defined grammar does not
contain infinitely recursive constructs�h]�(j�)��}�(h�``validate()``�h]�h�
validate()�����}�(hhhj&ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj"ubh�_ - function to verify that the defined grammar does not
contain infinitely recursive constructs�����}�(h�_ - function to verify that the defined grammar does not
contain infinitely recursive constructs�hj"ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M�hjubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj8hhh h=h!Nubeh"}�(h$]�jSah&]�h)]��set_parse_action�ah+]�h-]�j�j�uh/j�h h=h!MqhjChh�expect_referenced_by_name�}�jIj.s�expect_referenced_by_id�}�jSj.sj�Kubj�)��}�(h�.. _parse_with_tabs:�h]�h"}�(h$]�h&]�h)]�h+]�h-]�h;�parse-with-tabs�uh/j�h!M�hjChhh h=j�Kubj�)��}�(hhh]�(j�)��}�(h��``parse_with_tabs()`` - function to override default behavior of converting
tabs to spaces before parsing the input string; rarely used, except when
specifying whitespace-significant grammars using the White_ class.
�h]�h_)��}�(h��``parse_with_tabs()`` - function to override default behavior of converting
tabs to spaces before parsing the input string; rarely used, except when
specifying whitespace-significant grammars using the White_ class.�h]�(j�)��}�(h�``parse_with_tabs()``�h]�h�parse_with_tabs()�����}�(hhhjfubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjbubh�� - function to override default behavior of converting
tabs to spaces before parsing the input string; rarely used, except when
specifying whitespace-significant grammars using the �����}�(h�� - function to override default behavior of converting
tabs to spaces before parsing the input string; rarely used, except when
specifying whitespace-significant grammars using the �hjbubh�)��}�(h�White_�h]�h�White�����}�(hhhjyubah"}�(h$]�h&]�h)]�h+]�h-]��name��White�h;�white�uh/h�hjbj�Kubh� class.�����}�(h� class.�hjbubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M�hj^ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj[hhh h=h!Nubj�)��}�(hX�``enable_packrat()`` - a class-level static method to enable a memoizing
performance enhancement, known as "packrat parsing".  packrat parsing is
disabled by default, since it may conflict with some user programs that use
parse actions.  To activate the packrat feature, your
program must call the class method ``ParserElement.enable_packrat()``. For best
results, call ``enable_packrat()`` immediately after importing pyparsing.
�h]�h_)��}�(hX�``enable_packrat()`` - a class-level static method to enable a memoizing
performance enhancement, known as "packrat parsing".  packrat parsing is
disabled by default, since it may conflict with some user programs that use
parse actions.  To activate the packrat feature, your
program must call the class method ``ParserElement.enable_packrat()``. For best
results, call ``enable_packrat()`` immediately after importing pyparsing.�h]�(j�)��}�(h�``enable_packrat()``�h]�h�enable_packrat()�����}�(hhhj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubhX' - a class-level static method to enable a memoizing
performance enhancement, known as “packrat parsing”.  packrat parsing is
disabled by default, since it may conflict with some user programs that use
parse actions.  To activate the packrat feature, your
program must call the class method �����}�(hX# - a class-level static method to enable a memoizing
performance enhancement, known as "packrat parsing".  packrat parsing is
disabled by default, since it may conflict with some user programs that use
parse actions.  To activate the packrat feature, your
program must call the class method �hj�ubj�)��}�(h�"``ParserElement.enable_packrat()``�h]�h�ParserElement.enable_packrat()�����}�(hhhj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubh�. For best
results, call �����}�(h�. For best
results, call �hj�ubj�)��}�(h�``enable_packrat()``�h]�h�enable_packrat()�����}�(hhhj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubh�' immediately after importing pyparsing.�����}�(h�' immediately after importing pyparsing.�hj�ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M�hj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj[hhh h=h!Nubj�)��}�(hXv``enable_left_recursion()`` - a class-level static method to enable
pyparsing with left-recursive (LR) parsers. Similar to ``ParserElement.enable_packrat()``,
your program must call the class method ``ParserElement.enable_left_recursion()`` to
enable this feature. ``enable_left_recursion()`` uses a separate packrat cache, and so
is incompatible with ``enable_packrat()``.
�h]�h_)��}�(hXu``enable_left_recursion()`` - a class-level static method to enable
pyparsing with left-recursive (LR) parsers. Similar to ``ParserElement.enable_packrat()``,
your program must call the class method ``ParserElement.enable_left_recursion()`` to
enable this feature. ``enable_left_recursion()`` uses a separate packrat cache, and so
is incompatible with ``enable_packrat()``.�h]�(j�)��}�(h�``enable_left_recursion()``�h]�h�enable_left_recursion()�����}�(hhhj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubh�` - a class-level static method to enable
pyparsing with left-recursive (LR) parsers. Similar to �����}�(h�` - a class-level static method to enable
pyparsing with left-recursive (LR) parsers. Similar to �hj�ubj�)��}�(h�"``ParserElement.enable_packrat()``�h]�h�ParserElement.enable_packrat()�����}�(hhhjubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubh�*,
your program must call the class method �����}�(h�*,
your program must call the class method �hj�ubj�)��}�(h�)``ParserElement.enable_left_recursion()``�h]�h�%ParserElement.enable_left_recursion()�����}�(hhhjubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubh� to
enable this feature. �����}�(h� to
enable this feature. �hj�ubj�)��}�(h�``enable_left_recursion()``�h]�h�enable_left_recursion()�����}�(hhhj)ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubh�< uses a separate packrat cache, and so
is incompatible with �����}�(h�< uses a separate packrat cache, and so
is incompatible with �hj�ubj�)��}�(h�``enable_packrat()``�h]�h�enable_packrat()�����}�(hhhj<ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubh�.�����}�(hjhj�ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M�hj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj[hhh h=h!Nubeh"}�(h$]�jZah&]�h)]��parse_with_tabs�ah+]�h-]�j�j�uh/j�h h=h!M�hjChhjL}�j^jPsjN}�jZjPsj�Kubeh"}�(h$]�j�ah&]�h)]��classes in the pyparsing module�ah+]�h-]�uh/h	hj&hhh h=h!Mubh
)��}�(hhh]�(h)��}�(hj�h]�(h)��}�(hhh]�h�1.2.2   �����}�(hhhjphhh Nh!Nubah"}�(h$]�h&]�h(ah)]�h+]�h-]�uh/hhjmhhh Nh!Nubh�Basic ParserElement subclasses�����}�(hj�hjmhhh Nh!Nubeh"}�(h$]�h&]�h)]�h+]�h-]�h:Kh;j�uh/hhjjhhh h=h!M�ubj�)��}�(h�.. _Literal:�h]�h"}�(h$]�h&]�h)]�h+]�h-]�h;ja	uh/j�h!M�hjjhhh h=j�Kubj�)��}�(hhh]�j�)��}�(h�<``Literal`` - construct with a string to be matched exactly
�h]�h_)��}�(h�;``Literal`` - construct with a string to be matched exactly�h]�(j�)��}�(h�``Literal``�h]�h�Literal�����}�(hhhj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubh�0 - construct with a string to be matched exactly�����}�(h�0 - construct with a string to be matched exactly�hj�ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M�hj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�hhh h=h!Nubah"}�(h$]�ja	ah&]�h)]��literal�ah+]�h-]�j�j�uh/j�h h=h!M�hjjhhjL}�j�j�sjN}�ja	j�sj�Kubj�)��}�(h�.. _CaselessLiteral:�h]�h"}�(h$]�h&]�h)]�h+]�h-]�h;�caselessliteral�uh/j�h!M�hjjhhh h=j�Kubj�)��}�(hhh]�j�)��}�(h��``CaselessLiteral`` - construct with a string to be matched, but
without case checking; results are always returned as the
defining literal, NOT as they are found in the input string
�h]�h_)��}�(h��``CaselessLiteral`` - construct with a string to be matched, but
without case checking; results are always returned as the
defining literal, NOT as they are found in the input string�h]�(j�)��}�(h�``CaselessLiteral``�h]�h�CaselessLiteral�����}�(hhhj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubh�� - construct with a string to be matched, but
without case checking; results are always returned as the
defining literal, NOT as they are found in the input string�����}�(h�� - construct with a string to be matched, but
without case checking; results are always returned as the
defining literal, NOT as they are found in the input string�hj�ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M�hj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�hhh h=h!Nubah"}�(h$]�j�ah&]�h)]��caselessliteral�ah+]�h-]�j�j�uh/j�h h=h!M�hjjhhjL}�j�j�sjN}�j�j�sj�Kubj�)��}�(h�.. _Keyword:�h]�h"}�(h$]�h&]�h)]�h+]�h-]�h;�keyword�uh/j�h!M�hjjhhh h=j�Kubj�)��}�(hhh]�(j�)��}�(h��``Keyword`` - similar to Literal_, but must be immediately followed by
whitespace, punctuation, or other non-keyword characters; prevents
accidental matching of a non-keyword that happens to begin with a
defined keyword
�h]�h_)��}�(h��``Keyword`` - similar to Literal_, but must be immediately followed by
whitespace, punctuation, or other non-keyword characters; prevents
accidental matching of a non-keyword that happens to begin with a
defined keyword�h]�(j�)��}�(h�``Keyword``�h]�h�Keyword�����}�(hhhjubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjubh� - similar to �����}�(h� - similar to �hjubh�)��}�(h�Literal_�h]�h�Literal�����}�(hhhj+ubah"}�(h$]�h&]�h)]�h+]�h-]��name��Literal�h;ja	uh/h�hjj�Kubh��, but must be immediately followed by
whitespace, punctuation, or other non-keyword characters; prevents
accidental matching of a non-keyword that happens to begin with a
defined keyword�����}�(h��, but must be immediately followed by
whitespace, punctuation, or other non-keyword characters; prevents
accidental matching of a non-keyword that happens to begin with a
defined keyword�hjubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M�hjubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj
hhh h=h!Nubj�)��}�(h�O``CaselessKeyword`` - similar to Keyword_, but with caseless matching
behavior
�h]�h_)��}�(h�N``CaselessKeyword`` - similar to Keyword_, but with caseless matching
behavior�h]�(j�)��}�(h�``CaselessKeyword``�h]�h�CaselessKeyword�����}�(hhhjTubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjPubh� - similar to �����}�(h� - similar to �hjPubh�)��}�(h�Keyword_�h]�h�Keyword�����}�(hhhjgubah"}�(h$]�h&]�h)]�h+]�h-]��name��Keyword�h;juh/h�hjPj�Kubh�%, but with caseless matching
behavior�����}�(h�%, but with caseless matching
behavior�hjPubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M�hjLubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj
hhh h=h!Nubeh"}�(h$]�jah&]�h)]��keyword�ah+]�h-]�j�j�uh/j�h h=h!M�hjjhhjL}�j�jsjN}�jjsj�Kubj�)��}�(h�	.. _Word:�h]�h"}�(h$]�h&]�h)]�h+]�h-]�h;�word�uh/j�h!M�hjjhhh h=j�Kubj�)��}�(hhh]�(j�)��}�(hX�``Word`` - one or more contiguous characters; construct with a
string containing the set of allowed initial characters, and an
optional second string of allowed body characters; for instance,
a common ``Word`` construct is to match a code identifier - in C, a
valid identifier must start with an alphabetic character or an
underscore ('_'), followed by a body that can also include numeric
digits.  That is, ``a``, ``i``, ``MAX_LENGTH``, ``_a1``, ``b_109_``, and
``plan9FromOuterSpace``
are all valid identifiers; ``9b7z``, ``$a``, ``.section``, and ``0debug``
are not.  To
define an identifier using a ``Word``, use either of the following::

  Word(alphas+"_", alphanums+"_")
  Word(srange("[a-zA-Z_]"), srange("[a-zA-Z0-9_]"))

Pyparsing also provides pre-defined strings ``identchars`` and
``identbodychars`` so that you can also write::

  Word(identchars, identbodychars)

If only one
string given, it specifies that the same character set defined
for the initial character is used for the word body; for instance, to
define an identifier that can only be composed of capital letters and
underscores, use one of::

  ``Word("ABCDEFGHIJKLMNOPQRSTUVWXYZ_")``
  ``Word(srange("[A-Z_]"))``

A ``Word`` may
also be constructed with any of the following optional parameters:

- ``min`` - indicating a minimum length of matching characters

- ``max`` - indicating a maximum length of matching characters

- ``exact`` - indicating an exact length of matching characters

If ``exact`` is specified, it will override any values for ``min`` or ``max``.

Sometimes you want to define a word using all
characters in a range except for one or two of them; you can do this
with the new ``exclude_chars`` argument. This is helpful if you want to define
a word with all ``printables`` except for a single delimiter character, such
as '.'. Previously, you would have to create a custom string to pass to Word.
With this change, you can just create ``Word(printables, exclude_chars='.')``.
�h]�(h_)��}�(hX�``Word`` - one or more contiguous characters; construct with a
string containing the set of allowed initial characters, and an
optional second string of allowed body characters; for instance,
a common ``Word`` construct is to match a code identifier - in C, a
valid identifier must start with an alphabetic character or an
underscore ('_'), followed by a body that can also include numeric
digits.  That is, ``a``, ``i``, ``MAX_LENGTH``, ``_a1``, ``b_109_``, and
``plan9FromOuterSpace``
are all valid identifiers; ``9b7z``, ``$a``, ``.section``, and ``0debug``
are not.  To
define an identifier using a ``Word``, use either of the following::�h]�(j�)��}�(h�``Word``�h]�h�Word�����}�(hhhj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubh�� - one or more contiguous characters; construct with a
string containing the set of allowed initial characters, and an
optional second string of allowed body characters; for instance,
a common �����}�(h�� - one or more contiguous characters; construct with a
string containing the set of allowed initial characters, and an
optional second string of allowed body characters; for instance,
a common �hj�ubj�)��}�(h�``Word``�h]�h�Word�����}�(hhhj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubh�� construct is to match a code identifier - in C, a
valid identifier must start with an alphabetic character or an
underscore (‘_’), followed by a body that can also include numeric
digits.  That is, �����}�(h�� construct is to match a code identifier - in C, a
valid identifier must start with an alphabetic character or an
underscore ('_'), followed by a body that can also include numeric
digits.  That is, �hj�ubj�)��}�(h�``a``�h]�h�a�����}�(hhhj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubh�, �����}�(h�, �hj�ubj�)��}�(h�``i``�h]�h�i�����}�(hhhj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubh�, �����}�(h�, �hj�ubj�)��}�(h�``MAX_LENGTH``�h]�h�
MAX_LENGTH�����}�(hhhj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubh�, �����}�(h�, �hj�ubj�)��}�(h�``_a1``�h]�h�_a1�����}�(hhhjubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubh�, �����}�(h�, �hj�ubj�)��}�(h�
``b_109_``�h]�h�b_109_�����}�(hhhjubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubh�, and
�����}�(h�, and
�hj�ubj�)��}�(h�``plan9FromOuterSpace``�h]�h�plan9FromOuterSpace�����}�(hhhj,ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubh�
are all valid identifiers; �����}�(h�
are all valid identifiers; �hj�ubj�)��}�(h�``9b7z``�h]�h�9b7z�����}�(hhhj?ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubh�, �����}�(h�, �hj�ubj�)��}�(h�``$a``�h]�h�$a�����}�(hhhjRubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubh�, �����}�(hj�hj�ubj�)��}�(h�``.section``�h]�h�.section�����}�(hhhjdubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubh�, and �����}�(h�, and �hj�ubj�)��}�(h�
``0debug``�h]�h�0debug�����}�(hhhjwubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubh�+
are not.  To
define an identifier using a �����}�(h�+
are not.  To
define an identifier using a �hj�ubj�)��}�(h�``Word``�h]�h�Word�����}�(hhhj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubh�, use either of the following:�����}�(h�, use either of the following:�hj�ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M�hj�ubjb)��}�(h�QWord(alphas+"_", alphanums+"_")
Word(srange("[a-zA-Z_]"), srange("[a-zA-Z0-9_]"))�h]�h�QWord(alphas+"_", alphanums+"_")
Word(srange("[a-zA-Z_]"), srange("[a-zA-Z0-9_]"))�����}�(hhhj�ubah"}�(h$]�h&]�h)]�h+]�h-]�jqjruh/jah!Mhj�h h=ubh_)��}�(h�nPyparsing also provides pre-defined strings ``identchars`` and
``identbodychars`` so that you can also write::�h]�(h�,Pyparsing also provides pre-defined strings �����}�(h�,Pyparsing also provides pre-defined strings �hj�ubj�)��}�(h�``identchars``�h]�h�
identchars�����}�(hhhj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubh� and
�����}�(h� and
�hj�ubj�)��}�(h�``identbodychars``�h]�h�identbodychars�����}�(hhhj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubh� so that you can also write:�����}�(h� so that you can also write:�hj�ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!Mhj�ubjb)��}�(h� Word(identchars, identbodychars)�h]�h� Word(identchars, identbodychars)�����}�(hhhj�ubah"}�(h$]�h&]�h)]�h+]�h-]�jqjruh/jah!Mhj�h h=ubh_)��}�(h��If only one
string given, it specifies that the same character set defined
for the initial character is used for the word body; for instance, to
define an identifier that can only be composed of capital letters and
underscores, use one of::�h]�h��If only one
string given, it specifies that the same character set defined
for the initial character is used for the word body; for instance, to
define an identifier that can only be composed of capital letters and
underscores, use one of:�����}�(h��If only one
string given, it specifies that the same character set defined
for the initial character is used for the word body; for instance, to
define an identifier that can only be composed of capital letters and
underscores, use one of:�hj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M
hj�ubjb)��}�(h�B``Word("ABCDEFGHIJKLMNOPQRSTUVWXYZ_")``
``Word(srange("[A-Z_]"))``�h]�h�B``Word("ABCDEFGHIJKLMNOPQRSTUVWXYZ_")``
``Word(srange("[A-Z_]"))``�����}�(hhhjubah"}�(h$]�h&]�h)]�h+]�h-]�jqjruh/jah!Mhj�h h=ubh_)��}�(h�QA ``Word`` may
also be constructed with any of the following optional parameters:�h]�(h�A �����}�(h�A �hjubj�)��}�(h�``Word``�h]�h�Word�����}�(hhhjubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjubh�G may
also be constructed with any of the following optional parameters:�����}�(h�G may
also be constructed with any of the following optional parameters:�hjubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!Mhj�ubj�)��}�(hhh]�(j�)��}�(h�=``min`` - indicating a minimum length of matching characters
�h]�h_)��}�(h�<``min`` - indicating a minimum length of matching characters�h]�(j�)��}�(h�``min``�h]�h�min�����}�(hhhj>ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj:ubh�5 - indicating a minimum length of matching characters�����}�(h�5 - indicating a minimum length of matching characters�hj:ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!Mhj6ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj3ubj�)��}�(h�=``max`` - indicating a maximum length of matching characters
�h]�h_)��}�(h�<``max`` - indicating a maximum length of matching characters�h]�(j�)��}�(h�``max``�h]�h�max�����}�(hhhjeubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjaubh�5 - indicating a maximum length of matching characters�����}�(h�5 - indicating a maximum length of matching characters�hjaubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!Mhj]ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj3ubj�)��}�(h�>``exact`` - indicating an exact length of matching characters
�h]�h_)��}�(h�=``exact`` - indicating an exact length of matching characters�h]�(j�)��}�(h�	``exact``�h]�h�exact�����}�(hhhj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubh�4 - indicating an exact length of matching characters�����}�(h�4 - indicating an exact length of matching characters�hj�ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!Mhj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj3ubeh"}�(h$]�h&]�h)]�h+]�h-]�j�j�uh/j�h h=h!Mhj�ubh_)��}�(h�NIf ``exact`` is specified, it will override any values for ``min`` or ``max``.�h]�(h�If �����}�(h�If �hj�ubj�)��}�(h�	``exact``�h]�h�exact�����}�(hhhj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubh�/ is specified, it will override any values for �����}�(h�/ is specified, it will override any values for �hj�ubj�)��}�(h�``min``�h]�h�min�����}�(hhhj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubh� or �����}�(h� or �hj�ubj�)��}�(h�``max``�h]�h�max�����}�(hhhj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubh�.�����}�(hjhj�ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!Mhj�ubh_)��}�(hX�Sometimes you want to define a word using all
characters in a range except for one or two of them; you can do this
with the new ``exclude_chars`` argument. This is helpful if you want to define
a word with all ``printables`` except for a single delimiter character, such
as '.'. Previously, you would have to create a custom string to pass to Word.
With this change, you can just create ``Word(printables, exclude_chars='.')``.��h]�(h��Sometimes you want to define a word using all
characters in a range except for one or two of them; you can do this
with the new �����}�(h��Sometimes you want to define a word using all
characters in a range except for one or two of them; you can do this
with the new �hj�ubj�)��}�(h�``exclude_chars``�h]�h�
exclude_chars�����}�(hhhjubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubh�A argument. This is helpful if you want to define
a word with all �����}�(h�A argument. This is helpful if you want to define
a word with all �hj�ubj�)��}�(h�``printables``�h]�h�
printables�����}�(hhhjubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubh�� except for a single delimiter character, such
as ‘.’. Previously, you would have to create a custom string to pass to Word.
With this change, you can just create �����}�(h�� except for a single delimiter character, such
as '.'. Previously, you would have to create a custom string to pass to Word.
With this change, you can just create �hj�ubj�)��}�(h�'``Word(printables, exclude_chars='.')``�h]�h�#Word(printables, exclude_chars='.')�����}�(hhhj'ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubh�.�����}�(hjhj�ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!Mhj�ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�hhh h=h!Nubj�)��}�(h��``Char`` - a convenience form of ``Word`` that will match just a single character from
a string of matching characters::

    single_digit = Char(nums)
�h]�(h_)��}�(h�x``Char`` - a convenience form of ``Word`` that will match just a single character from
a string of matching characters::�h]�(j�)��}�(h�``Char``�h]�h�Char�����}�(hhhjMubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjIubh� - a convenience form of �����}�(h� - a convenience form of �hjIubj�)��}�(h�``Word``�h]�h�Word�����}�(hhhj`ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjIubh�N that will match just a single character from
a string of matching characters:�����}�(h�N that will match just a single character from
a string of matching characters:�hjIubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M%hjEubjb)��}�(h�single_digit = Char(nums)�h]�h�single_digit = Char(nums)�����}�(hhhjyubah"}�(h$]�h&]�h)]�h+]�h-]�jqjruh/jah!M(hjEh h=ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�hhh h=h!Nubj�)��}�(h��``CharsNotIn`` - similar to Word_, but matches characters not
in the given constructor string (accepts only one string for both
initial and body characters); also supports ``min``, ``max``, and ``exact``
optional parameters.
�h]�h_)��}�(h��``CharsNotIn`` - similar to Word_, but matches characters not
in the given constructor string (accepts only one string for both
initial and body characters); also supports ``min``, ``max``, and ``exact``
optional parameters.�h]�(j�)��}�(h�``CharsNotIn``�h]�h�
CharsNotIn�����}�(hhhj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubh� - similar to �����}�(h� - similar to �hj�ubh�)��}�(h�Word_�h]�h�Word�����}�(hhhj�ubah"}�(h$]�h&]�h)]�h+]�h-]��name��Word�h;j�uh/h�hj�j�Kubh��, but matches characters not
in the given constructor string (accepts only one string for both
initial and body characters); also supports �����}�(h��, but matches characters not
in the given constructor string (accepts only one string for both
initial and body characters); also supports �hj�ubj�)��}�(h�``min``�h]�h�min�����}�(hhhj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubh�, �����}�(h�, �hj�ubj�)��}�(h�``max``�h]�h�max�����}�(hhhj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubh�, and �����}�(h�, and �hj�ubj�)��}�(h�	``exact``�h]�h�exact�����}�(hhhj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubh�
optional parameters.�����}�(h�
optional parameters.�hj�ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M*hj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�hhh h=h!Nubj�)��}�(hXB``Regex`` - a powerful construct, that accepts a regular expression
to be matched at the current parse position; accepts an optional
``flags`` parameter, corresponding to the flags parameter in the ``re.compile``
method; if the expression includes named sub-fields, they will be
represented in the returned ParseResults_.
�h]�h_)��}�(hXA``Regex`` - a powerful construct, that accepts a regular expression
to be matched at the current parse position; accepts an optional
``flags`` parameter, corresponding to the flags parameter in the ``re.compile``
method; if the expression includes named sub-fields, they will be
represented in the returned ParseResults_.�h]�(j�)��}�(h�	``Regex``�h]�h�Regex�����}�(hhhj
ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjubh�| - a powerful construct, that accepts a regular expression
to be matched at the current parse position; accepts an optional
�����}�(h�| - a powerful construct, that accepts a regular expression
to be matched at the current parse position; accepts an optional
�hjubj�)��}�(h�	``flags``�h]�h�flags�����}�(hhhjubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjubh�8 parameter, corresponding to the flags parameter in the �����}�(h�8 parameter, corresponding to the flags parameter in the �hjubj�)��}�(h�``re.compile``�h]�h�
re.compile�����}�(hhhj0ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjubh�_
method; if the expression includes named sub-fields, they will be
represented in the returned �����}�(h�_
method; if the expression includes named sub-fields, they will be
represented in the returned �hjubh�)��}�(h�
ParseResults_�h]�h�ParseResults�����}�(hhhjCubah"}�(h$]�h&]�h)]�h+]�h-]��name��ParseResults�h;j�uh/h�hjj�Kubh�.�����}�(hjhjubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M/hjubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�hhh h=h!Nubj�)��}�(hXj``QuotedString`` - supports the definition of custom quoted string
formats, in addition to pyparsing's built-in ``dbl_quoted_string`` and
``sgl_quoted_string``.  ``QuotedString`` allows you to specify the following
parameters:

- ``quote_char`` - string of one or more characters defining the quote delimiting string

- ``esc_char`` - character to escape quotes, typically backslash (default=None)

- ``esc_quote`` - special quote sequence to escape an embedded quote string (such as SQL's "" to escape an embedded ") (default=None)

- ``multiline`` - boolean indicating whether quotes can span multiple lines (default=False)

- ``unquote_results`` - boolean indicating whether the matched text should be unquoted (default=True)

- ``end_quote_char`` - string of one or more characters defining the end of the quote delimited string (default=None => same as ``quote_char``)
�h]�(h_)��}�(h��``QuotedString`` - supports the definition of custom quoted string
formats, in addition to pyparsing's built-in ``dbl_quoted_string`` and
``sgl_quoted_string``.  ``QuotedString`` allows you to specify the following
parameters:�h]�(j�)��}�(h�``QuotedString``�h]�h�QuotedString�����}�(hhhjkubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjgubh�b - supports the definition of custom quoted string
formats, in addition to pyparsing’s built-in �����}�(h�` - supports the definition of custom quoted string
formats, in addition to pyparsing's built-in �hjgubj�)��}�(h�``dbl_quoted_string``�h]�h�dbl_quoted_string�����}�(hhhj~ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjgubh� and
�����}�(h� and
�hjgubj�)��}�(h�``sgl_quoted_string``�h]�h�sgl_quoted_string�����}�(hhhj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjgubh�.  �����}�(h�.  �hjgubj�)��}�(h�``QuotedString``�h]�h�QuotedString�����}�(hhhj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjgubh�0 allows you to specify the following
parameters:�����}�(h�0 allows you to specify the following
parameters:�hjgubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M5hjcubj�)��}�(hhh]�(j�)��}�(h�W``quote_char`` - string of one or more characters defining the quote delimiting string
�h]�h_)��}�(h�V``quote_char`` - string of one or more characters defining the quote delimiting string�h]�(j�)��}�(h�``quote_char``�h]�h�
quote_char�����}�(hhhj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubh�H - string of one or more characters defining the quote delimiting string�����}�(h�H - string of one or more characters defining the quote delimiting string�hj�ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M:hj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubj�)��}�(h�N``esc_char`` - character to escape quotes, typically backslash (default=None)
�h]�h_)��}�(h�M``esc_char`` - character to escape quotes, typically backslash (default=None)�h]�(j�)��}�(h�``esc_char``�h]�h�esc_char�����}�(hhhj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubh�A - character to escape quotes, typically backslash (default=None)�����}�(h�A - character to escape quotes, typically backslash (default=None)�hj�ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M<hj�ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubj�)��}�(h��``esc_quote`` - special quote sequence to escape an embedded quote string (such as SQL's "" to escape an embedded ") (default=None)
�h]�h_)��}�(h��``esc_quote`` - special quote sequence to escape an embedded quote string (such as SQL's "" to escape an embedded ") (default=None)�h]�(j�)��}�(h�
``esc_quote``�h]�h�	esc_quote�����}�(hhhj ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj ubh�~ - special quote sequence to escape an embedded quote string (such as SQL’s “” to escape an embedded “) (default=None)�����}�(h�v - special quote sequence to escape an embedded quote string (such as SQL's "" to escape an embedded ") (default=None)�hj ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M>hj ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubj�)��}�(h�Z``multiline`` - boolean indicating whether quotes can span multiple lines (default=False)
�h]�h_)��}�(h�Y``multiline`` - boolean indicating whether quotes can span multiple lines (default=False)�h]�(j�)��}�(h�
``multiline``�h]�h�	multiline�����}�(hhhj= ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj9 ubh�L - boolean indicating whether quotes can span multiple lines (default=False)�����}�(h�L - boolean indicating whether quotes can span multiple lines (default=False)�hj9 ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M@hj5 ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubj�)��}�(h�d``unquote_results`` - boolean indicating whether the matched text should be unquoted (default=True)
�h]�h_)��}�(h�c``unquote_results`` - boolean indicating whether the matched text should be unquoted (default=True)�h]�(j�)��}�(h�``unquote_results``�h]�h�unquote_results�����}�(hhhjd ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj` ubh�P - boolean indicating whether the matched text should be unquoted (default=True)�����}�(h�P - boolean indicating whether the matched text should be unquoted (default=True)�hj` ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!MBhj\ ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubj�)��}�(h��``end_quote_char`` - string of one or more characters defining the end of the quote delimited string (default=None => same as ``quote_char``)
�h]�h_)��}�(h��``end_quote_char`` - string of one or more characters defining the end of the quote delimited string (default=None => same as ``quote_char``)�h]�(j�)��}�(h�``end_quote_char``�h]�h�end_quote_char�����}�(hhhj� ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj� ubh�l - string of one or more characters defining the end of the quote delimited string (default=None => same as �����}�(h�l - string of one or more characters defining the end of the quote delimited string (default=None => same as �hj� ubj�)��}�(h�``quote_char``�h]�h�
quote_char�����}�(hhhj� ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj� ubh�)�����}�(hj�hj� ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!MDhj� ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�ubeh"}�(h$]�h&]�h)]�h+]�h-]�j�j�uh/j�h h=h!M:hjcubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�hhh Nh!Nubeh"}�(h$]�j�ah&]�h)]��word�ah+]�h-]�j�j�uh/j�h h=h!M�hjjhhjL}�j� j�sjN}�j�j�sj�Kubj�)��}�(h�.. _SkipTo:�h]�h"}�(h$]�h&]�h)]�h+]�h-]�h;�skipto�uh/j�h!MFhjjhhh h=j�Kubj�)��}�(hhh]�j�)��}�(hX�``SkipTo`` - skips ahead in the input string, accepting any
characters up to the specified pattern; may be constructed with
the following optional parameters:

- ``include`` - if set to true, also consumes the match expression
  (default is false)

- ``ignore`` - allows the user to specify patterns to not be matched,
  to prevent false matches

- ``fail_on`` - if a literal string or expression is given for this argument, it defines an expression that
  should cause the SkipTo_ expression to fail, and not skip over that expression

``SkipTo`` can also be written using ``...``::

  LBRACE, RBRACE = map(Literal, "{}")

  brace_expr = LBRACE + SkipTo(RBRACE) + RBRACE
  # can also be written as
  brace_expr = LBRACE + ... + RBRACE
�h]�(h_)��}�(h��``SkipTo`` - skips ahead in the input string, accepting any
characters up to the specified pattern; may be constructed with
the following optional parameters:�h]�(j�)��}�(h�
``SkipTo``�h]�h�SkipTo�����}�(hhhj� ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj� ubh�� - skips ahead in the input string, accepting any
characters up to the specified pattern; may be constructed with
the following optional parameters:�����}�(h�� - skips ahead in the input string, accepting any
characters up to the specified pattern; may be constructed with
the following optional parameters:�hj� ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!MHhj� ubj�)��}�(hhh]�(j�)��}�(h�T``include`` - if set to true, also consumes the match expression
(default is false)
�h]�h_)��}�(h�S``include`` - if set to true, also consumes the match expression
(default is false)�h]�(j�)��}�(h�``include``�h]�h�include�����}�(hhhj!ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj!ubh�H - if set to true, also consumes the match expression
(default is false)�����}�(h�H - if set to true, also consumes the match expression
(default is false)�hj!ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!MLhj!ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj!ubj�)��}�(h�]``ignore`` - allows the user to specify patterns to not be matched,
to prevent false matches
�h]�h_)��}�(h�\``ignore`` - allows the user to specify patterns to not be matched,
to prevent false matches�h]�(j�)��}�(h�
``ignore``�h]�h�ignore�����}�(hhhj2!ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj.!ubh�R - allows the user to specify patterns to not be matched,
to prevent false matches�����}�(h�R - allows the user to specify patterns to not be matched,
to prevent false matches�hj.!ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!MOhj*!ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj!ubj�)��}�(h��``fail_on`` - if a literal string or expression is given for this argument, it defines an expression that
should cause the SkipTo_ expression to fail, and not skip over that expression
�h]�h_)��}�(h��``fail_on`` - if a literal string or expression is given for this argument, it defines an expression that
should cause the SkipTo_ expression to fail, and not skip over that expression�h]�(j�)��}�(h�``fail_on``�h]�h�fail_on�����}�(hhhjY!ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjU!ubh�p - if a literal string or expression is given for this argument, it defines an expression that
should cause the �����}�(h�p - if a literal string or expression is given for this argument, it defines an expression that
should cause the �hjU!ubh�)��}�(h�SkipTo_�h]�h�SkipTo�����}�(hhhjl!ubah"}�(h$]�h&]�h)]�h+]�h-]��name��SkipTo�h;j� uh/h�hjU!j�Kubh�6 expression to fail, and not skip over that expression�����}�(h�6 expression to fail, and not skip over that expression�hjU!ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!MRhjQ!ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj!ubeh"}�(h$]�h&]�h)]�h+]�h-]�j�j�uh/j�h h=h!MLhj� ubh_)��}�(h�.``SkipTo`` can also be written using ``...``::�h]�(j�)��}�(h�
``SkipTo``�h]�h�SkipTo�����}�(hhhj�!ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�!ubh� can also be written using �����}�(h� can also be written using �hj�!ubj�)��}�(h�``...``�h]�h�...�����}�(hhhj�!ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�!ubh�:�����}�(h�:�hj�!ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!MUhj� ubjb)��}�(h��LBRACE, RBRACE = map(Literal, "{}")

brace_expr = LBRACE + SkipTo(RBRACE) + RBRACE
# can also be written as
brace_expr = LBRACE + ... + RBRACE�h]�h��LBRACE, RBRACE = map(Literal, "{}")

brace_expr = LBRACE + SkipTo(RBRACE) + RBRACE
# can also be written as
brace_expr = LBRACE + ... + RBRACE�����}�(hhhj�!ubah"}�(h$]�h&]�h)]�h+]�h-]�jqjruh/jah!MWhj� h h=ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj� hhh h=h!Nubah"}�(h$]�j� ah&]�h)]��skipto�ah+]�h-]�j�j�uh/j�h h=h!MHhjjhhjL}�j�!j� sjN}�j� j� sj�Kubj�)��}�(h�
.. _White:�h]�h"}�(h$]�h&]�h)]�h+]�h-]�h;j�uh/j�h!M]hjjhhh h=j�Kubj�)��}�(hhh]�(j�)��}�(hXu``White`` - also similar to Word_, but matches whitespace
characters.  Not usually needed, as whitespace is implicitly
ignored by pyparsing.  However, some grammars are whitespace-sensitive,
such as those that use leading tabs or spaces to indicating grouping
or hierarchy.  (If matching on tab characters, be sure to call
parse_with_tabs_ on the top-level parse element.)
�h]�h_)��}�(hXt``White`` - also similar to Word_, but matches whitespace
characters.  Not usually needed, as whitespace is implicitly
ignored by pyparsing.  However, some grammars are whitespace-sensitive,
such as those that use leading tabs or spaces to indicating grouping
or hierarchy.  (If matching on tab characters, be sure to call
parse_with_tabs_ on the top-level parse element.)�h]�(j�)��}�(h�	``White``�h]�h�White�����}�(hhhj�!ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�!ubh� - also similar to �����}�(h� - also similar to �hj�!ubh�)��}�(h�Word_�h]�h�Word�����}�(hhhj"ubah"}�(h$]�h&]�h)]�h+]�h-]��name��Word�h;j�uh/h�hj�!j�KubhX", but matches whitespace
characters.  Not usually needed, as whitespace is implicitly
ignored by pyparsing.  However, some grammars are whitespace-sensitive,
such as those that use leading tabs or spaces to indicating grouping
or hierarchy.  (If matching on tab characters, be sure to call
�����}�(hX", but matches whitespace
characters.  Not usually needed, as whitespace is implicitly
ignored by pyparsing.  However, some grammars are whitespace-sensitive,
such as those that use leading tabs or spaces to indicating grouping
or hierarchy.  (If matching on tab characters, be sure to call
�hj�!ubh�)��}�(h�parse_with_tabs_�h]�h�parse_with_tabs�����}�(hhhj"ubah"}�(h$]�h&]�h)]�h+]�h-]��name��parse_with_tabs�h;jZuh/h�hj�!j�Kubh�! on the top-level parse element.)�����}�(h�! on the top-level parse element.)�hj�!ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M_hj�!ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�!hhh h=h!Nubj�)��}�(h�~``Empty`` - a null expression, requiring no characters - will always
match; useful for debugging and for specialized grammars
�h]�h_)��}�(h�}``Empty`` - a null expression, requiring no characters - will always
match; useful for debugging and for specialized grammars�h]�(j�)��}�(h�	``Empty``�h]�h�Empty�����}�(hhhjF"ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjB"ubh�t - a null expression, requiring no characters - will always
match; useful for debugging and for specialized grammars�����}�(h�t - a null expression, requiring no characters - will always
match; useful for debugging and for specialized grammars�hjB"ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!Mfhj>"ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�!hhh h=h!Nubj�)��}�(h�j``NoMatch`` - opposite of ``Empty``, will never match; useful for debugging
and for specialized grammars

�h]�h_)��}�(h�h``NoMatch`` - opposite of ``Empty``, will never match; useful for debugging
and for specialized grammars�h]�(j�)��}�(h�``NoMatch``�h]�h�NoMatch�����}�(hhhjm"ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hji"ubh� - opposite of �����}�(h� - opposite of �hji"ubj�)��}�(h�	``Empty``�h]�h�Empty�����}�(hhhj�"ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hji"ubh�E, will never match; useful for debugging
and for specialized grammars�����}�(h�E, will never match; useful for debugging
and for specialized grammars�hji"ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!Mihje"ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�!hhh h=h!Nubeh"}�(h$]�j�ah&]�h)]��white�ah+]�h-]�j�j�uh/j�h h=h!M_hjjhhjL}�j�"j�!sjN}�j�j�!sj�Kubeh"}�(h$]�j�ah&]�h)]��basic parserelement subclasses�ah+]�h-]�uh/h	hj&hhh h=h!M�ubh
)��}�(hhh]�(h)��}�(hj h]�(h)��}�(hhh]�h�1.2.3   �����}�(hhhj�"hhh Nh!Nubah"}�(h$]�h&]�h(ah)]�h+]�h-]�uh/hhj�"hhh Nh!Nubh�Expression subclasses�����}�(hj hj�"hhh Nh!Nubeh"}�(h$]�h&]�h)]�h+]�h-]�h:Kh;j#uh/hhj�"hhh h=h!Mnubj�)��}�(h�.. _And:�h]�h"}�(h$]�h&]�h)]�h+]�h-]�h;j�uh/j�h!Mphj�"hhh h=j�Kubj�)��}�(hhh]�j�)��}�(hX�``And`` - construct with a list of ``ParserElements``, all of which must
match for ``And`` to match; can also be created using the '+'
operator; multiple expressions can be ``Anded`` together using the '*'
operator as in::

  ip_address = Word(nums) + ('.' + Word(nums)) * 3

A tuple can be used as the multiplier, indicating a min/max::

  us_phone_number = Word(nums) + ('-' + Word(nums)) * (1,2)

A special form of ``And`` is created if the '-' operator is used
instead of the '+' operator.  In the ``ip_address`` example above, if
no trailing '.' and ``Word(nums)`` are found after matching the initial
``Word(nums)``, then pyparsing will back up in the grammar and try other
alternatives to ``ip_address``.  However, if ``ip_address`` is defined as::

  strict_ip_address = Word(nums) - ('.'+Word(nums))*3

then no backing up is done.  If the first ``Word(nums)`` of ``strict_ip_address``
is matched, then any mismatch after that will raise a ``ParseSyntaxException``,
which will halt the parsing process immediately.  By careful use of the
'-' operator, grammars can provide meaningful error messages close to
the location where the incoming text does not match the specified
grammar.
�h]�(h_)��}�(h��``And`` - construct with a list of ``ParserElements``, all of which must
match for ``And`` to match; can also be created using the '+'
operator; multiple expressions can be ``Anded`` together using the '*'
operator as in::�h]�(j�)��}�(h�``And``�h]�h�And�����}�(hhhj�"ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�"ubh� - construct with a list of �����}�(h� - construct with a list of �hj�"ubj�)��}�(h�``ParserElements``�h]�h�ParserElements�����}�(hhhj�"ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�"ubh�, all of which must
match for �����}�(h�, all of which must
match for �hj�"ubj�)��}�(h�``And``�h]�h�And�����}�(hhhj#ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�"ubh�W to match; can also be created using the ‘+’
operator; multiple expressions can be �����}�(h�S to match; can also be created using the '+'
operator; multiple expressions can be �hj�"ubj�)��}�(h�	``Anded``�h]�h�Anded�����}�(hhhj#ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�"ubh�+ together using the ‘*’
operator as in:�����}�(h�' together using the '*'
operator as in:�hj�"ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!Mrhj�"ubjb)��}�(h�0ip_address = Word(nums) + ('.' + Word(nums)) * 3�h]�h�0ip_address = Word(nums) + ('.' + Word(nums)) * 3�����}�(hhhj3#ubah"}�(h$]�h&]�h)]�h+]�h-]�jqjruh/jah!Mwhj�"h h=ubh_)��}�(h�=A tuple can be used as the multiplier, indicating a min/max::�h]�h�<A tuple can be used as the multiplier, indicating a min/max:�����}�(h�<A tuple can be used as the multiplier, indicating a min/max:�hjA#ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!Myhj�"ubjb)��}�(h�9us_phone_number = Word(nums) + ('-' + Word(nums)) * (1,2)�h]�h�9us_phone_number = Word(nums) + ('-' + Word(nums)) * (1,2)�����}�(hhhjP#ubah"}�(h$]�h&]�h)]�h+]�h-]�jqjruh/jah!M{hj�"h h=ubh_)��}�(hXcA special form of ``And`` is created if the '-' operator is used
instead of the '+' operator.  In the ``ip_address`` example above, if
no trailing '.' and ``Word(nums)`` are found after matching the initial
``Word(nums)``, then pyparsing will back up in the grammar and try other
alternatives to ``ip_address``.  However, if ``ip_address`` is defined as::�h]�(h�A special form of �����}�(h�A special form of �hj^#ubj�)��}�(h�``And``�h]�h�And�����}�(hhhjg#ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj^#ubh�U is created if the ‘-‘ operator is used
instead of the ‘+’ operator.  In the �����}�(h�M is created if the '-' operator is used
instead of the '+' operator.  In the �hj^#ubj�)��}�(h�``ip_address``�h]�h�
ip_address�����}�(hhhjz#ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj^#ubh�+ example above, if
no trailing ‘.’ and �����}�(h�' example above, if
no trailing '.' and �hj^#ubj�)��}�(h�``Word(nums)``�h]�h�
Word(nums)�����}�(hhhj�#ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj^#ubh�& are found after matching the initial
�����}�(h�& are found after matching the initial
�hj^#ubj�)��}�(h�``Word(nums)``�h]�h�
Word(nums)�����}�(hhhj�#ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj^#ubh�K, then pyparsing will back up in the grammar and try other
alternatives to �����}�(h�K, then pyparsing will back up in the grammar and try other
alternatives to �hj^#ubj�)��}�(h�``ip_address``�h]�h�
ip_address�����}�(hhhj�#ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj^#ubh�.  However, if �����}�(h�.  However, if �hj^#ubj�)��}�(h�``ip_address``�h]�h�
ip_address�����}�(hhhj�#ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj^#ubh� is defined as:�����}�(h� is defined as:�hj^#ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M}hj�"ubjb)��}�(h�3strict_ip_address = Word(nums) - ('.'+Word(nums))*3�h]�h�3strict_ip_address = Word(nums) - ('.'+Word(nums))*3�����}�(hhhj�#ubah"}�(h$]�h&]�h)]�h+]�h-]�jqjruh/jah!M�hj�"h h=ubh_)��}�(hXzthen no backing up is done.  If the first ``Word(nums)`` of ``strict_ip_address``
is matched, then any mismatch after that will raise a ``ParseSyntaxException``,
which will halt the parsing process immediately.  By careful use of the
'-' operator, grammars can provide meaningful error messages close to
the location where the incoming text does not match the specified
grammar.�h]�(h�*then no backing up is done.  If the first �����}�(h�*then no backing up is done.  If the first �hj�#ubj�)��}�(h�``Word(nums)``�h]�h�
Word(nums)�����}�(hhhj�#ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�#ubh� of �����}�(h� of �hj�#ubj�)��}�(h�``strict_ip_address``�h]�h�strict_ip_address�����}�(hhhj	$ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�#ubh�7
is matched, then any mismatch after that will raise a �����}�(h�7
is matched, then any mismatch after that will raise a �hj�#ubj�)��}�(h�``ParseSyntaxException``�h]�h�ParseSyntaxException�����}�(hhhj$ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�#ubh��,
which will halt the parsing process immediately.  By careful use of the
‘-‘ operator, grammars can provide meaningful error messages close to
the location where the incoming text does not match the specified
grammar.�����}�(h��,
which will halt the parsing process immediately.  By careful use of the
'-' operator, grammars can provide meaningful error messages close to
the location where the incoming text does not match the specified
grammar.�hj�#ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M�hj�"ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�"hhh h=h!Nubah"}�(h$]�j�ah&]�h)]��and�ah+]�h-]�j�j�uh/j�h h=h!Mrhj�"hhjL}�j?$j�"sjN}�j�j�"sj�Kubj�)��}�(h�.. _Or:�h]�h"}�(h$]�h&]�h)]�h+]�h-]�h;j�
uh/j�h!M�hj�"hhh h=j�Kubj�)��}�(hhh]�j�)��}�(h��``Or`` - construct with a list of ``ParserElements``, any of which must
match for ``Or`` to match; if more than one expression matches, the
expression that makes the longest match will be used; can also
be created using the '^' operator
�h]�h_)��}�(h��``Or`` - construct with a list of ``ParserElements``, any of which must
match for ``Or`` to match; if more than one expression matches, the
expression that makes the longest match will be used; can also
be created using the '^' operator�h]�(j�)��}�(h�``Or``�h]�h�Or�����}�(hhhjY$ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjU$ubh� - construct with a list of �����}�(h� - construct with a list of �hjU$ubj�)��}�(h�``ParserElements``�h]�h�ParserElements�����}�(hhhjl$ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjU$ubh�, any of which must
match for �����}�(h�, any of which must
match for �hjU$ubj�)��}�(h�``Or``�h]�h�Or�����}�(hhhj$ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjU$ubh�� to match; if more than one expression matches, the
expression that makes the longest match will be used; can also
be created using the ‘^’ operator�����}�(h�� to match; if more than one expression matches, the
expression that makes the longest match will be used; can also
be created using the '^' operator�hjU$ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M�hjQ$ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjN$hhh h=h!Nubah"}�(h$]�j�
ah&]�h)]��or�ah+]�h-]�j�j�uh/j�h h=h!M�hj�"hhjL}�j�$jD$sjN}�j�
jD$sj�Kubj�)��}�(h�.. _MatchFirst:�h]�h"}�(h$]�h&]�h)]�h+]�h-]�h;j�
uh/j�h!M�hj�"hhh h=j�Kubj�)��}�(hhh]�j�)��}�(h��``MatchFirst`` - construct with a list of ``ParserElements``, any of
which must match for ``MatchFirst`` to match; matching is done
left-to-right, taking the first expression that matches; can
also be created using the '|' operator
�h]�h_)��}�(h��``MatchFirst`` - construct with a list of ``ParserElements``, any of
which must match for ``MatchFirst`` to match; matching is done
left-to-right, taking the first expression that matches; can
also be created using the '|' operator�h]�(j�)��}�(h�``MatchFirst``�h]�h�
MatchFirst�����}�(hhhj�$ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�$ubh� - construct with a list of �����}�(h� - construct with a list of �hj�$ubj�)��}�(h�``ParserElements``�h]�h�ParserElements�����}�(hhhj�$ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�$ubh�, any of
which must match for �����}�(h�, any of
which must match for �hj�$ubj�)��}�(h�``MatchFirst``�h]�h�
MatchFirst�����}�(hhhj�$ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�$ubh�� to match; matching is done
left-to-right, taking the first expression that matches; can
also be created using the ‘|’ operator�����}�(h� to match; matching is done
left-to-right, taking the first expression that matches; can
also be created using the '|' operator�hj�$ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M�hj�$ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�$hhh h=h!Nubah"}�(h$]�j�
ah&]�h)]��
matchfirst�ah+]�h-]�j�j�uh/j�h h=h!M�hj�"hhjL}�j%j�$sjN}�j�
j�$sj�Kubj�)��}�(h�	.. _Each:�h]�h"}�(h$]�h&]�h)]�h+]�h-]�h;�each�uh/j�h!M�hj�"hhh h=j�Kubj�)��}�(hhh]�(j�)��}�(h��``Each`` - similar to And_, in that all of the provided expressions
must match; however, ``Each`` permits matching to be done in any order;
can also be created using the '&' operator
�h]�h_)��}�(h��``Each`` - similar to And_, in that all of the provided expressions
must match; however, ``Each`` permits matching to be done in any order;
can also be created using the '&' operator�h]�(j�)��}�(h�``Each``�h]�h�Each�����}�(hhhj %ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj%ubh� - similar to �����}�(h� - similar to �hj%ubh�)��}�(h�And_�h]�h�And�����}�(hhhj3%ubah"}�(h$]�h&]�h)]�h+]�h-]��name��And�h;j�uh/h�hj%j�Kubh�?, in that all of the provided expressions
must match; however, �����}�(h�?, in that all of the provided expressions
must match; however, �hj%ubj�)��}�(h�``Each``�h]�h�Each�����}�(hhhjH%ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj%ubh�Y permits matching to be done in any order;
can also be created using the ‘&’ operator�����}�(h�U permits matching to be done in any order;
can also be created using the '&' operator�hj%ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M�hj%ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj%hhh h=h!Nubj�)��}�(hXk``Opt`` - construct with a ``ParserElement``, but this element is
not required to match; can be constructed with an optional ``default`` argument,
containing a default string or object to be supplied if the given optional
parse element is not found in the input string; parse action will only
be called if a match is found, or if a default is specified.

(``Opt`` was formerly named ``Optional``, but since the standard Python
library module ``typing`` now defines ``Optional``, the pyparsing class has
been renamed to ``Opt``. A compatibility synonym ``Optional`` is defined,
but will be removed in a future release.)
�h]�(h_)��}�(hXa``Opt`` - construct with a ``ParserElement``, but this element is
not required to match; can be constructed with an optional ``default`` argument,
containing a default string or object to be supplied if the given optional
parse element is not found in the input string; parse action will only
be called if a match is found, or if a default is specified.�h]�(j�)��}�(h�``Opt``�h]�h�Opt�����}�(hhhjo%ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjk%ubh� - construct with a �����}�(h� - construct with a �hjk%ubj�)��}�(h�``ParserElement``�h]�h�
ParserElement�����}�(hhhj�%ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjk%ubh�Q, but this element is
not required to match; can be constructed with an optional �����}�(h�Q, but this element is
not required to match; can be constructed with an optional �hjk%ubj�)��}�(h�``default``�h]�h�default�����}�(hhhj�%ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjk%ubh�� argument,
containing a default string or object to be supplied if the given optional
parse element is not found in the input string; parse action will only
be called if a match is found, or if a default is specified.�����}�(h�� argument,
containing a default string or object to be supplied if the given optional
parse element is not found in the input string; parse action will only
be called if a match is found, or if a default is specified.�hjk%ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M�hjg%ubh_)��}�(hX(``Opt`` was formerly named ``Optional``, but since the standard Python
library module ``typing`` now defines ``Optional``, the pyparsing class has
been renamed to ``Opt``. A compatibility synonym ``Optional`` is defined,
but will be removed in a future release.)�h]�(h�(�����}�(h�(�hj�%ubj�)��}�(h�``Opt``�h]�h�Opt�����}�(hhhj�%ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�%ubh� was formerly named �����}�(h� was formerly named �hj�%ubj�)��}�(h�``Optional``�h]�h�Optional�����}�(hhhj�%ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�%ubh�/, but since the standard Python
library module �����}�(h�/, but since the standard Python
library module �hj�%ubj�)��}�(h�
``typing``�h]�h�typing�����}�(hhhj�%ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�%ubh�
 now defines �����}�(h�
 now defines �hj�%ubj�)��}�(h�``Optional``�h]�h�Optional�����}�(hhhj�%ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�%ubh�*, the pyparsing class has
been renamed to �����}�(h�*, the pyparsing class has
been renamed to �hj�%ubj�)��}�(h�``Opt``�h]�h�Opt�����}�(hhhj&ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�%ubh�. A compatibility synonym �����}�(h�. A compatibility synonym �hj�%ubj�)��}�(h�``Optional``�h]�h�Optional�����}�(hhhj&ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�%ubh�6 is defined,
but will be removed in a future release.)�����}�(h�6 is defined,
but will be removed in a future release.)�hj�%ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M�hjg%ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj%hhh h=h!Nubj�)��}�(h�u``ZeroOrMore`` - similar to ``Opt``, but can be repeated; ``ZeroOrMore(expr)``
can also be written as ``expr[...]``.
�h]�h_)��}�(h�t``ZeroOrMore`` - similar to ``Opt``, but can be repeated; ``ZeroOrMore(expr)``
can also be written as ``expr[...]``.�h]�(j�)��}�(h�``ZeroOrMore``�h]�h�
ZeroOrMore�����}�(hhhj=&ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj9&ubh� - similar to �����}�(h� - similar to �hj9&ubj�)��}�(h�``Opt``�h]�h�Opt�����}�(hhhjP&ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj9&ubh�, but can be repeated; �����}�(h�, but can be repeated; �hj9&ubj�)��}�(h�``ZeroOrMore(expr)``�h]�h�ZeroOrMore(expr)�����}�(hhhjc&ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj9&ubh�
can also be written as �����}�(h�
can also be written as �hj9&ubj�)��}�(h�
``expr[...]``�h]�h�	expr[...]�����}�(hhhjv&ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj9&ubh�.�����}�(hjhj9&ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M�hj5&ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj%hhh h=h!Nubj�)��}�(h��``OneOrMore`` - similar to ``ZeroOrMore``, but at least one match must
be present; ``OneOrMore(expr)`` can also be written as ``expr[1, ...]``.
�h]�h_)��}�(h��``OneOrMore`` - similar to ``ZeroOrMore``, but at least one match must
be present; ``OneOrMore(expr)`` can also be written as ``expr[1, ...]``.�h]�(j�)��}�(h�
``OneOrMore``�h]�h�	OneOrMore�����}�(hhhj�&ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�&ubh� - similar to �����}�(h� - similar to �hj�&ubj�)��}�(h�``ZeroOrMore``�h]�h�
ZeroOrMore�����}�(hhhj�&ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�&ubh�*, but at least one match must
be present; �����}�(h�*, but at least one match must
be present; �hj�&ubj�)��}�(h�``OneOrMore(expr)``�h]�h�OneOrMore(expr)�����}�(hhhj�&ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�&ubh� can also be written as �����}�(h� can also be written as �hj�&ubj�)��}�(h�``expr[1, ...]``�h]�h�expr[1, ...]�����}�(hhhj�&ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�&ubh�.�����}�(hjhj�&ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M�hj�&ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj%hhh h=h!Nubj�)��}�(h��``FollowedBy`` - a lookahead expression, requires matching of the given
expressions, but does not advance the parsing position within the input string
�h]�h_)��}�(h��``FollowedBy`` - a lookahead expression, requires matching of the given
expressions, but does not advance the parsing position within the input string�h]�(j�)��}�(h�``FollowedBy``�h]�h�
FollowedBy�����}�(hhhj�&ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�&ubh�� - a lookahead expression, requires matching of the given
expressions, but does not advance the parsing position within the input string�����}�(h�� - a lookahead expression, requires matching of the given
expressions, but does not advance the parsing position within the input string�hj�&ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M�hj�&ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj%hhh h=h!Nubeh"}�(h$]�j%ah&]�h)]��each�ah+]�h-]�j�j�uh/j�h h=h!M�hj�"hhjL}�j'j
%sjN}�j%j
%sj�Kubj�)��}�(h�.. _NotAny:�h]�h"}�(h$]�h&]�h)]�h+]�h-]�h;�notany�uh/j�h!M�hj�"hhh h=j�Kubj�)��}�(hhh]�j�)��}�(h��``NotAny`` - a negative lookahead expression, prevents matching of named
expressions, does not advance the parsing position within the input string;
can also be created using the unary '~' operator

�h]�h_)��}�(h��``NotAny`` - a negative lookahead expression, prevents matching of named
expressions, does not advance the parsing position within the input string;
can also be created using the unary '~' operator�h]�(j�)��}�(h�
``NotAny``�h]�h�NotAny�����}�(hhhj9'ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj5'ubh�� - a negative lookahead expression, prevents matching of named
expressions, does not advance the parsing position within the input string;
can also be created using the unary ‘~’ operator�����}�(h�� - a negative lookahead expression, prevents matching of named
expressions, does not advance the parsing position within the input string;
can also be created using the unary '~' operator�hj5'ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M�hj1'ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj.'hhh h=h!Nubah"}�(h$]�j-'ah&]�h)]��notany�ah+]�h-]�j�j�uh/j�h h=h!M�hj�"hhjL}�j\'j#'sjN}�j-'j#'sj�Kubj�)��}�(h�.. _operators:�h]�h"}�(h$]�h&]�h)]�h+]�h-]�h;j�uh/j�h!M�hj�"hhh h=j�Kubeh"}�(h$]�j)ah&]�h)]��expression subclasses�ah+]�h-]�uh/h	hj&hhh h=h!Mnubh
)��}�(hhh]�(h)��}�(hjPh]�(h)��}�(hhh]�h�1.2.4   �����}�(hhhjx'hhh Nh!Nubah"}�(h$]�h&]�h(ah)]�h+]�h-]�uh/hhju'hhh Nh!Nubh�Expression operators�����}�(hjPhju'hhh Nh!Nubeh"}�(h$]�h&]�h)]�h+]�h-]�h:Kh;jSuh/hhjr'hhh h=h!M�ubj�)��}�(hhh]�(j�)��}�(h�I``+`` - creates And_ using the expressions before and after the operator
�h]�h_)��}�(h�H``+`` - creates And_ using the expressions before and after the operator�h]�(j�)��}�(h�``+``�h]�h�+�����}�(hhhj�'ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�'ubh� - creates �����}�(h� - creates �hj�'ubh�)��}�(h�And_�h]�h�And�����}�(hhhj�'ubah"}�(h$]�h&]�h)]�h+]�h-]��name��And�h;j�uh/h�hj�'j�Kubh�4 using the expressions before and after the operator�����}�(h�4 using the expressions before and after the operator�hj�'ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M�hj�'ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�'hhh h=h!Nubj�)��}�(h�l``|`` - creates MatchFirst_ (first left-to-right match) using the expressions before and after the operator
�h]�h_)��}�(h�k``|`` - creates MatchFirst_ (first left-to-right match) using the expressions before and after the operator�h]�(j�)��}�(h�``|``�h]�h�|�����}�(hhhj�'ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�'ubh� - creates �����}�(h� - creates �hj�'ubh�)��}�(h�MatchFirst_�h]�h�
MatchFirst�����}�(hhhj�'ubah"}�(h$]�h&]�h)]�h+]�h-]��name��
MatchFirst�h;j�
uh/h�hj�'j�Kubh�P (first left-to-right match) using the expressions before and after the operator�����}�(h�P (first left-to-right match) using the expressions before and after the operator�hj�'ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M�hj�'ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�'hhh h=h!Nubj�)��}�(h�X``^`` - creates Or_ (longest match) using the expressions before and after the operator
�h]�h_)��}�(h�W``^`` - creates Or_ (longest match) using the expressions before and after the operator�h]�(j�)��}�(h�``^``�h]�h�^�����}�(hhhj(ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj(ubh� - creates �����}�(h� - creates �hj(ubh�)��}�(h�Or_�h]�h�Or�����}�(hhhj%(ubah"}�(h$]�h&]�h)]�h+]�h-]��name��Or�h;j�
uh/h�hj(j�Kubh�D (longest match) using the expressions before and after the operator�����}�(h�D (longest match) using the expressions before and after the operator�hj(ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M�hj
(ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�'hhh h=h!Nubj�)��}�(h�J``&`` - creates Each_ using the expressions before and after the operator
�h]�h_)��}�(h�I``&`` - creates Each_ using the expressions before and after the operator�h]�(j�)��}�(h�``&``�h]�h�&�����}�(hhhjN(ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjJ(ubh� - creates �����}�(h� - creates �hjJ(ubh�)��}�(h�Each_�h]�h�Each�����}�(hhhja(ubah"}�(h$]�h&]�h)]�h+]�h-]��name��Each�h;j%uh/h�hjJ(j�Kubh�4 using the expressions before and after the operator�����}�(h�4 using the expressions before and after the operator�hjJ(ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M�hjF(ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�'hhh h=h!Nubj�)��}�(hXQ``*`` - creates And_ by multiplying the expression by the integer operand; if
expression is multiplied by a 2-tuple, creates an And_ of ``(min,max)``
expressions (similar to ``{min,max}`` form in regular expressions); if
``min`` is ``None``, interpret as ``(0,max)``; if ``max`` is ``None``, interpret as
``expr*min + ZeroOrMore(expr)``
�h]�h_)��}�(hXP``*`` - creates And_ by multiplying the expression by the integer operand; if
expression is multiplied by a 2-tuple, creates an And_ of ``(min,max)``
expressions (similar to ``{min,max}`` form in regular expressions); if
``min`` is ``None``, interpret as ``(0,max)``; if ``max`` is ``None``, interpret as
``expr*min + ZeroOrMore(expr)``�h]�(j�)��}�(h�``*``�h]�h�*�����}�(hhhj�(ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�(ubh� - creates �����}�(h� - creates �hj�(ubh�)��}�(h�And_�h]�h�And�����}�(hhhj�(ubah"}�(h$]�h&]�h)]�h+]�h-]��name��And�h;j�uh/h�hj�(j�Kubh�l by multiplying the expression by the integer operand; if
expression is multiplied by a 2-tuple, creates an �����}�(h�l by multiplying the expression by the integer operand; if
expression is multiplied by a 2-tuple, creates an �hj�(ubh�)��}�(h�And_�h]�h�And�����}�(hhhj�(ubah"}�(h$]�h&]�h)]�h+]�h-]��name��And�h;j�uh/h�hj�(j�Kubh� of �����}�(h� of �hj�(ubj�)��}�(h�
``(min,max)``�h]�h�	(min,max)�����}�(hhhj�(ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�(ubh�
expressions (similar to �����}�(h�
expressions (similar to �hj�(ubj�)��}�(h�
``{min,max}``�h]�h�	{min,max}�����}�(hhhj�(ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�(ubh�" form in regular expressions); if
�����}�(h�" form in regular expressions); if
�hj�(ubj�)��}�(h�``min``�h]�h�min�����}�(hhhj�(ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�(ubh� is �����}�(h� is �hj�(ubj�)��}�(h�``None``�h]�h�None�����}�(hhhj)ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�(ubh�, interpret as �����}�(h�, interpret as �hj�(ubj�)��}�(h�``(0,max)``�h]�h�(0,max)�����}�(hhhj)ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�(ubh�; if �����}�(h�; if �hj�(ubj�)��}�(h�``max``�h]�h�max�����}�(hhhj&)ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�(ubh� is �����}�(hj�(hj�(ubj�)��}�(h�``None``�h]�h�None�����}�(hhhj8)ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�(ubh�, interpret as
�����}�(h�, interpret as
�hj�(ubj�)��}�(h�``expr*min + ZeroOrMore(expr)``�h]�h�expr*min + ZeroOrMore(expr)�����}�(hhhjK)ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�(ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M�hj�(ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�'hhh h=h!Nubj�)��}�(h�@``-`` - like ``+`` but with no backup and retry of alternatives
�h]�h_)��}�(h�?``-`` - like ``+`` but with no backup and retry of alternatives�h]�(j�)��}�(h�``-``�h]�h�-�����}�(hhhjm)ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hji)ubh� - like �����}�(h� - like �hji)ubj�)��}�(h�``+``�h]�h�+�����}�(hhhj�)ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hji)ubh�- but with no backup and retry of alternatives�����}�(h�- but with no backup and retry of alternatives�hji)ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M�hje)ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�'hhh h=h!Nubj�)��}�(h�@``~`` - creates NotAny_ using the expression after the operator
�h]�h_)��}�(h�?``~`` - creates NotAny_ using the expression after the operator�h]�(j�)��}�(h�``~``�h]�h�~�����}�(hhhj�)ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�)ubh� - creates �����}�(h� - creates �hj�)ubh�)��}�(h�NotAny_�h]�h�NotAny�����}�(hhhj�)ubah"}�(h$]�h&]�h)]�h+]�h-]��name��NotAny�h;j-'uh/h�hj�)j�Kubh�( using the expression after the operator�����}�(h�( using the expression after the operator�hj�)ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M�hj�)ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�'hhh h=h!Nubj�)��}�(h�d``==`` - matching expression to string; returns ``True`` if the string matches the given expression
�h]�h_)��}�(h�c``==`` - matching expression to string; returns ``True`` if the string matches the given expression�h]�(j�)��}�(h�``==``�h]�h�==�����}�(hhhj�)ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�)ubh�* - matching expression to string; returns �����}�(h�* - matching expression to string; returns �hj�)ubj�)��}�(h�``True``�h]�h�True�����}�(hhhj�)ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�)ubh�+ if the string matches the given expression�����}�(h�+ if the string matches the given expression�hj�)ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M�hj�)ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�'hhh h=h!Nubj�)��}�(h��``<<=`` - inserts the expression following the operator as the body of the
``Forward`` expression before the operator (``<<`` can also be used, but ``<<=`` is preferred
to avoid operator precedence misinterpretation of the pyparsing expression)
�h]�h_)��}�(h��``<<=`` - inserts the expression following the operator as the body of the
``Forward`` expression before the operator (``<<`` can also be used, but ``<<=`` is preferred
to avoid operator precedence misinterpretation of the pyparsing expression)�h]�(j�)��}�(h�``<<=``�h]�h�<<=�����}�(hhhj*ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj*ubh�D - inserts the expression following the operator as the body of the
�����}�(h�D - inserts the expression following the operator as the body of the
�hj*ubj�)��}�(h�``Forward``�h]�h�Forward�����}�(hhhj0*ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj*ubh�! expression before the operator (�����}�(h�! expression before the operator (�hj*ubj�)��}�(h�``<<``�h]�h�<<�����}�(hhhjC*ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj*ubh� can also be used, but �����}�(h� can also be used, but �hj*ubj�)��}�(h�``<<=``�h]�h�<<=�����}�(hhhjV*ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj*ubh�Y is preferred
to avoid operator precedence misinterpretation of the pyparsing expression)�����}�(h�Y is preferred
to avoid operator precedence misinterpretation of the pyparsing expression)�hj*ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M�hj*ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�'hhh h=h!Nubj�)��}�(h�z``...`` - inserts a SkipTo_ expression leading to the next expression, as in
``Keyword("start") + ... + Keyword("end")``.
�h]�h_)��}�(h�y``...`` - inserts a SkipTo_ expression leading to the next expression, as in
``Keyword("start") + ... + Keyword("end")``.�h]�(j�)��}�(h�``...``�h]�h�...�����}�(hhhj}*ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjy*ubh�
 - inserts a �����}�(h�
 - inserts a �hjy*ubh�)��}�(h�SkipTo_�h]�h�SkipTo�����}�(hhhj�*ubah"}�(h$]�h&]�h)]�h+]�h-]��name��SkipTo�h;j� uh/h�hjy*j�Kubh�2 expression leading to the next expression, as in
�����}�(h�2 expression leading to the next expression, as in
�hjy*ubj�)��}�(h�+``Keyword("start") + ... + Keyword("end")``�h]�h�'Keyword("start") + ... + Keyword("end")�����}�(hhhj�*ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjy*ubh�.�����}�(hjhjy*ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M�hju*ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�'hhh h=h!Nubj�)��}�(hXv``[min, max]`` - specifies repetition similar to ``*`` with ``min`` and ``max`` specified
as the minimum and maximum number of repetitions. ``...`` can be used in place of ``None``.
For example ``expr[...]`` is equivalent to ``ZeroOrMore(expr)``, ``expr[1, ...]`` is
equivalent to ``OneOrMore(expr)``, and ``expr[..., 3]`` is equivalent to "up to 3 instances
of ``expr``".

�h]�h_)��}�(hXt``[min, max]`` - specifies repetition similar to ``*`` with ``min`` and ``max`` specified
as the minimum and maximum number of repetitions. ``...`` can be used in place of ``None``.
For example ``expr[...]`` is equivalent to ``ZeroOrMore(expr)``, ``expr[1, ...]`` is
equivalent to ``OneOrMore(expr)``, and ``expr[..., 3]`` is equivalent to "up to 3 instances
of ``expr``".�h]�(j�)��}�(h�``[min, max]``�h]�h�
[min, max]�����}�(hhhj�*ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�*ubh�# - specifies repetition similar to �����}�(h�# - specifies repetition similar to �hj�*ubj�)��}�(h�``*``�h]�h�*�����}�(hhhj�*ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�*ubh� with �����}�(h� with �hj�*ubj�)��}�(h�``min``�h]�h�min�����}�(hhhj�*ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�*ubh� and �����}�(h� and �hj�*ubj�)��}�(h�``max``�h]�h�max�����}�(hhhj+ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�*ubh�= specified
as the minimum and maximum number of repetitions. �����}�(h�= specified
as the minimum and maximum number of repetitions. �hj�*ubj�)��}�(h�``...``�h]�h�...�����}�(hhhj+ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�*ubh� can be used in place of �����}�(h� can be used in place of �hj�*ubj�)��}�(h�``None``�h]�h�None�����}�(hhhj*+ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�*ubh�.
For example �����}�(h�.
For example �hj�*ubj�)��}�(h�
``expr[...]``�h]�h�	expr[...]�����}�(hhhj=+ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�*ubh� is equivalent to �����}�(h� is equivalent to �hj�*ubj�)��}�(h�``ZeroOrMore(expr)``�h]�h�ZeroOrMore(expr)�����}�(hhhjP+ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�*ubh�, �����}�(h�, �hj�*ubj�)��}�(h�``expr[1, ...]``�h]�h�expr[1, ...]�����}�(hhhjc+ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�*ubh� is
equivalent to �����}�(h� is
equivalent to �hj�*ubj�)��}�(h�``OneOrMore(expr)``�h]�h�OneOrMore(expr)�����}�(hhhjv+ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�*ubh�, and �����}�(h�, and �hj�*ubj�)��}�(h�``expr[..., 3]``�h]�h�expr[..., 3]�����}�(hhhj�+ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�*ubh�* is equivalent to “up to 3 instances
of �����}�(h�( is equivalent to "up to 3 instances
of �hj�*ubj�)��}�(h�``expr``�h]�h�expr�����}�(hhhj�+ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�*ubh�”.�����}�(h�".�hj�*ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M�hj�*ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�'hhh h=h!Nubeh"}�(h$]�h&]�h)]�h+]�h-]�j�j�uh/j�h h=h!M�hjr'hhubeh"}�(h$]�(jYj�eh&]�h)]�(�expression operators��	operators�eh+]�h-]�uh/h	hj&hhh h=h!M�jL}�j�+ja'sjN}�j�ja'sj�Kubh
)��}�(hhh]�(h)��}�(hj�h]�(h)��}�(hhh]�h�1.2.5   �����}�(hhhj�+hhh Nh!Nubah"}�(h$]�h&]�h(ah)]�h+]�h-]�uh/hhj�+hhh Nh!Nubh�Positional subclasses�����}�(hj�hj�+hhh Nh!Nubeh"}�(h$]�h&]�h)]�h+]�h-]�h:Kh;j�uh/hhj�+hhh h=h!M�ubj�)��}�(hhh]�(j�)��}�(h�0``StringStart`` - matches beginning of the text
�h]�h_)��}�(h�/``StringStart`` - matches beginning of the text�h]�(j�)��}�(h�``StringStart``�h]�h�StringStart�����}�(hhhj�+ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�+ubh�  - matches beginning of the text�����}�(h�  - matches beginning of the text�hj�+ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M�hj�+ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�+hhh h=h!Nubj�)��}�(h�,``StringEnd`` - matches the end of the text
�h]�h_)��}�(h�+``StringEnd`` - matches the end of the text�h]�(j�)��}�(h�
``StringEnd``�h]�h�	StringEnd�����}�(hhhj,ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj,ubh� - matches the end of the text�����}�(h� - matches the end of the text�hj,ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M�hj,ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�+hhh h=h!Nubj�)��}�(h�S``LineStart`` - matches beginning of a line (lines delimited by ``\n`` characters)
�h]�h_)��}�(h�R``LineStart`` - matches beginning of a line (lines delimited by ``\n`` characters)�h]�(j�)��}�(h�
``LineStart``�h]�h�	LineStart�����}�(hhhjA,ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj=,ubh�3 - matches beginning of a line (lines delimited by �����}�(h�3 - matches beginning of a line (lines delimited by �hj=,ubj�)��}�(h�``\n``�h]�h�\n�����}�(hhhjT,ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj=,ubh� characters)�����}�(h� characters)�hj=,ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M�hj9,ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�+hhh h=h!Nubj�)��}�(h�(``LineEnd`` - matches the end of a line
�h]�h_)��}�(h�'``LineEnd`` - matches the end of a line�h]�(j�)��}�(h�``LineEnd``�h]�h�LineEnd�����}�(hhhj{,ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjw,ubh� - matches the end of a line�����}�(h� - matches the end of a line�hjw,ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M�hjs,ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�+hhh h=h!Nubj�)��}�(h�0``WordStart`` - matches a leading word boundary
�h]�h_)��}�(h�/``WordStart`` - matches a leading word boundary�h]�(j�)��}�(h�
``WordStart``�h]�h�	WordStart�����}�(hhhj�,ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�,ubh�" - matches a leading word boundary�����}�(h�" - matches a leading word boundary�hj�,ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M�hj�,ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�+hhh h=h!Nubj�)��}�(h�1``WordEnd`` - matches a trailing word boundary


�h]�h_)��}�(h�.``WordEnd`` - matches a trailing word boundary�h]�(j�)��}�(h�``WordEnd``�h]�h�WordEnd�����}�(hhhj�,ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�,ubh�# - matches a trailing word boundary�����}�(h�# - matches a trailing word boundary�hj�,ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M�hj�,ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�+hhh h=h!Nubeh"}�(h$]�h&]�h)]�h+]�h-]�j�j�uh/j�h h=h!M�hj�+hhubeh"}�(h$]�j�ah&]�h)]��positional subclasses�ah+]�h-]�uh/h	hj&hhh h=h!M�ubh
)��}�(hhh]�(h)��}�(hj�h]�(h)��}�(hhh]�h�1.2.6   �����}�(hhhj�,hhh Nh!Nubah"}�(h$]�h&]�h(ah)]�h+]�h-]�uh/hhj�,hhh Nh!Nubh�Converter subclasses�����}�(hj�hj�,hhh Nh!Nubeh"}�(h$]�h&]�h)]�h+]�h-]�h:Kh;j�uh/hhj�,hhh h=h!M�ubj�)��}�(hhh]�(j�)��}�(hX
``Combine`` - joins all matched tokens into a single string, using
specified ``join_string`` (default ``join_string=""``); expects
all matching tokens to be adjacent, with no intervening
whitespace (can be overridden by specifying ``adjacent=False`` in constructor)
�h]�h_)��}�(hX	``Combine`` - joins all matched tokens into a single string, using
specified ``join_string`` (default ``join_string=""``); expects
all matching tokens to be adjacent, with no intervening
whitespace (can be overridden by specifying ``adjacent=False`` in constructor)�h]�(j�)��}�(h�``Combine``�h]�h�Combine�����}�(hhhj-ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj-ubh�B - joins all matched tokens into a single string, using
specified �����}�(h�B - joins all matched tokens into a single string, using
specified �hj-ubj�)��}�(h�``join_string``�h]�h�join_string�����}�(hhhj0-ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj-ubh�
 (default �����}�(h�
 (default �hj-ubj�)��}�(h�``join_string=""``�h]�h�join_string=""�����}�(hhhjC-ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj-ubh�o); expects
all matching tokens to be adjacent, with no intervening
whitespace (can be overridden by specifying �����}�(h�o); expects
all matching tokens to be adjacent, with no intervening
whitespace (can be overridden by specifying �hj-ubj�)��}�(h�``adjacent=False``�h]�h�adjacent=False�����}�(hhhjV-ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj-ubh� in constructor)�����}�(h� in constructor)�hj-ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M�hj-ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj-hhh h=h!Nubj�)��}�(h��``Suppress`` - clears matched tokens; useful to keep returned
results from being cluttered with required but uninteresting
tokens (such as list delimiters)

�h]�h_)��}�(h��``Suppress`` - clears matched tokens; useful to keep returned
results from being cluttered with required but uninteresting
tokens (such as list delimiters)�h]�(j�)��}�(h�``Suppress``�h]�h�Suppress�����}�(hhhj}-ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjy-ubh�� - clears matched tokens; useful to keep returned
results from being cluttered with required but uninteresting
tokens (such as list delimiters)�����}�(h�� - clears matched tokens; useful to keep returned
results from being cluttered with required but uninteresting
tokens (such as list delimiters)�hjy-ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M�hju-ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj-hhh h=h!Nubeh"}�(h$]�h&]�h)]�h+]�h-]�j�j�uh/j�h h=h!M�hj�,hhubeh"}�(h$]�j�ah&]�h)]��converter subclasses�ah+]�h-]�uh/h	hj&hhh h=h!M�ubh
)��}�(hhh]�(h)��}�(hj�h]�(h)��}�(hhh]�h�1.2.7   �����}�(hhhj�-hhh Nh!Nubah"}�(h$]�h&]�h(ah)]�h+]�h-]�uh/hhj�-hhh Nh!Nubh�Special subclasses�����}�(hj�hj�-hhh Nh!Nubeh"}�(h$]�h&]�h)]�h+]�h-]�h:Kh;j�uh/hhj�-hhh h=h!Mubj�)��}�(hhh]�(j�)��}�(h��``Group`` - causes the matched tokens to be enclosed in a list;
useful in repeated elements like ``ZeroOrMore`` and ``OneOrMore`` to
break up matched tokens into groups for each repeated pattern
�h]�h_)��}�(h��``Group`` - causes the matched tokens to be enclosed in a list;
useful in repeated elements like ``ZeroOrMore`` and ``OneOrMore`` to
break up matched tokens into groups for each repeated pattern�h]�(j�)��}�(h�	``Group``�h]�h�Group�����}�(hhhj�-ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�-ubh�X - causes the matched tokens to be enclosed in a list;
useful in repeated elements like �����}�(h�X - causes the matched tokens to be enclosed in a list;
useful in repeated elements like �hj�-ubj�)��}�(h�``ZeroOrMore``�h]�h�
ZeroOrMore�����}�(hhhj�-ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�-ubh� and �����}�(h� and �hj�-ubj�)��}�(h�
``OneOrMore``�h]�h�	OneOrMore�����}�(hhhj�-ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�-ubh�A to
break up matched tokens into groups for each repeated pattern�����}�(h�A to
break up matched tokens into groups for each repeated pattern�hj�-ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!Mhj�-ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�-hhh h=h!Nubj�)��}�(h��``Dict`` - like ``Group``, but also constructs a dictionary, using the
``[0]``'th elements of all enclosed token lists as the keys, and
each token list as the value
�h]�h_)��}�(h��``Dict`` - like ``Group``, but also constructs a dictionary, using the
``[0]``'th elements of all enclosed token lists as the keys, and
each token list as the value�h]�(j�)��}�(h�``Dict``�h]�h�Dict�����}�(hhhj.ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj.ubh� - like �����}�(h� - like �hj.ubj�)��}�(h�	``Group``�h]�h�Group�����}�(hhhj1.ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj.ubh�., but also constructs a dictionary, using the
�����}�(h�., but also constructs a dictionary, using the
�hj.ubj�)��}�(h�``[0]``�h]�h�[0]�����}�(hhhjD.ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj.ubh�X’th elements of all enclosed token lists as the keys, and
each token list as the value�����}�(h�V'th elements of all enclosed token lists as the keys, and
each token list as the value�hj.ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!Mhj.ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�-hhh h=h!Nubj�)��}�(h��``Forward`` - placeholder token used to define recursive token
patterns; when defining the actual expression later in the
program, insert it into the ``Forward`` object using the ``<<=``
operator (see fourFn.py_ for an example).

�h]�h_)��}�(h��``Forward`` - placeholder token used to define recursive token
patterns; when defining the actual expression later in the
program, insert it into the ``Forward`` object using the ``<<=``
operator (see fourFn.py_ for an example).�h]�(j�)��}�(h�``Forward``�h]�h�Forward�����}�(hhhjk.ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjg.ubh�� - placeholder token used to define recursive token
patterns; when defining the actual expression later in the
program, insert it into the �����}�(h�� - placeholder token used to define recursive token
patterns; when defining the actual expression later in the
program, insert it into the �hjg.ubj�)��}�(h�``Forward``�h]�h�Forward�����}�(hhhj~.ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjg.ubh� object using the �����}�(h� object using the �hjg.ubj�)��}�(h�``<<=``�h]�h�<<=�����}�(hhhj�.ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjg.ubh�
operator (see �����}�(h�
operator (see �hjg.ubh�)��}�(h�
fourFn.py_�h]�h�	fourFn.py�����}�(hhhj�.ubah"}�(h$]�h&]�h)]�h+]�h-]��name��	fourFn.py�j�jb
uh/h�hjg.j�Kubh� for an example).�����}�(h� for an example).�hjg.ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!Mhjc.ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�-hhh h=h!Nubeh"}�(h$]�h&]�h)]�h+]�h-]�j�j�uh/j�h h=h!Mhj�-hhubeh"}�(h$]�j�ah&]�h)�]��special subclasses�ah+]�h-]�uh/h	hj&hhh h=h!Mubh
)��}�(hhh]�(h)��}�(hjh]�(h)��}�(hhh]�h�1.2.8   �����}�(hhhj�.hhh Nh!Nubah"}�(h$]�h&]�h(ah)]�h+]�h-]�uh/hhj�.hhh Nh!Nubh�
Other classes�����}�(hjhj�.hhh Nh!Nubeh"}�(h$]�h&]�h)]�h+]�h-]�h:Kh;juh/hhj�.hhh h=h!Mubj�)��}�(h�.. _ParseResults:�h]�h"}�(h$]�h&]�h)]�h+]�h-]�h;j�uh/j�h!Mhj�.hhh h=j�Kubj�)��}�(hhh]�j�)��}�(hX}``ParseResults`` - class used to contain and manage the lists of tokens
created from parsing the input using the user-defined parse
expression.  ``ParseResults`` can be accessed in a number of ways:

- as a list

  - total list of elements can be found using ``len()``

  - individual elements can be found using ``[0], [1], [-1],`` etc.,
    or retrieved using slices

  - elements can be deleted using ``del``

  - the ``-1``th element can be extracted and removed in a single operation
    using ``pop()``, or any element can be extracted and removed
    using ``pop(n)``

  - a nested ParseResults_ can be created by using the pyparsing ``Group`` class
    around elements in an expression::

        Word(alphas) + Group(Word(nums)[...]) + Word(alphas)

    will parse the string "abc 100 200 300 end" as::

        ['abc', ['100', '200', '300'], 'end']

    If the ``Group`` is constructed using ``aslist=True``, the resulting tokens
    will be a Python list instead of a ParseResults_.

- as a dictionary

  - if ``set_results_name()`` is used to name elements within the
    overall parse expression, then these fields can be referenced
    as dictionary elements or as attributes

  - the ``Dict`` class generates dictionary entries using the data of the
    input text - in addition to ParseResults_ listed as ``[ [ a1, b1, c1, ...], [ a2, b2, c2, ...]  ]``
    it also acts as a dictionary with entries defined as ``{ a1 : [ b1, c1, ... ] }, { a2 : [ b2, c2, ... ] }``;
    this is especially useful when processing tabular data where the first column contains a key
    value for that line of data; when constructed with ``aslist=True``, will
    return an actual Python ``dict`` instead of a ParseResults_.

  - list elements that are deleted using ``del`` will still be accessible by their
    dictionary keys

  - supports ``get()``, ``items()`` and ``keys()`` methods, similar to a dictionary

  - a keyed item can be extracted and removed using ``pop(key)``.  Here
    ``key`` must be non-numeric (such as a string), in order to use dict
    extraction instead of list extraction.

  - new named elements can be added (in a parse action, for instance), using the same
    syntax as adding an item to a dict (``parse_results["X"] = "new item"``);
    named elements can be removed using ``del parse_results["X"]``

- as a nested list

  - results returned from the Group class are encapsulated within their
    own list structure, so that the tokens can be handled as a hierarchical
    tree

- as an object

  - named elements can be accessed as if they were attributes of an object:
    if an element is referenced that does not exist, it will return ``""``.

ParseResults_ can also be converted to an ordinary list of strings
by calling ``as_list()``.  Note that this will strip the results of any
field names that have been defined for any embedded parse elements.
(The ``pprint`` module is especially good at printing out the nested contents
given by ``as_list()``.)

Finally, ParseResults_ can be viewed by calling ``dump()``. ``dump()`` will first show
the ``as_list()`` output, followed by an indented structure listing parsed tokens that
have been assigned results names.

Here is sample code illustrating some of these methods::

  >>> number = Word(nums)
  >>> name = Combine(Word(alphas)[...], adjacent=False, join_string=" ")
  >>> parser = number("house_number") + name("street_name")
  >>> result = parser.parse_string("123 Main St")
  >>> print(result)
  ['123', 'Main St']
  >>> print(type(result))
  <class 'pyparsing.ParseResults'>
  >>> print(repr(result))
  (['123', 'Main St'], {'house_number': ['123'], 'street_name': ['Main St']})
  >>> result.house_number
  '123'
  >>> result["street_name"]
  'Main St'
  >>> result.as_list()
  ['123', 'Main St']
  >>> result.as_dict()
  {'house_number': '123', 'street_name': 'Main St'}
  >>> print(result.dump())
  ['123', 'Main St']
  - house_number: '123'
  - street_name: 'Main St'

�h]�(h_)��}�(h��``ParseResults`` - class used to contain and manage the lists of tokens
created from parsing the input using the user-defined parse
expression.  ``ParseResults`` can be accessed in a number of ways:�h]�(j�)��}�(h�``ParseResults``�h]�h�ParseResults�����}�(hhhj/ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj/ubh�� - class used to contain and manage the lists of tokens
created from parsing the input using the user-defined parse
expression.  �����}�(h�� - class used to contain and manage the lists of tokens
created from parsing the input using the user-defined parse
expression.  �hj/ubj�)��}�(h�``ParseResults``�h]�h�ParseResults�����}�(hhhj/ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj/ubh�% can be accessed in a number of ways:�����}�(h�% can be accessed in a number of ways:�hj/ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!Mhj�.ubj�)��}�(hhh]�(j�)��}�(hX�as a list

- total list of elements can be found using ``len()``

- individual elements can be found using ``[0], [1], [-1],`` etc.,
  or retrieved using slices

- elements can be deleted using ``del``

- the ``-1``th element can be extracted and removed in a single operation
  using ``pop()``, or any element can be extracted and removed
  using ``pop(n)``

- a nested ParseResults_ can be created by using the pyparsing ``Group`` class
  around elements in an expression::

      Word(alphas) + Group(Word(nums)[...]) + Word(alphas)

  will parse the string "abc 100 200 300 end" as::

      ['abc', ['100', '200', '300'], 'end']

  If the ``Group`` is constructed using ``aslist=True``, the resulting tokens
  will be a Python list instead of a ParseResults_.
�h]�(h_)��}�(h�	as a list�h]�h�	as a list�����}�(hj9/hj7/ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!Mhj3/ubj�)��}�(hhh]�(j�)��}�(h�4total list of elements can be found using ``len()``
�h]�h_)��}�(h�3total list of elements can be found using ``len()``�h]�(h�*total list of elements can be found using �����}�(h�*total list of elements can be found using �hjL/ubj�)��}�(h�	``len()``�h]�h�len()�����}�(hhhjU/ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjL/ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!MhjH/ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjE/ubj�)��}�(h�[individual elements can be found using ``[0], [1], [-1],`` etc.,
or retrieved using slices
�h]�h_)��}�(h�Zindividual elements can be found using ``[0], [1], [-1],`` etc.,
or retrieved using slices�h]�(h�'individual elements can be found using �����}�(h�'individual elements can be found using �hjs/ubj�)��}�(h�``[0], [1], [-1],``�h]�h�[0], [1], [-1],�����}�(hhhj|/ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjs/ubh�  etc.,
or retrieved using slices�����}�(h�  etc.,
or retrieved using slices�hjs/ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!Mhjo/ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjE/ubj�)��}�(h�&elements can be deleted using ``del``
�h]�h_)��}�(h�%elements can be deleted using ``del``�h]�(h�elements can be deleted using �����}�(h�elements can be deleted using �hj�/ubj�)��}�(h�``del``�h]�h�del�����}�(hhhj�/ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�/ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M hj�/ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjE/ubj�)��}�(h��the ``-1``th element can be extracted and removed in a single operation
using ``pop()``, or any element can be extracted and removed
using ``pop(n)``
�h]�h_)��}�(h��the ``-1``th element can be extracted and removed in a single operation
using ``pop()``, or any element can be extracted and removed
using ``pop(n)``�h]�(h�the �����}�(h�the �hj�/ubj�)��}�(h�S``-1``th element can be extracted and removed in a single operation
using ``pop()``�h]�h�O-1``th element can be extracted and removed in a single operation
using ``pop()�����}�(hhhj�/ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�/ubh�4, or any element can be extracted and removed
using �����}�(h�4, or any element can be extracted and removed
using �hj�/ubj�)��}�(h�
``pop(n)``�h]�h�pop(n)�����}�(hhhj�/ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�/ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M"hj�/ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjE/ubj�)��}�(hX�a nested ParseResults_ can be created by using the pyparsing ``Group`` class
around elements in an expression::

    Word(alphas) + Group(Word(nums)[...]) + Word(alphas)

will parse the string "abc 100 200 300 end" as::

    ['abc', ['100', '200', '300'], 'end']

If the ``Group`` is constructed using ``aslist=True``, the resulting tokens
will be a Python list instead of a ParseResults_.
�h]�(h_)��}�(h�oa nested ParseResults_ can be created by using the pyparsing ``Group`` class
around elements in an expression::�h]�(h�	a nested �����}�(h�	a nested �hj0ubh�)��}�(h�
ParseResults_�h]�h�ParseResults�����}�(hhhj	0ubah"}�(h$]�h&]�h)]�h+]�h-]��name��ParseResults�h;j�uh/h�hj0j�Kubh�' can be created by using the pyparsing �����}�(h�' can be created by using the pyparsing �hj0ubj�)��}�(h�	``Group``�h]�h�Group�����}�(hhhj0ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj0ubh�( class
around elements in an expression:�����}�(h�( class
around elements in an expression:�hj0ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M&hj�/ubjb)��}�(h�4Word(alphas) + Group(Word(nums)[...]) + Word(alphas)�h]�h�4Word(alphas) + Group(Word(nums)[...]) + Word(alphas)�����}�(hhhj70ubah"}�(h$]�h&]�h)]�h+]�h-]�jqjruh/jah!M)hj�/h h=ubh_)��}�(h�0will parse the string "abc 100 200 300 end" as::�h]�h�3will parse the string “abc 100 200 300 end” as:�����}�(h�/will parse the string "abc 100 200 300 end" as:�hjE0ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M+hj�/ubjb)��}�(h�%['abc', ['100', '200', '300'], 'end']�h]�h�%['abc', ['100', '200', '300'], 'end']�����}�(hhhjT0ubah"}�(h$]�h&]�h)]�h+]�h-]�jqjruh/jah!M-hj�/h h=ubh_)��}�(h�}If the ``Group`` is constructed using ``aslist=True``, the resulting tokens
will be a Python list instead of a ParseResults_.�h]�(h�If the �����}�(h�If the �hjb0ubj�)��}�(h�	``Group``�h]�h�Group�����}�(hhhjk0ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjb0ubh� is constructed using �����}�(h� is constructed using �hjb0ubj�)��}�(h�``aslist=True``�h]�h�aslist=True�����}�(hhhj~0ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjb0ubh�:, the resulting tokens
will be a Python list instead of a �����}�(h�:, the resulting tokens
will be a Python list instead of a �hjb0ubh�)��}�(h�
ParseResults_�h]�h�ParseResults�����}�(hhhj�0ubah"}�(h$]�h&]�h)]�h+]�h-]��name��ParseResults�h;j�uh/h�hjb0j�Kubh�.�����}�(hjhjb0ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M/hj�/ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjE/ubeh"}�(h$]�h&]�h)]�h+]�h-]�j�j�uh/j�h h=h!Mhj3/ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj0/ubj�)��}�(hXas a dictionary

- if ``set_results_name()`` is used to name elements within the
  overall parse expression, then these fields can be referenced
  as dictionary elements or as attributes

- the ``Dict`` class generates dictionary entries using the data of the
  input text - in addition to ParseResults_ listed as ``[ [ a1, b1, c1, ...], [ a2, b2, c2, ...]  ]``
  it also acts as a dictionary with entries defined as ``{ a1 : [ b1, c1, ... ] }, { a2 : [ b2, c2, ... ] }``;
  this is especially useful when processing tabular data where the first column contains a key
  value for that line of data; when constructed with ``aslist=True``, will
  return an actual Python ``dict`` instead of a ParseResults_.

- list elements that are deleted using ``del`` will still be accessible by their
  dictionary keys

- supports ``get()``, ``items()`` and ``keys()`` methods, similar to a dictionary

- a keyed item can be extracted and removed using ``pop(key)``.  Here
  ``key`` must be non-numeric (such as a string), in order to use dict
  extraction instead of list extraction.

- new named elements can be added (in a parse action, for instance), using the same
  syntax as adding an item to a dict (``parse_results["X"] = "new item"``);
  named elements can be removed using ``del parse_results["X"]``
�h]�(h_)��}�(h�as a dictionary�h]�h�as a dictionary�����}�(hj�0hj�0ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M2hj�0ubj�)��}�(hhh]�(j�)��}�(h��if ``set_results_name()`` is used to name elements within the
overall parse expression, then these fields can be referenced
as dictionary elements or as attributes
�h]�h_)��}�(h��if ``set_results_name()`` is used to name elements within the
overall parse expression, then these fields can be referenced
as dictionary elements or as attributes�h]�(h�if �����}�(h�if �hj�0ubj�)��}�(h�``set_results_name()``�h]�h�set_results_name()�����}�(hhhj�0ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�0ubh�� is used to name elements within the
overall parse expression, then these fields can be referenced
as dictionary elements or as attributes�����}�(h�� is used to name elements within the
overall parse expression, then these fields can be referenced
as dictionary elements or as attributes�hj�0ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M4hj�0ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�0ubj�)��}�(hX�the ``Dict`` class generates dictionary entries using the data of the
input text - in addition to ParseResults_ listed as ``[ [ a1, b1, c1, ...], [ a2, b2, c2, ...]  ]``
it also acts as a dictionary with entries defined as ``{ a1 : [ b1, c1, ... ] }, { a2 : [ b2, c2, ... ] }``;
this is especially useful when processing tabular data where the first column contains a key
value for that line of data; when constructed with ``aslist=True``, will
return an actual Python ``dict`` instead of a ParseResults_.
�h]�h_)��}�(hX�the ``Dict`` class generates dictionary entries using the data of the
input text - in addition to ParseResults_ listed as ``[ [ a1, b1, c1, ...], [ a2, b2, c2, ...]  ]``
it also acts as a dictionary with entries defined as ``{ a1 : [ b1, c1, ... ] }, { a2 : [ b2, c2, ... ] }``;
this is especially useful when processing tabular data where the first column contains a key
value for that line of data; when constructed with ``aslist=True``, will
return an actual Python ``dict`` instead of a ParseResults_.�h]�(h�the �����}�(h�the �hj1ubj�)��}�(h�``Dict``�h]�h�Dict�����}�(hhhj1ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj1ubh�V class generates dictionary entries using the data of the
input text - in addition to �����}�(h�V class generates dictionary entries using the data of the
input text - in addition to �hj1ubh�)��}�(h�
ParseResults_�h]�h�ParseResults�����}�(hhhj1ubah"}�(h$]�h&]�h)]�h+]�h-]��name��ParseResults�h;j�uh/h�hj1j�Kubh� listed as �����}�(h� listed as �hj1ubj�)��}�(h�/``[ [ a1, b1, c1, ...], [ a2, b2, c2, ...]  ]``�h]�h�+[ [ a1, b1, c1, ...], [ a2, b2, c2, ...]  ]�����}�(hhhj31ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj1ubh�6
it also acts as a dictionary with entries defined as �����}�(h�6
it also acts as a dictionary with entries defined as �hj1ubj�)��}�(h�6``{ a1 : [ b1, c1, ... ] }, { a2 : [ b2, c2, ... ] }``�h]�h�2{ a1 : [ b1, c1, ... ] }, { a2 : [ b2, c2, ... ] }�����}�(hhhjF1ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj1ubh��;
this is especially useful when processing tabular data where the first column contains a key
value for that line of data; when constructed with �����}�(h��;
this is especially useful when processing tabular data where the first column contains a key
value for that line of data; when constructed with �hj1ubj�)��}�(h�``aslist=True``�h]�h�aslist=True�����}�(hhhjY1ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj1ubh�, will
return an actual Python �����}�(h�, will
return an actual Python �hj1ubj�)��}�(h�``dict``�h]�h�dict�����}�(hhhjl1ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj1ubh� instead of a �����}�(h� instead of a �hj1ubh�)��}�(h�
ParseResults_�h]�h�ParseResults�����}�(hhhj1ubah"}�(h$]�h&]�h)]�h+]�h-]��name��ParseResults�h;j�uh/h�hj1j�Kubh�.�����}�(hjhj1ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M8hj�0ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�0ubj�)��}�(h�_list elements that are deleted using ``del`` will still be accessible by their
dictionary keys
�h]�h_)��}�(h�^list elements that are deleted using ``del`` will still be accessible by their
dictionary keys�h]�(h�%list elements that are deleted using �����}�(h�%list elements that are deleted using �hj�1ubj�)��}�(h�``del``�h]�h�del�����}�(hhhj�1ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�1ubh�2 will still be accessible by their
dictionary keys�����}�(h�2 will still be accessible by their
dictionary keys�hj�1ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M?hj�1ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�0ubj�)��}�(h�Psupports ``get()``, ``items()`` and ``keys()`` methods, similar to a dictionary
�h]�h_)��}�(h�Osupports ``get()``, ``items()`` and ``keys()`` methods, similar to a dictionary�h]�(h�	supports �����}�(h�	supports �hj�1ubj�)��}�(h�	``get()``�h]�h�get()�����}�(hhhj�1ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�1ubh�, �����}�(h�, �hj�1ubj�)��}�(h�``items()``�h]�h�items()�����}�(hhhj�1ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�1ubh� and �����}�(h� and �hj�1ubj�)��}�(h�
``keys()``�h]�h�keys()�����}�(hhhj�1ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�1ubh�! methods, similar to a dictionary�����}�(h�! methods, similar to a dictionary�hj�1ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!MBhj�1ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�0ubj�)��}�(h��a keyed item can be extracted and removed using ``pop(key)``.  Here
``key`` must be non-numeric (such as a string), in order to use dict
extraction instead of list extraction.
�h]�h_)��}�(h��a keyed item can be extracted and removed using ``pop(key)``.  Here
``key`` must be non-numeric (such as a string), in order to use dict
extraction instead of list extraction.�h]�(h�0a keyed item can be extracted and removed using �����}�(h�0a keyed item can be extracted and removed using �hj!2ubj�)��}�(h�``pop(key)``�h]�h�pop(key)�����}�(hhhj*2ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj!2ubh�.  Here
�����}�(h�.  Here
�hj!2ubj�)��}�(h�``key``�h]�h�key�����}�(hhhj=2ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj!2ubh�d must be non-numeric (such as a string), in order to use dict
extraction instead of list extraction.�����}�(h�d must be non-numeric (such as a string), in order to use dict
extraction instead of list extraction.�hj!2ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!MDhj2ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�0ubj�)��}�(h��new named elements can be added (in a parse action, for instance), using the same
syntax as adding an item to a dict (``parse_results["X"] = "new item"``);
named elements can be removed using ``del parse_results["X"]``
�h]�h_)��}�(h��new named elements can be added (in a parse action, for instance), using the same
syntax as adding an item to a dict (``parse_results["X"] = "new item"``);
named elements can be removed using ``del parse_results["X"]``�h]�(h�vnew named elements can be added (in a parse action, for instance), using the same
syntax as adding an item to a dict (�����}�(h�vnew named elements can be added (in a parse action, for instance), using the same
syntax as adding an item to a dict (�hj`2ubj�)��}�(h�#``parse_results["X"] = "new item"``�h]�h�parse_results["X"] = "new item"�����}�(hhhji2ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj`2ubh�');
named elements can be removed using �����}�(h�');
named elements can be removed using �hj`2ubj�)��}�(h�``del parse_results["X"]``�h]�h�del parse_results["X"]�����}�(hhhj|2ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj`2ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!MHhj\2ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�0ubeh"}�(h$]�h&]�h)]�h+]�h-]�j�j�uh/j�h h=h!M4hj�0ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj0/ubj�)��}�(h��as a nested list

- results returned from the Group class are encapsulated within their
  own list structure, so that the tokens can be handled as a hierarchical
  tree
�h]�(h_)��}�(h�as a nested list�h]�h�as a nested list�����}�(hj�2hj�2ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!MLhj�2ubj�)��}�(hhh]�j�)��}�(h��results returned from the Group class are encapsulated within their
own list structure, so that the tokens can be handled as a hierarchical
tree
�h]�h_)��}�(h��results returned from the Group class are encapsulated within their
own list structure, so that the tokens can be handled as a hierarchical
tree�h]�h��results returned from the Group class are encapsulated within their
own list structure, so that the tokens can be handled as a hierarchical
tree�����}�(hj�2hj�2ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!MNhj�2ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�2ubah"}�(h$]�h&]�h)]�h+]�h-]�j�j�uh/j�h h=h!MNhj�2ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj0/ubj�)��}�(h��as an object

- named elements can be accessed as if they were attributes of an object:
  if an element is referenced that does not exist, it will return ``""``.
�h]�(h_)��}�(h�as an object�h]�h�as an object�����}�(hj�2hj�2ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!MRhj�2ubj�)��}�(hhh]�j�)��}�(h��named elements can be accessed as if they were attributes of an object:
if an element is referenced that does not exist, it will return ``""``.
�h]�h_)��}�(h��named elements can be accessed as if they were attributes of an object:
if an element is referenced that does not exist, it will return ``""``.�h]�(h��named elements can be accessed as if they were attributes of an object:
if an element is referenced that does not exist, it will return �����}�(h��named elements can be accessed as if they were attributes of an object:
if an element is referenced that does not exist, it will return �hj�2ubj�)��}�(h�``""``�h]�h�""�����}�(hhhj�2ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�2ubh�.�����}�(hjhj�2ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!MThj�2ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�2ubah"}�(h$]�h&]�h)]�h+]�h-]�j�j�uh/j�h h=h!MThj�2ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj0/ubeh"}�(h$]�h&]�h)]�h+]�h-]�j�j�uh/j�h h=h!Mhj�.ubh_)��}�(hX5ParseResults_ can also be converted to an ordinary list of strings
by calling ``as_list()``.  Note that this will strip the results of any
field names that have been defined for any embedded parse elements.
(The ``pprint`` module is especially good at printing out the nested contents
given by ``as_list()``.)�h]�(h�)��}�(h�
ParseResults_�h]�h�ParseResults�����}�(hhhj13ubah"}�(h$]�h&]�h)]�h+]�h-]��name��ParseResults�h;j�uh/h�hj-3j�Kubh�A can also be converted to an ordinary list of strings
by calling �����}�(h�A can also be converted to an ordinary list of strings
by calling �hj-3ubj�)��}�(h�
``as_list()``�h]�h�	as_list()�����}�(hhhjF3ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj-3ubh�y.  Note that this will strip the results of any
field names that have been defined for any embedded parse elements.
(The �����}�(h�y.  Note that this will strip the results of any
field names that have been defined for any embedded parse elements.
(The �hj-3ubj�)��}�(h�
``pprint``�h]�h�pprint�����}�(hhhjY3ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj-3ubh�H module is especially good at printing out the nested contents
given by �����}�(h�H module is especially good at printing out the nested contents
given by �hj-3ubj�)��}�(h�
``as_list()``�h]�h�	as_list()�����}�(hhhjl3ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj-3ubh�.)�����}�(h�.)�hj-3ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!MWhj�.ubh_)��}�(h��Finally, ParseResults_ can be viewed by calling ``dump()``. ``dump()`` will first show
the ``as_list()`` output, followed by an indented structure listing parsed tokens that
have been assigned results names.�h]�(h�	Finally, �����}�(h�	Finally, �hj�3ubh�)��}�(h�
ParseResults_�h]�h�ParseResults�����}�(hhhj�3ubah"}�(h$]�h&]�h)]�h+]�h-]��name��ParseResults�h;j�uh/h�hj�3j�Kubh� can be viewed by calling �����}�(h� can be viewed by calling �hj�3ubj�)��}�(h�
``dump()``�h]�h�dump()�����}�(hhhj�3ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�3ubh�. �����}�(h�. �hj�3ubj�)��}�(h�
``dump()``�h]�h�dump()�����}�(hhhj�3ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�3ubh� will first show
the �����}�(h� will first show
the �hj�3ubj�)��}�(h�
``as_list()``�h]�h�	as_list()�����}�(hhhj�3ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�3ubh�g output, followed by an indented structure listing parsed tokens that
have been assigned results names.�����}�(h�g output, followed by an indented structure listing parsed tokens that
have been assigned results names.�hj�3ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M]hj�.ubh_)��}�(h�8Here is sample code illustrating some of these methods::�h]�h�7Here is sample code illustrating some of these methods:�����}�(h�7Here is sample code illustrating some of these methods:�hj�3ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!Mahj�.ubjb)��}�(hX�>>> number = Word(nums)
>>> name = Combine(Word(alphas)[...], adjacent=False, join_string=" ")
>>> parser = number("house_number") + name("street_name")
>>> result = parser.parse_string("123 Main St")
>>> print(result)
['123', 'Main St']
>>> print(type(result))
<class 'pyparsing.ParseResults'>
>>> print(repr(result))
(['123', 'Main St'], {'house_number': ['123'], 'street_name': ['Main St']})
>>> result.house_number
'123'
>>> result["street_name"]
'Main St'
>>> result.as_list()
['123', 'Main St']
>>> result.as_dict()
{'house_number': '123', 'street_name': 'Main St'}
>>> print(result.dump())
['123', 'Main St']
- house_number: '123'
- street_name: 'Main St'�h]�hX�>>> number = Word(nums)
>>> name = Combine(Word(alphas)[...], adjacent=False, join_string=" ")
>>> parser = number("house_number") + name("street_name")
>>> result = parser.parse_string("123 Main St")
>>> print(result)
['123', 'Main St']
>>> print(type(result))
<class 'pyparsing.ParseResults'>
>>> print(repr(result))
(['123', 'Main St'], {'house_number': ['123'], 'street_name': ['Main St']})
>>> result.house_number
'123'
>>> result["street_name"]
'Main St'
>>> result.as_list()
['123', 'Main St']
>>> result.as_dict()
{'house_number': '123', 'street_name': 'Main St'}
>>> print(result.dump())
['123', 'Main St']
- house_number: '123'
- street_name: 'Main St'�����}�(hhhj�3ubah"}�(h$]�h&]�h)]�h+]�h-]�jqjruh/jah!Mchj�.h h=ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�.hhh h=h!Nubah"}�(h$]�j�ah&]�h)]��parseresults�ah+]�h-]�j�j�uh/j�h h=h!Mhj�.hhjL}�j	4j�.sjN}�j�j�.sj�Kubeh"}�(h$]�jah&]�h)]��
other classes�ah+]�h-]�uh/h	hj&hhh h=h!Mubh
)��}�(hhh]�(h)��}�(hj@h]�(h)��}�(hhh]�h�1.2.9   �����}�(hhhj4hhh Nh!Nubah"}�(h$]�h&]�h(ah)]�h+]�h-]�uh/hhj4hhh Nh!Nubh�%Exception classes and Troubleshooting�����}�(hj@hj4hhh Nh!Nubeh"}�(h$]�h&]�h)]�h+]�h-]�h:Kh;jCuh/hhj4hhh h=h!M|ubj�)��}�(h�.. _ParseException:�h]�h"}�(h$]�h&]�h)]�h+]�h-]�h;j�uh/j�h!M~hj4hhh h=j�Kubj�)��}�(hhh]�(j�)��}�(hX�``ParseException`` - exception returned when a grammar parse fails;
``ParseExceptions`` have attributes ``loc``, ``msg``, ``line``, ``lineno``, and ``column``; to view the
text line and location where the reported ParseException occurs, use::

  except ParseException as err:
      print(err.line)
      print(" " * (err.column - 1) + "^")
      print(err)

``ParseExceptions`` also have an ``explain()`` method that gives this same information::

  except ParseException as err:
      print(err.explain())
�h]�(h_)��}�(h��``ParseException`` - exception returned when a grammar parse fails;
``ParseExceptions`` have attributes ``loc``, ``msg``, ``line``, ``lineno``, and ``column``; to view the
text line and location where the reported ParseException occurs, use::�h]�(j�)��}�(h�``ParseException``�h]�h�ParseException�����}�(hhhjG4ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjC4ubh�2 - exception returned when a grammar parse fails;
�����}�(h�2 - exception returned when a grammar parse fails;
�hjC4ubj�)��}�(h�``ParseExceptions``�h]�h�ParseExceptions�����}�(hhhjZ4ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjC4ubh� have attributes �����}�(h� have attributes �hjC4ubj�)��}�(h�``loc``�h]�h�loc�����}�(hhhjm4ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjC4ubh�, �����}�(h�, �hjC4ubj�)��}�(h�``msg``�h]�h�msg�����}�(hhhj�4ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjC4ubh�, �����}�(h�, �hjC4ubj�)��}�(h�``line``�h]�h�line�����}�(hhhj�4ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjC4ubh�, �����}�(hj4hjC4ubj�)��}�(h�
``lineno``�h]�h�lineno�����}�(hhhj�4ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjC4ubh�, and �����}�(h�, and �hjC4ubj�)��}�(h�
``column``�h]�h�column�����}�(hhhj�4ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjC4ubh�S; to view the
text line and location where the reported ParseException occurs, use:�����}�(h�S; to view the
text line and location where the reported ParseException occurs, use:�hjC4ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M�hj?4ubjb)��}�(h�hexcept ParseException as err:
    print(err.line)
    print(" " * (err.column - 1) + "^")
    print(err)�h]�h�hexcept ParseException as err:
    print(err.line)
    print(" " * (err.column - 1) + "^")
    print(err)�����}�(hhhj�4ubah"}�(h$]�h&]�h)]�h+]�h-]�jqjruh/jah!M�hj?4h h=ubh_)��}�(h�X``ParseExceptions`` also have an ``explain()`` method that gives this same information::�h]�(j�)��}�(h�``ParseExceptions``�h]�h�ParseExceptions�����}�(hhhj�4ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�4ubh� also have an �����}�(h� also have an �hj�4ubj�)��}�(h�
``explain()``�h]�h�	explain()�����}�(hhhj�4ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�4ubh�) method that gives this same information:�����}�(h�) method that gives this same information:�hj�4ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M�hj?4ubjb)��}�(h�6except ParseException as err:
    print(err.explain())�h]�h�6except ParseException as err:
    print(err.explain())�����}�(hhhj5ubah"}�(h$]�h&]�h)]�h+]�h-]�jqjruh/jah!M�hj?4h h=ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj<4hhh h=h!Nubj�)��}�(h��``RecursiveGrammarException`` - exception returned by ``validate()`` if
the grammar contains a recursive infinite loop, such as::

  bad_grammar = Forward()
  good_token = Literal("A")
  bad_grammar <<= Opt(good_token) + bad_grammar
�h]�(h_)��}�(h��``RecursiveGrammarException`` - exception returned by ``validate()`` if
the grammar contains a recursive infinite loop, such as::�h]�(j�)��}�(h�``RecursiveGrammarException``�h]�h�RecursiveGrammarException�����}�(hhhj+5ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj'5ubh� - exception returned by �����}�(h� - exception returned by �hj'5ubj�)��}�(h�``validate()``�h]�h�
validate()�����}�(hhhj>5ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj'5ubh�< if
the grammar contains a recursive infinite loop, such as:�����}�(h�< if
the grammar contains a recursive infinite loop, such as:�hj'5ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M�hj#5ubjb)��}�(h�_bad_grammar = Forward()
good_token = Literal("A")
bad_grammar <<= Opt(good_token) + bad_grammar�h]�h�_bad_grammar = Forward()
good_token = Literal("A")
bad_grammar <<= Opt(good_token) + bad_grammar�����}�(hhhjW5ubah"}�(h$]�h&]�h)]�h+]�h-]�jqjruh/jah!M�hj#5h h=ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj<4hhh h=h!Nubj�)��}�(h��``ParseFatalException`` - exception that parse actions can raise to stop parsing
immediately.  Should be used when a semantic error is found in the input text, such
as a mismatched XML tag.
�h]�h_)��}�(h��``ParseFatalException`` - exception that parse actions can raise to stop parsing
immediately.  Should be used when a semantic error is found in the input text, such
as a mismatched XML tag.�h]�(j�)��}�(h�``ParseFatalException``�h]�h�ParseFatalException�����}�(hhhjs5ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjo5ubh�� - exception that parse actions can raise to stop parsing
immediately.  Should be used when a semantic error is found in the input text, such
as a mismatched XML tag.�����}�(h�� - exception that parse actions can raise to stop parsing
immediately.  Should be used when a semantic error is found in the input text, such
as a mismatched XML tag.�hjo5ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M�hjk5ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj<4hhh h=h!Nubj�)��}�(h��``ParseSyntaxException`` - subclass of ``ParseFatalException`` raised when a
syntax error is found, based on the use of the '-' operator when defining
a sequence of expressions in an And_ expression.
�h]�h_)��}�(h��``ParseSyntaxException`` - subclass of ``ParseFatalException`` raised when a
syntax error is found, based on the use of the '-' operator when defining
a sequence of expressions in an And_ expression.�h]�(j�)��}�(h�``ParseSyntaxException``�h]�h�ParseSyntaxException�����}�(hhhj�5ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�5ubh� - subclass of �����}�(h� - subclass of �hj�5ubj�)��}�(h�``ParseFatalException``�h]�h�ParseFatalException�����}�(hhhj�5ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�5ubh�} raised when a
syntax error is found, based on the use of the ‘-‘ operator when defining
a sequence of expressions in an �����}�(h�y raised when a
syntax error is found, based on the use of the '-' operator when defining
a sequence of expressions in an �hj�5ubh�)��}�(h�And_�h]�h�And�����}�(hhhj�5ubah"}�(h$]�h&]�h)]�h+]�h-]��name��And�h;j�uh/h�hj�5j�Kubh� expression.�����}�(h� expression.�hj�5ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M�hj�5ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj<4hhh h=h!Nubj�)��}�(h��You can also get some insights into the parsing logic using diagnostic parse actions,
and ``set_debug()``, or test the matching of expression fragments by testing them using
``search_string()`` or ``scan_string()``.
�h]�h_)��}�(h��You can also get some insights into the parsing logic using diagnostic parse actions,
and ``set_debug()``, or test the matching of expression fragments by testing them using
``search_string()`` or ``scan_string()``.�h]�(h�ZYou can also get some insights into the parsing logic using diagnostic parse actions,
and �����}�(h�ZYou can also get some insights into the parsing logic using diagnostic parse actions,
and �hj�5ubj�)��}�(h�``set_debug()``�h]�h�set_debug()�����}�(hhhj�5ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�5ubh�E, or test the matching of expression fragments by testing them using
�����}�(h�E, or test the matching of expression fragments by testing them using
�hj�5ubj�)��}�(h�``search_string()``�h]�h�search_string()�����}�(hhhj6ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�5ubh� or �����}�(h� or �hj�5ubj�)��}�(h�``scan_string()``�h]�h�
scan_string()�����}�(hhhj6ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�5ubh�.�����}�(hjhj�5ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M�hj�5ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj<4hhh h=h!Nubj�)��}�(hXOUse ``with_line_numbers`` from ``pyparsing_testing`` to display the input string
being parsed, with line and column numbers that correspond to the values reported
in set_debug() output::

    import pyparsing as pp
    ppt = pp.testing

    data = """\
       A
          100"""

    expr = pp.Word(pp.alphanums).set_name("word").set_debug()
    print(ppt.with_line_numbers(data))
    expr[...].parseString(data)

prints::

    .          1
      1234567890
    1:   A|
    2:      100|

    Match word at loc 3(1,4)
        A
        ^
    Matched word -> ['A']
    Match word at loc 11(2,7)
           100
           ^
    Matched word -> ['100']

`with_line_numbers` has several options for displaying control characters, end-of-line
and space markers, Unicode symbols for control characters - these are documented in the
function's docstring.
�h]�(h_)��}�(h��Use ``with_line_numbers`` from ``pyparsing_testing`` to display the input string
being parsed, with line and column numbers that correspond to the values reported
in set_debug() output::�h]�(h�Use �����}�(h�Use �hj66ubj�)��}�(h�``with_line_numbers``�h]�h�with_line_numbers�����}�(hhhj?6ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj66ubh� from �����}�(h� from �hj66ubj�)��}�(h�``pyparsing_testing``�h]�h�pyparsing_testing�����}�(hhhjR6ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj66ubh�� to display the input string
being parsed, with line and column numbers that correspond to the values reported
in set_debug() output:�����}�(h�� to display the input string
being parsed, with line and column numbers that correspond to the values reported
in set_debug() output:�hj66ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M�hj26ubjb)��}�(h��import pyparsing as pp
ppt = pp.testing

data = """\
   A
      100"""

expr = pp.Word(pp.alphanums).set_name("word").set_debug()
print(ppt.with_line_numbers(data))
expr[...].parseString(data)�h]�h��import pyparsing as pp
ppt = pp.testing

data = """\
   A
      100"""

expr = pp.Word(pp.alphanums).set_name("word").set_debug()
print(ppt.with_line_numbers(data))
expr[...].parseString(data)�����}�(hhhjk6ubah"}�(h$]�h&]�h)]�h+]�h-]�jqjruh/jah!M�hj26h h=ubh_)��}�(h�prints::�h]�h�prints:�����}�(h�prints:�hjy6ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M�hj26ubjb)��}�(h��.          1
  1234567890
1:   A|
2:      100|

Match word at loc 3(1,4)
    A
    ^
Matched word -> ['A']
Match word at loc 11(2,7)
       100
       ^
Matched word -> ['100']�h]�h��.          1
  1234567890
1:   A|
2:      100|

Match word at loc 3(1,4)
    A
    ^
Matched word -> ['A']
Match word at loc 11(2,7)
       100
       ^
Matched word -> ['100']�����}�(hhhj�6ubah"}�(h$]�h&]�h)]�h+]�h-]�jqjruh/jah!M�hj26h h=ubh_)��}�(h��`with_line_numbers` has several options for displaying control characters, end-of-line
and space markers, Unicode symbols for control characters - these are documented in the
function's docstring.�h]�(h�title_reference���)��}�(h�`with_line_numbers`�h]�h�with_line_numbers�����}�(hhhj�6ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�6hj�6ubh�� has several options for displaying control characters, end-of-line
and space markers, Unicode symbols for control characters - these are documented in the
function’s docstring.�����}�(h�� has several options for displaying control characters, end-of-line
and space markers, Unicode symbols for control characters - these are documented in the
function's docstring.�hj�6ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M�hj26ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj<4hhh h=h!Nubj�)��}�(hXuDiagnostics can be enabled using ``pyparsing.enable_diag`` and passing
one of the following enum values defined in ``pyparsing.Diagnostics``

- ``warn_multiple_tokens_in_named_alternation`` - flag to enable warnings when a results
  name is defined on a MatchFirst_ or Or_ expression with one or more And_ subexpressions

- ``warn_ungrouped_named_tokens_in_collection`` - flag to enable warnings when a results
  name is defined on a containing expression with ungrouped subexpressions that also
  have results names

- ``warn_name_set_on_empty_Forward`` - flag to enable warnings when a ``Forward`` is defined
  with a results name, but has no contents defined

- ``warn_on_parse_using_empty_Forward`` - flag to enable warnings when a ``Forward`` is
  defined in a grammar but has never had an expression attached to it

- ``warn_on_assignment_to_Forward`` - flag to enable warnings when a ``Forward`` is defined
  but is overwritten by assigning using ``'='`` instead of ``'<<='`` or ``'<<'``

- ``warn_on_multiple_string_args_to_oneof`` - flag to enable warnings when ``one_of`` is
  incorrectly called with multiple str arguments

- ``enable_debug_on_named_expressions`` - flag to auto-enable debug on all subsequent
  calls to ``ParserElement.set_name``

All warnings can be enabled by calling ``pyparsing.enable_all_warnings()``.
Sample::

  import pyparsing as pp
  pp.enable_all_warnings()

  fwd = pp.Forward().set_results_name("recursive_expr")

  >>> UserWarning: warn_name_set_on_empty_Forward: setting results name 'recursive_expr'
                   on Forward expression that has no contained expression

Warnings can also be enabled using the Python ``-W`` switch (using ``-Wd`` or
``-Wd:::pyparsing``) or setting a non-empty value to the environment variable
``PYPARSINGENABLEALLWARNINGS``. (If using ``-Wd`` for testing, but wishing to
disable pyparsing warnings, add ``-Wi:::pyparsing``.)

�h]�(h_)��}�(h��Diagnostics can be enabled using ``pyparsing.enable_diag`` and passing
one of the following enum values defined in ``pyparsing.Diagnostics``�h]�(h�!Diagnostics can be enabled using �����}�(h�!Diagnostics can be enabled using �hj�6ubj�)��}�(h�``pyparsing.enable_diag``�h]�h�pyparsing.enable_diag�����}�(hhhj�6ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�6ubh�9 and passing
one of the following enum values defined in �����}�(h�9 and passing
one of the following enum values defined in �hj�6ubj�)��}�(h�``pyparsing.Diagnostics``�h]�h�pyparsing.Diagnostics�����}�(hhhj�6ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�6ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M�hj�6ubj�)��}�(hhh]�(j�)��}�(h��``warn_multiple_tokens_in_named_alternation`` - flag to enable warnings when a results
name is defined on a MatchFirst_ or Or_ expression with one or more And_ subexpressions
�h]�h_)��}�(h��``warn_multiple_tokens_in_named_alternation`` - flag to enable warnings when a results
name is defined on a MatchFirst_ or Or_ expression with one or more And_ subexpressions�h]�(j�)��}�(h�-``warn_multiple_tokens_in_named_alternation``�h]�h�)warn_multiple_tokens_in_named_alternation�����}�(hhhj�6ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�6ubh�? - flag to enable warnings when a results
name is defined on a �����}�(h�? - flag to enable warnings when a results
name is defined on a �hj�6ubh�)��}�(h�MatchFirst_�h]�h�
MatchFirst�����}�(hhhj
7ubah"}�(h$]�h&]�h)]�h+]�h-]��name��
MatchFirst�h;j�
uh/h�hj�6j�Kubh� or �����}�(h� or �hj�6ubh�)��}�(h�Or_�h]�h�Or�����}�(hhhj"7ubah"}�(h$]�h&]�h)]�h+]�h-]��name��Or�h;j�
uh/h�hj�6j�Kubh� expression with one or more �����}�(h� expression with one or more �hj�6ubh�)��}�(h�And_�h]�h�And�����}�(hhhj77ubah"}�(h$]�h&]�h)]�h+]�h-]��name��And�h;j�uh/h�hj�6j�Kubh� subexpressions�����}�(h� subexpressions�hj�6ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M�hj�6ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�6ubj�)��}�(h��``warn_ungrouped_named_tokens_in_collection`` - flag to enable warnings when a results
name is defined on a containing expression with ungrouped subexpressions that also
have results names
�h]�h_)��}�(h��``warn_ungrouped_named_tokens_in_collection`` - flag to enable warnings when a results
name is defined on a containing expression with ungrouped subexpressions that also
have results names�h]�(j�)��}�(h�-``warn_ungrouped_named_tokens_in_collection``�h]�h�)warn_ungrouped_named_tokens_in_collection�����}�(hhhj`7ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj\7ubh�� - flag to enable warnings when a results
name is defined on a containing expression with ungrouped subexpressions that also
have results names�����}�(h�� - flag to enable warnings when a results
name is defined on a containing expression with ungrouped subexpressions that also
have results names�hj\7ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M�hjX7ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�6ubj�)��}�(h��``warn_name_set_on_empty_Forward`` - flag to enable warnings when a ``Forward`` is defined
with a results name, but has no contents defined
�h]�h_)��}�(h��``warn_name_set_on_empty_Forward`` - flag to enable warnings when a ``Forward`` is defined
with a results name, but has no contents defined�h]�(j�)��}�(h�"``warn_name_set_on_empty_Forward``�h]�h�warn_name_set_on_empty_Forward�����}�(hhhj�7ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�7ubh�" - flag to enable warnings when a �����}�(h�" - flag to enable warnings when a �hj�7ubj�)��}�(h�``Forward``�h]�h�Forward�����}�(hhhj�7ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�7ubh�< is defined
with a results name, but has no contents defined�����}�(h�< is defined
with a results name, but has no contents defined�hj�7ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M�hj7ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�6ubj�)��}�(h��``warn_on_parse_using_empty_Forward`` - flag to enable warnings when a ``Forward`` is
defined in a grammar but has never had an expression attached to it
�h]�h_)��}�(h��``warn_on_parse_using_empty_Forward`` - flag to enable warnings when a ``Forward`` is
defined in a grammar but has never had an expression attached to it�h]�(j�)��}�(h�%``warn_on_parse_using_empty_Forward``�h]�h�!warn_on_parse_using_empty_Forward�����}�(hhhj�7ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�7ubh�" - flag to enable warnings when a �����}�(h�" - flag to enable warnings when a �hj�7ubj�)��}�(h�``Forward``�h]�h�Forward�����}�(hhhj�7ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�7ubh�G is
defined in a grammar but has never had an expression attached to it�����}�(h�G is
defined in a grammar but has never had an expression attached to it�hj�7ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M�hj�7ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�6ubj�)��}�(h��``warn_on_assignment_to_Forward`` - flag to enable warnings when a ``Forward`` is defined
but is overwritten by assigning using ``'='`` instead of ``'<<='`` or ``'<<'``
�h]�h_)��}�(h��``warn_on_assignment_to_Forward`` - flag to enable warnings when a ``Forward`` is defined
but is overwritten by assigning using ``'='`` instead of ``'<<='`` or ``'<<'``�h]�(j�)��}�(h�!``warn_on_assignment_to_Forward``�h]�h�warn_on_assignment_to_Forward�����}�(hhhj�7ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�7ubh�" - flag to enable warnings when a �����}�(h�" - flag to enable warnings when a �hj�7ubj�)��}�(h�``Forward``�h]�h�Forward�����}�(hhhj8ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�7ubh�2 is defined
but is overwritten by assigning using �����}�(h�2 is defined
but is overwritten by assigning using �hj�7ubj�)��}�(h�``'='``�h]�h�'='�����}�(hhhj!8ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�7ubh� instead of �����}�(h� instead of �hj�7ubj�)��}�(h�	``'<<='``�h]�h�'<<='�����}�(hhhj48ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�7ubh� or �����}�(h� or �hj�7ubj�)��}�(h�``'<<'``�h]�h�'<<'�����}�(hhhjG8ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�7ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M�hj�7ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�6ubj�)��}�(h��``warn_on_multiple_string_args_to_oneof`` - flag to enable warnings when ``one_of`` is
incorrectly called with multiple str arguments
�h]�h_)��}�(h��``warn_on_multiple_string_args_to_oneof`` - flag to enable warnings when ``one_of`` is
incorrectly called with multiple str arguments�h]�(j�)��}�(h�)``warn_on_multiple_string_args_to_oneof``�h]�h�%warn_on_multiple_string_args_to_oneof�����}�(hhhji8ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hje8ubh�  - flag to enable warnings when �����}�(h�  - flag to enable warnings when �hje8ubj�)��}�(h�
``one_of``�h]�h�one_of�����}�(hhhj|8ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hje8ubh�2 is
incorrectly called with multiple str arguments�����}�(h�2 is
incorrectly called with multiple str arguments�hje8ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M�hja8ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�6ubj�)��}�(h�x``enable_debug_on_named_expressions`` - flag to auto-enable debug on all subsequent
calls to ``ParserElement.set_name``
�h]�h_)��}�(h�w``enable_debug_on_named_expressions`` - flag to auto-enable debug on all subsequent
calls to ``ParserElement.set_name``�h]�(j�)��}�(h�%``enable_debug_on_named_expressions``�h]�h�!enable_debug_on_named_expressions�����}�(hhhj�8ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�8ubh�8 - flag to auto-enable debug on all subsequent
calls to �����}�(h�8 - flag to auto-enable debug on all subsequent
calls to �hj�8ubj�)��}�(h�``ParserElement.set_name``�h]�h�ParserElement.set_name�����}�(hhhj�8ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�8ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M�hj�8ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�6ubeh"}�(h$]�h&]�h)]�h+]�h-]�j�j�uh/j�h h=h!M�hj�6ubh_)��}�(h�TAll warnings can be enabled by calling ``pyparsing.enable_all_warnings()``.
Sample::�h]�(h�'All warnings can be enabled by calling �����}�(h�'All warnings can be enabled by calling �hj�8ubj�)��}�(h�#``pyparsing.enable_all_warnings()``�h]�h�pyparsing.enable_all_warnings()�����}�(hhhj�8ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�8ubh�	.
Sample:�����}�(h�	.
Sample:�hj�8ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M�hj�6ubjb)��}�(hXimport pyparsing as pp
pp.enable_all_warnings()

fwd = pp.Forward().set_results_name("recursive_expr")

>>> UserWarning: warn_name_set_on_empty_Forward: setting results name 'recursive_expr'
                 on Forward expression that has no contained expression�h]�hXimport pyparsing as pp
pp.enable_all_warnings()

fwd = pp.Forward().set_results_name("recursive_expr")

>>> UserWarning: warn_name_set_on_empty_Forward: setting results name 'recursive_expr'
                 on Forward expression that has no contained expression�����}�(hhhj�8ubah"}�(h$]�h&]�h)]�h+]�h-]�jqjruh/jah!M�hj�6h h=ubh_)��}�(hXWarnings can also be enabled using the Python ``-W`` switch (using ``-Wd`` or
``-Wd:::pyparsing``) or setting a non-empty value to the environment variable
``PYPARSINGENABLEALLWARNINGS``. (If using ``-Wd`` for testing, but wishing to
disable pyparsing warnings, add ``-Wi:::pyparsing``.)�h]�(h�.Warnings can also be enabled using the Python �����}�(h�.Warnings can also be enabled using the Python �hj9ubj�)��}�(h�``-W``�h]�h�-W�����}�(hhhj9ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj9ubh� switch (using �����}�(h� switch (using �hj9ubj�)��}�(h�``-Wd``�h]�h�-Wd�����}�(hhhj"9ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj9ubh� or
�����}�(h� or
�hj9ubj�)��}�(h�``-Wd:::pyparsing``�h]�h�-Wd:::pyparsing�����}�(hhhj59ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj9ubh�;) or setting a non-empty value to the environment variable
�����}�(h�;) or setting a non-empty value to the environment variable
�hj9ubj�)��}�(h�``PYPARSINGENABLEALLWARNINGS``�h]�h�PYPARSINGENABLEALLWARNINGS�����}�(hhhjH9ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj9ubh�. (If using �����}�(h�. (If using �hj9ubj�)��}�(h�``-Wd``�h]�h�-Wd�����}�(hhhj[9ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj9ubh�= for testing, but wishing to
disable pyparsing warnings, add �����}�(h�= for testing, but wishing to
disable pyparsing warnings, add �hj9ubj�)��}�(h�``-Wi:::pyparsing``�h]�h�-Wi:::pyparsing�����}�(hhhjn9ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj9ubh�.)�����}�(h�.)�hj9ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M�hj�6ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj<4hhh h=h!Nubeh"}�(h$]�j�ah&]�h)]��parseexception�ah+]�h-]�j�j�uh/j�h h=h!M�hj4hhjL}�j�9j24sjN}�j�j24sj�Kubeh"}�(h$]�jIah&]�h)]��%exception classes and troubleshooting�ah+]�h-]�uh/h	hj&hhh h=h!M|ubeh"}�(h$]�j�ah&]�h)]��classes�ah+]�h-]�uh/h	hhhhh h=h!Mubh
)��}�(hhh]�(h)��}�(hj|h]�(h)��}�(hhh]�h�	1.3   �����}�(hhhj�9hhh Nh!Nubah"}�(h$]�h&]�h(ah)]�h+]�h-]�uh/hhj�9hhh Nh!Nubh�$Miscellaneous attributes and methods�����}�(hj|hj�9hhh Nh!Nubeh"}�(h$]�h&]�h)]�h+]�h-]�h:Kh;juh/hhj�9hhh h=h!M�ubh
)��}�(hhh]�(h)��}�(hj�h]�(h)��}�(hhh]�h�1.3.1   �����}�(hhhj�9hhh Nh!Nubah"}�(h$]�h&]�h(ah)]�h+]�h-]�uh/hhj�9hhh Nh!Nubh�Helper methods�����}�(hj�hj�9hhh Nh!Nubeh"}�(h$]�h&]�h)]�h+]�h-]�h:Kh;j�uh/hhj�9hhh h=h!M�ubj�)��}�(hhh]�(j�)��}�(hX;``delimited_list(expr, delim=',')`` - convenience function for
matching one or more occurrences of expr, separated by delim.
By default, the delimiters are suppressed, so the returned results contain
only the separate list elements.  Can optionally specify ``combine=True``,
indicating that the expressions and delimiters should be returned as one
combined value (useful for scoped variables, such as ``"a.b.c"``, or
``"a::b::c"``, or paths such as ``"a/b/c"``). Can also optionally specify
``allow_trailing_delim`` to accept a trailing delimiter at the end of the list.
�h]�h_)��}�(hX:``delimited_list(expr, delim=',')`` - convenience function for
matching one or more occurrences of expr, separated by delim.
By default, the delimiters are suppressed, so the returned results contain
only the separate list elements.  Can optionally specify ``combine=True``,
indicating that the expressions and delimiters should be returned as one
combined value (useful for scoped variables, such as ``"a.b.c"``, or
``"a::b::c"``, or paths such as ``"a/b/c"``). Can also optionally specify
``allow_trailing_delim`` to accept a trailing delimiter at the end of the list.�h]�(j�)��}�(h�#``delimited_list(expr, delim=',')``�h]�h�delimited_list(expr, delim=',')�����}�(hhhj�9ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�9ubh�� - convenience function for
matching one or more occurrences of expr, separated by delim.
By default, the delimiters are suppressed, so the returned results contain
only the separate list elements.  Can optionally specify �����}�(h�� - convenience function for
matching one or more occurrences of expr, separated by delim.
By default, the delimiters are suppressed, so the returned results contain
only the separate list elements.  Can optionally specify �hj�9ubj�)��}�(h�``combine=True``�h]�h�combine=True�����}�(hhhj�9ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�9ubh��,
indicating that the expressions and delimiters should be returned as one
combined value (useful for scoped variables, such as �����}�(h��,
indicating that the expressions and delimiters should be returned as one
combined value (useful for scoped variables, such as �hj�9ubj�)��}�(h�``"a.b.c"``�h]�h�"a.b.c"�����}�(hhhj:ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�9ubh�, or
�����}�(h�, or
�hj�9ubj�)��}�(h�
``"a::b::c"``�h]�h�	"a::b::c"�����}�(hhhj":ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�9ubh�, or paths such as �����}�(h�, or paths such as �hj�9ubj�)��}�(h�``"a/b/c"``�h]�h�"a/b/c"�����}�(hhhj5:ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�9ubh�). Can also optionally specify
�����}�(h�). Can also optionally specify
�hj�9ubj�)��}�(h�``allow_trailing_delim``�h]�h�allow_trailing_delim�����}�(hhhjH:ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�9ubh�7 to accept a trailing delimiter at the end of the list.�����}�(h�7 to accept a trailing delimiter at the end of the list.�hj�9ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M�hj�9ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�9hhh h=h!Nubj�)��}�(hX�``counted_array(expr)`` - convenience function for a pattern where an list of
instances of the given expression are preceded by an integer giving the count of
elements in the list.  Returns an expression that parses the leading integer,
reads exactly that many expressions, and returns the array of expressions in the
parse results - the leading integer is suppressed from the results (although it
is easily reconstructed by using len on the returned array).
�h]�h_)��}�(hX�``counted_array(expr)`` - convenience function for a pattern where an list of
instances of the given expression are preceded by an integer giving the count of
elements in the list.  Returns an expression that parses the leading integer,
reads exactly that many expressions, and returns the array of expressions in the
parse results - the leading integer is suppressed from the results (although it
is easily reconstructed by using len on the returned array).�h]�(j�)��}�(h�``counted_array(expr)``�h]�h�counted_array(expr)�����}�(hhhjo:ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjk:ubhX� - convenience function for a pattern where an list of
instances of the given expression are preceded by an integer giving the count of
elements in the list.  Returns an expression that parses the leading integer,
reads exactly that many expressions, and returns the array of expressions in the
parse results - the leading integer is suppressed from the results (although it
is easily reconstructed by using len on the returned array).�����}�(hX� - convenience function for a pattern where an list of
instances of the given expression are preceded by an integer giving the count of
elements in the list.  Returns an expression that parses the leading integer,
reads exactly that many expressions, and returns the array of expressions in the
parse results - the leading integer is suppressed from the results (although it
is easily reconstructed by using len on the returned array).�hjk:ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M�hjg:ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�9hhh h=h!Nubj�)��}�(hXM``one_of(choices, caseless=False, as_keyword=False)`` - convenience function for quickly declaring an
alternative set of Literal_ expressions. ``choices`` can be passed as a list of strings
or as a single string of values separated by spaces. The values are sorted so that longer
matches are attempted first; this ensures that a short value does
not mask a longer one that starts with the same characters. If ``caseless=True``,
will create an alternative set of CaselessLiteral_ tokens. If ``as_keyword=True``,
``one_of`` will declare Keyword_ expressions instead of Literal_ expressions.
�h]�h_)��}�(hXL``one_of(choices, caseless=False, as_keyword=False)`` - convenience function for quickly declaring an
alternative set of Literal_ expressions. ``choices`` can be passed as a list of strings
or as a single string of values separated by spaces. The values are sorted so that longer
matches are attempted first; this ensures that a short value does
not mask a longer one that starts with the same characters. If ``caseless=True``,
will create an alternative set of CaselessLiteral_ tokens. If ``as_keyword=True``,
``one_of`` will declare Keyword_ expressions instead of Literal_ expressions.�h]�(j�)��}�(h�5``one_of(choices, caseless=False, as_keyword=False)``�h]�h�1one_of(choices, caseless=False, as_keyword=False)�����}�(hhhj�:ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�:ubh�D - convenience function for quickly declaring an
alternative set of �����}�(h�D - convenience function for quickly declaring an
alternative set of �hj�:ubh�)��}�(h�Literal_�h]�h�Literal�����}�(hhhj�:ubah"}�(h$]�h&]�h)]�h+]�h-]��name��Literal�h;ja	uh/h�hj�:j�Kubh� expressions. �����}�(h� expressions. �hj�:ubj�)��}�(h�``choices``�h]�h�choices�����}�(hhhj�:ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�:ubh�� can be passed as a list of strings
or as a single string of values separated by spaces. The values are sorted so that longer
matches are attempted first; this ensures that a short value does
not mask a longer one that starts with the same characters. If �����}�(h�� can be passed as a list of strings
or as a single string of values separated by spaces. The values are sorted so that longer
matches are attempted first; this ensures that a short value does
not mask a longer one that starts with the same characters. If �hj�:ubj�)��}�(h�``caseless=True``�h]�h�
caseless=True�����}�(hhhj�:ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�:ubh�$,
will create an alternative set of �����}�(h�$,
will create an alternative set of �hj�:ubh�)��}�(h�CaselessLiteral_�h]�h�CaselessLiteral�����}�(hhhj�:ubah"}�(h$]�h&]�h)]�h+]�h-]��name��CaselessLiteral�h;j�uh/h�hj�:j�Kubh� tokens. If �����}�(h� tokens. If �hj�:ubj�)��}�(h�``as_keyword=True``�h]�h�as_keyword=True�����}�(hhhj�:ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�:ubh�,
�����}�(h�,
�hj�:ubj�)��}�(h�
``one_of``�h]�h�one_of�����}�(hhhj;ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�:ubh� will declare �����}�(h� will declare �hj�:ubh�)��}�(h�Keyword_�h]�h�Keyword�����}�(hhhj;ubah"}�(h$]�h&]�h)]�h+]�h-]��name��Keyword�h;juh/h�hj�:j�Kubh� expressions instead of �����}�(h� expressions instead of �hj�:ubh�)��}�(h�Literal_�h]�h�Literal�����}�(hhhj4;ubah"}�(h$]�h&]�h)]�h+]�h-]��name��Literal�h;ja	uh/h�hj�:j�Kubh�
 expressions.�����}�(h�
 expressions.�hj�:ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!Mhj�:ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�9hhh h=h!Nubj�)��}�(h��``dict_of(key, value)`` - convenience function for quickly declaring a
dictionary pattern of ``Dict(ZeroOrMore(Group(key + value)))``.
�h]�h_)��}�(h��``dict_of(key, value)`` - convenience function for quickly declaring a
dictionary pattern of ``Dict(ZeroOrMore(Group(key + value)))``.�h]�(j�)��}�(h�``dict_of(key, value)``�h]�h�dict_of(key, value)�����}�(hhhj];ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjY;ubh�F - convenience function for quickly declaring a
dictionary pattern of �����}�(h�F - convenience function for quickly declaring a
dictionary pattern of �hjY;ubj�)��}�(h�(``Dict(ZeroOrMore(Group(key + value)))``�h]�h�$Dict(ZeroOrMore(Group(key + value)))�����}�(hhhjp;ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjY;ubh�.�����}�(hjhjY;ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!MhjU;ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�9hhh h=h!Nubj�)��}�(hX�``make_html_tags(tag_str)`` and ``make_xml_tags(tag_str)`` - convenience
functions to create definitions of opening and closing tag expressions.  Returns
a pair of expressions, for the corresponding ``<tag>`` and ``</tag>`` strings.  Includes
support for attributes in the opening tag, such as ``<tag attr1="abc">`` - attributes
are returned as named results in the returned ParseResults_.  ``make_html_tags`` is less
restrictive than ``make_xml_tags``, especially with respect to case sensitivity.
�h]�h_)��}�(hX�``make_html_tags(tag_str)`` and ``make_xml_tags(tag_str)`` - convenience
functions to create definitions of opening and closing tag expressions.  Returns
a pair of expressions, for the corresponding ``<tag>`` and ``</tag>`` strings.  Includes
support for attributes in the opening tag, such as ``<tag attr1="abc">`` - attributes
are returned as named results in the returned ParseResults_.  ``make_html_tags`` is less
restrictive than ``make_xml_tags``, especially with respect to case sensitivity.�h]�(j�)��}�(h�``make_html_tags(tag_str)``�h]�h�make_html_tags(tag_str)�����}�(hhhj�;ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�;ubh� and �����}�(h� and �hj�;ubj�)��}�(h�``make_xml_tags(tag_str)``�h]�h�make_xml_tags(tag_str)�����}�(hhhj�;ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�;ubh�� - convenience
functions to create definitions of opening and closing tag expressions.  Returns
a pair of expressions, for the corresponding �����}�(h�� - convenience
functions to create definitions of opening and closing tag expressions.  Returns
a pair of expressions, for the corresponding �hj�;ubj�)��}�(h�	``<tag>``�h]�h�<tag>�����}�(hhhj�;ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�;ubh� and �����}�(hj�;hj�;ubj�)��}�(h�
``</tag>``�h]�h�</tag>�����}�(hhhj�;ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�;ubh�G strings.  Includes
support for attributes in the opening tag, such as �����}�(h�G strings.  Includes
support for attributes in the opening tag, such as �hj�;ubj�)��}�(h�``<tag attr1="abc">``�h]�h�<tag attr1="abc">�����}�(hhhj�;ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�;ubh�< - attributes
are returned as named results in the returned �����}�(h�< - attributes
are returned as named results in the returned �hj�;ubh�)��}�(h�
ParseResults_�h]�h�ParseResults�����}�(hhhj�;ubah"}�(h$]�h&]�h)]�h+]�h-]��name��ParseResults��Uh;j�uh/h�hj�;j�Kubh�.  �����}�(h�.  �hj�;ubj�)��}�(h�``make_html_tags``�h]�h�make_html_tags�����}�(hhhj	<ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�;ubh� is less
restrictive than �����}�(h� is less
restrictive than �hj�;ubj�)��}�(h�``make_xml_tags``�h]�h�
make_xml_tags�����}�(hhhj<ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�;ubh�., especially with respect to case sensitivity.�����}�(h�., especially with respect to case sensitivity.�hj�;ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!Mhj�;ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�9hhh h=h!Nubj�)��}�(hXt
``infix_notation(base_operand, operator_list)`` -
convenience function to define a grammar for parsing infix notation
expressions with a hierarchical precedence of operators. To use the ``infix_notation``
helper:

1.  Define the base "atom" operand term of the grammar.
    For this simple grammar, the smallest operand is either
    an integer or a variable.  This will be the first argument
    to the ``infix_notation`` method.

2.  Define a list of tuples for each level of operator
    precedence.  Each tuple is of the form
    ``(operand_expr, num_operands, right_left_assoc, parse_action)``, where:

    - ``operand_expr`` - the pyparsing expression for the operator;
      may also be a string, which will be converted to a Literal_; if
      ``None``, indicates an empty operator, such as the implied
      multiplication operation between 'm' and 'x' in "y = mx + b".

    - ``num_operands`` - the number of terms for this operator (must
      be 1, 2, or 3)

    - ``right_left_assoc`` is the indicator whether the operator is
      right or left associative, using the pyparsing-defined
      constants ``OpAssoc.RIGHT`` and ``OpAssoc.LEFT``.

    - ``parse_action`` is the parse action to be associated with
      expressions matching this operator expression (the
      ``parse_action`` tuple member may be omitted)

3.  Call ``infix_notation`` passing the operand expression and
    the operator precedence list, and save the returned value
    as the generated pyparsing expression.  You can then use
    this expression to parse input strings, or incorporate it
    into a larger, more complex grammar.

``infix_notation`` also supports optional arguments ``lpar`` and ``rpar``, to
parse groups with symbols other than "(" and ")". They may be passed as strings
(in which case they will be converted to ``Suppress`` objects, and suppressed from
the parsed results), or passed as pyparsing expressions, in which case they will
be kept as-is, and grouped with their contents.

For instance, to use "<" and ">" for grouping symbols, you could write::

      expr = infix_notation(int_expr,
          [
              (one_of("+ -"), 2, opAssoc.LEFT),
          ],
          lpar="<",
          rpar=">"
          )
      expr.parse_string("3 - <2 + 11>")

returning::

      [3, '-', [2, '+', 11]]

If the grouping symbols are to be retained, then pass them as pyparsing ``Literals``::

      expr = infix_notation(int_expr,
          [
              (one_of("+ -"), 2, opAssoc.LEFT),
          ],
          lpar=Literal("<"),
          rpar=Literal(">")
          )
      expr.parse_string("3 - <2 + 11>")

returning::

      [3, '-', ['<', [2, '+', 11], '>']]
�h]�(h_)��}�(h��``infix_notation(base_operand, operator_list)`` -
convenience function to define a grammar for parsing infix notation
expressions with a hierarchical precedence of operators. To use the ``infix_notation``
helper:�h]�(j�)��}�(h�/``infix_notation(base_operand, operator_list)``�h]�h�+infix_notation(base_operand, operator_list)�����}�(hhhjC<ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj?<ubh�� -
convenience function to define a grammar for parsing infix notation
expressions with a hierarchical precedence of operators. To use the �����}�(h�� -
convenience function to define a grammar for parsing infix notation
expressions with a hierarchical precedence of operators. To use the �hj?<ubj�)��}�(h�``infix_notation``�h]�h�infix_notation�����}�(hhhjV<ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj?<ubh�
helper:�����}�(h�
helper:�hj?<ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!Mhj;<ubje)��}�(hhh]�(j�)��}�(h��Define the base "atom" operand term of the grammar.
For this simple grammar, the smallest operand is either
an integer or a variable.  This will be the first argument
to the ``infix_notation`` method.
�h]�h_)��}�(h��Define the base "atom" operand term of the grammar.
For this simple grammar, the smallest operand is either
an integer or a variable.  This will be the first argument
to the ``infix_notation`` method.�h]�(h��Define the base “atom” operand term of the grammar.
For this simple grammar, the smallest operand is either
an integer or a variable.  This will be the first argument
to the �����}�(h��Define the base "atom" operand term of the grammar.
For this simple grammar, the smallest operand is either
an integer or a variable.  This will be the first argument
to the �hjv<ubj�)��}�(h�``infix_notation``�h]�h�infix_notation�����}�(hhhj<ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjv<ubh� method.�����}�(h� method.�hjv<ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!Mhjr<ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjo<ubj�)��}�(hXGDefine a list of tuples for each level of operator
precedence.  Each tuple is of the form
``(operand_expr, num_operands, right_left_assoc, parse_action)``, where:

- ``operand_expr`` - the pyparsing expression for the operator;
  may also be a string, which will be converted to a Literal_; if
  ``None``, indicates an empty operator, such as the implied
  multiplication operation between 'm' and 'x' in "y = mx + b".

- ``num_operands`` - the number of terms for this operator (must
  be 1, 2, or 3)

- ``right_left_assoc`` is the indicator whether the operator is
  right or left associative, using the pyparsing-defined
  constants ``OpAssoc.RIGHT`` and ``OpAssoc.LEFT``.

- ``parse_action`` is the parse action to be associated with
  expressions matching this operator expression (the
  ``parse_action`` tuple member may be omitted)
�h]�(h_)��}�(h��Define a list of tuples for each level of operator
precedence.  Each tuple is of the form
``(operand_expr, num_operands, right_left_assoc, parse_action)``, where:�h]�(h�ZDefine a list of tuples for each level of operator
precedence.  Each tuple is of the form
�����}�(h�ZDefine a list of tuples for each level of operator
precedence.  Each tuple is of the form
�hj�<ubj�)��}�(h�@``(operand_expr, num_operands, right_left_assoc, parse_action)``�h]�h�<(operand_expr, num_operands, right_left_assoc, parse_action)�����}�(hhhj�<ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�<ubh�, where:�����}�(h�, where:�hj�<ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M hj�<ubj�)��}�(hhh]�(j�)��}�(h��``operand_expr`` - the pyparsing expression for the operator;
may also be a string, which will be converted to a Literal_; if
``None``, indicates an empty operator, such as the implied
multiplication operation between 'm' and 'x' in "y = mx + b".
�h]�h_)��}�(h��``operand_expr`` - the pyparsing expression for the operator;
may also be a string, which will be converted to a Literal_; if
``None``, indicates an empty operator, such as the implied
multiplication operation between 'm' and 'x' in "y = mx + b".�h]�(j�)��}�(h�``operand_expr``�h]�h�operand_expr�����}�(hhhj�<ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�<ubh�a - the pyparsing expression for the operator;
may also be a string, which will be converted to a �����}�(h�a - the pyparsing expression for the operator;
may also be a string, which will be converted to a �hj�<ubh�)��}�(h�Literal_�h]�h�Literal�����}�(hhhj�<ubah"}�(h$]�h&]�h)]�h+]�h-]��name��Literal�h;ja	uh/h�hj�<j�Kubh�; if
�����}�(h�; if
�hj�<ubj�)��}�(h�``None``�h]�h�None�����}�(hhhj�<ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�<ubh�|, indicates an empty operator, such as the implied
multiplication operation between ‘m’ and ‘x’ in “y = mx + b”.�����}�(h�p, indicates an empty operator, such as the implied
multiplication operation between 'm' and 'x' in "y = mx + b".�hj�<ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M$hj�<ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�<ubj�)��}�(h�N``num_operands`` - the number of terms for this operator (must
be 1, 2, or 3)
�h]�h_)��}�(h�M``num_operands`` - the number of terms for this operator (must
be 1, 2, or 3)�h]�(j�)��}�(h�``num_operands``�h]�h�num_operands�����}�(hhhj=ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj=ubh�= - the number of terms for this operator (must
be 1, 2, or 3)�����}�(h�= - the number of terms for this operator (must
be 1, 2, or 3)�hj=ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M)hj=ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�<ubj�)��}�(h��``right_left_assoc`` is the indicator whether the operator is
right or left associative, using the pyparsing-defined
constants ``OpAssoc.RIGHT`` and ``OpAssoc.LEFT``.
�h]�h_)��}�(h��``right_left_assoc`` is the indicator whether the operator is
right or left associative, using the pyparsing-defined
constants ``OpAssoc.RIGHT`` and ``OpAssoc.LEFT``.�h]�(j�)��}�(h�``right_left_assoc``�h]�h�right_left_assoc�����}�(hhhjE=ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjA=ubh�k is the indicator whether the operator is
right or left associative, using the pyparsing-defined
constants �����}�(h�k is the indicator whether the operator is
right or left associative, using the pyparsing-defined
constants �hjA=ubj�)��}�(h�``OpAssoc.RIGHT``�h]�h�
OpAssoc.RIGHT�����}�(hhhjX=ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjA=ubh� and �����}�(h� and �hjA=ubj�)��}�(h�``OpAssoc.LEFT``�h]�h�OpAssoc.LEFT�����}�(hhhjk=ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjA=ubh�.�����}�(hjhjA=ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M,hj==ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�<ubj�)��}�(h��``parse_action`` is the parse action to be associated with
expressions matching this operator expression (the
``parse_action`` tuple member may be omitted)
�h]�h_)��}�(h��``parse_action`` is the parse action to be associated with
expressions matching this operator expression (the
``parse_action`` tuple member may be omitted)�h]�(j�)��}�(h�``parse_action``�h]�h�parse_action�����}�(hhhj�=ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�=ubh�^ is the parse action to be associated with
expressions matching this operator expression (the
�����}�(h�^ is the parse action to be associated with
expressions matching this operator expression (the
�hj�=ubj�)��}�(h�``parse_action``�h]�h�parse_action�����}�(hhhj�=ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�=ubh� tuple member may be omitted)�����}�(h� tuple member may be omitted)�hj�=ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M0hj�=ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�<ubeh"}�(h$]�h&]�h)]�h+]�h-]�j�j�uh/j�h h=h!M$hj�<ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjo<ubj�)��}�(hX
Call ``infix_notation`` passing the operand expression and
the operator precedence list, and save the returned value
as the generated pyparsing expression.  You can then use
this expression to parse input strings, or incorporate it
into a larger, more complex grammar.
�h]�h_)��}�(hXCall ``infix_notation`` passing the operand expression and
the operator precedence list, and save the returned value
as the generated pyparsing expression.  You can then use
this expression to parse input strings, or incorporate it
into a larger, more complex grammar.�h]�(h�Call �����}�(h�Call �hj�=ubj�)��}�(h�``infix_notation``�h]�h�infix_notation�����}�(hhhj�=ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�=ubh�� passing the operand expression and
the operator precedence list, and save the returned value
as the generated pyparsing expression.  You can then use
this expression to parse input strings, or incorporate it
into a larger, more complex grammar.�����}�(h�� passing the operand expression and
the operator precedence list, and save the returned value
as the generated pyparsing expression.  You can then use
this expression to parse input strings, or incorporate it
into a larger, more complex grammar.�hj�=ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M4hj�=ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjo<ubeh"}�(h$]�h&]�h)]�h+]�h-]�jjj hj!juh/jdhj;<ubh_)��}�(hXq``infix_notation`` also supports optional arguments ``lpar`` and ``rpar``, to
parse groups with symbols other than "(" and ")". They may be passed as strings
(in which case they will be converted to ``Suppress`` objects, and suppressed from
the parsed results), or passed as pyparsing expressions, in which case they will
be kept as-is, and grouped with their contents.�h]�(j�)��}�(h�``infix_notation``�h]�h�infix_notation�����}�(hhhj>ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj>ubh�" also supports optional arguments �����}�(h�" also supports optional arguments �hj>ubj�)��}�(h�``lpar``�h]�h�lpar�����}�(hhhj>ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj>ubh� and �����}�(h� and �hj>ubj�)��}�(h�``rpar``�h]�h�rpar�����}�(hhhj+>ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj>ubh��, to
parse groups with symbols other than “(” and “)”. They may be passed as strings
(in which case they will be converted to �����}�(h�~, to
parse groups with symbols other than "(" and ")". They may be passed as strings
(in which case they will be converted to �hj>ubj�)��}�(h�``Suppress``�h]�h�Suppress�����}�(hhhj>>ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj>ubh�� objects, and suppressed from
the parsed results), or passed as pyparsing expressions, in which case they will
be kept as-is, and grouped with their contents.�����}�(h�� objects, and suppressed from
the parsed results), or passed as pyparsing expressions, in which case they will
be kept as-is, and grouped with their contents.�hj>ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M:hj;<ubh_)��}�(h�HFor instance, to use "<" and ">" for grouping symbols, you could write::�h]�h�OFor instance, to use “<” and “>” for grouping symbols, you could write:�����}�(h�GFor instance, to use "<" and ">" for grouping symbols, you could write:�hjW>ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M@hj;<ubjb)��}�(h��expr = infix_notation(int_expr,
    [
        (one_of("+ -"), 2, opAssoc.LEFT),
    ],
    lpar="<",
    rpar=">"
    )
expr.parse_string("3 - <2 + 11>")�h]�h��expr = infix_notation(int_expr,
    [
        (one_of("+ -"), 2, opAssoc.LEFT),
    ],
    lpar="<",
    rpar=">"
    )
expr.parse_string("3 - <2 + 11>")�����}�(hhhjf>ubah"}�(h$]�h&]�h)]�h+]�h-]�jqjruh/jah!MBhj;<h h=ubh_)��}�(h�returning::�h]�h�
returning:�����}�(h�
returning:�hjt>ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!MKhj;<ubjb)��}�(h�[3, '-', [2, '+', 11]]�h]�h�[3, '-', [2, '+', 11]]�����}�(hhhj�>ubah"}�(h$]�h&]�h)]�h+]�h-]�jqjruh/jah!MMhj;<h h=ubh_)��}�(h�VIf the grouping symbols are to be retained, then pass them as pyparsing ``Literals``::�h]�(h�HIf the grouping symbols are to be retained, then pass them as pyparsing �����}�(h�HIf the grouping symbols are to be retained, then pass them as pyparsing �hj�>ubj�)��}�(h�``Literals``�h]�h�Literals�����}�(hhhj�>ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�>ubh�:�����}�(hj�!hj�>ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!MOhj;<ubjb)��}�(h��expr = infix_notation(int_expr,
    [
        (one_of("+ -"), 2, opAssoc.LEFT),
    ],
    lpar=Literal("<"),
    rpar=Literal(">")
    )
expr.parse_string("3 - <2 + 11>")�h]�h��expr = infix_notation(int_expr,
    [
        (one_of("+ -"), 2, opAssoc.LEFT),
    ],
    lpar=Literal("<"),
    rpar=Literal(">")
    )
expr.parse_string("3 - <2 + 11>")�����}�(hhhj�>ubah"}�(h$]�h&]�h)]�h+]�h-]�jqjruh/jah!MQhj;<h h=ubh_)��}�(h�returning::�h]�h�
returning:�����}�(h�
returning:�hj�>ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!MZhj;<ubjb)��}�(h�"[3, '-', ['<', [2, '+', 11], '>']]�h]�h�"[3, '-', ['<', [2, '+', 11], '>']]�����}�(hhhj�>ubah"}�(h$]�h&]�h)]�h+]�h-]�jqjruh/jah!M\hj;<h h=ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�9hhh h=h!Nubj�)��}�(hXw``match_previous_literal`` and ``match_previous_expr`` - function to define an
expression that matches the same content
as was parsed in a previous parse expression.  For instance::

      first = Word(nums)
      match_expr = first + ":" + match_previous_literal(first)

will match "1:1", but not "1:2".  Since this matches at the literal
level, this will also match the leading "1:1" in "1:10".

In contrast::

      first = Word(nums)
      match_expr = first + ":" + match_previous_expr(first)

will *not* match the leading "1:1" in "1:10"; the expressions are
evaluated first, and then compared, so "1" is compared with "10".
�h]�(h_)��}�(h��``match_previous_literal`` and ``match_previous_expr`` - function to define an
expression that matches the same content
as was parsed in a previous parse expression.  For instance::�h]�(j�)��}�(h�``match_previous_literal``�h]�h�match_previous_literal�����}�(hhhj�>ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�>ubh� and �����}�(h� and �hj�>ubj�)��}�(h�``match_previous_expr``�h]�h�match_previous_expr�����}�(hhhj�>ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�>ubh�~ - function to define an
expression that matches the same content
as was parsed in a previous parse expression.  For instance:�����}�(h�~ - function to define an
expression that matches the same content
as was parsed in a previous parse expression.  For instance:�hj�>ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M^hj�>ubjb)��}�(h�Kfirst = Word(nums)
match_expr = first + ":" + match_previous_literal(first)�h]�h�Kfirst = Word(nums)
match_expr = first + ":" + match_previous_literal(first)�����}�(hhhj?ubah"}�(h$]�h&]�h)]�h+]�h-]�jqjruh/jah!Mbhj�>h h=ubh_)��}�(h�|will match "1:1", but not "1:2".  Since this matches at the literal
level, this will also match the leading "1:1" in "1:10".�h]�h��will match “1:1”, but not “1:2”.  Since this matches at the literal
level, this will also match the leading “1:1” in “1:10”.�����}�(hj'?hj%?ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!Mehj�>ubh_)��}�(h�
In contrast::�h]�h�In contrast:�����}�(h�In contrast:�hj3?ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!Mhhj�>ubjb)��}�(h�Hfirst = Word(nums)
match_expr = first + ":" + match_previous_expr(first)�h]�h�Hfirst = Word(nums)
match_expr = first + ":" + match_previous_expr(first)�����}�(hhhjB?ubah"}�(h$]�h&]�h)]�h+]�h-]�jqjruh/jah!Mjhj�>h h=ubh_)��}�(h��will *not* match the leading "1:1" in "1:10"; the expressions are
evaluated first, and then compared, so "1" is compared with "10".�h]�(h�will �����}�(h�will �hjP?ubj)��}�(h�*not*�h]�h�not�����}�(hhhjY?ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/jhjP?ubh�� match the leading “1:1” in “1:10”; the expressions are
evaluated first, and then compared, so “1” is compared with “10”.�����}�(h�y match the leading "1:1" in "1:10"; the expressions are
evaluated first, and then compared, so "1" is compared with "10".�hjP?ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!Mmhj�>ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�9hhh h=h!Nubj�)��}�(hXZ``nested_expr(opener, closer, content=None, ignore_expr=quoted_string)`` - method for defining nested
lists enclosed in opening and closing delimiters.

- ``opener`` - opening character for a nested list (default="("); can also be a pyparsing expression

- ``closer`` - closing character for a nested list (default=")"); can also be a pyparsing expression

- ``content`` - expression for items within the nested lists (default=None)

- ``ignore_expr`` - expression for ignoring opening and closing delimiters (default=``quoted_string``)

If an expression is not provided for the content argument, the nested
expression will capture all whitespace-delimited content between delimiters
as a list of separate values.

Use the ``ignore_expr`` argument to define expressions that may contain
opening or closing characters that should not be treated as opening
or closing characters for nesting, such as ``quoted_string`` or a comment
expression.  Specify multiple expressions using an Or_ or MatchFirst_.
The default is ``quoted_string``, but if no expressions are to be ignored,
then pass ``None`` for this argument.

�h]�(h_)��}�(h��``nested_expr(opener, closer, content=None, ignore_expr=quoted_string)`` - method for defining nested
lists enclosed in opening and closing delimiters.�h]�(j�)��}�(h�H``nested_expr(opener, closer, content=None, ignore_expr=quoted_string)``�h]�h�Dnested_expr(opener, closer, content=None, ignore_expr=quoted_string)�����}�(hhhj�?ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj|?ubh�O - method for defining nested
lists enclosed in opening and closing delimiters.�����}�(h�O - method for defining nested
lists enclosed in opening and closing delimiters.�hj|?ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!Mphjx?ubj�)��}�(hhh]�(j�)��}�(h�c``opener`` - opening character for a nested list (default="("); can also be a pyparsing expression
�h]�h_)��}�(h�b``opener`` - opening character for a nested list (default="("); can also be a pyparsing expression�h]�(j�)��}�(h�
``opener``�h]�h�opener�����}�(hhhj�?ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�?ubh�\ - opening character for a nested list (default=”(“); can also be a pyparsing expression�����}�(h�X - opening character for a nested list (default="("); can also be a pyparsing expression�hj�?ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!Mshj�?ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�?ubj�)��}�(h�c``closer`` - closing character for a nested list (default=")"); can also be a pyparsing expression
�h]�h_)��}�(h�b``closer`` - closing character for a nested list (default=")"); can also be a pyparsing expression�h]�(j�)��}�(h�
``closer``�h]�h�closer�����}�(hhhj�?ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�?ubh�\ - closing character for a nested list (default=”)”); can also be a pyparsing expression�����}�(h�X - closing character for a nested list (default=")"); can also be a pyparsing expression�hj�?ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!Muhj�?ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�?ubj�)��}�(h�J``content`` - expression for items within the nested lists (default=None)
�h]�h_)��}�(h�I``content`` - expression for items within the nested lists (default=None)�h]�(j�)��}�(h�``content``�h]�h�content�����}�(hhhj�?ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�?ubh�> - expression for items within the nested lists (default=None)�����}�(h�> - expression for items within the nested lists (default=None)�hj�?ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!Mwhj�?ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�?ubj�)��}�(h�e``ignore_expr`` - expression for ignoring opening and closing delimiters (default=``quoted_string``)
�h]�h_)��}�(h�d``ignore_expr`` - expression for ignoring opening and closing delimiters (default=``quoted_string``)�h]�(j�)��}�(h�``ignore_expr``�h]�h�ignore_expr�����}�(hhhj@ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj@ubh�U - expression for ignoring opening and closing delimiters (default=``quoted_string``)�����}�(h�U - expression for ignoring opening and closing delimiters (default=``quoted_string``)�hj@ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!Myhj@ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�?ubeh"}�(h$]�h&]�h)]�h+]�h-]�j�j�uh/j�h h=h!Mshjx?ubh_)��}�(h��If an expression is not provided for the content argument, the nested
expression will capture all whitespace-delimited content between delimiters
as a list of separate values.�h]�h��If an expression is not provided for the content argument, the nested
expression will capture all whitespace-delimited content between delimiters
as a list of separate values.�����}�(hj@@hj>@ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M{hjx?ubh_)��}�(hX�Use the ``ignore_expr`` argument to define expressions that may contain
opening or closing characters that should not be treated as opening
or closing characters for nesting, such as ``quoted_string`` or a comment
expression.  Specify multiple expressions using an Or_ or MatchFirst_.
The default is ``quoted_string``, but if no expressions are to be ignored,
then pass ``None`` for this argument.�h]�(h�Use the �����}�(h�Use the �hjL@ubj�)��}�(h�``ignore_expr``�h]�h�ignore_expr�����}�(hhhjU@ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjL@ubh�� argument to define expressions that may contain
opening or closing characters that should not be treated as opening
or closing characters for nesting, such as �����}�(h�� argument to define expressions that may contain
opening or closing characters that should not be treated as opening
or closing characters for nesting, such as �hjL@ubj�)��}�(h�``quoted_string``�h]�h�
quoted_string�����}�(hhhjh@ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjL@ubh�A or a comment
expression.  Specify multiple expressions using an �����}�(h�A or a comment
expression.  Specify multiple expressions using an �hjL@ubh�)��}�(h�Or_�h]�h�Or�����}�(hhhj{@ubah"}�(h$]�h&]�h)]�h+]�h-]��name��Or�h;j�
uh/h�hjL@j�Kubh� or �����}�(h� or �hjL@ubh�)��}�(h�MatchFirst_�h]�h�
MatchFirst�����}�(hhhj�@ubah"}�(h$]�h&]�h)]�h+]�h-]��name��
MatchFirst�h;j�
uh/h�hjL@j�Kubh�.
The default is �����}�(h�.
The default is �hjL@ubj�)��}�(h�``quoted_string``�h]�h�
quoted_string�����}�(hhhj�@ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjL@ubh�5, but if no expressions are to be ignored,
then pass �����}�(h�5, but if no expressions are to be ignored,
then pass �hjL@ubj�)��}�(h�``None``�h]�h�None�����}�(hhhj�@ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjL@ubh� for this argument.�����}�(h� for this argument.�hjL@ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!Mhjx?ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�9hhh h=h!Nubj�)��}�(hX�``IndentedBlock(statement_expr, recursive=False, grouped=True)`` -
function to define an indented block of statements, similar to
indentation-based blocking in Python source code:

- ``statement_expr`` - the expression defining a statement that
  will be found in the indented block; a valid ``IndentedBlock``
  must contain at least 1 matching ``statement_expr``

- ``recursive`` - flag indicating whether the IndentedBlock can
  itself contain nested sub-blocks of the same type of expression
  (default=False)

- ``grouped`` - flag indicating whether the tokens returned from
  parsing the IndentedBlock should be grouped (default=True)
�h]�(h_)��}�(h��``IndentedBlock(statement_expr, recursive=False, grouped=True)`` -
function to define an indented block of statements, similar to
indentation-based blocking in Python source code:�h]�(j�)��}�(h�@``IndentedBlock(statement_expr, recursive=False, grouped=True)``�h]�h�<IndentedBlock(statement_expr, recursive=False, grouped=True)�����}�(hhhj�@ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�@ubh�s -
function to define an indented block of statements, similar to
indentation-based blocking in Python source code:�����}�(h�s -
function to define an indented block of statements, similar to
indentation-based blocking in Python source code:�hj�@ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M�hj�@ubj�)��}�(hhh]�(j�)��}�(h��``statement_expr`` - the expression defining a statement that
will be found in the indented block; a valid ``IndentedBlock``
must contain at least 1 matching ``statement_expr``
�h]�h_)��}�(h��``statement_expr`` - the expression defining a statement that
will be found in the indented block; a valid ``IndentedBlock``
must contain at least 1 matching ``statement_expr``�h]�(j�)��}�(h�``statement_expr``�h]�h�statement_expr�����}�(hhhjAubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�@ubh�Y - the expression defining a statement that
will be found in the indented block; a valid �����}�(h�Y - the expression defining a statement that
will be found in the indented block; a valid �hj�@ubj�)��}�(h�``IndentedBlock``�h]�h�
IndentedBlock�����}�(hhhjAubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�@ubh�"
must contain at least 1 matching �����}�(h�"
must contain at least 1 matching �hj�@ubj�)��}�(h�``statement_expr``�h]�h�statement_expr�����}�(hhhj)Aubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�@ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M�hj�@ubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�@ubj�)��}�(h��``recursive`` - flag indicating whether the IndentedBlock can
itself contain nested sub-blocks of the same type of expression
(default=False)
�h]�h_)��}�(h��``recursive`` - flag indicating whether the IndentedBlock can
itself contain nested sub-blocks of the same type of expression
(default=False)�h]�(j�)��}�(h�
``recursive``�h]�h�	recursive�����}�(hhhjKAubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjGAubh�� - flag indicating whether the IndentedBlock can
itself contain nested sub-blocks of the same type of expression
(default=False)�����}�(h�� - flag indicating whether the IndentedBlock can
itself contain nested sub-blocks of the same type of expression
(default=False)�hjGAubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M�hjCAubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�@ubj�)��}�(h�z``grouped`` - flag indicating whether the tokens returned from
parsing the IndentedBlock should be grouped (default=True)
�h]�h_)��}�(h�y``grouped`` - flag indicating whether the tokens returned from
parsing the IndentedBlock should be grouped (default=True)�h]�(j�)��}�(h�``grouped``�h]�h�grouped�����}�(hhhjrAubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjnAubh�n - flag indicating whether the tokens returned from
parsing the IndentedBlock should be grouped (default=True)�����}�(h�n - flag indicating whether the tokens returned from
parsing the IndentedBlock should be grouped (default=True)�hjnAubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M�hjjAubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�@ubeh"}�(h$]�h&]�h)]�h+]�h-]�j�j�uh/j�h h=h!M�hj�@ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�9hhh Nh!Nubeh"}�(h$]�h&]�h)]�h+]�h-]�j�j�uh/j�h h=h!M�hj�9hhubj�)��}�(h�.. _originalTextFor:�h]�h"}�(h$]�h&]�h)]�h+]�h-]�h;�originaltextfor�uh/j�h!M�hj�9hhh h=ubj�)��}�(hhh]�(j�)��}�(hX	``original_text_for(expr)`` - helper function to preserve the originally parsed text, regardless of any
token processing or conversion done by the contained expression.  For instance, the following expression::

      full_name = Word(alphas) + Word(alphas)

will return the parse of "John Smith" as ['John', 'Smith'].  In some applications, the actual name as it
was given in the input string is what is desired.  To do this, use ``original_text_for``::

      full_name = original_text_for(Word(alphas) + Word(alphas))
�h]�(h_)��}�(h��``original_text_for(expr)`` - helper function to preserve the originally parsed text, regardless of any
token processing or conversion done by the contained expression.  For instance, the following expression::�h]�(j�)��}�(h�``original_text_for(expr)``�h]�h�original_text_for(expr)�����}�(hhhj�Aubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�Aubh�� - helper function to preserve the originally parsed text, regardless of any
token processing or conversion done by the contained expression.  For instance, the following expression:�����}�(h�� - helper function to preserve the originally parsed text, regardless of any
token processing or conversion done by the contained expression.  For instance, the following expression:�hj�Aubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M�hj�Aubjb)��}�(h�'full_name = Word(alphas) + Word(alphas)�h]�h�'full_name = Word(alphas) + Word(alphas)�����}�(hhhj�Aubah"}�(h$]�h&]�h)]�h+]�h-]�jqjruh/jah!M�hj�Ah h=ubh_)��}�(h��will return the parse of "John Smith" as ['John', 'Smith'].  In some applications, the actual name as it
was given in the input string is what is desired.  To do this, use ``original_text_for``::�h]�(h��will return the parse of “John Smith” as [‘John’, ‘Smith’].  In some applications, the actual name as it
was given in the input string is what is desired.  To do this, use �����}�(h��will return the parse of "John Smith" as ['John', 'Smith'].  In some applications, the actual name as it
was given in the input string is what is desired.  To do this, use �hj�Aubj�)��}�(h�``original_text_for``�h]�h�original_text_for�����}�(hhhj�Aubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�Aubh�:�����}�(hj�!hj�Aubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M�hj�Aubjb)��}�(h�:full_name = original_text_for(Word(alphas) + Word(alphas))�h]�h�:full_name = original_text_for(Word(alphas) + Word(alphas))�����}�(hhhjBubah"}�(h$]�h&]�h)]�h+]�h-]�jqjruh/jah!M�hj�Ah h=ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�Ahhh h=h!Nubj�)��}�(h��``ungroup(expr)`` - function to "ungroup" returned tokens; useful
to undo the default behavior of And_ to always group the returned tokens, even
if there is only one in the list.
�h]�h_)��}�(h��``ungroup(expr)`` - function to "ungroup" returned tokens; useful
to undo the default behavior of And_ to always group the returned tokens, even
if there is only one in the list.�h]�(j�)��}�(h�``ungroup(expr)``�h]�h�
ungroup(expr)�����}�(hhhjBubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjBubh�U - function to “ungroup” returned tokens; useful
to undo the default behavior of �����}�(h�Q - function to "ungroup" returned tokens; useful
to undo the default behavior of �hjBubh�)��}�(h�And_�h]�h�And�����}�(hhhj0Bubah"}�(h$]�h&]�h)]�h+]�h-]��name��And�h;j�uh/h�hjBj�Kubh�L to always group the returned tokens, even
if there is only one in the list.�����}�(h�L to always group the returned tokens, even
if there is only one in the list.�hjBubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M�hjBubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�Ahhh h=h!Nubj�)��}�(h��``lineno(loc, string)`` - function to give the line number of the
location within the string; the first line is line 1, newlines
start new rows
�h]�h_)��}�(h��``lineno(loc, string)`` - function to give the line number of the
location within the string; the first line is line 1, newlines
start new rows�h]�(j�)��}�(h�``lineno(loc, string)``�h]�h�lineno(loc, string)�����}�(hhhjYBubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjUBubh�x - function to give the line number of the
location within the string; the first line is line 1, newlines
start new rows�����}�(h�x - function to give the line number of the
location within the string; the first line is line 1, newlines
start new rows�hjUBubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M�hjQBubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�Ahhh h=h!Nubj�)��}�(h��``col(loc, string)`` - function to give the column number of the
location within the string; the first column is column 1,
newlines reset the column number to 1
�h]�h_)��}�(h��``col(loc, string)`` - function to give the column number of the
location within the string; the first column is column 1,
newlines reset the column number to 1�h]�(j�)��}�(h�``col(loc, string)``�h]�h�col(loc, string)�����}�(hhhj�Bubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj|Bubh�� - function to give the column number of the
location within the string; the first column is column 1,
newlines reset the column number to 1�����}�(h�� - function to give the column number of the
location within the string; the first column is column 1,
newlines reset the column number to 1�hj|Bubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M�hjxBubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�Ahhh h=h!Nubj�)��}�(h��``line(loc, string)`` - function to retrieve the line of text
representing ``lineno(loc, string)``; useful when printing out diagnostic
messages for exceptions
�h]�h_)��}�(h��``line(loc, string)`` - function to retrieve the line of text
representing ``lineno(loc, string)``; useful when printing out diagnostic
messages for exceptions�h]�(j�)��}�(h�``line(loc, string)``�h]�h�line(loc, string)�����}�(hhhj�Bubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�Bubh�6 - function to retrieve the line of text
representing �����}�(h�6 - function to retrieve the line of text
representing �hj�Bubj�)��}�(h�``lineno(loc, string)``�h]�h�lineno(loc, string)�����}�(hhhj�Bubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�Bubh�=; useful when printing out diagnostic
messages for exceptions�����}�(h�=; useful when printing out diagnostic
messages for exceptions�hj�Bubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M�hj�Bubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�Ahhh h=h!Nubj�)��}�(hXW``srange(range_spec)`` - function to define a string of characters,
given a string of the form used by regexp string ranges, such as ``"[0-9]"`` for
all numeric digits, ``"[A-Z_]"`` for uppercase characters plus underscore, and
so on (note that ``range_spec`` does not include support for generic regular
expressions, just string range specs)
�h]�h_)��}�(hXV``srange(range_spec)`` - function to define a string of characters,
given a string of the form used by regexp string ranges, such as ``"[0-9]"`` for
all numeric digits, ``"[A-Z_]"`` for uppercase characters plus underscore, and
so on (note that ``range_spec`` does not include support for generic regular
expressions, just string range specs)�h]�(j�)��}�(h�``srange(range_spec)``�h]�h�srange(range_spec)�����}�(hhhj�Bubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�Bubh�o - function to define a string of characters,
given a string of the form used by regexp string ranges, such as �����}�(h�o - function to define a string of characters,
given a string of the form used by regexp string ranges, such as �hj�Bubj�)��}�(h�``"[0-9]"``�h]�h�"[0-9]"�����}�(hhhj�Bubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�Bubh� for
all numeric digits, �����}�(h� for
all numeric digits, �hj�Bubj�)��}�(h�``"[A-Z_]"``�h]�h�"[A-Z_]"�����}�(hhhjCubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�Bubh�@ for uppercase characters plus underscore, and
so on (note that �����}�(h�@ for uppercase characters plus underscore, and
so on (note that �hj�Bubj�)��}�(h�``range_spec``�h]�h�
range_spec�����}�(hhhjCubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�Bubh�S does not include support for generic regular
expressions, just string range specs)�����}�(h�S does not include support for generic regular
expressions, just string range specs)�hj�Bubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M�hj�Bubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�Ahhh h=h!Nubj�)��}�(h��``trace_parse_action(fn)`` - decorator function to debug parse actions. Lists
each call, called arguments, and return value or exception


�h]�h_)��}�(h��``trace_parse_action(fn)`` - decorator function to debug parse actions. Lists
each call, called arguments, and return value or exception�h]�(j�)��}�(h�``trace_parse_action(fn)``�h]�h�trace_parse_action(fn)�����}�(hhhjACubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj=Cubh�n - decorator function to debug parse actions. Lists
each call, called arguments, and return value or exception�����}�(h�n - decorator function to debug parse actions. Lists
each call, called arguments, and return value or exception�hj=Cubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M�hj9Cubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�Ahhh h=h!Nubeh"}�(h$]�j�Aah&]�h)]��originaltextfor�ah+]�h-]�j�j�uh/j�h h=h!M�hj�9hhjL}�jdCj�AsjN}�j�Aj�Asubeh"}�(h$]�j�ah&]�h)]��helper methods�ah+]�h-]�uh/h	hj�9hhh h=h!M�ubh
)��}�(hhh]�(h)��}�(hj�h]�(h)��}�(hhh]�h�1.3.2   �����}�(hhhjvChhh Nh!Nubah"}�(h$]�h&]�h(ah)]�h+]�h-]�uh/hhjsChhh Nh!Nubh�Helper parse actions�����}�(hj�hjsChhh Nh!Nubeh"}�(h$]�h&]�h)]�h+]�h-]�h:Kh;j�uh/hhjpChhh h=h!M�ubj�)��}�(hhh]�(j�)��}�(h��``remove_quotes`` - removes the first and last characters of a quoted string;
useful to remove the delimiting quotes from quoted strings
�h]�h_)��}�(h��``remove_quotes`` - removes the first and last characters of a quoted string;
useful to remove the delimiting quotes from quoted strings�h]�(j�)��}�(h�``remove_quotes``�h]�h�
remove_quotes�����}�(hhhj�Cubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�Cubh�w - removes the first and last characters of a quoted string;
useful to remove the delimiting quotes from quoted strings�����}�(h�w - removes the first and last characters of a quoted string;
useful to remove the delimiting quotes from quoted strings�hj�Cubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M�hj�Cubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�Chhh h=h!Nubj�)��}�(h��``replace_with(repl_string)`` - returns a parse action that simply returns the
``repl_string``; useful when using ``transform_string``, or converting HTML entities, as in::

    nbsp = Literal("&nbsp;").set_parse_action(replace_with("<BLANK>"))
�h]�(h_)��}�(h��``replace_with(repl_string)`` - returns a parse action that simply returns the
``repl_string``; useful when using ``transform_string``, or converting HTML entities, as in::�h]�(j�)��}�(h�``replace_with(repl_string)``�h]�h�replace_with(repl_string)�����}�(hhhj�Cubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�Cubh�2 - returns a parse action that simply returns the
�����}�(h�2 - returns a parse action that simply returns the
�hj�Cubj�)��}�(h�``repl_string``�h]�h�repl_string�����}�(hhhj�Cubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�Cubh�; useful when using �����}�(h�; useful when using �hj�Cubj�)��}�(h�``transform_string``�h]�h�transform_string�����}�(hhhj�Cubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�Cubh�%, or converting HTML entities, as in:�����}�(h�%, or converting HTML entities, as in:�hj�Cubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M�hj�Cubjb)��}�(h�Bnbsp = Literal("&nbsp;").set_parse_action(replace_with("<BLANK>"))�h]�h�Bnbsp = Literal("&nbsp;").set_parse_action(replace_with("<BLANK>"))�����}�(hhhj�Cubah"}�(h$]�h&]�h)]�h+]�h-]�jqjruh/jah!M�hj�Ch h=ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�Chhh h=h!Nubj�)��}�(h��``original_text_for``- restores any internal whitespace or suppressed
text within the tokens for a matched parse
expression.  This is especially useful when defining expressions
for ``scan_string`` or ``transform_string`` applications.
�h]�h_)��}�(h��``original_text_for``- restores any internal whitespace or suppressed
text within the tokens for a matched parse
expression.  This is especially useful when defining expressions
for ``scan_string`` or ``transform_string`` applications.�h]�(j�)��}�(h�``original_text_for``�h]�h�original_text_for�����}�(hhhjDubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjDubh��- restores any internal whitespace or suppressed
text within the tokens for a matched parse
expression.  This is especially useful when defining expressions
for �����}�(h��- restores any internal whitespace or suppressed
text within the tokens for a matched parse
expression.  This is especially useful when defining expressions
for �hjDubj�)��}�(h�``scan_string``�h]�h�scan_string�����}�(hhhj-Dubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjDubh� or �����}�(h� or �hjDubj�)��}�(h�``transform_string``�h]�h�transform_string�����}�(hhhj@Dubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjDubh� applications.�����}�(h� applications.�hjDubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M�hjDubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�Chhh h=h!Nubj�)��}�(hX�``with_attribute(*args, **kwargs)`` - helper to create a validating parse action to be used with start tags created
with ``make_xml_tags`` or ``make_html_tags``. Use ``with_attribute`` to qualify a starting tag
with a required attribute value, to avoid false matches on common tags such as
``<TD>`` or ``<DIV>``.

``with_attribute`` can be called with:

- keyword arguments, as in ``(class="Customer", align="right")``, or

- a list of name-value tuples, as in ``(("ns1:class", "Customer"), ("ns2:align", "right"))``

An attribute can be specified to have the special value
``with_attribute.ANY_VALUE``, which will match any value - use this to
ensure that an attribute is present but any attribute value is
acceptable.
�h]�(h_)��}�(hX8``with_attribute(*args, **kwargs)`` - helper to create a validating parse action to be used with start tags created
with ``make_xml_tags`` or ``make_html_tags``. Use ``with_attribute`` to qualify a starting tag
with a required attribute value, to avoid false matches on common tags such as
``<TD>`` or ``<DIV>``.�h]�(j�)��}�(h�#``with_attribute(*args, **kwargs)``�h]�h�with_attribute(*args, **kwargs)�����}�(hhhjgDubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjcDubh�V - helper to create a validating parse action to be used with start tags created
with �����}�(h�V - helper to create a validating parse action to be used with start tags created
with �hjcDubj�)��}�(h�``make_xml_tags``�h]�h�
make_xml_tags�����}�(hhhjzDubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjcDubh� or �����}�(h� or �hjcDubj�)��}�(h�``make_html_tags``�h]�h�make_html_tags�����}�(hhhj�Dubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjcDubh�. Use �����}�(h�. Use �hjcDubj�)��}�(h�``with_attribute``�h]�h�with_attribute�����}�(hhhj�Dubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjcDubh�j to qualify a starting tag
with a required attribute value, to avoid false matches on common tags such as
�����}�(h�j to qualify a starting tag
with a required attribute value, to avoid false matches on common tags such as
�hjcDubj�)��}�(h�``<TD>``�h]�h�<TD>�����}�(hhhj�Dubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjcDubh� or �����}�(hj�DhjcDubj�)��}�(h�	``<DIV>``�h]�h�<DIV>�����}�(hhhj�Dubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjcDubh�.�����}�(hjhjcDubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M�hj_Dubh_)��}�(h�&``with_attribute`` can be called with:�h]�(j�)��}�(h�``with_attribute``�h]�h�with_attribute�����}�(hhhj�Dubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�Dubh� can be called with:�����}�(h� can be called with:�hj�Dubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M�hj_Dubj�)��}�(hhh]�(j�)��}�(h�Ckeyword arguments, as in ``(class="Customer", align="right")``, or
�h]�h_)��}�(h�Bkeyword arguments, as in ``(class="Customer", align="right")``, or�h]�(h�keyword arguments, as in �����}�(h�keyword arguments, as in �hjEubj�)��}�(h�%``(class="Customer", align="right")``�h]�h�!(class="Customer", align="right")�����}�(hhhj
Eubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjEubh�, or�����}�(h�, or�hjEubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M�hj�Dubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�Dubj�)��}�(h�[a list of name-value tuples, as in ``(("ns1:class", "Customer"), ("ns2:align", "right"))``
�h]�h_)��}�(h�Za list of name-value tuples, as in ``(("ns1:class", "Customer"), ("ns2:align", "right"))``�h]�(h�#a list of name-value tuples, as in �����}�(h�#a list of name-value tuples, as in �hj-Eubj�)��}�(h�7``(("ns1:class", "Customer"), ("ns2:align", "right"))``�h]�h�3(("ns1:class", "Customer"), ("ns2:align", "right"))�����}�(hhhj6Eubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj-Eubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M�hj)Eubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�Dubeh"}�(h$]�h&]�h)]�h+]�h-]�j�j�uh/j�h h=h!M�hj_Dubh_)��}�(h��An attribute can be specified to have the special value
``with_attribute.ANY_VALUE``, which will match any value - use this to
ensure that an attribute is present but any attribute value is
acceptable.�h]�(h�8An attribute can be specified to have the special value
�����}�(h�8An attribute can be specified to have the special value
�hjVEubj�)��}�(h�``with_attribute.ANY_VALUE``�h]�h�with_attribute.ANY_VALUE�����}�(hhhj_Eubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjVEubh�u, which will match any value - use this to
ensure that an attribute is present but any attribute value is
acceptable.�����}�(h�u, which will match any value - use this to
ensure that an attribute is present but any attribute value is
acceptable.�hjVEubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M�hj_Dubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�Chhh h=h!Nubj�)��}�(h��``match_only_at_col(column_number)`` - a parse action that verifies that
an expression was matched at a particular column, raising a
``ParseException`` if matching at a different column number; useful when parsing
tabular data
�h]�h_)��}�(h��``match_only_at_col(column_number)`` - a parse action that verifies that
an expression was matched at a particular column, raising a
``ParseException`` if matching at a different column number; useful when parsing
tabular data�h]�(j�)��}�(h�$``match_only_at_col(column_number)``�h]�h� match_only_at_col(column_number)�����}�(hhhj�Eubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�Eubh�a - a parse action that verifies that
an expression was matched at a particular column, raising a
�����}�(h�a - a parse action that verifies that
an expression was matched at a particular column, raising a
�hj�Eubj�)��}�(h�``ParseException``�h]�h�ParseException�����}�(hhhj�Eubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�Eubh�K if matching at a different column number; useful when parsing
tabular data�����}�(h�K if matching at a different column number; useful when parsing
tabular data�hj�Eubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M�hj~Eubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�Chhh h=h!Nubj�)��}�(h�K``common.convert_to_integer()`` - converts all matched tokens to uppercase
�h]�h_)��}�(h�J``common.convert_to_integer()`` - converts all matched tokens to uppercase�h]�(j�)��}�(h�``common.convert_to_integer()``�h]�h�common.convert_to_integer()�����}�(hhhj�Eubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�Eubh�+ - converts all matched tokens to uppercase�����}�(h�+ - converts all matched tokens to uppercase�hj�Eubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M�hj�Eubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�Chhh h=h!Nubj�)��}�(h�I``common.convert_to_float()`` - converts all matched tokens to uppercase
�h]�h_)��}�(h�H``common.convert_to_float()`` - converts all matched tokens to uppercase�h]�(j�)��}�(h�``common.convert_to_float()``�h]�h�common.convert_to_float()�����}�(hhhj�Eubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�Eubh�+ - converts all matched tokens to uppercase�����}�(h�+ - converts all matched tokens to uppercase�hj�Eubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M�hj�Eubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�Chhh h=h!Nubj�)��}�(h�I``common.convert_to_date()`` - converts matched token to a datetime.date
�h]�h_)��}�(h�H``common.convert_to_date()`` - converts matched token to a datetime.date�h]�(j�)��}�(h�``common.convert_to_date()``�h]�h�common.convert_to_date()�����}�(hhhjFubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj
Fubh�, - converts matched token to a datetime.date�����}�(h�, - converts matched token to a datetime.date�hj
Fubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M�hjFubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�Chhh h=h!Nubj�)��}�(h�Q``common.convert_to_datetime()`` - converts matched token to a datetime.datetime
�h]�h_)��}�(h�P``common.convert_to_datetime()`` - converts matched token to a datetime.datetime�h]�(j�)��}�(h� ``common.convert_to_datetime()``�h]�h�common.convert_to_datetime()�����}�(hhhj5Fubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj1Fubh�0 - converts matched token to a datetime.datetime�����}�(h�0 - converts matched token to a datetime.datetime�hj1Fubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M�hj-Fubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�Chhh h=h!Nubj�)��}�(h�D``common.strip_html_tags()`` - removes HTML tags from matched token
�h]�h_)��}�(h�C``common.strip_html_tags()`` - removes HTML tags from matched token�h]�(j�)��}�(h�``common.strip_html_tags()``�h]�h�common.strip_html_tags()�����}�(hhhj\Fubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjXFubh�' - removes HTML tags from matched token�����}�(h�' - removes HTML tags from matched token�hjXFubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M�hjTFubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�Chhh h=h!Nubj�)��}�(h�H``common.downcase_tokens()`` - converts all matched tokens to lowercase
�h]�h_)��}�(h�G``common.downcase_tokens()`` - converts all matched tokens to lowercase�h]�(j�)��}�(h�``common.downcase_tokens()``�h]�h�common.downcase_tokens()�����}�(hhhj�Fubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjFubh�+ - converts all matched tokens to lowercase�����}�(h�+ - converts all matched tokens to lowercase�hjFubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M�hj{Fubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�Chhh h=h!Nubj�)��}�(h�G``common.upcase_tokens()`` - converts all matched tokens to uppercase

�h]�h_)��}�(h�E``common.upcase_tokens()`` - converts all matched tokens to uppercase�h]�(j�)��}�(h�``common.upcase_tokens()``�h]�h�common.upcase_tokens()�����}�(hhhj�Fubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�Fubh�+ - converts all matched tokens to uppercase�����}�(h�+ - converts all matched tokens to uppercase�hj�Fubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M�hj�Fubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�Chhh h=h!Nubeh"}�(h$]�h&]�h)]�h+]�h-]�j�j�uh/j�h h=h!M�hjpChhubeh"}�(h$]�j�ah&]�h)]��helper parse actions�ah+]�h-]�uh/h	hj�9hhh h=h!M�ubh
)��}�(hhh]�(h)��}�(hj	h]�(h)��}�(hhh]�h�1.3.3   �����}�(hhhj�Fhhh Nh!Nubah"}�(h$]�h&]�h(ah)]�h+]�h-]�uh/hhj�Fhhh Nh!Nubh�!Common string and token constants�����}�(hj	hj�Fhhh Nh!Nubeh"}�(h$]�h&]�h)]�h+]�h-]�h:Kh;juh/hhj�Fhhh h=h!M�ubj�)��}�(hhh]�(j�)��}�(h�(``alphas`` - same as ``string.letters``
�h]�h_)��}�(h�'``alphas`` - same as ``string.letters``�h]�(j�)��}�(h�
``alphas``�h]�h�alphas�����}�(hhhj�Fubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�Fubh� - same as �����}�(h� - same as �hj�Fubj�)��}�(h�``string.letters``�h]�h�string.letters�����}�(hhhjGubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�Fubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M�hj�Fubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�Fhhh h=h!Nubj�)��}�(h�%``nums`` - same as ``string.digits``
�h]�h_)��}�(h�$``nums`` - same as ``string.digits``�h]�(j�)��}�(h�``nums``�h]�h�nums�����}�(hhhj3Gubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj/Gubh� - same as �����}�(h� - same as �hj/Gubj�)��}�(h�``string.digits``�h]�h�
string.digits�����}�(hhhjFGubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj/Gubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M�hj+Gubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�Fhhh h=h!Nubj�)��}�(h�6``alphanums`` - a string containing ``alphas + nums``
�h]�h_)��}�(h�5``alphanums`` - a string containing ``alphas + nums``�h]�(j�)��}�(h�
``alphanums``�h]�h�	alphanums�����}�(hhhjhGubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjdGubh� - a string containing �����}�(h� - a string containing �hjdGubj�)��}�(h�``alphas + nums``�h]�h�
alphas + nums�����}�(hhhj{Gubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjdGubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M�hj`Gubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�Fhhh h=h!Nubj�)��}�(h��``alphas8bit`` - a string containing alphabetic 8-bit characters::

  ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþ
�h]�(h_)��}�(h�B``alphas8bit`` - a string containing alphabetic 8-bit characters::�h]�(j�)��}�(h�``alphas8bit``�h]�h�
alphas8bit�����}�(hhhj�Gubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�Gubh�3 - a string containing alphabetic 8-bit characters:�����}�(h�3 - a string containing alphabetic 8-bit characters:�hj�Gubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M�hj�Gubjb)��}�(h�zÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþ�h]�h�zÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþ�����}�(hhhj�Gubah"}�(h$]�h&]�h)]�h+]�h-]�jqjruh/jah!M�hj�Gh h=ubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�Fhhh h=h!Nubj�)��}�(h�S``printables`` - same as ``string.printable``, minus the space (``' '``) character
�h]�h_)��}�(h�R``printables`` - same as ``string.printable``, minus the space (``' '``) character�h]�(j�)��}�(h�``printables``�h]�h�
printables�����}�(hhhj�Gubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�Gubh� - same as �����}�(h� - same as �hj�Gubj�)��}�(h�``string.printable``�h]�h�string.printable�����}�(hhhj�Gubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�Gubh�, minus the space (�����}�(h�, minus the space (�hj�Gubj�)��}�(h�``' '``�h]�h�' '�����}�(hhhj�Gubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�Gubh�) character�����}�(h�) character�hj�Gubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M�hj�Gubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�Fhhh h=h!Nubj�)��}�(h�4``empty`` - a global ``Empty()``; will always match
�h]�h_)��}�(h�3``empty`` - a global ``Empty()``; will always match�h]�(j�)��}�(h�	``empty``�h]�h�empty�����}�(hhhjHubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjHubh� - a global �����}�(h� - a global �hjHubj�)��}�(h�``Empty()``�h]�h�Empty()�����}�(hhhj2Hubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjHubh�; will always match�����}�(h�; will always match�hjHubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!MhjHubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�Fhhh h=h!Nubj�)��}�(h�h``sgl_quoted_string`` - a string of characters enclosed in 's; may
include whitespace, but not newlines
�h]�h_)��}�(h�g``sgl_quoted_string`` - a string of characters enclosed in 's; may
include whitespace, but not newlines�h]�(j�)��}�(h�``sgl_quoted_string``�h]�h�sgl_quoted_string�����}�(hhhjYHubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjUHubh�T - a string of characters enclosed in ‘s; may
include whitespace, but not newlines�����}�(h�R - a string of characters enclosed in 's; may
include whitespace, but not newlines�hjUHubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!MhjQHubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�Fhhh h=h!Nubj�)��}�(h�h``dbl_quoted_string`` - a string of characters enclosed in "s; may
include whitespace, but not newlines
�h]�h_)��}�(h�g``dbl_quoted_string`` - a string of characters enclosed in "s; may
include whitespace, but not newlines�h]�(j�)��}�(h�``dbl_quoted_string``�h]�h�dbl_quoted_string�����}�(hhhj�Hubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj|Hubh�T - a string of characters enclosed in “s; may
include whitespace, but not newlines�����}�(h�R - a string of characters enclosed in "s; may
include whitespace, but not newlines�hj|Hubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!MhjxHubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�Fhhh h=h!Nubj�)��}�(h�>``quoted_string`` - ``sgl_quoted_string | dbl_quoted_string``
�h]�h_)��}�(h�=``quoted_string`` - ``sgl_quoted_string | dbl_quoted_string``�h]�(j�)��}�(h�``quoted_string``�h]�h�
quoted_string�����}�(hhhj�Hubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�Hubh� - �����}�(h� - �hj�Hubj�)��}�(h�)``sgl_quoted_string | dbl_quoted_string``�h]�h�%sgl_quoted_string | dbl_quoted_string�����}�(hhhj�Hubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�Hubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!Mhj�Hubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�Fhhh h=h!Nubj�)��}�(h��``c_style_comment`` - a comment block delimited by ``'/*'`` and ``'*/'`` sequences; can span
multiple lines, but does not support nesting of comments
�h]�h_)��}�(h��``c_style_comment`` - a comment block delimited by ``'/*'`` and ``'*/'`` sequences; can span
multiple lines, but does not support nesting of comments�h]�(j�)��}�(h�``c_style_comment``�h]�h�c_style_comment�����}�(hhhj�Hubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�Hubh�  - a comment block delimited by �����}�(h�  - a comment block delimited by �hj�Hubj�)��}�(h�``'/*'``�h]�h�'/*'�����}�(hhhj�Hubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�Hubh� and �����}�(h� and �hj�Hubj�)��}�(h�``'*/'``�h]�h�'*/'�����}�(hhhjIubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�Hubh�M sequences; can span
multiple lines, but does not support nesting of comments�����}�(h�M sequences; can span
multiple lines, but does not support nesting of comments�hj�Hubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M
hj�Hubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�Fhhh h=h!Nubj�)��}�(h��``html_comment`` - a comment block delimited by ``'<!--'`` and ``'-->'`` sequences; can span
multiple lines, but does not support nesting of comments
�h]�h_)��}�(h��``html_comment`` - a comment block delimited by ``'<!--'`` and ``'-->'`` sequences; can span
multiple lines, but does not support nesting of comments�h]�(j�)��}�(h�``html_comment``�h]�h�html_comment�����}�(hhhj)Iubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj%Iubh�  - a comment block delimited by �����}�(h�  - a comment block delimited by �hj%Iubj�)��}�(h�
``'<!--'``�h]�h�'<!--'�����}�(hhhj<Iubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj%Iubh� and �����}�(h� and �hj%Iubj�)��}�(h�	``'-->'``�h]�h�'-->'�����}�(hhhjOIubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj%Iubh�M sequences; can span
multiple lines, but does not support nesting of comments�����}�(h�M sequences; can span
multiple lines, but does not support nesting of comments�hj%Iubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M
hj!Iubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�Fhhh h=h!Nubj�)��}�(h��``comma_separated_list`` - similar to ``delimited_list``, except that the
list expressions can be any text value, or a quoted string; quoted strings can
safely include commas without incorrectly breaking the string into two tokens
�h]�h_)��}�(h��``comma_separated_list`` - similar to ``delimited_list``, except that the
list expressions can be any text value, or a quoted string; quoted strings can
safely include commas without incorrectly breaking the string into two tokens�h]�(j�)��}�(h�``comma_separated_list``�h]�h�comma_separated_list�����}�(hhhjvIubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjrIubh� - similar to �����}�(h� - similar to �hjrIubj�)��}�(h�``delimited_list``�h]�h�delimited_list�����}�(hhhj�Iubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjrIubh��, except that the
list expressions can be any text value, or a quoted string; quoted strings can
safely include commas without incorrectly breaking the string into two tokens�����}�(h��, except that the
list expressions can be any text value, or a quoted string; quoted strings can
safely include commas without incorrectly breaking the string into two tokens�hjrIubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!MhjnIubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�Fhhh h=h!Nubj�)��}�(h�_``rest_of_line`` - all remaining printable characters up to but not including the next
newline
�h]�h_)��}�(h�^``rest_of_line`` - all remaining printable characters up to but not including the next
newline�h]�(j�)��}�(h�``rest_of_line``�h]�h�rest_of_line�����}�(hhhj�Iubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�Iubh�N - all remaining printable characters up to but not including the next
newline�����}�(h�N - all remaining printable characters up to but not including the next
newline�hj�Iubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!Mhj�Iubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�Fhhh h=h!Nubj�)��}�(h�W``common.integer`` - an integer with no leading sign; parsed token is converted to int
�h]�h_)��}�(h�V``common.integer`` - an integer with no leading sign; parsed token is converted to int�h]�(j�)��}�(h�``common.integer``�h]�h�common.integer�����}�(hhhj�Iubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�Iubh�D - an integer with no leading sign; parsed token is converted to int�����}�(h�D - an integer with no leading sign; parsed token is converted to int�hj�Iubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!Mhj�Iubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�Fhhh h=h!Nubj�)��}�(h�Q``common.hex_integer`` - a hexadecimal integer; parsed token is converted to int
�h]�h_)��}�(h�P``common.hex_integer`` - a hexadecimal integer; parsed token is converted to int�h]�(j�)��}�(h�``common.hex_integer``�h]�h�common.hex_integer�����}�(hhhj�Iubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�Iubh�: - a hexadecimal integer; parsed token is converted to int�����}�(h�: - a hexadecimal integer; parsed token is converted to int�hj�Iubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!Mhj�Iubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�Fhhh h=h!Nubj�)��}�(h�d``common.signed_integer`` - an integer with optional leading sign; parsed token is converted to int
�h]�h_)��}�(h�c``common.signed_integer`` - an integer with optional leading sign; parsed token is converted to int���h]�(j�)��}�(h�``common.signed_integer``�h]�h�common.signed_integer�����}�(hhhj%Jubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj!Jubh�J - an integer with optional leading sign; parsed token is converted to int�����}�(h�J - an integer with optional leading sign; parsed token is converted to int�hj!Jubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!MhjJubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�Fhhh h=h!Nubj�)��}�(h�^``common.fraction`` - signed_integer '/' signed_integer; parsed tokens are converted to float
�h]�h_)��}�(h�]``common.fraction`` - signed_integer '/' signed_integer; parsed tokens are converted to float�h]�(j�)��}�(h�``common.fraction``�h]�h�common.fraction�����}�(hhhjLJubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjHJubh�N - signed_integer ‘/’ signed_integer; parsed tokens are converted to float�����}�(h�J - signed_integer '/' signed_integer; parsed tokens are converted to float�hjHJubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!MhjDJubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�Fhhh h=h!Nubj�)��}�(h�]``common.mixed_integer`` - signed_integer '-' fraction; parsed tokens are converted to float
�h]�h_)��}�(h�\``common.mixed_integer`` - signed_integer '-' fraction; parsed tokens are converted to float�h]�(j�)��}�(h�``common.mixed_integer``�h]�h�common.mixed_integer�����}�(hhhjsJubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjoJubh�H - signed_integer ‘-‘ fraction; parsed tokens are converted to float�����}�(h�D - signed_integer '-' fraction; parsed tokens are converted to float�hjoJubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!MhjkJubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�Fhhh h=h!Nubj�)��}�(h�D``common.real`` - real number; parsed tokens are converted to float
�h]�h_)��}�(h�C``common.real`` - real number; parsed tokens are converted to float�h]�(j�)��}�(h�``common.real``�h]�h�common.real�����}�(hhhj�Jubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�Jubh�4 - real number; parsed tokens are converted to float�����}�(h�4 - real number; parsed tokens are converted to float�hj�Jubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M!hj�Jubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�Fhhh h=h!Nubj�)��}�(h�h``common.sci_real`` - real number with optional scientific notation; parsed tokens are convert to float
�h]�h_)��}�(h�g``common.sci_real`` - real number with optional scientific notation; parsed tokens are convert to float�h]�(j�)��}�(h�``common.sci_real``�h]�h�common.sci_real�����}�(hhhj�Jubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�Jubh�T - real number with optional scientific notation; parsed tokens are convert to float�����}�(h�T - real number with optional scientific notation; parsed tokens are convert to float�hj�Jubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M#hj�Jubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�Fhhh h=h!Nubj�)��}�(h�n``common.number`` - any numeric expression; parsed tokens are returned as converted by the matched expression
�h]�h_)��}�(h�m``common.number`` - any numeric expression; parsed tokens are returned as converted by the matched expression�h]�(j�)��}�(h�``common.number``�h]�h�
common.number�����}�(hhhj�Jubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�Jubh�\ - any numeric expression; parsed tokens are returned as converted by the matched expression�����}�(h�\ - any numeric expression; parsed tokens are returned as converted by the matched expression�hj�Jubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M%hj�Jubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�Fhhh h=h!Nubj�)��}�(h�R``common.fnumber`` - any numeric expression; parsed tokens are converted to float
�h]�h_)��}�(h�Q``common.fnumber`` - any numeric expression; parsed tokens are converted to float�h]�(j�)��}�(h�``common.fnumber``�h]�h�common.fnumber�����}�(hhhjKubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjKubh�? - any numeric expression; parsed tokens are converted to float�����}�(h�? - any numeric expression; parsed tokens are converted to float�hjKubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M'hjKubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�Fhhh h=h!Nubj�)��}�(h��``common.identifier`` - a programming identifier (follows Python's syntax convention of leading alpha or "_",
followed by 0 or more alpha, num, or "_")
�h]�h_)��}�(h��``common.identifier`` - a programming identifier (follows Python's syntax convention of leading alpha or "_",
followed by 0 or more alpha, num, or "_")�h]�(j�)��}�(h�``common.identifier``�h]�h�common.identifier�����}�(hhhj6Kubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj2Kubh�� - a programming identifier (follows Python’s syntax convention of leading alpha or “_”,
followed by 0 or more alpha, num, or “_”)�����}�(h�� - a programming identifier (follows Python's syntax convention of leading alpha or "_",
followed by 0 or more alpha, num, or "_")�hj2Kubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M)hj.Kubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�Fhhh h=h!Nubj�)��}�(h�'``common.ipv4_address`` - IPv4 address
�h]�h_)��}�(h�&``common.ipv4_address`` - IPv4 address�h]�(j�)��}�(h�``common.ipv4_address``�h]�h�common.ipv4_address�����}�(hhhj]Kubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjYKubh� - IPv4 address�����}�(h� - IPv4 address�hjYKubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M,hjUKubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�Fhhh h=h!Nubj�)��}�(h�'``common.ipv6_address`` - IPv6 address
�h]�h_)��}�(h�&``common.ipv6_address`` - IPv6 address�h]�(j�)��}�(h�``common.ipv6_address``�h]�h�common.ipv6_address�����}�(hhhj�Kubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�Kubh� - IPv6 address�����}�(h� - IPv6 address�hj�Kubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M.hj|Kubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�Fhhh h=h!Nubj�)��}�(h�H``common.mac_address`` - MAC address (with ":", "-", or "." delimiters)
�h]�h_)��}�(h�G``common.mac_address`` - MAC address (with ":", "-", or "." delimiters)�h]�(j�)��}�(h�``common.mac_address``�h]�h�common.mac_address�����}�(hhhj�Kubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�Kubh�= - MAC address (with “:”, “-“, or “.” delimiters)�����}�(h�1 - MAC address (with ":", "-", or "." delimiters)�hj�Kubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M0hj�Kubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�Fhhh h=h!Nubj�)��}�(h�8``common.iso8601_date`` - date in ``YYYY-MM-DD`` format
�h]�h_)��}�(h�7``common.iso8601_date`` - date in ``YYYY-MM-DD`` format�h]�(j�)��}�(h�``common.iso8601_date``�h]�h�common.iso8601_date�����}�(hhhj�Kubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�Kubh� - date in �����}�(h� - date in �hj�Kubj�)��}�(h�``YYYY-MM-DD``�h]�h�
YYYY-MM-DD�����}�(hhhj�Kubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�Kubh� format�����}�(h� format�hj�Kubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M2hj�Kubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�Fhhh h=h!Nubj�)��}�(h��``common.iso8601_datetime`` - datetime in ``YYYY-MM-DDThh:mm:ss.s(Z|+-00:00)`` format; trailing seconds,
milliseconds, and timezone optional; accepts separating ``'T'`` or ``' '``
�h]�h_)��}�(h��``common.iso8601_datetime`` - datetime in ``YYYY-MM-DDThh:mm:ss.s(Z|+-00:00)`` format; trailing seconds,
milliseconds, and timezone optional; accepts separating ``'T'`` or ``' '``�h]�(j�)��}�(h�``common.iso8601_datetime``�h]�h�common.iso8601_datetime�����}�(hhhjLubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjLubh� - datetime in �����}�(h� - datetime in �hjLubj�)��}�(h�$``YYYY-MM-DDThh:mm:ss.s(Z|+-00:00)``�h]�h� YYYY-MM-DDThh:mm:ss.s(Z|+-00:00)�����}�(hhhjLubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjLubh�S format; trailing seconds,
milliseconds, and timezone optional; accepts separating �����}�(h�S format; trailing seconds,
milliseconds, and timezone optional; accepts separating �hjLubj�)��}�(h�``'T'``�h]�h�'T'�����}�(hhhj2Lubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjLubh� or �����}�(h� or �hjLubj�)��}�(h�``' '``�h]�h�' '�����}�(hhhjELubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjLubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M4hjLubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�Fhhh h=h!Nubj�)��}�(h��``common.url`` - matches URL strings and returns a ParseResults with named fields like those returned
by ``urllib.parse.urlparse()``

�h]�h_)��}�(h��``common.url`` - matches URL strings and returns a ParseResults with named fields like those returned
by ``urllib.parse.urlparse()``�h]�(j�)��}�(h�``common.url``�h]�h�
common.url�����}�(hhhjgLubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjcLubh�[ - matches URL strings and returns a ParseResults with named fields like those returned
by �����}�(h�[ - matches URL strings and returns a ParseResults with named fields like those returned
by �hjcLubj�)��}�(h�``urllib.parse.urlparse()``�h]�h�urllib.parse.urlparse()�����}�(hhhjzLubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjcLubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M7hj_Lubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�Fhhh h=h!Nubeh"}�(h$]�h&]�h)]�h+]�h-]�j�j�uh/j�h h=h!M�hj�Fhhubeh"}�(h$]�jah&]�h)]��!common string and token constants�ah+]�h-]�uh/h	hj�9hhh h=h!M�ubh
)��}�(hhh]�(h)��}�(hj9h]�(h)��}�(hhh]�h�1.3.4   �����}�(hhhj�Lhhh Nh!Nubah"}�(h$]�h&]�h(ah)]�h+]�h-]�uh/hhj�Lhhh Nh!Nubh�0Unicode character sets for international parsing�����}�(hj9hj�Lhhh Nh!Nubeh"}�(h$]�h&]�h)]�h+]�h-]�h:Kh;j<uh/hhj�Lhhh h=h!M<ubh_)��}�(hX
Pyparsing includes the ``unicode`` namespace that contains definitions for ``alphas``, ``nums``, ``alphanums``,
``identchars``, ``identbodychars``, and ``printables`` for character ranges besides 7- or 8-bit ASCII. You can
access them using code like the following::�h]�(h�Pyparsing includes the �����}�(h�Pyparsing includes the �hj�Lhhh Nh!Nubj�)��}�(h�``unicode``�h]�h�unicode�����}�(hhhj�Lubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�Lubh�) namespace that contains definitions for �����}�(h�) namespace that contains definitions for �hj�Lhhh Nh!Nubj�)��}�(h�
``alphas``�h]�h�alphas�����}�(hhhj�Lubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�Lubh�, �����}�(h�, �hj�Lhhh Nh!Nubj�)��}�(h�``nums``�h]�h�nums�����}�(hhhj�Lubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�Lubh�, �����}�(h�, �hj�Lubj�)��}�(h�
``alphanums``�h]�h�	alphanums�����}�(hhhjMubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�Lubh�,
�����}�(h�,
�hj�Lhhh Nh!Nubj�)��}�(h�``identchars``�h]�h�
identchars�����}�(hhhjMubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�Lubh�, �����}�(hj�Lhj�Lubj�)��}�(h�``identbodychars``�h]�h�identbodychars�����}�(hhhj%Mubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�Lubh�, and �����}�(h�, and �hj�Lhhh Nh!Nubj�)��}�(h�``printables``�h]�h�
printables�����}�(hhhj8Mubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�Lubh�c for character ranges besides 7- or 8-bit ASCII. You can
access them using code like the following:�����}�(h�c for character ranges besides 7- or 8-bit ASCII. You can
access them using code like the following:�hj�Lhhh Nh!Nubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M=hj�Lhhubjb)��}�(h��import pyparsing as pp
ppu = pp.unicode

greek_word = pp.Word(ppu.Greek.alphas)
greek_word[...].parse_string("Καλημέρα κόσμε")�h]�h��import pyparsing as pp
ppu = pp.unicode

greek_word = pp.Word(ppu.Greek.alphas)
greek_word[...].parse_string("Καλημέρα κόσμε")�����}�(hhhjQMubah"}�(h$]�h&]�h)]�h+]�h-]�jqjruh/jah!MAhj�Lhhh h=ubh_)��}�(h�*The following language ranges are defined.�h]�h�*The following language ranges are defined.�����}�(hjaMhj_Mhhh Nh!Nubah"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!MGhj�Lhhubh�table���)��}�(hhh]�h�tgroup���)��}�(hhh]�(h�colspec���)��}�(hhh]�h"}�(h$]�h&]�h)]�h+]�h-]��colwidth�Kuh/jwMhjtMubjxM)��}�(hhh]�h"}�(h$]�h&]�h)]�h+]�h-]��colwidth�Kuh/jwMhjtMubjxM)��}�(hhh]�h"}�(h$]�h&]�h)]�h+]�h-]��colwidth�K0uh/jwMhjtMubh�tbody���)��}�(hhh]�(h�row���)��}�(hhh]�(h�entry���)��}�(hhh]�h_)��}�(h�Unicode set�h]�h�Unicode set�����}�(hj�Mhj�Mubah"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!MJhj�Mubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�Mhj�Mubj�M)��}�(hhh]�h_)��}�(h�Alternate names�h]�h�Alternate names�����}�(hj�Mhj�Mubah"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!MJhj�Mubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�Mhj�Mubj�M)��}�(hhh]�h_)��}�(h�Description�h]�h�Description�����}�(hj�Mhj�Mubah"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!MJhj�Mubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�Mhj�Mubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/j�Mhj�Mubj�M)��}�(hhh]�(j�M)��}�(hhh]�h_)��}�(h�Arabic�h]�h�Arabic�����}�(hj�Mhj�Mubah"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!MLhj�Mubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�Mhj�Mubj�M)��}�(hhh]�h_)��}�(h�العربية�h]�h�العربية�����}�(hj
NhjNubah"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!MLhjNubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�Mhj�Mubj�M)��}�(hhh]�h"}�(h$]�h&]�h)]�h+]�h-]�uh/j�Mhj�Mubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/j�Mhj�Mubj�M)��}�(hhh]�(j�M)��}�(hhh]�h_)��}�(h�Chinese�h]�h�Chinese�����}�(hj6Nhj4Nubah"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!MMhj1Nubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�Mhj.Nubj�M)��}�(hhh]�h_)��}�(h�中文�h]�h�中文�����}�(hjMNhjKNubah"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!MMhjHNubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�Mhj.Nubj�M)��}�(hhh]�h"}�(h$]�h&]�h)]�h+]�h-]�uh/j�Mhj.Nubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/j�Mhj�Mubj�M)��}�(hhh]�(j�M)��}�(hhh]�h_)��}�(h�Cyrillic�h]�h�Cyrillic�����}�(hjvNhjtNubah"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!MNhjqNubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�MhjnNubj�M)��}�(hhh]�h_)��}�(h�кириллица�h]�h�кириллица�����}�(hj�Nhj�Nubah"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!MNhj�Nubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�MhjnNubj�M)��}�(hhh]�h"}�(h$]�h&]�h)]�h+]�h-]�uh/j�MhjnNubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/j�Mhj�Mubj�M)��}�(hhh]�(j�M)��}�(hhh]�h_)��}�(h�Greek�h]�h�Greek�����}�(hj�Nhj�Nubah"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!MOhj�Nubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�Mhj�Nubj�M)��}�(hhh]�h_)��}�(h�Ελληνικά�h]�h�Ελληνικά�����}�(hj�Nhj�Nubah"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!MOhj�Nubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�Mhj�Nubj�M)��}�(hhh]�h"}�(h$]�h&]�h)]�h+]�h-]�uh/j�Mhj�Nubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/j�Mhj�Mubj�M)��}�(hhh]�(j�M)��}�(hhh]�h_)��}�(h�Hebrew�h]�h�Hebrew�����}�(hj�Nhj�Nubah"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!MPhj�Nubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�Mhj�Nubj�M)��}�(hhh]�h_)��}�(h�עִברִית�h]�h�עִברִית�����}�(hj
OhjOubah"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!MPhjOubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�Mhj�Nubj�M)��}�(hhh]�h"}�(h$]�h&]�h)]�h+]�h-]�uh/j�Mhj�Nubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/j�Mhj�Mubj�M)��}�(hhh]�(j�M)��}�(hhh]�h_)��}�(h�Japanese�h]�h�Japanese�����}�(hj6Ohj4Oubah"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!MQhj1Oubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�Mhj.Oubj�M)��}�(hhh]�h_)��}�(h�	日本語�h]�h�	日本語�����}�(hjMOhjKOubah"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!MQhjHOubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�Mhj.Oubj�M)��}�(hhh]�h_)��}�(h�+Union of Kanji, Katakana, and Hiragana sets�h]�h�+Union of Kanji, Katakana, and Hiragana sets�����}�(hjdOhjbOubah"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!MQhj_Oubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�Mhj.Oubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/j�Mhj�Mubj�M)��}�(hhh]�(j�M)��}�(hhh]�h_)��}�(h�Japanese.Kanji�h]�h�Japanese.Kanji�����}�(hj�Ohj�Oubah"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!MRhjOubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�Mhj|Oubj�M)��}�(hhh]�h_)��}�(h�漢字�h]�h�漢字�����}�(hj�Ohj�Oubah"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!MRhj�Oubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�Mhj|Oubj�M)��}�(hhh]�h"}�(h$]�h&]�h)]�h+]�h-]�uh/j�Mhj|Oubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/j�Mhj�Mubj�M)��}�(hhh]�(j�M)��}�(hhh]�h_)��}�(h�Japanese.Katakana�h]�h�Japanese.Katakana�����}�(hj�Ohj�Oubah"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!MShj�Oubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�Mhj�Oubj�M)��}�(hhh]�h_)��}�(h�カタカナ�h]�h�カタカナ�����}�(hj�Ohj�Oubah"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!MShj�Oubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�Mhj�Oubj�M)��}�(hhh]�h"}�(h$]�h&]�h)]�h+]�h-]�uh/j�Mhj�Oubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/j�Mhj�Mubj�M)��}�(hhh]�(j�M)��}�(hhh]�h_)��}�(h�Japanese.Hiragana�h]�h�Japanese.Hiragana�����}�(hjPhjPubah"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!MThj�Oubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�Mhj�Oubj�M)��}�(hhh]�h_)��}�(h�ひらがな�h]�h�ひらがな�����}�(hjPhjPubah"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!MThjPubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�Mhj�Oubj�M)��}�(hhh]�h"}�(h$]�h&]�h)]�h+]�h-]�uh/j�Mhj�Oubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/j�Mhj�Mubj�M)��}�(hhh]�(j�M)��}�(hhh]�h_)��}�(h�Hangul�h]�h�Hangul�����}�(hjDPhjBPubah"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!MUhj?Pubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�Mhj<Pubj�M)��}�(hhh]�h_)��}�(h�Korean, 한국어�h]�h�Korean, 한국어�����}�(hj[PhjYPubah"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!MUhjVPubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�Mhj<Pubj�M)��}�(hhh]�h"}�(h$]�h&]�h)]�h+]�h-]�uh/j�Mhj<Pubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/j�Mhj�Mubj�M)��}�(hhh]�(j�M)��}�(hhh]�h_)��}�(h�Latin1�h]�h�Latin1�����}�(hj�Phj�Pubah"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!MVhjPubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�Mhj|Pubj�M)��}�(hhh]�h"}�(h$]�h&]�h)]�h+]�h-]�uh/j�Mhj|Pubj�M)��}�(hhh]�h_)��}�(h�+All Unicode characters up to code point 255�h]�h�+All Unicode characters up to code point 255�����}�(hj�Phj�Pubah"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!MVhj�Pubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�Mhj|Pubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/j�Mhj�Mubj�M)��}�(hhh]�(j�M)��}�(hhh]�h_)��}�(h�LatinA�h]�h�LatinA�����}�(hj�Phj�Pubah"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!MWhj�Pubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�Mhj�Pubj�M)��}�(hhh]�h"}�(h$]�h&]�h)]�h+]�h-]�uh/j�Mhj�Pubj�M)��}�(hhh]�h"}�(h$]�h&]�h)]�h+]�h-]�uh/j�Mhj�Pubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/j�Mhj�Mubj�M)��}�(hhh]�(j�M)��}�(hhh]�h_)��}�(h�LatinB�h]�h�LatinB�����}�(hj�Phj�Pubah"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!MXhj�Pubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�Mhj�Pubj�M)��}�(hhh]�h"}�(h$]�h&]�h)]�h+]�h-]�uh/j�Mhj�Pubj�M)��}�(hhh]�h"}�(h$]�h&]�h)]�h+]�h-]�uh/j�Mhj�Pubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/j�Mhj�Mubj�M)��}�(hhh]�(j�M)��}�(hhh]�h_)��}�(h�Thai�h]�h�Thai�����}�(hj(Qhj&Qubah"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!MYhj#Qubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�Mhj Qubj�M)��}�(hhh]�h_)��}�(h�	ไทย�h]�h�	ไทย�����}�(hj?Qhj=Qubah"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!MYhj:Qubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�Mhj Qubj�M)��}�(hhh]�h"}�(h$]�h&]�h)]�h+]�h-]�uh/j�Mhj Qubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/j�Mhj�Mubj�M)��}�(hhh]�(j�M)��}�(hhh]�h_)��}�(h�
Devanagari�h]�h�
Devanagari�����}�(hjhQhjfQubah"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!MZhjcQubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�Mhj`Qubj�M)��}�(hhh]�h_)��}�(h�देवनागरी�h]�h�देवनागरी�����}�(hjQhj}Qubah"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!MZhjzQubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�Mhj`Qubj�M)��}�(hhh]�h"}�(h$]�h&]�h)]�h+]�h-]�uh/j�Mhj`Qubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/j�Mhj�Mubj�M)��}�(hhh]�(j�M)��}�(hhh]�h_)��}�(h�BasicMultilingualPlane�h]�h�BasicMultilingualPlane�����}�(hj�Qhj�Qubah"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M[hj�Qubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�Mhj�Qubj�M)��}�(hhh]�h_)��}�(h�BMP�h]�h�BMP�����}�(hj�Qhj�Qubah"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M[hj�Qubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�Mhj�Qubj�M)��}�(hhh]�h_)��}�(h�-All Unicode characters up to code point 65535�h]�h�-All Unicode characters up to code point 65535�����}�(hj�Qhj�Qubah"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M[hj�Qubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�Mhj�Qubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/j�Mhj�Mubj�M)��}�(hhh]�(j�M)��}�(hhh]�h_)��}�(h�CJK�h]�h�CJK�����}�(hj�Qhj�Qubah"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M\hj�Qubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�Mhj�Qubj�M)��}�(hhh]�h"}�(h$]�h&]�h)]�h+]�h-]�uh/j�Mhj�Qubj�M)��}�(hhh]�h_)��}�(h�+Union of Chinese, Japanese, and Korean sets�h]�h�+Union of Chinese, Japanese, and Korean sets�����}�(hjRhjRubah"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M\hjRubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�Mhj�Qubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/j�Mhj�Mubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/j�MhjtMubeh"}�(h$]�h&]�h)]�h+]�h-]��cols�Kuh/jrMhjoMubah"}�(h$]�h&]�h)]�h+]�h-]�uh/jmMhj�Lhhh h=h!Nubh_)��}�(h��The base ``unicode`` class also includes definitions based on all Unicode code points up to ``sys.maxunicode``. This
set will include emojis, wingdings, and many other specialized and typographical variant characters.�h]�(h�	The base �����}�(h�	The base �hjARhhh Nh!Nubj�)��}�(h�``unicode``�h]�h�unicode�����}�(hhhjJRubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjARubh�H class also includes definitions based on all Unicode code points up to �����}�(h�H class also includes definitions based on all Unicode code points up to �hjARhhh Nh!Nubj�)��}�(h�``sys.maxunicode``�h]�h�sys.maxunicode�����}�(hhhj]Rubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjARubh�k. This
set will include emojis, wingdings, and many other specialized and typographical variant characters.�����}�(h�k. This
set will include emojis, wingdings, and many other specialized and typographical variant characters.�hjARhhh Nh!Nubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M_hj�Lhhubeh"}�(h$]�jBah&]�h)]��0unicode character sets for international parsing�ah+]�h-]�uh/h	hj�9hhh h=h!M<ubeh"}�(h$]�j�ah&]�h)]��$miscellaneous attributes and methods�ah+]�h-]�uh/h	hhhhh h=h!M�ubh
)��}�(hhh]�(h)��}�(hjuh]�(h)��}�(hhh]�h�	1.4   �����}�(hhhj�Rhhh Nh!Nubah"}�(h$]�h&]�h(ah)]�h+]�h-]�uh/hhj�Rhhh Nh!Nubh�Generating Railroad Diagrams�����}�(hjuhj�Rhhh Nh!Nubeh"}�(h$]�h&]�h)]�h+]�h-]�h:Kh;jxuh/hhj�Rhhh h=h!Mdubh_)��}�(hXUGrammars are conventionally represented in what are called "railroad diagrams", which allow you to visually follow
the sequence of tokens in a grammar along lines which are a bit like train tracks. You might want to generate a
railroad diagram for your grammar in order to better understand it yourself, or maybe to communicate it to others.�h]�hXYGrammars are conventionally represented in what are called “railroad diagrams”, which allow you to visually follow
the sequence of tokens in a grammar along lines which are a bit like train tracks. You might want to generate a
railroad diagram for your grammar in order to better understand it yourself, or maybe to communicate it to others.�����}�(hj�Rhj�Rhhh Nh!Nubah"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!Mehj�Rhhubh
)��}�(hhh]�(h)��}�(hj�h]�(h)��}�(hhh]�h�1.4.1   �����}�(hhhj�Rhhh Nh!Nubah"}�(h$]�h&]�h(ah)]�h+]�h-]�uh/hhj�Rhhh Nh!Nubh�Usage�����}�(hj�hj�Rhhh Nh!Nubeh"}�(h$]�h&]�h)]�h+]�h-]�h:Kh;j�uh/hhj�Rhhh h=h!Mjubh_)��}�(hX+To generate a railroad diagram in pyparsing, you first have to install pyparsing with the ``diagrams`` extra.
To do this, just run ``pip install pyparsing[diagrams]``, and make sure you add ``pyparsing[diagrams]`` to any
``setup.py`` or ``requirements.txt`` that specifies pyparsing as a dependency.�h]�(h�ZTo generate a railroad diagram in pyparsing, you first have to install pyparsing with the �����}�(h�ZTo generate a railroad diagram in pyparsing, you first have to install pyparsing with the �hj�Rhhh Nh!Nubj�)��}�(h�``diagrams``�h]�h�diagrams�����}�(hhhj�Rubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�Rubh� extra.
To do this, just run �����}�(h� extra.
To do this, just run �hj�Rhhh Nh!Nubj�)��}�(h�#``pip install pyparsing[diagrams]``�h]�h�pip install pyparsing[diagrams]�����}�(hhhj�Rubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�Rubh�, and make sure you add �����}�(h�, and make sure you add �hj�Rhhh Nh!Nubj�)��}�(h�``pyparsing[diagrams]``�h]�h�pyparsing[diagrams]�����}�(hhhj�Rubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�Rubh� to any
�����}�(h� to any
�hj�Rhhh Nh!Nubj�)��}�(h�``setup.py``�h]�h�setup.py�����}�(hhhjSubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�Rubh� or �����}�(h� or �hj�Rhhh Nh!Nubj�)��}�(h�``requirements.txt``�h]�h�requirements.txt�����}�(hhhj!Subah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�Rubh�* that specifies pyparsing as a dependency.�����}�(h�* that specifies pyparsing as a dependency.�hj�Rhhh Nh!Nubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!Mkhj�Rhhubh_)��}�(h�tCreate your parser as you normally would. Then call ``create_diagram()``, passing the name of an output HTML file.::�h]�(h�4Create your parser as you normally would. Then call �����}�(h�4Create your parser as you normally would. Then call �hj:Shhh Nh!Nubj�)��}�(h�``create_diagram()``�h]�h�create_diagram()�����}�(hhhjCSubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj:Subh�+, passing the name of an output HTML file.:�����}�(h�+, passing the name of an output HTML file.:�hj:Shhh Nh!Nubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!Mohj�Rhhubjb)��}�(h��street_address = Word(nums).set_name("house_number") + Word(alphas)[1, ...].set_name("street_name")
street_address.set_name("street_address")
street_address.create_diagram("street_address_diagram.html")�h]�h��street_address = Word(nums).set_name("house_number") + Word(alphas)[1, ...].set_name("street_name")
street_address.set_name("street_address")
street_address.create_diagram("street_address_diagram.html")�����}�(hhhj\Subah"}�(h$]�h&]�h)]�h+]�h-]�jqjruh/jah!Mqhj�Rhhh h=ubh_)��}�(h�ZThis will result in the railroad diagram being written to ``street_address_diagram.html``.�h]�(h�:This will result in the railroad diagram being written to �����}�(h�:This will result in the railroad diagram being written to �hjjShhh Nh!Nubj�)��}�(h�``street_address_diagram.html``�h]�h�street_address_diagram.html�����}�(hhhjsSubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjjSubh�.�����}�(hjhjjShhh Nh!Nubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!Muhj�Rhhubh_)��}�(h��Diagrams usually will vertically wrap expressions containing more than 3 terms. You can override this by
passing the `vertical` argument to `create_diagram` with a larger value.�h]�(h�uDiagrams usually will vertically wrap expressions containing more than 3 terms. You can override this by
passing the �����}�(h�uDiagrams usually will vertically wrap expressions containing more than 3 terms. You can override this by
passing the �hj�Shhh Nh!Nubj�6)��}�(h�
`vertical`�h]�h�vertical�����}�(hhhj�Subah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�6hj�Subh�
 argument to �����}�(h�
 argument to �hj�Shhh Nh!Nubj�6)��}�(h�`create_diagram`�h]�h�create_diagram�����}�(hhhj�Subah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�6hj�Subh� with a larger value.�����}�(h� with a larger value.�hj�Shhh Nh!Nubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!Mwhj�Rhhubeh"}�(h$]�j�ah&]�h)]��usage�ah+]�h-]�uh/h	hj�Rhhh h=h!Mjubh
)��}�(hhh]�(h)��}�(hj�h]�(h)��}�(hhh]�h�1.4.2   �����}�(hhhj�Shhh Nh!Nubah"}�(h$]�h&]�h(ah)]�h+]�h-]�uh/hhj�Shhh Nh!Nubh�Example�����}�(hj�hj�Shhh Nh!Nubeh"}�(h$]�h&]�h)]�h+]�h-]�h:Kh;j�uh/hhj�Shhh h=h!M{ubh_)��}�(h��You can view an example railroad diagram generated from `a pyparsing grammar for
SQL SELECT statements <_static/sql_railroad.html>`_.�h]�(h�8You can view an example railroad diagram generated from �����}�(h�8You can view an example railroad diagram generated from �hj�Shhh Nh!Nubh�)��}�(h�L`a pyparsing grammar for
SQL SELECT statements <_static/sql_railroad.html>`_�h]�h�-a pyparsing grammar for
SQL SELECT statements�����}�(hhhj�Subah"}�(h$]�h&]�h)]�h+]�h-]��name��-a pyparsing grammar for SQL SELECT statements�j��_static/sql_railroad.html�uh/h�hj�Subj�)��}�(h� <_static/sql_railroad.html>�h]�h"}�(h$]��-a-pyparsing-grammar-for-sql-select-statements�ah&]�h)]��-a pyparsing grammar for sql select statements�ah+]�h-]��refuri�j�Suh/j�j�Khj�Subh�.�����}�(hjhj�Shhh Nh!Nubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M|hj�Shhubeh"}�(h$]�j�ah&]�h)]��example�ah+]�h-]�uh/h	hj�Rhhh h=h!M{ubh
)��}�(hhh]�(h)��}�(hjh]�(h)��}�(hhh]�h�1.4.3   �����}�(hhhj"Thhh Nh!Nubah"}�(h$]�h&]�h(ah)]�h+]�h-]�uh/hhjThhh Nh!Nubh�
Naming tip�����}�(hjhjThhh Nh!Nubeh"}�(h$]�h&]�h)]�h+]�h-]�h:Kh;juh/hhjThhh h=h!M�ubh_)��}�(hXParser elements that are separately named will be broken out as their own sub-diagrams. As a short-cut alternative
to going through and adding ``.set_name()`` calls on all your sub-expressions, you can use ``autoname_elements()`` after
defining your complete grammar. For example::�h]�(h��Parser elements that are separately named will be broken out as their own sub-diagrams. As a short-cut alternative
to going through and adding �����}�(h��Parser elements that are separately named will be broken out as their own sub-diagrams. As a short-cut alternative
to going through and adding �hj9Thhh Nh!Nubj�)��}�(h�``.set_name()``�h]�h�.set_name()�����}�(hhhjBTubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj9Tubh�0 calls on all your sub-expressions, you can use �����}�(h�0 calls on all your sub-expressions, you can use �hj9Thhh Nh!Nubj�)��}�(h�``autoname_elements()``�h]�h�autoname_elements()�����}�(hhhjUTubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj9Tubh�3 after
defining your complete grammar. For example:�����}�(h�3 after
defining your complete grammar. For example:�hj9Thhh Nh!Nubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M�hjThhubjb)��}�(h�Na = pp.Literal("a")
b = pp.Literal("b").set_name("bbb")
pp.autoname_elements()�h]�h�Na = pp.Literal("a")
b = pp.Literal("b").set_name("bbb")
pp.autoname_elements()�����}�(hhhjnTubah"}�(h$]�h&]�h)]�h+]�h-]�jqjruh/jah!M�hjThhh h=ubh_)��}�(h�;`a` will get named "a", while `b` will keep its name "bbb".�h]�(j�6)��}�(h�`a`�h]�h�a�����}�(hhhj�Tubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�6hj|Tubh� will get named “a”, while �����}�(h� will get named "a", while �hj|Thhh Nh!Nubj�6)��}�(h�`b`�h]�h�b�����}�(hhhj�Tubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�6hj|Tubh� will keep its name “bbb”.�����}�(h� will keep its name "bbb".�hj|Thhh Nh!Nubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M�hjThhubeh"}�(h$]�jah&]�h)]��
naming tip�ah+]�h-]�uh/h	hj�Rhhh h=h!M�ubh
)��}�(hhh]�(h)��}�(hj2h]�(h)��}�(hhh]�h�1.4.4   �����}�(hhhj�Thhh Nh!Nubah"}�(h$]�h&]�h(ah)]�h+]�h-]�uh/hhj�Thhh Nh!Nubh�
Customization�����}�(hj2hj�Thhh Nh!Nubeh"}�(h$]�h&]�h)]�h+]�h-]�h:Kh;j5uh/hhj�Thhh h=h!M�ubh_)��}�(hXlYou can customize the resulting diagram in a few ways.
To do so, run ``pyparsing.diagrams.to_railroad`` to convert your grammar into a form understood by the
`railroad-diagrams <https://github.com/tabatkins/railroad-diagrams/blob/gh-pages/README-py.md>`_ module, and
then ``pyparsing.diagrams.railroad_to_html`` to convert that into an HTML document. For example::�h]�(h�EYou can customize the resulting diagram in a few ways.
To do so, run �����}�(h�EYou can customize the resulting diagram in a few ways.
To do so, run �hj�Thhh Nh!Nubj�)��}�(h�"``pyparsing.diagrams.to_railroad``�h]�h�pyparsing.diagrams.to_railroad�����}�(hhhj�Tubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�Tubh�7 to convert your grammar into a form understood by the
�����}�(h�7 to convert your grammar into a form understood by the
�hj�Thhh Nh!Nubh�)��}�(h�``railroad-diagrams <https://github.com/tabatkins/railroad-diagrams/blob/gh-pages/README-py.md>`_�h]�h�railroad-diagrams�����}�(hhhj�Tubah"}�(h$]�h&]�h)]�h+]�h-]��name��railroad-diagrams�j��Ihttps://github.com/tabatkins/railroad-diagrams/blob/gh-pages/README-py.md�uh/h�hj�Tubj�)��}�(h�L <https://github.com/tabatkins/railroad-diagrams/blob/gh-pages/README-py.md>�h]�h"}�(h$]��railroad-diagrams�ah&]�h)]��railroad-diagrams�ah+]�h-]��refuri�j�Tuh/j�j�Khj�Tubh� module, and
then �����}�(h� module, and
then �hj�Thhh Nh!Nubj�)��}�(h�'``pyparsing.diagrams.railroad_to_html``�h]�h�#pyparsing.diagrams.railroad_to_html�����}�(hhhjUubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�Tubh�4 to convert that into an HTML document. For example:�����}�(h�4 to convert that into an HTML document. For example:�hj�Thhh Nh!Nubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M�hj�Thhubjb)��}�(h��from pyparsing.diagram import to_railroad, railroad_to_html

with open('output.html', 'w') as fp:
    railroad = to_railroad(my_grammar)
    fp.write(railroad_to_html(railroad))�h]�h��from pyparsing.diagram import to_railroad, railroad_to_html

with open('output.html', 'w') as fp:
    railroad = to_railroad(my_grammar)
    fp.write(railroad_to_html(railroad))�����}�(hhhj(Uubah"}�(h$]�h&]�h)]�h+]�h-]�jqjruh/jah!M�hj�Thhh h=ubh_)��}�(h�IThis will result in the railroad diagram being written to ``output.html``�h]�(h�:This will result in the railroad diagram being written to �����}�(h�:This will result in the railroad diagram being written to �hj6Uhhh Nh!Nubj�)��}�(h�``output.html``�h]�h�output.html�����}�(hhhj?Uubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj6Uubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M�hj�Thhubh_)��}�(hXYou can then pass in additional keyword arguments to ``pyparsing.diagrams.to_railroad``, which will be passed
into the ``Diagram()`` constructor of the underlying library,
`as explained here <https://github.com/tabatkins/railroad-diagrams/blob/gh-pages/README-py.md#diagrams>`_.�h]�(h�5You can then pass in additional keyword arguments to �����}�(h�5You can then pass in additional keyword arguments to �hjSUhhh Nh!Nubj�)��}�(h�"``pyparsing.diagrams.to_railroad``�h]�h�pyparsing.diagrams.to_railroad�����}�(hhhj\Uubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjSUubh� , which will be passed
into the �����}�(h� , which will be passed
into the �hjSUhhh Nh!Nubj�)��}�(h�
``Diagram()``�h]�h�	Diagram()�����}�(hhhjoUubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjSUubh�( constructor of the underlying library,
�����}�(h�( constructor of the underlying library,
�hjSUhhh Nh!Nubh�)��}�(h�i`as explained here <https://github.com/tabatkins/railroad-diagrams/blob/gh-pages/README-py.md#diagrams>`_�h]�h�as explained here�����}�(hhhj�Uubah"}�(h$]�h&]�h)]�h+]�h-]��name��as explained here�j��Rhttps://github.com/tabatkins/railroad-diagrams/blob/gh-pages/README-py.md#diagrams�uh/h�hjSUubj�)��}�(h�U <https://github.com/tabatkins/railroad-diagrams/blob/gh-pages/README-py.md#diagrams>�h]�h"}�(h$]��as-explained-here�ah&]�h)]��as explained here�ah+]�h-]��refuri�j�Uuh/j�j�KhjSUubh�.�����}�(hjhjSUhhh Nh!Nubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M�hj�Thhubh_)��}�(h�ZIn addition, you can edit global options in the underlying library, by editing constants::�h]�h�YIn addition, you can edit global options in the underlying library, by editing constants:�����}�(h�YIn addition, you can edit global options in the underlying library, by editing constants:�hj�Uhhh Nh!Nubah"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M�hj�Thhubjb)��}�(h��from pyparsing.diagram import to_railroad, railroad_to_html
import railroad

railroad.DIAGRAM_CLASS = "my-custom-class"
my_railroad = to_railroad(my_grammar)�h]�h��from pyparsing.diagram import to_railroad, railroad_to_html
import railroad

railroad.DIAGRAM_CLASS = "my-custom-class"
my_railroad = to_railroad(my_grammar)�����}�(hhhj�Uubah"}�(h$]�h&]�h)]�h+]�h-]�jqjruh/jah!M�hj�Thhh h=ubh_)��}�(h�yThese options `are documented here <https://github.com/tabatkins/railroad-diagrams/blob/gh-pages/README-py.md#options>`_.�h]�(h�These options �����}�(h�These options �hj�Uhhh Nh!Nubh�)��}�(h�j`are documented here <https://github.com/tabatkins/railroad-diagrams/blob/gh-pages/README-py.md#options>`_�h]�h�are documented here�����}�(hhhj�Uubah"}�(h$]�h&]�h)]�h+]�h-]��name��are documented here�j��Qhttps://github.com/tabatkins/railroad-diagrams/blob/gh-pages/README-py.md#options�uh/h�hj�Uubj�)��}�(h�T <https://github.com/tabatkins/railroad-diagrams/blob/gh-pages/README-py.md#options>�h]�h"}�(h$]��are-documented-here�ah&]�h)]��are documented here�ah+]�h-]��refuri�j�Uuh/j�j�Khj�Uubh�.�����}�(hjhj�Uhhh Nh!Nubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M�hj�Thhubh_)��}�(h��Finally, you can edit the HTML produced by ``pyparsing.diagrams.railroad_to_html`` by passing in certain keyword
arguments that will be used in the HTML template. Currently, these are:�h]�(h�+Finally, you can edit the HTML produced by �����}�(h�+Finally, you can edit the HTML produced by �hj�Uhhh Nh!Nubj�)��}�(h�'``pyparsing.diagrams.railroad_to_html``�h]�h�#pyparsing.diagrams.railroad_to_html�����}�(hhhjVubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�Uubh�f by passing in certain keyword
arguments that will be used in the HTML template. Currently, these are:�����}�(h�f by passing in certain keyword
arguments that will be used in the HTML template. Currently, these are:�hj�Uhhh Nh!Nubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M�hj�Thhubj�)��}�(hhh]�(j�)��}�(h�n``head``: A string containing HTML to use in the ``<head>`` tag. This might be a stylesheet or other metadata
�h]�h_)��}�(h�m``head``: A string containing HTML to use in the ``<head>`` tag. This might be a stylesheet or other metadata�h]�(j�)��}�(h�``head``�h]�h�head�����}�(hhhj%Vubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj!Vubh�): A string containing HTML to use in the �����}�(h�): A string containing HTML to use in the �hj!Vubj�)��}�(h�
``<head>``�h]�h�<head>�����}�(hhhj8Vubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj!Vubh�2 tag. This might be a stylesheet or other metadata�����}�(h�2 tag. This might be a stylesheet or other metadata�hj!Vubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M�hjVubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjVhhh h=h!Nubj�)��}�(h��``body``: A string containing HTML to use in the ``<body>`` tag, above the actual diagram. This might consist of a
heading, description, or JavaScript.
�h]�h_)��}�(h��``body``: A string containing HTML to use in the ``<body>`` tag, above the actual diagram. This might consist of a
heading, description, or JavaScript.�h]�(j�)��}�(h�``body``�h]�h�body�����}�(hhhj_Vubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj[Vubh�): A string containing HTML to use in the �����}�(h�): A string containing HTML to use in the �hj[Vubj�)��}�(h�
``<body>``�h]�h�<body>�����}�(hhhjrVubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj[Vubh�\ tag, above the actual diagram. This might consist of a
heading, description, or JavaScript.�����}�(h�\ tag, above the actual diagram. This might consist of a
heading, description, or JavaScript.�hj[Vubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M�hjWVubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjVhhh h=h!Nubeh"}�(h$]�h&]�h)]�h+]�h-]�j�j�uh/j�h h=h!M�hj�Thhubh_)��}�(h�uIf you want to provide a custom stylesheet using the ``head`` keyword, you can make use of the following CSS classes:�h]�(h�5If you want to provide a custom stylesheet using the �����}�(h�5If you want to provide a custom stylesheet using the �hj�Vhhh Nh!Nubj�)��}�(h�``head``�h]�h�head�����}�(hhhj�Vubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�Vubh�8 keyword, you can make use of the following CSS classes:�����}�(h�8 keyword, you can make use of the following CSS classes:�hj�Vhhh Nh!Nubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M�hj�Thhubj�)��}�(hhh]�(j�)��}�(h�r``railroad-group``: A group containing everything relating to a given element group (ie something with a heading)
�h]�h_)��}�(h�q``railroad-group``: A group containing everything relating to a given element group (ie something with a heading)�h]�(j�)��}�(h�``railroad-group``�h]�h�railroad-group�����}�(hhhj�Vubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�Vubh�_: A group containing everything relating to a given element group (ie something with a heading)�����}�(h�_: A group containing everything relating to a given element group (ie something with a heading)�hj�Vubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M�hj�Vubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�Vhhh h=h!Nubj�)��}�(h�/``railroad-heading``: The title for each group
�h]�h_)��}�(h�.``railroad-heading``: The title for each group�h]�(j�)��}�(h�``railroad-heading``�h]�h�railroad-heading�����}�(hhhj�Vubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�Vubh�: The title for each group�����}�(h�: The title for each group�hj�Vubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M�hj�Vubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�Vhhh h=h!Nubj�)��}�(h�G``railroad-svg``: A div containing only the diagram SVG for each group
�h]�h_)��}�(h�F``railroad-svg``: A div containing only the diagram SVG for each group�h]�(j�)��}�(h�``railroad-svg``�h]�h�railroad-svg�����}�(hhhjWubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hjWubh�6: A div containing only the diagram SVG for each group�����}�(h�6: A div containing only the diagram SVG for each group�hjWubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M�hj
Wubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�Vhhh h=h!Nubj�)��}�(h�I``railroad-description``: A div containing the group description (unused)�h]�h_)��}�(hj3Wh]�(j�)��}�(h�``railroad-description``�h]�h�railroad-description�����}�(hhhj8Wubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj5Wubh�1: A div containing the group description (unused)�����}�(h�1: A div containing the group description (unused)�hj5Wubeh"}�(h$]�h&]�h)]�h+]�h-]�uh/h^h h=h!M�hj1Wubah"}�(h$]�h&]�h)]�h+]�h-]�uh/j�hj�Vhhh h=h!Nubeh"}�(h$]�h&]�h)]�h+]�h-]�j�j�uh/j�h h=h!M�hj�Thhubeh"}�(h$]�j;ah&]�h)]��
customization�ah+]�h-]�uh/h	hj�Rhhh h=h!M�ubeh"}�(h$]�j~ah&]�h)]��generating railroad diagrams�ah+]�h-]�uh/h	hhhhh h=h!Mdubeh"}�(h$]�j�ah&]�h)]��using the pyparsing module�ah+]�h-]�uh/h	hhhhh h=h!Kubah"}�(h$]�h&]�h)]�h+]�h-]��source�h=uh/h�current_source�N�current_line�N�settings��docutils.frontend��Values���)��}�(hN�	generator�N�	datestamp�N�source_link�N�
source_url�N�
toc_backlinks�j�M�footnote_backlinks�K�
sectnum_xform�K�strip_comments�N�strip_elements_with_classes�N�
strip_classes�N�report_level�K�
halt_level�K�exit_status_level�K�debug�N�warning_stream�N�	traceback���input_encoding��	utf-8-sig��input_encoding_error_handler��strict��output_encoding��utf-8��output_encoding_error_handler�j�W�error_encoding��UTF-8��error_encoding_error_handler��backslashreplace��
language_code��en��record_dependencies�N�config�N�	id_prefix�h�auto_id_prefix��id��
dump_settings�N�dump_internals�N�dump_transforms�N�dump_pseudo_xml�N�expose_internals�N�strict_visitor�N�_disable_config�N�_source�h=�_destination�N�
_config_files�]��pep_references�N�pep_base_url�� https://www.python.org/dev/peps/��pep_file_url_template��pep-%04d��rfc_references�N�rfc_base_url��https://tools.ietf.org/html/��	tab_width�K�trim_footnote_reference_space���file_insertion_enabled���raw_enabled�K�syntax_highlight��long��smart_quotes���smartquotes_locales�]��character_level_inline_markup���doctitle_xform���
docinfo_xform�K�sectsubtitle_xform���embed_stylesheet���cloak_email_addresses���env�N�gettext_compact��ub�reporter�N�indirect_targets�]��substitution_defs�}�j_jSs�substitution_names�}��copy�j_s�refnames�}�(�parseresults�]�(j�j�j�j�j�jCj	0j�0j1j1j13j�3j�;e�	operators�]�j�a�literal�]�(jQ	j+j�:j4;j�<e�
matchfirst�]�(j�
j�'j
7j�@e�or�]�(j�
jj*j%(j"7j{@e�parseexception�]�(j�j�e�	fourfn.py�]�(j�j�.e�and�]�(j�j�j3%j�'j�(j�(j�5j77j0Be�set_parse_action�]�jCa�white�]�jya�keyword�]�(jgj;e�word�]�(j�j"e�skipto�]�(jl!j�*e�parse_with_tabs�]�j"a�each�]�ja(a�notany�]�j�)a�caselessliteral�]�j�:au�refids�}�(jS]�j.ajZ]�jPaja	]�j�aj�]�j�aj]�jaj�]�j�aj� ]�j� aj�]�j�!aj�]�j�"aj�
]�jD$aj�
]�j�$aj%]�j
%aj-']�j#'aj�]�ja'aj�]�j�.aj�]�j24aj�A]�j�Aau�nameids�}�(joWj�jljhj�j�j�j�j#jj�j/jj_jl
ji
j�
j�
j�9j�jgj�jIjSj^jZj�"j�j�ja	j�j�j�jj� j�j�!j� j�"j�jo'j)j?$j�j�$j�
j%j�
j'j%j\'j-'j�+j�j�+jYj�,j�j�-j�j�.j�j4jj	4j�j�9jIj�9j�j�Rj�jmCj�jdCj�Aj�Fj�j�LjjzRjBjhWj~j�Sj�jTj�jTjTj�TjjaWj;jUjUj�Uj�Uj�Uj�Uu�	nametypes�}�(joWNjlNj��j��j#Nj�NjNjl
�j�
�j�9NjgNjI�j^�j�"Nj��j��j��j� �j�!�j�"�jo'Nj?$�j�$�j%�j'�j\'�j�+�j�+Nj�,Nj�-Nj�.Nj4Nj	4�j�9Nj�9�j�RNjmCNjdC�j�FNj�LNjzRNjhWNj�SNjTNjT�j�TNjaWNjU�j�U�j�U�uh$}�(j�hjhj�j�j�j�j�jj9j/j"j_j�ji
jc
j�
j�
j�j&j�jCjSj8jZj[j�jjja	j�j�j�jj
j�j�j� j� j�j�!j)j�"j�j�"j�
jN$j�
j�$j%j%j-'j.'j�jr'jYjr'j�j�+j�j�,j�j�-jj�.j�j�.jIj4j�j<4j�j�9j�j�9j�Aj�Aj�jpCjj�FjBj�Lj~j�Rj�j�Rj�j�SjTj�SjjTj;j�TjUj�Tj�Uj�Uj�Uj�Uh<j�j�j�j)jjYjBj�jj�j�j�j�j#jjSj<j�jlj�j�j�j�jj�jCj,jjhj�j�j�j�jj�j<j%jxjaj�j�j�j�jj�j5ju�
footnote_refs�}��
citation_refs�}��
autofootnotes�]��autofootnote_refs�]��symbol_footnotes�]��symbol_footnote_refs�]��	footnotes�]��	citations�]��autofootnote_start�K�symbol_footnote_start�K�id_start�K�parse_messages�]��transform_messages�]�h�system_message���)��}�(hhh]�h_)��}�(hhh]�h�5Hyperlink target "originaltextfor" is not referenced.�����}�(hhhj'Xubah"}�(h$]�h&]�h)]�h+]�h-]�uh/h^hj$Xubah"}�(h$]�h&]�h)]�h+]�h-]��level�K�type��INFO��source�h=�line�M�uh/j"Xuba�transformer�N�
decoration�Nhhub.