You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Attempting to use the word constructor as an identifier in brs causes parser errors, despite the fact that this is valid in RBI.
submain()
constructor=function()
return {
foo: "bar"
}
end functioninstance=constructor()
printinstance.foo' => "bar"end sub
output:
$ bin/cli.js /tmp/mwe.brs
/tmp/derp.brs(2,4-15): Found unexpected token 'constructor'
/tmp/derp.brs(6,4-16): Expected 'end sub' to terminate sub block
/tmp/derp.brs(8,15-26): Found unexpected token 'constructor'
/tmp/derp.brs(10,0-7): Found unexpected token 'end sub'
Error occurred parsing
The text was updated successfully, but these errors were encountered:
sjbarag
added
bug
Any difference between this BrightScript implementation and RBI, or otherwise unexpected behavior
lexer
Affects this project's lexer (aka scanner)
labels
Jan 21, 2021
By using an identifier in a BrightScript file as an index into that
object, we accidentally leaked non-Token properties on the `KeyWords` JS
object from the lexer, e.g. `return KeyWords["constructor"]`. Use
`hasOwnProperty()` to check if an identifier is a BrightScript keyword
to avoid returning JavaScript internals as Tokens.
fixes#613
By using an identifier in a BrightScript file as an index into that
object, we accidentally leaked non-Token properties on the `KeyWords` JS
object from the lexer, e.g. `return KeyWords["constructor"]`. Use
`hasOwnProperty()` to check if an identifier is a BrightScript keyword
to avoid returning JavaScript internals as Tokens.
fixes#613
Attempting to use the word
constructor
as an identifier inbrs
causes parser errors, despite the fact that this is valid in RBI.output:
The text was updated successfully, but these errors were encountered: