58 questions
1 vote
1 answer
64 views
Understanding PetitParser2 behavior
I'm struggling with a small parser using PetitParser2. Here is a fragment of some of the rules I'm defining but their behaviour is not as I could expect: andKeyword := 'and' asPParser trim, #letter ...
1 vote
1 answer
149 views
How to correctly handle parsing errors with PetitParser or PetitParser2 in Pharo
I know there has been an old question How can a PetitParser parse rule signal an error?. Lukas Renggli has written it is: in general this is not good style (mixes syntactic and semantic analysis) ...
0 votes
1 answer
162 views
How to consume until a delimiter - with exceptions (Petit Parser for Dart)
Fair enough, previously was a badly worded question. I'm going to take another stab at it. I'm using Dart's PetitParser to consume input. I want a lexer that will accept any string until one of a ...
0 votes
0 answers
74 views
Dart/Flutter PetitParser Fails to Ingest
Having trouble again getting a my input properly ingested, and I'm not sure what I'm doing wrong. The full file I'm using to to define my lexers can be seen here. But specifically what I'm running ...
0 votes
1 answer
132 views
What is an example of use case for epsilon in dart petitparser?
I don't understand the comment: /// Returns a parser that consumes nothing and succeeds. /// /// For example, `char('a').or(epsilon())` is equivalent to /// `char('a').optional()`. @useResult Parser&...
0 votes
1 answer
73 views
Parse XPath with PetitParser in Java
Does anybody know if there is an existing implementation of an XPath parser in Java that uses PetitParser? I assume it is more or less impossible to cover all thinkable XPath expressions that are ...
0 votes
1 answer
469 views
Cannot figure out why I'm getting error when parsing a string in Dart/Flutter with petitparser: uppercase letter expected at 1:1
UPDATE 1: It looks like changing digit().plus() to word().plus() works. Does that seem right? Petitparser has proven to be very powerful! I have the following flutter/dart code: testString = '((S|71|...
1 vote
1 answer
168 views
Can someone point me in the right direction to begin parsing this string in dart?
I have a series of string like this: (((S|69|L || S|69|R || S|72|L || S|72|R) && ((S|62|L && (S|78|L || S|55|L) && (S|77|L || S|1|L)) || (S|62|R && (S|78|R || S|55|R) &...
0 votes
1 answer
105 views
Why is the ordered choice ignored of toChoiceParser() when adding a plus() parser?
I am stuck at one point with the Dart package petitparser: It seems that the "priority rule" ("parse p1, if that doesn't work parse p2 - ordered choice") is ignored by the ...
0 votes
1 answer
161 views
Using whitespace as a list separator
I can successfully parse a comma-delimited list with dart-petitparser, but the same code fails when confronted with a space-delimited list: class MyDefinition extends GrammarDefinition { @override ...
0 votes
1 answer
134 views
Java petitparser optional end of expression
I need a parser that took only important marked parts from a text file. This is sample input: else before 1 else before 2 --Start Query 1 important 1 --End 1 else between 1 and 2 - 1 else between 1 ...
2 votes
1 answer
257 views
PetitParser and Parentheses
Sorry, I ran into another question about using PetitParser. I've figured out my recursive issues, but now I have a problem with parentheses. If I need to be able to parse the following two expressions:...
2 votes
1 answer
84 views
How to get the content between two identical elements
I want to parse the root element of such data as follows <elementA> ... ...anything ... </ elementA> <elementB> <!--anything such as same element name--> <elementB>...
1 vote
1 answer
339 views
Using Flutter's PetiteParser to create FHIRPath
I'd like to ask for some guidance using petitparser (I'm updating this question). There's a json-based grammar called FHIRPath that I'm trying to recreate in dart. I'm new to grammars like this, so it'...
3 votes
1 answer
136 views
ref0 not resolved by petitparser
petitparser is a parser generator written in dart to be used e.g. in Flutter. According to this page, petitparser allows to use ref0 to reference the current parse class. In the section Using Grammar ...