Closed seizethedave closed 6 years ago
This shouldn't parse since f() is an expression and not a statement. But a parsing failure should be reported rather than the AttributeError here.
AttributeError
CSE2: extern f(i : Int) : Int = "{i} + 1" op addElement(x : Int) f(x + 2);
Squinkle:cozy dgrant$ cozy specs/cse2.ds -t 2 --java cse2.java Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.5/bin/cozy", line 11, in <module> load_entry_point('Cozy', 'console_scripts', 'cozy')() File "/Users/dgrant/Dev/cozy/cozy/cozy/main.py", line 62, in run ast = parse.parse(input_text) File "/Users/dgrant/Dev/cozy/cozy/cozy/parse.py", line 463, in parse return parser.parse(s) File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/ply/yacc.py", line 331, in parse return self.parseopt_notrack(input, lexer, debug, tracking, tokenfunc) File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/ply/yacc.py", line 1118, in parseopt_notrack p.callable(pslice) File "/Users/dgrant/Dev/cozy/cozy/cozy/parse.py", line 433, in p_basicstm p[0] = syntax.SCall(p[1].e, p[1].f, p[3]) AttributeError: 'EVar' object has no attribute 'e'
This shouldn't parse since f() is an expression and not a statement. But a parsing failure should be reported rather than the
AttributeError
here.