mirror of
https://github.com/Sei-Lisa/LSL-PyOptimizer
synced 2025-07-01 15:48:21 +00:00
Parse_unary_postfix_expression shouldn't accept the token (i.e. advance to the next) if it's not processed. This caused a mismatch between the reported syntax error and the position where it should have been detected. Fixed.
Added corresponding regression test.
This commit is contained in:
parent
ceb442e931
commit
cfb9dee941
2 changed files with 28 additions and 5 deletions
|
@ -467,6 +467,17 @@ class Test03_Optimizer(UnitTestCase):
|
|||
self.assertRaises(EParseAlreadyDefined, self.parser.parse,
|
||||
'default { timer() {} timer() {} }')
|
||||
|
||||
try:
|
||||
self.parser.parse('default { timer() { return } }')
|
||||
# should raise EParseSyntax, so it should never get here
|
||||
self.assertFalse(True)
|
||||
except EParseSyntax as e:
|
||||
# should err before first closing brace
|
||||
self.assertEqual(e.cno, 27)
|
||||
except:
|
||||
# should raise no other exception
|
||||
self.assertFalse(True)
|
||||
|
||||
def tearDown(self):
|
||||
del self.parser
|
||||
del self.opt
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue