Questions tagged [arpeggio]

4 questions
1
vote
1 answer

Arpeggio can't go back after a catch

Here's a simple code to understand: def line(): return _(r".+") def start(): return [line, (line, line)], EOF parser = ParserPython(start, debug=True) input_expr = """ A B """ parse_tree = parser.parse(input_expr) Here, in the rule start, it…
damio
  • 6,041
  • 3
  • 39
  • 58
1
vote
2 answers

PEG grammar ordered choice failure

I have a PEG grammar for a toy DSL using the Python Arpeggio package: from arpeggio.cleanpeg import ParserPEG grammar = """ root = block* EOF block = header (item1+ / item2+) header = "block" item1 = number name comment? …
Dave
  • 3,834
  • 2
  • 29
  • 44
0
votes
1 answer

Why does TextX ignore \n in string literal, but not in regex?

TL;DR: The issue will be fixed in version 3.0 of TextX. The workaround is to use regex for matching escaped (\) characters, such as \n. FULL QUESTION: Using TextX, I am parsing a homegrown mark-up language, where paragraph and line breaks are…
MLAO
  • 3
  • 4
0
votes
1 answer

Difficulty writing PEG recursive expression grammar with Arpeggio

My input text might have a simple statement like this: aircraft In my language I call this a name which represents a set of instances with various properties. It yields an instance_set of all aircraft instances in this example. I can apply a filter…
Leon Starr
  • 480
  • 1
  • 4
  • 10