Wiki

Ticket #35: throwStop.patch

File throwStop.patch, 1.2 KB (added by hopscc, 16 years ago)
  • Source/CobraParser.cobra

     
    539539        token = .grab 
    540540        branch token.text 
    541541            on 'throw' 
     542                msg = .optional('STRING_SINGLE','STRING_DOUBLE') 
     543                if msg 
     544                    print '%%> [msg.text[1:-1]]' 
     545                    .throwError('Compilation Stopped due CompilerDirective "throw"')         
    542546                # throw an internal error. used for testing that the compiler will catch and report these as internal errors 
    543547                .expect('EOL') 
    544548                # TODO: throw AssertException(SourceSite sourceSite, object[] expressions, object thiss, object info) 
  • Tests/820-errors/600-other/120-throw-stop.cobra

     
     1# This tests %% throw with message ends with Compilation Stopped 
     2# Need also test that thrown msg emitted but need TestifyRunner i/f for that 
     3 
     4 
     5#below emits %%> internal error  
     6%% throw  'internal error' # .error. Compilation Stopped 
     7 
     8class Program 
     9 
     10    def main is shared 
     11        pass