📄 actiontranslatorlexer.java
字号:
""); } } else if ( scope.isParameterScope ) { st = template("parameterSetAttributeRef"); st.setAttribute("attr", scope.getAttribute(ID4.getText())); st.setAttribute("expr", translateAction(expr.getText())); } else { st = template("returnSetAttributeRef"); st.setAttribute("ruleDescriptor", enclosingRule); st.setAttribute("attr", scope.getAttribute(ID4.getText())); st.setAttribute("expr", translateAction(expr.getText())); } } } if ( backtracking==1 ) { if ( token==null && ruleNestingLevel==1 ) { emit(_type,_line,_charPosition,_channel,_start,getCharIndex()-1); } } } finally { ruleNestingLevel--; } } // $ANTLR end SET_LOCAL_ATTR // $ANTLR start LOCAL_ATTR public void mLOCAL_ATTR() throws RecognitionException { try { ruleNestingLevel++; int _type = LOCAL_ATTR; int _start = getCharIndex(); int _line = getLine(); int _charPosition = getCharPositionInLine(); int _channel = Token.DEFAULT_CHANNEL; // ActionTranslator.g:531:4: ( '$' ID {...}?) // ActionTranslator.g:531:4: '$' ID {...}? { match('$'); if (failed) return ; int ID5Start = getCharIndex(); mID(); if (failed) return ; Token ID5 = new CommonToken(input, Token.INVALID_TOKEN_TYPE, Token.DEFAULT_CHANNEL, ID5Start, getCharIndex()-1); if ( !(enclosingRule!=null && enclosingRule.getLocalAttributeScope(ID5.getText())!=null) ) { if (backtracking>0) {failed=true; return ;} throw new FailedPredicateException(input, "LOCAL_ATTR", "enclosingRule!=null && enclosingRule.getLocalAttributeScope($ID.text)!=null"); } if ( backtracking==1 ) { StringTemplate st; AttributeScope scope = enclosingRule.getLocalAttributeScope(ID5.getText()); if ( scope.isPredefinedRuleScope ) { st = template("rulePropertyRef_"+ID5.getText()); grammar.referenceRuleLabelPredefinedAttribute(enclosingRule.name); st.setAttribute("scope", enclosingRule.name); st.setAttribute("attr", ID5.getText()); } else if ( scope.isPredefinedLexerRuleScope ) { st = template("lexerRulePropertyRef_"+ID5.getText()); st.setAttribute("scope", enclosingRule.name); st.setAttribute("attr", ID5.getText()); } else if ( scope.isParameterScope ) { st = template("parameterAttributeRef"); st.setAttribute("attr", scope.getAttribute(ID5.getText())); } else { st = template("returnAttributeRef"); st.setAttribute("ruleDescriptor", enclosingRule); st.setAttribute("attr", scope.getAttribute(ID5.getText())); } } } if ( backtracking==1 ) { if ( token==null && ruleNestingLevel==1 ) { emit(_type,_line,_charPosition,_channel,_start,getCharIndex()-1); } } } finally { ruleNestingLevel--; } } // $ANTLR end LOCAL_ATTR // $ANTLR start SET_DYNAMIC_SCOPE_ATTR public void mSET_DYNAMIC_SCOPE_ATTR() throws RecognitionException { try { ruleNestingLevel++; int _type = SET_DYNAMIC_SCOPE_ATTR; int _start = getCharIndex(); int _line = getLine(); int _charPosition = getCharPositionInLine(); int _channel = Token.DEFAULT_CHANNEL; // ActionTranslator.g:572:4: ( '$' x= ID '::' y= ID ( WS )? '=' expr= ATTR_VALUE_EXPR ';' {...}?) // ActionTranslator.g:572:4: '$' x= ID '::' y= ID ( WS )? '=' expr= ATTR_VALUE_EXPR ';' {...}? { match('$'); if (failed) return ; int xStart = getCharIndex(); mID(); if (failed) return ; Token x = new CommonToken(input, Token.INVALID_TOKEN_TYPE, Token.DEFAULT_CHANNEL, xStart, getCharIndex()-1); match("::"); if (failed) return ; int yStart = getCharIndex(); mID(); if (failed) return ; Token y = new CommonToken(input, Token.INVALID_TOKEN_TYPE, Token.DEFAULT_CHANNEL, yStart, getCharIndex()-1); // ActionTranslator.g:572:23: ( WS )? int alt5=2; int LA5_0 = input.LA(1); if ( ((LA5_0>='\t' && LA5_0<='\n')||LA5_0==' ') ) { alt5=1; } switch (alt5) { case 1 : // ActionTranslator.g:572:23: WS { mWS(); if (failed) return ; } break; } match('='); if (failed) return ; int exprStart = getCharIndex(); mATTR_VALUE_EXPR(); if (failed) return ; Token expr = new CommonToken(input, Token.INVALID_TOKEN_TYPE, Token.DEFAULT_CHANNEL, exprStart, getCharIndex()-1); match(';'); if (failed) return ; if ( !(resolveDynamicScope(x.getText())!=null && resolveDynamicScope(x.getText()).getAttribute(y.getText())!=null) ) { if (backtracking>0) {failed=true; return ;} throw new FailedPredicateException(input, "SET_DYNAMIC_SCOPE_ATTR", "resolveDynamicScope($x.text)!=null &&\n\t\t\t\t\t\t resolveDynamicScope($x.text).getAttribute($y.text)!=null"); } if ( backtracking==1 ) { AttributeScope scope = resolveDynamicScope(x.getText()); if ( scope!=null ) { StringTemplate st = template("scopeSetAttributeRef"); st.setAttribute("scope", x.getText()); st.setAttribute("attr", scope.getAttribute(y.getText())); st.setAttribute("expr", translateAction(expr.getText())); } else { // error: invalid dynamic attribute } } } if ( backtracking==1 ) { if ( token==null && ruleNestingLevel==1 ) { emit(_type,_line,_charPosition,_channel,_start,getCharIndex()-1); } } } finally { ruleNestingLevel--; } } // $ANTLR end SET_DYNAMIC_SCOPE_ATTR // $ANTLR start DYNAMIC_SCOPE_ATTR public void mDYNAMIC_SCOPE_ATTR() throws RecognitionException { try { ruleNestingLevel++; int _type = DYNAMIC_SCOPE_ATTR; int _start = getCharIndex(); int _line = getLine(); int _charPosition = getCharPositionInLine(); int _channel = Token.DEFAULT_CHANNEL; // ActionTranslator.g:591:4: ( '$' x= ID '::' y= ID {...}?) // ActionTranslator.g:591:4: '$' x= ID '::' y= ID {...}? { match('$'); if (failed) return ; int xStart = getCharIndex(); mID(); if (failed) return ; Token x = new CommonToken(input, Token.INVALID_TOKEN_TYPE, Token.DEFAULT_CHANNEL, xStart, getCharIndex()-1); match("::"); if (failed) return ; int yStart = getCharIndex(); mID(); if (failed) return ; Token y = new CommonToken(input, Token.INVALID_TOKEN_TYPE, Token.DEFAULT_CHANNEL, yStart, getCharIndex()-1); if ( !(resolveDynamicScope(x.getText())!=null && resolveDynamicScope(x.getText()).getAttribute(y.getText())!=null) ) { if (backtracking>0) {failed=true; return ;} throw new FailedPredicateException(input, "DYNAMIC_SCOPE_ATTR", "resolveDynamicScope($x.text)!=null &&\n\t\t\t\t\t\t resolveDynamicScope($x.text).getAttribute($y.text)!=null"); } if ( backtracking==1 ) { AttributeScope scope = resolveDynamicScope(x.getText()); if ( scope!=null ) { StringTemplate st = template("scopeAttributeRef"); st.setAttribute("scope", x.getText()); st.setAttribute("attr", scope.getAttribute(y.getText())); } else { // error: invalid dynamic attribute } } } if ( backtracking==1 ) { if ( token==null && ruleNestingLevel==1 ) { emit(_type,_line,_charPosition,_channel,_start,getCharIndex()-1); } } } finally { ruleNestingLevel--; } } // $ANTLR end DYNAMIC_SCOPE_ATTR // $ANTLR start ERROR_SCOPED_XY public void mERROR_SCOPED_XY() throws RecognitionException { try { ruleNestingLevel++; int _type = ERROR_SCOPED_XY; int _start = getCharIndex(); int _line = getLine(); int _charPosition = getCharPositionInLine(); int _channel = Token.DEFAULT_CHANNEL; // ActionTranslator.g:610:4: ( '$' x= ID '::' y= ID ) // ActionTranslator.g:610:4: '$' x= ID '::' y= ID { match('$'); if (failed) return ; int xStart = getCharIndex(); mID(); if (failed) return ; Token x = new CommonToken(input, Token.INVALID_TOKEN_TYPE, Token.DEFAULT_CHANNEL, xStart, getCharIndex()-1); match("::"); if (failed) return ; int yStart = getCharIndex(); mID(); if (failed) return ; Token y = new CommonToken(input, Token.INVALID_TOKEN_TYPE, Token.DEFAULT_CHANNEL, yStart, getCharIndex()-1); if ( backtracking==1 ) { chunks.add(getText()); generator.issueInvalidScopeError(x.getText(),y.getText(), enclosingRule,actionToken, outerAltNum); } } if ( backtracking==1 ) { if ( token==null && ruleNestingLevel==1 ) { emit(_type,_line,_charPosition,_channel,_start,getCharIndex()-1); } } } finally { ruleNestingLevel--; } } // $ANTLR end ERROR_SCOPED_XY // $ANTLR start DYNAMIC_NEGATIVE_INDEXED_SCOPE_ATTR public void mDYNAMIC_NEGATIVE_INDEXED_SCOPE_ATTR() throws RecognitionException { try { ruleNestingLevel++; int _type = DYNAMIC_NEGATIVE_INDEXED_SCOPE_ATTR; int _start = getCharIndex(); int _line = getLine(); int _charPosition = getCharPositionInLine(); int _channel = Token.DEFAULT_CHANNEL; // ActionTranslator.g:628:4: ( '$' x= ID '[' '-' expr= SCOPE_INDEX_EXPR ']' '::' y= ID ) // ActionTranslator.g:628:4: '$' x= ID '[' '-' expr= SCOPE_INDEX_EXPR ']' '::' y= ID { match('$'); if (failed) return ; int xStart = getCharIndex(); mID(); if (failed) return ; Token x = new CommonToken(input, Token.INVALID_TOKEN_TYPE, Token.DEFAULT_CHANNEL, xStart, getCharIndex()-1); match('['); if (failed) return ; match('-'); if (failed) return ; int exprStart = getCharIndex(); mSCOPE_INDEX_EXPR(); if (failed) return ; Token expr = new CommonToken(input, Token.INVALID_TOKEN_TYPE, Token.DEFAULT_CHANNEL, exprStart, getCharIndex()-1); match(']'); if (failed) return ; match("::"); if (failed) return ; int yStart = getCharIndex(); mID(); if (failed) return ; Token y = new CommonToken(input, Token.INVALID_TOKEN_TYPE, Token.DEFAULT_CHANNEL, yStart, getCharIndex()-1); if ( backtracking==1 ) { StringTemplate st = template("scopeAttributeRef"); st.setAttribute("scope", x.getText()); st.setAttribute("attr", resolveDynamicScope(x.getText()).getAttribute(y.getText())); st.setAttribute("negIndex", expr.getText()); } } if ( backtracking==1 ) { if ( token==null && ruleNestingLevel==1 ) { emit(_type,_line,_charPosition,_channel,_start,getCharIndex()-1); }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -