Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

parseState.ResultRange reports incorrect position info #65

Open
nshibano opened this issue Nov 10, 2016 · 0 comments
Open

parseState.ResultRange reports incorrect position info #65

nshibano opened this issue Nov 10, 2016 · 0 comments

Comments

@nshibano
Copy link

Description

parseState.ResultRange reports incorrect position info when filename isn't set to lexbuf.EndPos.

Repro steps

I have uploaded repro here.

https://github.com/nshibano/FsLexYacc-report-20161111

To run the repro, please clone this repository and open ConsoleApplication3.sln and click run button. (The first run will fail because of nuget files isn't loaded. Restart VisualStudio and try again to reload.)

In this sample application, text "ABC" is parsed with very simple lexing/parsing rules. And parser returns position range obtained from parseState.ResultRange. Therefore position info should point entire text "ABC". However, reported range is incorrect and it points only part of it, "BC".

This glitch happens only when filename isn't set to lexbuf.EndPos. With filename set, parseState.ResultRange reports correct position.

Here is the output from sample application.

Range is 1 to 3.
Substring is "BC"
Try again with filename set to lexbuf.
Range is 0 to 3.
Substring is "ABC"

Known workarounds

To avoid this glitch, set filename to lexbuf.EndPos.

Related information

Visual Studio 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant