Questions tagged [petitparser]
PetitParser is a parsing framework for Smalltalk, Java and Dart.
petitparser
59
questions
0
votes
0
answers
16
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
55
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
0
answers
29
views
PetitParser2 Smalltalk grammar testing dataset
I would like to use PetitParser2 in Pharo.
I would like to use the Smalltalk grammar, but the testing dataset is not available anymore. Does anyone know where to get it?
Edit:
The filename missing is ...
0
votes
1
answer
84
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
40
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
87
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
55
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
284
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
122
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
76
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
131
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
102
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
224
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
73
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
275
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'...