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

JavaScriptParser.ParseProgram throws on empty file with comments and Loc = true #92

Closed
sam-lord opened this issue Feb 13, 2019 · 0 comments · Fixed by #93
Closed

JavaScriptParser.ParseProgram throws on empty file with comments and Loc = true #92

sam-lord opened this issue Feb 13, 2019 · 0 comments · Fixed by #93

Comments

@sam-lord
Copy link
Contributor

// Copyright 2009 the Sputnik authors.  All rights reserved.
/**
 * Correct interpretation of single line comments
 *
 * @path ch07/7.4/S7.4_A1_T2.js
 * @description Simple test, create empty comment: ///
 */

//CHECK#1
///

Parsing the above file with this parser:

var parser = new JavaScriptParser(source, new ParserOptions
{
    Loc = true
});

Throws this exception:

System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.

Because a Location was initialised with start and end equal to (12, 0).

I believe the solution to this is modifying the Location constructor to allow the end to be equal to the start (but not precede it). I'll create a PR to reflect that, but I'd appreciate it if anyone can comment on whether the correct behaviour would be that start and end would equal (0, 0).

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

Successfully merging a pull request may close this issue.

1 participant