Beaglefoot / tree-sitter-awk

GNU AWK grammar for tree-sitter

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Adding comment inside 'switch' statement triggers syntax error

0liv1er opened this issue · comments

Here below are some code examples which execute without any problem with GNU awk but that trigger warnings or errors when adding comment in an awk switch statement (using nvim and awk-language-server plugin).

BEGIN {
        str="hello world"
        switch(str) {
                # This comment triggers a warning: Syntax error: missing }
        }
} # and a syntax error here also
BEGIN {
        str="hello world"
        switch(str) {
                case "hello":
                case "world":
                        break # This comment triggers a syntax error
        }
}
BEGIN {
        str="hello world"
        switch(str) {
                case "hello":
                default: # This comment triggers a warning: Syntax error: Missing identifier
        }
}

I can replicate. It's a bug in parser.

This is fixed in 0.6.1.