summaryrefslogtreecommitdiff
path: root/docs/HowToUsePyparsing.rst
diff options
context:
space:
mode:
authorPaul McGuire <ptmcg@users.noreply.github.com>2020-08-19 22:42:25 -0500
committerPaul McGuire <ptmcg@users.noreply.github.com>2020-08-19 22:42:25 -0500
commit508750e836c67f95856824b97d3893c6009dda8f (patch)
treeda4b7981283c22d5e1da11e011bf5f9ef9dcf165 /docs/HowToUsePyparsing.rst
parentaf90c6d42bfb1288c30d0e44046b0e2819ad54d6 (diff)
downloadpyparsing-git-508750e836c67f95856824b97d3893c6009dda8f.tar.gz
Convert SyntaxWarnings to ValueError and TypeError exceptions; change diagnostics to an enum, and add enable_diag(), disable_diag() and enable_all_warnings() methods; clean up pyparsing imports in test_unit.py
Diffstat (limited to 'docs/HowToUsePyparsing.rst')
-rw-r--r--docs/HowToUsePyparsing.rst15
1 files changed, 13 insertions, 2 deletions
diff --git a/docs/HowToUsePyparsing.rst b/docs/HowToUsePyparsing.rst
index 88bb8be..4e3c24b 100644
--- a/docs/HowToUsePyparsing.rst
+++ b/docs/HowToUsePyparsing.rst
@@ -77,7 +77,7 @@ The parsed tokens are returned in the following form::
['Hello', ',', 'World', '!']
['Bonjour', ',', 'Monde', '!']
['Hola', ',', 'Mundo', '!']
- ['Gutentag', ',', 'Welt', '!']
+ ['Hallo', ',', 'Welt', '!']
Usage notes
@@ -809,7 +809,7 @@ Exception classes and Troubleshooting
and ``setDebug()``, or test the matching of expression fragments by testing them using
``searchString()`` or ``scanString()``.
-- Diagnostics can be enabled using ``pyparsing.enable_diagnostic`` and passing
+- Diagnostics 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
@@ -834,6 +834,17 @@ Exception classes and Troubleshooting
- ``enable_debug_on_named_expressions`` - flag to auto-enable debug on all subsequent
calls to ``ParserElement.setName``
+ All warnings can be enabled by calling ``pyparsing.enable_all_warnings()``.
+ Sample::
+
+ import pyparsing as pp
+ pp.enable_all_warnings()
+
+ fwd = pp.Forward().setResultsName("recursive_expr")
+
+ >>> UserWarning: warn_name_set_on_empty_Forward: setting results name 'recursive_expr'
+ on Forward expression that has no contained expression
+
Miscellaneous attributes and methods
====================================