mirror of
https://github.com/Sei-Lisa/LSL-PyOptimizer
synced 2025-07-01 23:58:20 +00:00
Parser fix: Give error in state switch when ident is not a state
This commit is contained in:
parent
1d1aba9687
commit
28de23a03b
3 changed files with 10 additions and 2 deletions
|
@ -1825,8 +1825,11 @@ list lazy_list_set(list L, integer i, list v)
|
||||||
raise EParseSyntax(self)
|
raise EParseSyntax(self)
|
||||||
# State Switch only searches for states in the global scope
|
# State Switch only searches for states in the global scope
|
||||||
name = self.tok[1] if self.tok[0] == 'IDENT' else 'default'
|
name = self.tok[1] if self.tok[0] == 'IDENT' else 'default'
|
||||||
if name not in self.symtab[0] and (name not in self.globals
|
if (name not in self.symtab[0]
|
||||||
or self.globals[name]['Kind'] != 's'):
|
or self.symtab[0][name]['Kind'] != 's'
|
||||||
|
) and (name not in self.globals
|
||||||
|
or self.globals[name]['Kind'] != 's'
|
||||||
|
):
|
||||||
raise EParseUndefined(self)
|
raise EParseUndefined(self)
|
||||||
self.NextToken()
|
self.NextToken()
|
||||||
self.expect(';')
|
self.expect(';')
|
||||||
|
|
3
unit_tests/regression.suite/state-global.err
Normal file
3
unit_tests/regression.suite/state-global.err
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
default{timer(){state Z;}}
|
||||||
|
^
|
||||||
|
(Line 2 char 23): ERROR: Name not defined within scope
|
2
unit_tests/regression.suite/state-global.lsl
Normal file
2
unit_tests/regression.suite/state-global.lsl
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
integer Z;
|
||||||
|
default{timer(){state Z;}}
|
Loading…
Add table
Add a link
Reference in a new issue