willowtreeapps / wist

A linter for BrightScript
Apache License 2.0
43 stars 11 forks source link

A single Error cascades and triggers numerous alerts #112

Closed joetesta closed 5 years ago

joetesta commented 6 years ago

In my file I had a "print" statement with a quoted string followed by a comma and a var (line 153): print "something", something_else

this generated an appropriate error, however the rest of the file then generated a bunch of errors:

  153:24  error    Parsing error: mismatched input ',' expecting {COMMENT, NEWLINE, ':'}
  161:40  error    Parsing error: mismatched input 'as' expecting {COMMENT, NEWLINE, ':'}
  162:2   error    Parsing error: extraneous input 'overrides' expecting {<EOF>, FUNCTION, SUB, COMMENT, NEWLINE}
  165:2   error    Parsing error: extraneous input 'if' expecting {FUNCTION, SUB, COMMENT, NEWLINE}
  166:4   error    Parsing error: extraneous input 'overrides' expecting {FUNCTION, SUB, COMMENT, NEWLINE}
  167:2   error    Parsing error: extraneous input 'end' expecting {FUNCTION, SUB, COMMENT, NEWLINE}
  169:2   error    Parsing error: extraneous input 'if' expecting {FUNCTION, SUB, COMMENT, NEWLINE}
  170:4   error    Parsing error: extraneous input 'overrides' expecting {FUNCTION, SUB, COMMENT, NEWLINE}
  171:2   error    Parsing error: extraneous input 'end' expecting {FUNCTION, SUB, COMMENT, NEWLINE}
  173:2   error    Parsing error: extraneous input 'if' expecting {FUNCTION, SUB, COMMENT, NEWLINE}
  174:4   error    Parsing error: extraneous input 'overrides' expecting {FUNCTION, SUB, COMMENT, NEWLINE}
  175:2   error    Parsing error: extraneous input 'end' expecting {FUNCTION, SUB, COMMENT, NEWLINE}
  177:2   error    Parsing error: extraneous input 'print' expecting {FUNCTION, SUB, COMMENT, NEWLINE}
  179:2   error    Parsing error: extraneous input 'return' expecting {FUNCTION, SUB, COMMENT, NEWLINE}
  180:0   error    Parsing error: extraneous input 'end' expecting {FUNCTION, SUB, COMMENT, NEWLINE}
  180:7   error    Parsing error: missing IDENTIFIER at '\n'
  181:0   error    Parsing error: extraneous input '<EOF>' expecting {BOX, CREATEOBJECT, DIM, END, ENDSUB, EXIT, EXITWHILE, EVAL, FALSE, FOR, GETGLOBALAA, GETLASTRUNCOMPILEERROR, GETLASTRUNRUNTIMEERROR, GOTO, IF, INVALID, NEXT, NOT, PRINT, RETURN, RUN, STOP, STRING, TAB, TRUE, TYPE, WHILE, STRING_LITERAL, INT_LITERAL, FLOAT_LITERAL, IDENTIFIER, COMMENT, NEWLINE, CONDITIONAL_CONST, CONDITIONAL_ERROR, CONDITIONAL_IF, '?', '(', ':', '+', '-'}
nishtahir commented 6 years ago

Can you provide a sample that reproduces the issue?

joetesta commented 6 years ago

Hi - this was the (partial) sample I included: print "something", something_else Any subs declared after this trigger "error"

nishtahir commented 5 years ago

I can't seem to reproduce this with this as the input. I'm guessing this was fixed with some other PR

' This is a sample file containing syntax that compiles properly

#const debug = true

REM Although the file compiles,
REM
REM Not all linting rules pass

sub DefaultMain()
    print "something", something_else    ' this should fail
    print "request failed �"
    #if debug = true
    print "debug mode enabled"
    #else
    print "debug mode disabled"
    #end if

    print "in showChannelSGScreen"

    'Indicate this is a Roku SceneGraph application'
    screen = CreateObject("roSGScreen")
    m.port = CreateObject("roMessagePort")
    screen.setMessagePort(m.port)

    'Create a scene and load /components/sampleproject.xml'
    scene = screen.CreateScene("SampleProject")
    screen.show()

    stop

    ? "some thing";"other thing"

    a = ["foo", "bar", "baz"]

    b = [
        "foo"
        "bar"
        "baz"
    ]

    c = {
        "foo": 1,
        "bar": 2,
        "baz": 3
    }

    c = {
        "foo": 1
        "bar": 2
        "baz": 3
    }
end sub