fsharp/powerpack — pull request #6 by vpolozov (2012-10-11 12:41:26+00:00)
Title: Apply patch for parseState.ResultRange

See patches at http://fsharppowerpack.codeplex.com/SourceControl/list/patches

This patch replaces default behaviour of FsYacc's parseState.ResultRange and other lexing positions. FsYacc binds position of lookahead token to result range if right side of the rule was empty. In some cases such behaviour isn't correct. For example:

start: rule1 TOKEN4 { $1 }
rule1: TOKEN1 TOKEN2 rule2 { parseState.ResultRange }
rule2: TOKEN3 { }
| { }

Patch considers position of empty productions to be Lexing.Position.Empty.
So, without the patch, if rule2 evaluates to empty, result of rule1 for input [TOKEN1 TOKEN2 TOKEN4] will be range from TOKEN1 to TOKEN4 instead of expected range from TOKEN1 to TOKEN2.