void IOSCfgParser::interface_known_ip_commands() { try { // for error handling { if ((LA(1) == ACCESS_GROUP) && (LA(2) == WORD)) { access_group_by_name(); } else if ((LA(1) == ACCESS_GROUP) && (LA(2) == INT_CONST)) { access_group_by_number(); } else if ((LA(1) == ADDRESS)) { intf_address(); } else { throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); } } match(NEWLINE); } catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { if( inputState->guessing == 0 ) { reportError(ex); recover(ex,_tokenSet_2); } else { throw; } } }
void IOSCfgParser::remark() { try { // for error handling match(REMARK); if ( inputState->guessing==0 ) { #line 566 "iosacl.g" importer->setCurrentLineNumber(LT(0)->getLine()); *dbg << LT(1)->getLine() << ":"; std::string rem; while (LA(1) != ANTLR_USE_NAMESPACE(antlr)Token::EOF_TYPE && LA(1) != NEWLINE) { rem += LT(1)->getText() + " "; consume(); } importer->addRuleComment( rem ); *dbg << " REMARK " << rem << std::endl; //consumeUntil(NEWLINE); #line 909 "IOSCfgParser.cpp" } } catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { if( inputState->guessing == 0 ) { reportError(ex); recover(ex,_tokenSet_1); } else { throw; } } }
void FMTLexer::mCSTRING(bool _createToken) { int _ttype; antlr::RefToken _token; std::string::size_type _begin = text.length(); _ttype = CSTRING; std::string::size_type _saveIndex; if ((LA(1) == 0x25 /* '%' */ ) && (LA(2) == 0x22 /* '\"' */ )) { _saveIndex = text.length(); match('%' /* charlit */ ); text.erase(_saveIndex); _saveIndex = text.length(); match('\"' /* charlit */ ); text.erase(_saveIndex); cLexer->DoubleQuotes( true); selector->push( cLexer); selector->retry(); } else if ((LA(1) == 0x25 /* '%' */ ) && (LA(2) == 0x27 /* '\'' */ )) { _saveIndex = text.length(); match('%' /* charlit */ ); text.erase(_saveIndex); _saveIndex = text.length(); match('\'' /* charlit */ ); text.erase(_saveIndex); cLexer->DoubleQuotes( false); selector->push( cLexer); selector->retry(); } else { throw antlr::NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn()); } if ( _createToken && _token==antlr::nullToken && _ttype!=antlr::Token::SKIP ) { _token = makeToken(_ttype); _token->setText(text.substr(_begin, text.length()-_begin)); } _returnToken = _token; _saveIndex=0; }
void IOSCfgParser::description() { try { // for error handling match(DESCRIPTION); if ( inputState->guessing==0 ) { #line 547 "iosacl.g" importer->setCurrentLineNumber(LT(0)->getLine()); *dbg << LT(1)->getLine() << ":"; std::string descr; while (LA(1) != ANTLR_USE_NAMESPACE(antlr)Token::EOF_TYPE && LA(1) != NEWLINE) { descr += LT(1)->getText() + " "; consume(); } importer->setInterfaceComment( descr ); *dbg << " DESCRIPTION " << descr << std::endl; //consumeUntil(NEWLINE); #line 489 "IOSCfgParser.cpp" } } catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { if( inputState->guessing == 0 ) { reportError(ex); recover(ex,_tokenSet_2); } else { throw; } } }
void FMTLexer::mX(bool _createToken) { int _ttype; antlr::RefToken _token; std::string::size_type _begin = text.length(); _ttype = X; std::string::size_type _saveIndex; { switch ( LA(1)) { case 0x78 /* 'x' */ : { match('x' /* charlit */ ); break; } case 0x58 /* 'X' */ : { match('X' /* charlit */ ); break; } default: { throw antlr::NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn()); } } } if ( _createToken && _token==antlr::nullToken && _ttype!=antlr::Token::SKIP ) { _token = makeToken(_ttype); _token->setText(text.substr(_begin, text.length()-_begin)); } _returnToken = _token; _saveIndex=0; }
void FMTLexer::mWHITESPACE(bool _createToken) { int _ttype; antlr::RefToken _token; std::string::size_type _begin = text.length(); _ttype = WHITESPACE; std::string::size_type _saveIndex; { // ( ... )+ int _cnt135=0; for (;;) { if ((LA(1) == 0x9 /* '\t' */ || LA(1) == 0x20 /* ' ' */ )) { mW(false); } else { if ( _cnt135>=1 ) { goto _loop135; } else {throw antlr::NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());} } _cnt135++; } _loop135:; } // ( ... )+ _ttype=antlr::Token::SKIP; if ( _createToken && _token==antlr::nullToken && _ttype!=antlr::Token::SKIP ) { _token = makeToken(_ttype); _token->setText(text.substr(_begin, text.length()-_begin)); } _returnToken = _token; _saveIndex=0; }
void FMTLexer::mDIGITS(bool _createToken) { int _ttype; antlr::RefToken _token; std::string::size_type _begin = text.length(); _ttype = DIGITS; std::string::size_type _saveIndex; { // ( ... )+ int _cnt138=0; for (;;) { if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ ))) { matchRange('0','9'); } else { if ( _cnt138>=1 ) { goto _loop138; } else {throw antlr::NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());} } _cnt138++; } _loop138:; } // ( ... )+ if ( _createToken && _token==antlr::nullToken && _ttype!=antlr::Token::SKIP ) { _token = makeToken(_ttype); _token->setText(text.substr(_begin, text.length()-_begin)); } _returnToken = _token; _saveIndex=0; }
rule() #endif { zzRULE; zzBLOCK(zztasp1); zzMake0; { if ( (setwd1[LA(1)]&0x80) ) { reg_expr(); zzmatch(ACTION); zzaRet.l=zzaArg(zztasp1,1 ).l; zzaRet.r=zzaArg(zztasp1,1 ).r; (zzaArg(zztasp1,1 ).r)->accept=action_no; zzCONSUME; } else { if ( (LA(1)==ACTION) ) { zzmatch(ACTION); zzaRet.l = NULL; zzaRet.r = NULL; error("no expression for action ", zzline); zzCONSUME; } else {zzFAIL(1,zzerr3,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;} } zzEXIT(zztasp1); return; fail: zzEXIT(zztasp1); zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText); zzresynch(setwd2, 0x1); } }
/** * Parse string literal (ECMA-262 v5, 7.8.4) */ static token parse_string (void) { ecma_char_t c = (ecma_char_t) LA (0); JERRY_ASSERT (c == '\'' || c == '"'); consume_char (); new_token (); const bool is_double_quoted = (c == '"'); const char end_char = (is_double_quoted ? '"' : '\''); do { c = (ecma_char_t) LA (0); consume_char (); if (c == '\0') { PARSE_ERROR ("Unclosed string", token_start - buffer_start); } else if (ecma_char_is_line_terminator (c)) { PARSE_ERROR ("String literal shall not contain newline character", token_start - buffer_start); } else if (c == '\\') { ecma_char_t nc = (ecma_char_t) LA (0); if (convert_single_escape_character (nc, NULL)) { consume_char (); } else if (ecma_char_is_line_terminator (nc)) { consume_char (); if (ecma_char_is_carriage_return (nc)) { nc = (ecma_char_t) LA (0); if (ecma_char_is_new_line (nc)) { consume_char (); } } } } } while (c != end_char); token ret = convert_string_to_token_transform_escape_seq (TOK_STRING, token_start, (size_t) (buffer - token_start) - 1u); token_start = NULL; return ret; } /* parse_string */
void MDParser::inversionblock() { returnAST = ANTLR_USE_NAMESPACE(antlr)nullAST; ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; ANTLR_USE_NAMESPACE(antlr)RefAST inversionblock_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; try { // for error handling ANTLR_USE_NAMESPACE(antlr)RefAST tmp55_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; tmp55_AST = astFactory->create(LT(1)); astFactory->makeASTRoot(currentAST, tmp55_AST); match(INVERSION); { switch ( LA(1)) { case LBRACKET: { match(LBRACKET); intConst(); match(RBRACKET); break; } case LCURLY: { break; } default: { throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); } } } match(LCURLY); { // ( ... )* for (;;) { if ((_tokenSet_10.member(LA(1)))) { inversionstatement(); astFactory->addASTChild( currentAST, returnAST ); } else { goto _loop51; } } _loop51:; } // ( ... )* ANTLR_USE_NAMESPACE(antlr)RefAST tmp59_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; tmp59_AST = astFactory->create(LT(1)); astFactory->addASTChild(currentAST, tmp59_AST); match(RCURLY); #line 137 "MDParser.g" tmp59_AST->setType(ENDBLOCK); #line 971 "MDParser.cpp" inversionblock_AST = currentAST.root; } catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { reportError(ex); recover(ex,_tokenSet_8); } returnAST = inversionblock_AST; }
void MDParser::bendblock() { returnAST = ANTLR_USE_NAMESPACE(antlr)nullAST; ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; ANTLR_USE_NAMESPACE(antlr)RefAST bendblock_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; try { // for error handling ANTLR_USE_NAMESPACE(antlr)RefAST tmp45_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; tmp45_AST = astFactory->create(LT(1)); astFactory->makeASTRoot(currentAST, tmp45_AST); match(BEND); { switch ( LA(1)) { case LBRACKET: { match(LBRACKET); intConst(); match(RBRACKET); break; } case LCURLY: { break; } default: { throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); } } } match(LCURLY); { // ( ... )* for (;;) { if ((LA(1) == MEMBERS || LA(1) == ID)) { bendstatement(); astFactory->addASTChild( currentAST, returnAST ); } else { goto _loop41; } } _loop41:; } // ( ... )* ANTLR_USE_NAMESPACE(antlr)RefAST tmp49_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; tmp49_AST = astFactory->create(LT(1)); astFactory->addASTChild(currentAST, tmp49_AST); match(RCURLY); #line 123 "MDParser.g" tmp49_AST->setType(ENDBLOCK); #line 853 "MDParser.cpp" bendblock_AST = currentAST.root; } catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { reportError(ex); recover(ex,_tokenSet_8); } returnAST = bendblock_AST; }
static void grobble_whitespaces (void) { ecma_char_t c = LA (0); while ((isspace (c) && c != '\n')) { consume_char (); c = LA (0); } }
void P::factor() { returnAST = RefBasicAST(ANTLR_USE_NAMESPACE(antlr)nullAST); ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; RefBasicAST factor_AST = RefBasicAST(ANTLR_USE_NAMESPACE(antlr)nullAST); try { // for error handling factor2(); astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); { // ( ... )* for (;;) { if ((LA(1) == MOD || LA(1) == EXP)) { { switch ( LA(1)) { case EXP: { RefBinaryCompArithOpAST tmp11_AST = RefBinaryCompArithOpAST(RefBasicAST(ANTLR_USE_NAMESPACE(antlr)nullAST)); tmp11_AST = astFactory->create(LT(1)); astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp11_AST)); match(EXP); break; } case MOD: { RefBinaryCompArithOpAST tmp12_AST = RefBinaryCompArithOpAST(RefBasicAST(ANTLR_USE_NAMESPACE(antlr)nullAST)); tmp12_AST = astFactory->create(LT(1)); astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp12_AST)); match(MOD); break; } default: { throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); } } } factor2(); astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); } else { goto _loop14; } } _loop14:; } // ( ... )* factor_AST = RefBasicAST(currentAST.root); } catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { reportError(ex); recover(ex,_tokenSet_3); } returnAST = factor_AST; }
void P::arith_exp() { returnAST = RefBasicAST(ANTLR_USE_NAMESPACE(antlr)nullAST); ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; RefBasicAST arith_exp_AST = RefBasicAST(ANTLR_USE_NAMESPACE(antlr)nullAST); try { // for error handling term(); astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); { // ( ... )* for (;;) { if ((LA(1) == PLUS || LA(1) == MINUS)) { { switch ( LA(1)) { case PLUS: { RefBinaryCompArithOpAST tmp7_AST = RefBinaryCompArithOpAST(RefBasicAST(ANTLR_USE_NAMESPACE(antlr)nullAST)); tmp7_AST = astFactory->create(LT(1)); astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp7_AST)); match(PLUS); break; } case MINUS: { RefBinaryCompArithOpAST tmp8_AST = RefBinaryCompArithOpAST(RefBasicAST(ANTLR_USE_NAMESPACE(antlr)nullAST)); tmp8_AST = astFactory->create(LT(1)); astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp8_AST)); match(MINUS); break; } default: { throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); } } } term(); astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); } else { goto _loop6; } } _loop6:; } // ( ... )* arith_exp_AST = RefBasicAST(currentAST.root); } catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { reportError(ex); recover(ex,_tokenSet_1); } returnAST = arith_exp_AST; }
/** * Skip any whitespace and comment tokens * * @return true - if a newline token was skipped, * false - otherwise */ static bool lexer_skip_whitespace_and_comments (void) { bool new_lines_occurred = false; while (true) { ecma_char_t c = LA (0); if (lit_char_is_white_space (c)) { do { consume_char (); c = LA (0); } while (lit_char_is_white_space (c)); } else if (lit_char_is_line_terminator (c)) { dump_current_line (); new_lines_occurred = true; do { consume_char (); c = LA (0); } while (lit_char_is_line_terminator (c)); } else if (c == LIT_CHAR_SLASH && (LA (1) == LIT_CHAR_SLASH || LA (1) == LIT_CHAR_ASTERISK)) { /* ECMA-262 v5, 7.4, SingleLineComment or MultiLineComment */ if (lexer_parse_comment ()) { new_lines_occurred = true; } } else { break; } } return new_lines_occurred; } /* lexer_skip_whitespace_and_comments */
/**Make sure current lookahead symbol matches token type <tt>t</tt>. * Throw an exception upon mismatch, which is catch by either the * error handler or by the syntactic predicate. */ void Parser::match(int t) { if ( DEBUG_PARSER ) std::cout << "enter match(" << t << ") with LA(1)=" << LA(1) << std::endl; if ( LA(1)!=t ) { if ( DEBUG_PARSER ) std::cout << "token mismatch: " << LA(1) << "!=" << t << std::endl; throw MismatchedTokenException(tokenNames, LT(1), t, false); } else { // mark token as consumed -- fetch next token deferred until LA/LT consume(); } }
/** Return the next monitored token. * Test the token following the monitored token. * If following is another monitored token, save it * for the next invocation of nextToken (like a single * lookahead token) and return it then. * If following is unmonitored, nondiscarded (hidden) * channel token, add it to the monitored token. * * Note: EOF must be a monitored Token. */ RefToken TokenStreamHiddenTokenFilter::nextToken() { // handle an initial condition; don't want to get lookahead // token of this splitter until first call to nextToken if ( !LA(1) ) { consumeFirst(); } // we always consume hidden tokens after monitored, thus, // upon entry LA(1) is a monitored token. RefToken monitored = LA(1); // point to hidden tokens found during last invocation static_cast<CommonHiddenStreamToken*>(monitored.get())->setHiddenBefore(lastHiddenToken); lastHiddenToken = nullToken; // Look for hidden tokens, hook them into list emanating // from the monitored tokens. consume(); RefToken p = monitored; // while hidden or discarded scarf tokens while ( hideMask.member(LA(1)->getType()) || discardMask.member(LA(1)->getType()) ) { if ( hideMask.member(LA(1)->getType()) ) { // attach the hidden token to the monitored in a chain // link forwards static_cast<CommonHiddenStreamToken*>(p.get())->setHiddenAfter(LA(1)); // link backwards if (p != monitored) { //hidden cannot point to monitored tokens static_cast<CommonHiddenStreamToken*>(LA(1).get())->setHiddenBefore(p); } p = lastHiddenToken = LA(1); } consume(); } return monitored; }
math::Vector<2> CDispRigidBody::bCoef(real_t e, const NewtonCollisionBase & bData) const { const real_t & dt = bData.dData.dt; math::Vector<2> r(bData.points.eff - rotationPoint()); rotateToGlobal(r); real_t ax = 1.0 / m() + (r(1) * r(1) / Idisp()); real_t ay = 1.0 / m() + (r(0) * r(0) / Idisp()); //compensate permanent forces //reaction to permanent force real_t bx = resultantForce(0) * dt * ax; real_t by = resultantForce(1) * dt * ay; //reaction to permanent moment real_t resultantMomentx_add = 0.0; real_t resultantMomenty_add = 0.0; if (r(1) != 0.0) resultantMomentx_add = resultantMoment() * dt * ax / r(1); if (r(0) != 0.0) resultantMomenty_add = resultantMoment() * dt * ay / r(0); bx += resultantMomentx_add; by -= resultantMomenty_add; //momentum addition bx += e * pA(0) / m(); by += e * pA(1) / m(); //angular momentum addition bx += e * LA() * -r(1) / Idisp(); by += e * LA() * r(0) / Idisp(); //L translates into force proportional to (rx, ry) real_t Lx_coef = std::abs(r(1)) / (std::abs(r(1)) + std::abs(r(0))); real_t Ly_coef = std::abs(r(0)) / (std::abs(r(1)) + std::abs(r(0))); real_t Lx_add = std::abs(LA() * r(1) / Idisp() + resultantMomentx_add); real_t Ly_add = std::abs(LA() * r(0) / Idisp() - resultantMomenty_add); real_t px_add = std::abs(pA(0) / m() + resultantForce(0) * dt * ax); real_t py_add = std::abs(pA(1) / m() + resultantForce(1) * dt * ay); //multiply bx by bx_coef if ((Lx_add + px_add) != 0.0) //do not divide by 0.0 (note: px_add and Lx_add are absolute values) bx *= (Lx_coef * Lx_add + px_add) / (Lx_add + px_add); //multiply by by by_coef if ((Ly_add + py_add) != 0.0) //do not divide by 0.0 (note: py_add and Ly_add are absolute values) by *= (Ly_coef * Ly_add + py_add) / (Ly_add + py_add); return math::Vector<2>(bx, by); }
/**Make sure current lookahead symbol matches the given set * Throw an exception upon mismatch, which is catch by either the * error handler or by the syntactic predicate. */ void Parser::match(const BitSet& b) { if ( DEBUG_PARSER ) std::cout << "enter match(" << "bitset" /*b.toString()*/ << ") with LA(1)=" << LA(1) << std::endl; if ( !b.member(LA(1)) ) { if ( DEBUG_PARSER ) std::cout << "token mismatch: " << LA(1) << " not member of " << "bitset" /*b.toString()*/ << std::endl; throw MismatchedTokenException(tokenNames, LT(1), b, false); } else { // mark token as consumed -- fetch next token deferred until LA/LT consume(); } }
and_expr() #endif { zzRULE; zzBLOCK(zztasp1); zzMake0; { repeat_expr(); zzaRet.l=zzaArg(zztasp1,1 ).l; zzaRet.r=zzaArg(zztasp1,1 ).r; { zzBLOCK(zztasp2); zzMake0; { while ( (setwd2[LA(1)]&0x8) ) { repeat_expr(); if (zzaRet.r != NULL) { (zzaRet.r)->trans[1]=zzaArg(zztasp2,1 ).l; zzaRet.r=zzaArg(zztasp2,1 ).r; } zzLOOP(zztasp2); } zzEXIT(zztasp2); } } zzEXIT(zztasp1); return; } }
void IOSCfgParser::xoperator() { try { // for error handling switch ( LA(1)) { case P_EQ: case P_GT: case P_LT: case P_NEQ: { single_port_op(); break; } case P_RANGE: { port_range(); break; } default: { throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); } } } catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { if( inputState->guessing == 0 ) { reportError(ex); recover(ex,_tokenSet_11); } else { throw; } } }
/* standard error reporting function that assumes DLG-based scanners; * you should redefine in subclass to change it or if you use your * own scanner. */ void ANTLRParser:: syn(_ANTLRTokenPtr tok, ANTLRChar *egroup, SetWordType *eset, ANTLRTokenType etok, int k) { int line; line = LT(1)->getLine(); syntaxErrCount++; /* MR11 */ fprintf(stderr, "line %d: syntax error at \"%s\"", line, (LA(1)==eofToken && LT(1)->getText()[0] == '@')? "<eof>":LT(1)->getText() /* MR21a */); if ( !etok && !eset ) {fprintf(stderr, "\n"); return;} if ( k==1 ) fprintf(stderr, " missing"); else { fprintf(stderr, "; \"%s\" not", LT(1)->getText()); if ( set_deg(eset)>1 ) fprintf(stderr, " in"); } if ( set_deg(eset)>0 ) edecode(eset); else fprintf(stderr, " %s", token_tbl[etok]); if ( strlen(egroup) > 0 ) fprintf(stderr, " in %s", egroup); fprintf(stderr, "\n"); }
// // 7-Apr-97 133MR1 // Change suggested by Eli Sternheim ([email protected]) // void ANTLRParser:: consumeUntilToken(int t) { int tmp; // MR1 const int Eof=1; // MR1 while ( (tmp=LA(1)) !=t && tmp!=Eof) { consume(); } // MR1 }
// // 7-Apr-97 133MR1 // Change suggested by Eli Sternheim ([email protected]) // void ANTLRParser:: consumeUntil(SetWordType *st) { ANTLRTokenType tmp; // MR1 const int Eof=1; // MR1 while ( !set_el( (tmp=LA(1)), st) && tmp!=Eof) { consume(); } // MR1 }
and_expr() #endif { zzRULE; zzBLOCK(zztasp1); zzMake0; { repeat_expr(); zzaRet.l=zzaArg(zztasp1,1 ).l; zzaRet.r=zzaArg(zztasp1,1 ).r; { zzBLOCK(zztasp2); zzMake0; { while ( (setwd2[LA(1)]&0x4) ) { repeat_expr(); (zzaRet.r)->trans[1]=zzaArg(zztasp2,1 ).l; zzaRet.r=zzaArg(zztasp2,1 ).r; zzLOOP(zztasp2); } zzEXIT(zztasp2); } } zzEXIT(zztasp1); return; fail: zzEXIT(zztasp1); zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText); zzresynch(setwd2, 0x8); } }
void MDParser::constant() { returnAST = ANTLR_USE_NAMESPACE(antlr)nullAST; ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; ANTLR_USE_NAMESPACE(antlr)RefAST constant_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; try { // for error handling switch ( LA(1)) { case NUM_INT: case NUM_LONG: { intConst(); astFactory->addASTChild( currentAST, returnAST ); constant_AST = currentAST.root; break; } case NUM_FLOAT: case NUM_DOUBLE: { floatConst(); astFactory->addASTChild( currentAST, returnAST ); constant_AST = currentAST.root; break; } case LPAREN: { vectorConst(); astFactory->addASTChild( currentAST, returnAST ); constant_AST = currentAST.root; break; } case ID: { ANTLR_USE_NAMESPACE(antlr)RefAST tmp25_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; tmp25_AST = astFactory->create(LT(1)); astFactory->addASTChild(currentAST, tmp25_AST); match(ID); constant_AST = currentAST.root; break; } case StringLiteral: { ANTLR_USE_NAMESPACE(antlr)RefAST tmp26_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; tmp26_AST = astFactory->create(LT(1)); astFactory->addASTChild(currentAST, tmp26_AST); match(StringLiteral); constant_AST = currentAST.root; break; } default: { throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); } } } catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { reportError(ex); recover(ex,_tokenSet_5); } returnAST = constant_AST; }
void MDParser::mdfile() { returnAST = ANTLR_USE_NAMESPACE(antlr)nullAST; ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; ANTLR_USE_NAMESPACE(antlr)RefAST mdfile_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; try { // for error handling { // ( ... )* for (;;) { if ((_tokenSet_0.member(LA(1)))) { statement(); astFactory->addASTChild( currentAST, returnAST ); } else { goto _loop3; } } _loop3:; } // ( ... )* mdfile_AST = currentAST.root; } catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { reportError(ex); recover(ex,_tokenSet_1); } returnAST = mdfile_AST; }
void MDParser::inttuple() { returnAST = ANTLR_USE_NAMESPACE(antlr)nullAST; ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; ANTLR_USE_NAMESPACE(antlr)RefAST inttuple_AST = ANTLR_USE_NAMESPACE(antlr)nullAST; try { // for error handling intConst(); astFactory->addASTChild( currentAST, returnAST ); { // ( ... )* for (;;) { if ((LA(1) == COMMA)) { match(COMMA); intConst(); astFactory->addASTChild( currentAST, returnAST ); } else { goto _loop71; } } _loop71:; } // ( ... )* inttuple_AST = currentAST.root; } catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { reportError(ex); recover(ex,_tokenSet_12); } returnAST = inttuple_AST; }
atom_list() #endif { zzRULE; zzBLOCK(zztasp1); zzMake0; { set_free(zzaRet.label); { zzBLOCK(zztasp2); zzMake0; { while ( (setwd3[LA(1)]&0x1) ) { near_atom(); set_orin(&(zzaRet.label),zzaArg(zztasp2,1 ).label); zzLOOP(zztasp2); } zzEXIT(zztasp2); } } zzEXIT(zztasp1); return; fail: zzEXIT(zztasp1); zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText); zzresynch(setwd3, 0x2); } }
void ConversionParser::get_conversions( UTFCaseChanger *chng ) { changer = chng; try { // for error handling { // ( ... )* for (;;) { if ((LA(1) == NUMBER)) { conversion(); } else { goto _loop3; } } _loop3:; } // ( ... )* } catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { reportError(ex); recover(ex,_tokenSet_0); } }