-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PEG syntax considerations #17
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -48,7 +48,10 @@ def get_parser(debug=False, root='query_specification'): | |
peg_rules = re.sub('#', '// ', peg_rules) | ||
|
||
# adapt character range syntax | ||
peg_rules = re.sub("'\\[", "r'[", peg_rules) | ||
peg_rules = re.sub("\\[", "r'[", peg_rules) | ||
peg_rules = re.sub("\\!r'\\[", "r'[^", peg_rules) | ||
peg_rules = re.sub("\\]", "]'", peg_rules) | ||
peg_rules = re.sub("EOF <-[^;]*;", "", peg_rules) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure I'm too enthused by hacking the grammar syntax with regular expressions. For now, that's probably all right, but we should have a plan to parse our grammar into a tree and then serialise it in the various syntaxes, I guess. I just wonder if someone else might not already have written something like that... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's indeed a very interesting idea and much stable/reliable than regular expressions, though apparently this is enough and allowed us to quickly test this grammar with different parsers. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The hacking is to fit arpeggio, which asks for regular expressions: documentation on grammars.
We'd need to think about an alternate toolset which doesn't rely on them to test the ADQL examples. |
||
|
||
return ParserPEG(peg_rules, | ||
root, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hu? How can this disapear without breaking the grammar?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was duplicated for some unknown reason: line 485 and line 558.