Ticket #48: error-compiler-directive.patch
File error-compiler-directive.patch, 2.7 KB (added by hopscc, 16 years ago) |
---|
-
Source/CobraParser.cobra
543 543 .expect('EOL') 544 544 # TODO: throw AssertException(SourceSite sourceSite, object[] expressions, object thiss, object info) 545 545 assert false, IdentifierExpr(token, 'throw') 546 on 'error' 547 # emit an optional message and throw an error, halting compilation 548 msgText = '%%error directive' 549 msg = .optional('STRING_SINGLE','STRING_DOUBLE') 550 if msg 551 msgText = msg.text[1:-1] 552 print '%%> [msgText]' 553 .throwError('Compilation stopped: "[msgText]"') 546 554 on 'number' # TODO: fix this to work on a per-file basis 547 555 # number 'decimal' | 'float' | 'float32' | 'float64' 548 556 typeName = .grab -
Tests/820-errors/600-other/120-error-compiler-directive.cobra
1 # This tests %% error without message ends with Compilation stopped and default msg 2 3 %% error # .error. Compilation stopped: "%%error directive" 4 class Program 5 6 def main is shared 7 pass -
Tests/820-errors/600-other/122-error-compiler-directive.cobra
1 # This tests %% error message ends with Compilation stopped and error msg 2 # Need also test that provided msg emitted but need TestifyRunner i/f for that 3 4 # following also emits %%> internal error 5 %% error 'internal error' # .error. Compilation stopped: "internal error" 6 class Program 7 8 def main is shared 9 pass -
Developer/IntermediateReleaseNotes.text
1 1 Post 0.8 2 2 3 * Added support for a new compiler directive 'error' that takes an optional message. 4 When encountered in compilation of a source file it causes display of 5 the mesage if any and stops compilation with an error. 6 .code 7 %% error 'Cannot build this file till mondo-patch installed' 8 3 9 * Added support for "multi-arg assignment" which allows you to assign to a number of variables from contents of a list in one statement 4 10 .code 5 11 a,b,c = ['val1', 'val2', 'val3']