LeastFixedPoint/java-parser-tools

API problem: No way to identify where parsing fails

Opened this issue · 1 comments

Currently when a call is made to the Matchers.fullMatch(matcher, document) 
method and a document is passed with a syntax error in it then fullMatch 
simply returns an empty Results list.

There needs to be a way to indicate where the parsing failed so that the 
syntax error may be discovered. 
Perhaps the returned List should always have at least one Result object 
and the Result class should contain fields to indicate if a matching error 
happened and where in the document matching failed.

Original issue reported on code.google.com by emorning on 7 Apr 2009 at 7:56

Well, if you want to know where the parsing has failed you can use not 
Matchers.fullMatch(matcher, string), but simply matcher.match(string). Then you 
will 
have a list of partial ResultTrees each having a "rest" field indicating where 
it 
failed.

Though, we might want to have a method like this:
ResultTree Matchers.bestResult(List<ResultTree> results)
to find the best among results.

Original comment by shooshpa...@gmail.com on 19 Sep 2009 at 8:47

  • Changed state: Accepted
  • Added labels: Type-Enhancement
  • Removed labels: Type-Defect