Пример #1
0
 private bool parse( string script )
 {
     error_line_ = -1;
     tokens_ = new List<TokenInfo>();
     LexicalAnalyzer lex = new LexicalAnalyzer( script, false, false );
     ScriptLineData lines = new ScriptLineData( script, 0 );
     int token = 0;
     try {
         do {
             token = lex.getNext();
             if( token == Token.T_SYMBOL ) {
                 string name = lex.getString( lex.getValue() );
                 tokens_.Add( new TokenInfo( token, name ) );
             } else if( token == Token.T_COMMENT ) {
                 string comment = lex.getComment();
                 tokens_.Add( new TokenInfo( token, comment ) );
             } else {
                 // シンボル名とコメント本体のみ取得して、他は値無視
                 tokens_.Add( new TokenInfo( token, null ) );
             }
         } while( token != 0 );
     } catch( CompileException ) {
         error_line_ = lines.getSrcPosToLine( lex.getCurrentPosition() );
     }
     return error_line_ == -1;
 }