summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorptmcg <ptmcg@austin.rr.com>2022-05-20 16:45:44 -0500
committerptmcg <ptmcg@austin.rr.com>2022-05-20 16:45:44 -0500
commitff2b1624c08ba80b6a5132601fddc4835467c9a0 (patch)
tree425a43aee0db5d938c8d6b4a26187afb1b93ce27
parent3a256cc444258ecc1321001702672c65eb5d425a (diff)
downloadpyparsing-git-ff2b1624c08ba80b6a5132601fddc4835467c9a0.tar.gz
Cleaned up/expanded some docstrings and docs to reflect new 3.0.10 changes
-rw-r--r--CHANGES4
-rw-r--r--docs/whats_new_in_3_0_0.rst18
-rw-r--r--pyparsing/core.py5
3 files changed, 24 insertions, 3 deletions
diff --git a/CHANGES b/CHANGES
index 7c4cad7..248517f 100644
--- a/CHANGES
+++ b/CHANGES
@@ -11,10 +11,12 @@ Version 3.0.10 - (in development)
test = "BEGIN aaa bbb ccc END"
BEGIN, END = map(Keyword, "BEGIN END".split())
body_word = Word(alphas)
+
expr = BEGIN + Group(body_word[:END]) + END
# equivalent to
# expr = BEGIN + Group(ZeroOrMore(body_word, stop_on=END)) + END
- print(expr.parse_string(test).as_list())
+
+ print(expr.parse_string(test))
Prints:
diff --git a/docs/whats_new_in_3_0_0.rst b/docs/whats_new_in_3_0_0.rst
index 6eb8530..5c467b1 100644
--- a/docs/whats_new_in_3_0_0.rst
+++ b/docs/whats_new_in_3_0_0.rst
@@ -4,11 +4,11 @@ What's New in Pyparsing 3.0.0
:author: Paul McGuire
-:date: April, 2022
+:date: May, 2022
:abstract: This document summarizes the changes made
in the 3.0.0 release of pyparsing.
- (Updated to reflect changes up to 3.0.8)
+ (Updated to reflect changes up to 3.0.10)
.. sectnum:: :depth: 4
@@ -62,6 +62,20 @@ generator for documenting pyparsing parsers.::
# save as HTML
parser.create_diagram('parser_rr_diag.html')
+``create_diagram`` accepts these named arguments:
+
+- ``vertical`` (int) - threshold for formatting multiple alternatives vertically
+ instead of horizontally (default=3)
+- ``show_results_names`` - bool flag whether diagram should show annotations for
+ defined results names
+- ``show_groups`` - bool flag whether groups should be highlighted with an unlabeled surrounding box
+- ``embed`` - bool flag whether generated HTML should omit ``<HEAD>``, ``<BODY>``, and ``<DOCTYPE>`` tags to embed
+ the resulting HTML in an enclosing HTML source (new in 3.0.10)
+- ``head`` - str containing additional HTML to insert into the ``<HEAD>`` section of the
+ generated code; can be used to insert custom CSS styling
+- ``body`` - str containing additional HTML to insert at the beginning of the ``<BODY>`` section of the
+ generated code
+
To use this new feature, install the supporting diagramming packages using::
pip install pyparsing[diagrams]
diff --git a/pyparsing/core.py b/pyparsing/core.py
index fb9d594..2b93b33 100644
--- a/pyparsing/core.py
+++ b/pyparsing/core.py
@@ -2186,6 +2186,11 @@ class ParserElement(ABC):
- show_groups - bool flag whether groups should be highlighted with an unlabeled surrounding box
- embed - bool flag whether generated HTML should omit <HEAD>, <BODY>, and <DOCTYPE> tags to embed
the resulting HTML in an enclosing HTML source
+ - head - str containing additional HTML to insert into the <HEAD> section of the generated code;
+ can be used to insert custom CSS styling
+ - body - str containing additional HTML to insert at the beginning of the <BODY> section of the
+ generated code
+
Additional diagram-formatting keyword arguments can also be included;
see railroad.Diagram class.
"""