Show
Ignore:
Timestamp:
08/12/08 23:46:19 (5 months ago)
Author:
Chuck.Esterbrook
Message:

New .no-warnings. compiler directive to suppress all warnings on a given line of source code. ticket:37
Code cleanup. ticket:36

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • cobra/trunk/Source/CobraTokenizer.cobra

    r1572 r1574  
     1use System.Text.RegularExpressions 
     2 
     3 
    14class CobraTokenizer 
    25        inherits Tokenizer 
     
    392395                #print '<> onWHITESPACE_COMMENT_2' 
    393396                return nil 
    394  
     397         
    395398        ## 
    396399        ## Comment out block 
     
    507510                return tok 
    508511 
     512        var _directiveRE = Regex(r'#\s*\.([\w\-]+)\.', RegexOptions.Compiled) 
     513 
    509514        def onSINGLE_LINE_COMMENT(tok as IToken) as IToken? 
    510515                # eat these 
     516                 
     517                # check for .no-warnings. 
     518                reMatch = _directiveRE.match(tok.text) 
     519                if reMatch.success 
     520                        name = reMatch.groups[1].value 
     521                        branch name 
     522                                on 'no-warnings', .addNoWarning(tok) 
     523                                # for testify 
     524                                on 'args', pass  # TODO: actually this could be worth implementing outside of testify 
     525                                on 'compile-only', pass 
     526                                on 'error', pass 
     527                                on 'multi', pass 
     528                                on 'multipart', pass 
     529                                on 'skip', pass 
     530                                on 'warning', pass 
     531                                else, .throwError('Unrecognized compiler directive "[name]".') 
     532 
    511533                return nil 
    512534