Questions tagged [petitparser]

PetitParser is a parsing framework for Smalltalk, Java and Dart.

PetitParser is a parsing framework originally written in Smalltalk.

PetitParser combines ideas from scannerless parsing, parser combinators, parsing expression grammars and packrat parsers to model grammars and parsers as objects that can be reconfigured dynamically.

Information can be found at the PetitParser page of the University of Bern.

There are implementations in

To get started with PetitParser you might have a look at:

54 questions
0
votes
1 answer

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 understood by e.g. javax.xml.xpath.XPath but maybe…
Matthias
  • 263
  • 4
  • 11
0
votes
1 answer

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|L || S|70|L || S|69|L || S|72|L) && (F|54|L ||…
Coltuxumab
  • 615
  • 5
  • 16
0
votes
1 answer

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 toChoiceParser() if a plus() parser is added. import…
CodingFun
  • 3
  • 1
0
votes
1 answer

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 Parser start() => throw UnsupportedError('Not…
Roger Lipscombe
  • 89,048
  • 55
  • 235
  • 380
0
votes
1 answer

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 and 2 - 2 --Start Query 2 important 2 --End 2 else…
msangel
  • 9,895
  • 3
  • 50
  • 69
0
votes
1 answer

Whitespace is missing in my PetitParser map Function

I tried to parse normal text with function calls in it. class EmmaGrammarDefinition extends GrammarDefinition { const EmmaGrammarDefinition(); Parser start() => ref(value).plus().end(); Parser token(Object source, [String name]) { if…
0
votes
1 answer

Why flatten gets rid of mapped values?

I am trying to parse a sentence and, at the same time, convert numbers to their digit representation. As a simple example I want the sentence three apples parsed and converted to 3 apples With this code simple code I can actually parse the…
0
votes
1 answer

Dart Petitparser to Process Lisp code

I am considering using petitparser for Dart (https://pub.dartlang.org/packages/petitparser) in my project. I want to use it to process Lisp code stored as Strings. For example, given data like this: (setq age 20) (setq livesin "Mississippi") And a …
Hesh
  • 413
  • 1
  • 3
  • 11
0
votes
1 answer

How would I create a parser which consumes a character that is also at the beginning and end

How would I create a parser that allows a character which also happens to be the same as the begin/end character. Using the following example: 'Isn't it hot' The second single-quote should be accepted as part of the content that is between the…
EndlessLife
  • 319
  • 3
  • 13
1 2 3
4