diff options
author | Petr Viktorin <encukou@gmail.com> | 2024-05-30 07:27:32 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-30 07:27:32 (GMT) |
commit | 48f21b3631eb20871fe234e9714b19aa76cf3a49 (patch) | |
tree | bcd17f5b614f11fa18fa92dd2ce1865fdf96af34 /Doc | |
parent | a5fef800d31648d19cecc240a2fa0dc71371753e (diff) | |
download | cpython-48f21b3631eb20871fe234e9714b19aa76cf3a49.zip cpython-48f21b3631eb20871fe234e9714b19aa76cf3a49.tar.gz cpython-48f21b3631eb20871fe234e9714b19aa76cf3a49.tar.bz2 |
gh-118235: Move RAISE_SYNTAX_ERROR actions to invalid rules and make sure they stay there (GH-119731)
The Full Grammar specification in the docs omits rule actions, so grammar rules that raise a syntax error looked like valid syntax.
This was solved in ef940de by hiding those rules in the custom syntax highlighter.
This moves all syntax-error alternatives to invalid rules, adds a validator that ensures that actions containing RAISE_SYNTAX_ERROR are in invalid rules, and reverts the syntax highlighter hack.
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/tools/extensions/peg_highlight.py | 2 |
1 files changed, 0 insertions, 2 deletions
diff --git a/Doc/tools/extensions/peg_highlight.py b/Doc/tools/extensions/peg_highlight.py index 5ab5530..4bdc2ee 100644 --- a/Doc/tools/extensions/peg_highlight.py +++ b/Doc/tools/extensions/peg_highlight.py @@ -16,7 +16,6 @@ class PEGLexer(RegexLexer): - Rule types - Rule options - Rules named `invalid_*` or `incorrect_*` - - Rules with `RAISE_SYNTAX_ERROR` """ name = "PEG" @@ -60,7 +59,6 @@ class PEGLexer(RegexLexer): (r"^(\s+\|\s+.*invalid_\w+.*\n)", bygroups(None)), (r"^(\s+\|\s+.*incorrect_\w+.*\n)", bygroups(None)), (r"^(#.*invalid syntax.*(?:.|\n)*)", bygroups(None),), - (r"^(\s+\|\s+.*\{[^}]*RAISE_SYNTAX_ERROR[^}]*\})\n", bygroups(None)), ], "root": [ include("invalids"), |