diff --git a/lslopt/lslparse.py b/lslopt/lslparse.py index 4fb2de8..c079654 100644 --- a/lslopt/lslparse.py +++ b/lslopt/lslparse.py @@ -1652,6 +1652,8 @@ list lazy_list_set(list L, integer i, list v) # we always do and open a new scope for it. At worst it will be # empty. At least it is not reflected as braces in the code if # braces are not used. + # FIXME: This causes issues with this code that should work: + # default{timer(){ jump x; while(1) @x; }} self.PushScope() self.breakstack.append([self.GenerateLabel(), self.scopeindex, False]) diff --git a/testparser.py b/testparser.py index 38de56d..152676c 100644 --- a/testparser.py +++ b/testparser.py @@ -227,6 +227,15 @@ class Test02_Parser(UnitTestCase): self.parser.parse('f(){if(1) {state default;}if (1) if (1) state default; else state default;}default{timer(){}}') self.parser.parse('default{timer(){vector v;v.x=0;}}') + # Check for exceptions only + p = self.parser.parse('default{timer(){jump x;while(1)@x;}}') + self.outscript.output(p) + + self.assertRaises(EParseUndefined, self.parser.parse, + 'default{timer(){jump x;while(1){@x;}}}') + self.assertRaises(EParseUndefined, self.parser.parse, + 'default{timer(){jump x;{while(1)@x;}}}') + def tearDown(self): del self.parser @@ -478,6 +487,14 @@ class Test03_Optimizer(UnitTestCase): # should raise no other exception self.assertFalse(True) + p = self.parser.parse('default{timer(){jump x;while(1)@x;}}') + self.opt.optimize(p) + out = self.outscript.output(p) + print out + # FIXME: DCR produces invalid code, thinks the while can be eliminated + # due to the jump jumping past it. Extremely corner case, but maybe + # worth a fix. + def tearDown(self): del self.parser del self.opt