Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/pull/124'
Browse files Browse the repository at this point in the history
  • Loading branch information
igordejanovic committed Jan 5, 2024
2 parents 844986e + 022dcfe commit cd76a4c
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ please take a look at related PRs and issues and see if the change affects you.
- fix: #98 suppressed match in zero-or-more [#98]. Thanks @vpavlu for reporting
the issue.

- fix: empty comments in .peg files hid the next line, commented or not.

[#125]: https://github.com/textX/Arpeggio/issues/125
[#123]: https://github.com/textX/Arpeggio/discussions/123
[#101]: https://github.com/textX/Arpeggio/issues/101
Expand Down
2 changes: 1 addition & 1 deletion arpeggio/cleanpeg.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def rule_name(): return _(r"[a-zA-Z_]([a-zA-Z_]|[0-9])*")
def rule_crossref(): return rule_name
def str_match(): return _(r'''(?s)('[^'\\]*(?:\\.[^'\\]*)*')|'''
r'''("[^"\\]*(?:\\.[^"\\]*)*")''')
def comment(): return "//", _(".*\n")
def comment(): return _("//.*\n", multiline=False)


class ParserPEG(ParserPEGOrig):
Expand Down
4 changes: 2 additions & 2 deletions arpeggio/peg.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ def regex(): return _(r"""(r'[^'\\]*(?:\\.[^'\\]*)*')|"""
def rule_name(): return _(r"[a-zA-Z_]([a-zA-Z_]|[0-9])*")
def rule_crossref(): return rule_name
def str_match(): return _(r'''(?s)('[^'\\]*(?:\\.[^'\\]*)*')|'''
r'''("[^"\\]*(?:\\.[^"\\]*)*")''')
def comment(): return "//", _(".*\n")
r'''("[^"\\]*(?:\\.[^"\\]*)*")''')
def comment(): return _("//.*\n", multiline=False)


# Escape sequences supported in PEG literal string matches
Expand Down
1 change: 1 addition & 0 deletions arpeggio/tests/test_peg_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
factor <- ("+" / "-")?
(number / "(" expression ")");
// This is another comment
//
term <- factor (( "*" / "/") factor)*;
expression <- term (("+" / "-") term)*;
calc <- expression+ EOF;
Expand Down

0 comments on commit cd76a4c

Please sign in to comment.