Questions tagged [fastparse]

FastParse is a parser-combinator library for Scala that lets you quickly and easily write recursive descent parsers in Scala.

FastParse is a parser-combinator library for Scala that lets you quickly and easily write recursive descent parsers in Scala. Features include:

Up to 1/5 the speed of a hand-written parser, 100x faster than scala-parser-combinators, comparable (though slightly slower than) Parboiled2 1/10th the size of a hand-written parser Automatic, excellent error-reporting and diagnostics. Zero allocations during a parse Compatible with both Scala-JVM and Scala.js

http://lihaoyi.github.io/fastparse/

27 questions
1
vote
1 answer

FastParse, search an expression in a free text

I'm trying FastParse library, but, I'm not sure then is the correct library for what I want to do. In my test, I'm looking for a 'data' put in the middle of text paragraph, the text is this: INTEL SSD 180 GB Serie 540s Interfaccia Sata III 6 Gb / s…
faster2b
  • 662
  • 6
  • 22
1
vote
1 answer

scala fastparse typechecking

I am puzzled by why the following code using scala fastparse 0.4.3 fails typechecking. val White = WhitespaceApi.Wrapper{ import fastparse.all._ NoTrace(CharIn(" \t\n").rep) } import fastparse.noApi._ import White._ case class Term(tokens:…
chris
  • 2,473
  • 1
  • 29
  • 28
1
vote
1 answer

Fastparse doesn't backtrack

Edit (to generalize the problem): I'd like to parse a grammar, where ::= [a-z]* ::= xxx ::= b+ ::= I expect (for example) the following words to pass: aaaaxxxbb, axxxaaxxxbbb,…
Gabor Juhasz
  • 317
  • 2
  • 9
1
vote
1 answer

Scala FastParse Library Error

I am trying to learn the scala fast parse library. Towards this I have written the following code import fastparse.noApi._ import fastparse.WhitespaceApi object FastParsePOC { val White = WhitespaceApi.Wrapper{ import fastparse.all._ …
Knows Not Much
  • 30,395
  • 60
  • 197
  • 373
0
votes
1 answer

I'm having an issue with using ASTParser in eclipse

I'm trying to use ASTParser in eclipse but facing an NoClassDefFoundError. I've already followed some guides and imported related 9 jars. Following are the details: package test_JDT; import java.io.BufferedInputStream; import…
Zhang Tab
  • 11
  • 3
0
votes
2 answers

No implicit view available from fastparse.P[Any] => fastparse.P[Unit]

I am working through the tutorial/explanation of fastparse and am getting the error message error: No implicit view available from fastparse.P[Any] => fastparse.P[Unit] for the sequence example. I am using sbt 1.3.8 and scala 2.13.1. The defined…
Sim
  • 4,199
  • 4
  • 39
  • 77
0
votes
1 answer

Return type error while parsing parsing results

I am parsing the results of parsing python code to get the result. Project Structure: PythonParseProject build.sbt src main scala pyparse Ast.scala Lexical.scala Expressions.scala …
ioprst
  • 187
  • 16
0
votes
1 answer

How to handle text tables with FastParse?

I have text file with single row table (tab separated) and I need to parse it to receive Map("one" -> 1, "two" -> 2, "three" -> 3). I can't figure out how to do it and even not sure that it is possible at all. Any ideas guys? one two three 1 2 …
mulya
  • 1,273
  • 13
  • 26
0
votes
1 answer

FastParse - out of memory error

I'm trying to use the FastParse library to create a parser for a very primitive templating system like this: Hello, your name is {{name}} and today is {{date}}. So far I have: scala> import fastparse.all._ import fastparse.all._ scala> val…
Knut Arne Vedaa
  • 15,372
  • 11
  • 48
  • 59
0
votes
0 answers

Parse string with unescaped characters

I have one library which supports some kind of custom language. The parser is written using scala RegexParsers. Now I'm trying to rewrite our parser using fastparse library to speedup our engine. The question is: Is it possible to parse properly…
dyrkin
  • 544
  • 4
  • 15
0
votes
1 answer

Fastparse parse error column numbers missing

I just updated from fastparse 0.3.7 to 0.4.1. There is no longer a column number value in the extras of a Parsed.Failure. I grepped through the source and it seems the functionality has been removed, though it is still in the documentation. Is…
seanmcl
  • 9,740
  • 3
  • 39
  • 45
0
votes
2 answers

P[Node].rep produces P[String] rather than array of nodes

I would expect the result for plusses to be some kind of array case class Plus() val plus: P[Plus] = P ("+") map {_ => Plus()} val plusses: P[List[Plus]] = P ( plus.rep.! ) // type mismatch; found: Parser[String] required: Parser[List[Plus]] but…
1
2