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

'continue' is treated as a keyword even when it's disabled on LuaSyntaxOptions #127

Open
waneck opened this issue Apr 24, 2024 · 0 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@waneck
Copy link

waneck commented Apr 24, 2024

Describe the bug
continue is treated as a keyword even when it's disabled on LuaSyntaxOptions

To Reproduce

using Loretta.CodeAnalysis.Lua;
using Loretta.CodeAnalysis;

var parseOptions = new LuaParseOptions(LuaSyntaxOptions.Lua51).WithDocumentationMode(DocumentationMode.Parse);

// parse
var lorettaAst = LuaSyntaxTree.ParseText(@"
local continue = true

if continue then
    continue = false
end
", parseOptions, "test.lua");

foreach (var exc in lorettaAst.GetDiagnostics())
{
    Console.WriteLine(exc.ToString()); 
}

this code generates the following diagnostics:

test.lua(2,7): error LUA1000: Identifier expected; 'continue' is a keyword
test.lua(2,16): error LUA1012: Invalid statement
test.lua(2,16): error LUA1012: Invalid statement
test.lua(4,4): error LUA1011: Invalid expression part 'continue'
test.lua(4,4): error LUA1006: Syntax error, 'then' expected
test.lua(4,11): error LUA1012: Invalid statement
test.lua(5,14): error LUA1012: Invalid statement
test.lua(5,14): error LUA1012: Invalid statement

Expected behavior
Since Lua 5.1 is defined, no error is expected

Additional context
Loretta Version: Happens both on 0.2.13-nightly1 and 0.2.12

@waneck waneck added the bug Something isn't working label Apr 24, 2024
@GGG-KILLER GGG-KILLER added this to the v0.2.12 milestone Apr 26, 2024
@GGG-KILLER GGG-KILLER self-assigned this Apr 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Todo
Development

No branches or pull requests

2 participants