Quantcast

Parsing to the end of a file

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Parsing to the end of a file

jorge.ortiz@gmail.com
I'm using Parboiled to build a parser for Apache Thrift (https://thrift.apache.org/) files.

Sometimes, when there is a bug in my parser or a bug in the Thrift source I'm parsing, the parser will consume a portion of the file and return success, even though there was content in the file that was left unparsed.

Is there a way to have Parboiled error unless it consumes the entire input?

I'm running Parboiled 1.1.4 for Scala 2.9.2. The code I'm running looks something like:

  val thrift: String = ...
  val parser = new ThriftParser
  val runner = ReportingParseRunner(parser.Program)
  val runResult = runner.run(thrift)

Thanks,

--j

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Parsing to the end of a file

mail
Hi,

create a rule ending with the EOI terminal should do what you want.

Cheers
Markus


2013/6/21 jorge.ortiz [via parboiled users] <[hidden email]>
I'm using Parboiled to build a parser for Apache Thrift (https://thrift.apache.org/) files.

Sometimes, when there is a bug in my parser or a bug in the Thrift source I'm parsing, the parser will consume a portion of the file and return success, even though there was content in the file that was left unparsed.

Is there a way to have Parboiled error unless it consumes the entire input?

I'm running Parboiled 1.1.4 for Scala 2.9.2. The code I'm running looks something like:

  val thrift: String = ...
  val parser = new ThriftParser
  val runner = ReportingParseRunner(parser.Program)
  val runResult = runner.run(thrift)

Thanks,

--j




If you reply to this email, your message will be added to the discussion below:
http://users.parboiled.org/Parsing-to-the-end-of-a-file-tp4024215.html
To unsubscribe from parboiled users, click here.
NAML



--
____________________________________

          Markus Wolf
          Kieler Straße 21
          22769 Hamburg

     tel: (+49) 40 / 80 600 599
     mob: (+49) 177 / 288 48 67
 twitter: @KnisterPeter
____________________________________

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Parsing to the end of a file

jorge.ortiz@gmail.com
Thank you! That's exactly what I was looking for.
Loading...