// $ANTLR start "number" // C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:265:1: number : ( INT | FLOAT ); public number_return number() // throws RecognitionException [1] { var retval = new number_return(); retval.Start = input.LT( 1 ); CommonTree root_0 = null; IToken set93 = null; CommonTree set93_tree = null; try { // C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:266:2: ( INT | FLOAT ) // C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g: { root_0 = (CommonTree)adaptor.GetNilNode(); set93 = input.LT( 1 ); if ( ( input.LA( 1 ) >= INT && input.LA( 1 ) <= FLOAT ) ) { input.Consume(); adaptor.AddChild( root_0, adaptor.Create( set93 ) ); state.errorRecovery = false; } else { var mse = new MismatchedSetException( null, input ); throw mse; } } retval.Stop = input.LT( -1 ); retval.Tree = adaptor.RulePostProcessing( root_0 ); adaptor.SetTokenBoundaries( retval.Tree, (IToken)retval.Start, (IToken)retval.Stop ); } catch ( RecognitionException re ) { ReportError( re ); Recover( input, re ); // Conversion of the second argument necessary, but harmless retval.Tree = adaptor.ErrorNode( input, (IToken)retval.Start, input.LT( -1 ), re ); } finally {} return retval; }
// throws RecognitionException [1] // $ANTLR start number // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:1478:1: number : ( HEX_LITERAL | DECIMAL_LITERAL | OCTAL_LITERAL | FLOAT_LITERAL ); public number_return number() { number_return retval = new number_return(); retval.start = input.LT(1); int number_StartIndex = input.Index(); CommonTree root_0 = null; CommonToken set302 = null; CommonTree set302_tree=null; try { if ( (backtracking > 0) && AlreadyParsedRule(input, 114) ) { return retval; } // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g:1479:4: ( HEX_LITERAL | DECIMAL_LITERAL | OCTAL_LITERAL | FLOAT_LITERAL ) // C:\\Users\\sephiroth\\Documents\\Visual Studio 2005\\Projects\\CodeReformatter\\CodeReformatter\\AS.g: { root_0 = (CommonTree)adaptor.GetNilNode(); set302 = (CommonToken)input.LT(1); if ( (input.LA(1) >= HEX_LITERAL && input.LA(1) <= FLOAT_LITERAL) ) { input.Consume(); if ( backtracking==0 ) adaptor.AddChild(root_0, adaptor.Create(set302)); errorRecovery = false;failed = false; } else { if ( backtracking > 0 ) {failed = true; return retval;} MismatchedSetException mse = new MismatchedSetException(null,input); RecoverFromMismatchedSet(input,mse,FOLLOW_set_in_number0); throw mse; } } retval.stop = input.LT(-1); if ( backtracking==0 ) { retval.tree = (CommonTree)adaptor.RulePostProcessing(root_0); adaptor.SetTokenBoundaries(retval.Tree, retval.start, retval.stop); } } catch (NoViableAltException e) { Debug.WriteLine("NoValiable alt: token=" + e.Token + " (decision=" + e.decisionNumber + " state " + e.stateNumber + ")" + " decision=<<" + e.grammarDecisionDescription + ">>"); throw e; } catch (MismatchedTokenException e) { Debug.WriteLine("[" + e.Line + ":" + e.Index + "]: " + e.Message + ". Unexpected " + e.UnexpectedType.ToString() + "( expecting: "+ e.expecting + " )"); throw e; } catch(RecognitionException e) { Debug.WriteLine("RecognitionException: " + e); throw e; } finally { if ( backtracking > 0 ) { Memoize(input, 114, number_StartIndex); } } return retval; }