public static String getLexerRuleNameFromLiteral(String literal) { String name = literalToRuleNameMap.get(literal); if ( name!=null ) { return name; } // is it a keyword like true or begin? String strippedLiteral = Misc.strip(literal, 1); if ( Character.isLetter(strippedLiteral.charAt(0)) ) { return strippedLiteral.toUpperCase(); } return "T__"+lexerRuleNameID++; }
/** Create singleton template for use with dictionary values. */ public ST createSingleton(Token templateToken) { String template; if ( templateToken.getType()==GroupParser.BIGSTRING ) { template = Misc.strip(templateToken.getText(),2); } else { template = Misc.strip(templateToken.getText(),1); } CompiledST impl = compile(getFileName(), null, null, template, templateToken); ST st = createStringTemplateInternally(impl); st.groupThatCreatedThisInstance = this; st.impl.hasFormalArgs = false; st.impl.name = ST.UNKNOWN_NAME; st.impl.defineImplicitlyDefinedTemplates(this); return st; }
/** Create singleton template for use with dictionary values */ public ST createSingleton(Token templateToken) { String template; if ( templateToken.getType()==GroupParser.BIGSTRING ) { template = Misc.strip(templateToken.getText(),2); } else { template = Misc.strip(templateToken.getText(),1); } CompiledST impl = compile(getFileName(), null, null, template, templateToken); ST st = createStringTemplateInternally(impl); st.groupThatCreatedThisInstance = this; st.impl.hasFormalArgs = false; st.impl.name = ST.UNKNOWN_NAME; st.impl.defineImplicitlyDefinedTemplates(this); return st; }
/** Create singleton template for use with dictionary values. */ public ST createSingleton(Token templateToken) { String template; if ( templateToken.getType()==GroupParser.BIGSTRING ) { template = Misc.strip(templateToken.getText(),2); } else { template = Misc.strip(templateToken.getText(),1); } CompiledST impl = compile(getFileName(), null, null, template, templateToken); ST st = createStringTemplateInternally(impl); st.groupThatCreatedThisInstance = this; st.impl.hasFormalArgs = false; st.impl.name = ST.UNKNOWN_NAME; st.impl.defineImplicitlyDefinedTemplates(this); return st; }
/** Create singleton template for use with dictionary values. */ public ST createSingleton(Token templateToken) { String template; if ( templateToken.getType()==GroupParser.BIGSTRING ) { template = Misc.strip(templateToken.getText(),2); } else { template = Misc.strip(templateToken.getText(),1); } CompiledST impl = compile(getFileName(), null, null, template, templateToken); ST st = createStringTemplateInternally(impl); st.groupThatCreatedThisInstance = this; st.impl.hasFormalArgs = false; st.impl.name = ST.UNKNOWN_NAME; st.impl.defineImplicitlyDefinedTemplates(this); return st; }
/** Create singleton template for use with dictionary values. */ public ST createSingleton(Token templateToken) { String template; if ( templateToken.getType()==GroupParser.BIGSTRING ) { template = Misc.strip(templateToken.getText(),2); } else { template = Misc.strip(templateToken.getText(),1); } CompiledST impl = compile(getFileName(), null, null, template, templateToken); ST st = createStringTemplateInternally(impl); st.groupThatCreatedThisInstance = this; st.impl.hasFormalArgs = false; st.impl.name = ST.UNKNOWN_NAME; st.impl.defineImplicitlyDefinedTemplates(this); return st; }
/** Create singleton template for use with dictionary values. */ public ST createSingleton(Token templateToken) { String template; if ( templateToken.getType()==GroupParser.BIGSTRING || templateToken.getType()==GroupParser.BIGSTRING_NO_NL ) { template = Misc.strip(templateToken.getText(),2); } else { template = Misc.strip(templateToken.getText(),1); } CompiledST impl = compile(getFileName(), null, null, template, templateToken); ST st = createStringTemplateInternally(impl); st.groupThatCreatedThisInstance = this; st.impl.hasFormalArgs = false; st.impl.name = ST.UNKNOWN_NAME; st.impl.defineImplicitlyDefinedTemplates(this); return st; }
/** Create singleton template for use with dictionary values. */ public ST createSingleton(Token templateToken) { String template; if ( templateToken.getType()==GroupParser.BIGSTRING || templateToken.getType()==GroupParser.BIGSTRING_NO_NL ) { template = Misc.strip(templateToken.getText(),2); } else { template = Misc.strip(templateToken.getText(),1); } CompiledST impl = compile(getFileName(), null, null, template, templateToken); ST st = createStringTemplateInternally(impl); st.groupThatCreatedThisInstance = this; st.impl.hasFormalArgs = false; st.impl.name = ST.UNKNOWN_NAME; st.impl.defineImplicitlyDefinedTemplates(this); return st; }
public void defineArgDefaultValueTemplates(STGroup group) { if ( formalArguments==null ) return; for (String a : formalArguments.keySet()) { FormalArgument fa = formalArguments.get(a); if ( fa.defaultValueToken!=null ) { numberOfArgsWithDefaultValues++; if ( fa.defaultValueToken.getType()==GroupParser.ANONYMOUS_TEMPLATE ) { String argSTname = fa.name + "_default_value"; Compiler c2 = new Compiler(group); String defArgTemplate = Misc.strip(fa.defaultValueToken.getText(), 1); fa.compiledDefaultValue = c2.compile(group.getFileName(), argSTname, null, defArgTemplate, fa.defaultValueToken); fa.compiledDefaultValue.name = argSTname; fa.compiledDefaultValue.defineImplicitlyDefinedTemplates(group); } else if ( fa.defaultValueToken.getType()==GroupParser.STRING ) { fa.defaultValue = Misc.strip(fa.defaultValueToken.getText(), 1); } else { // true or false fa.defaultValue = fa.defaultValueToken.getType()==GroupParser.TRUE; } } } }
/** Create singleton template for use with dictionary values. */ public ST createSingleton(Token templateToken) { String template; if ( templateToken.getType()==GroupParser.BIGSTRING || templateToken.getType()==GroupParser.BIGSTRING_NO_NL ) { template = Misc.strip(templateToken.getText(),2); } else { template = Misc.strip(templateToken.getText(),1); } CompiledST impl = compile(getFileName(), null, null, template, templateToken); ST st = createStringTemplateInternally(impl); st.groupThatCreatedThisInstance = this; st.impl.hasFormalArgs = false; st.impl.name = ST.UNKNOWN_NAME; st.impl.defineImplicitlyDefinedTemplates(this); return st; }
public final void keyValuePair(Map<String,Object> mapping) throws RecognitionException { Token STRING10=null; Object keyValue11 =null; try { // org\\stringtemplate\\v4\\compiler\\Group.g:311:2: ( STRING ':' keyValue ) // org\\stringtemplate\\v4\\compiler\\Group.g:311:4: STRING ':' keyValue { STRING10=(Token)match(input,STRING,FOLLOW_STRING_in_keyValuePair678); match(input,20,FOLLOW_20_in_keyValuePair680); pushFollow(FOLLOW_keyValue_in_keyValuePair682); keyValue11=keyValue(); state._fsp--; mapping.put(Misc.replaceEscapes(Misc.strip((STRING10!=null?STRING10.getText():null), 1)), keyValue11); } } catch (RecognitionException re) { reportError(re); recover(input,re); } finally { // do for sure before leaving } } // $ANTLR end "keyValuePair"
public final void keyValuePair(Map<String,Object> mapping) throws RecognitionException { Token STRING10=null; Object keyValue11 = null; try { // org/stringtemplate/v4/compiler/Group.g:286:2: ( STRING ':' keyValue ) // org/stringtemplate/v4/compiler/Group.g:286:4: STRING ':' keyValue { STRING10=(Token)match(input,STRING,FOLLOW_STRING_in_keyValuePair608); match(input,17,FOLLOW_17_in_keyValuePair610); pushFollow(FOLLOW_keyValue_in_keyValuePair612); keyValue11=keyValue(); state._fsp--; mapping.put(Misc.replaceEscapes(Misc.strip((STRING10!=null?STRING10.getText():null), 1)), keyValue11); } } catch (RecognitionException re) { reportError(re); recover(input,re); } finally { } return ; } // $ANTLR end "keyValuePair"
public final void keyValuePair(Map<String,Object> mapping) throws RecognitionException { Token STRING10=null; Object keyValue11 =null; try { // org/stringtemplate/v4/compiler/Group.g:338:2: ( STRING ':' keyValue ) // org/stringtemplate/v4/compiler/Group.g:338:4: STRING ':' keyValue { STRING10=(Token)match(input,STRING,FOLLOW_STRING_in_keyValuePair678); match(input,20,FOLLOW_20_in_keyValuePair680); pushFollow(FOLLOW_keyValue_in_keyValuePair682); keyValue11=keyValue(); state._fsp--; mapping.put(Misc.replaceEscapes(Misc.strip((STRING10!=null?STRING10.getText():null), 1)), keyValue11); } } catch (RecognitionException re) { reportError(re); recover(input,re); } finally { // do for sure before leaving } } // $ANTLR end "keyValuePair"
public final void keyValuePair(Map<String,Object> mapping) throws RecognitionException { Token STRING10=null; Object keyValue11 =null; try { // org\\stringtemplate\\v4\\compiler\\Group.g:311:2: ( STRING ':' keyValue ) // org\\stringtemplate\\v4\\compiler\\Group.g:311:4: STRING ':' keyValue { STRING10=(Token)match(input,STRING,FOLLOW_STRING_in_keyValuePair678); match(input,20,FOLLOW_20_in_keyValuePair680); pushFollow(FOLLOW_keyValue_in_keyValuePair682); keyValue11=keyValue(); state._fsp--; mapping.put(Misc.replaceEscapes(Misc.strip((STRING10!=null?STRING10.getText():null), 1)), keyValue11); } } catch (RecognitionException re) { reportError(re); recover(input,re); } finally { // do for sure before leaving } } // $ANTLR end "keyValuePair"
public final void keyValuePair(Map<String,Object> mapping) throws RecognitionException { Token STRING10=null; Object keyValue11 =null; try { // org/stringtemplate/v4/compiler/Group.g:338:2: ( STRING ':' keyValue ) // org/stringtemplate/v4/compiler/Group.g:338:4: STRING ':' keyValue { STRING10=(Token)match(input,STRING,FOLLOW_STRING_in_keyValuePair678); match(input,20,FOLLOW_20_in_keyValuePair680); pushFollow(FOLLOW_keyValue_in_keyValuePair682); keyValue11=keyValue(); state._fsp--; mapping.put(Misc.replaceEscapes(Misc.strip((STRING10!=null?STRING10.getText():null), 1)), keyValue11); } } catch (RecognitionException re) { reportError(re); recover(input,re); } finally { // do for sure before leaving } } // $ANTLR end "keyValuePair"
public final void keyValuePair(Map<String,Object> mapping) throws RecognitionException { Token STRING10=null; Object keyValue11 =null; try { // org\\stringtemplate\\v4\\compiler\\Group.g:311:2: ( STRING ':' keyValue ) // org\\stringtemplate\\v4\\compiler\\Group.g:311:4: STRING ':' keyValue { STRING10=(Token)match(input,STRING,FOLLOW_STRING_in_keyValuePair678); match(input,20,FOLLOW_20_in_keyValuePair680); pushFollow(FOLLOW_keyValue_in_keyValuePair682); keyValue11=keyValue(); state._fsp--; mapping.put(Misc.replaceEscapes(Misc.strip((STRING10!=null?STRING10.getText():null), 1)), keyValue11); } } catch (RecognitionException re) { reportError(re); recover(input,re); } finally { // do for sure before leaving } } // $ANTLR end "keyValuePair"
public final void keyValuePair(Map<String,Object> mapping) throws RecognitionException { Token STRING10=null; Object keyValue11 =null; try { // org\\stringtemplate\\v4\\compiler\\Group.g:311:2: ( STRING ':' keyValue ) // org\\stringtemplate\\v4\\compiler\\Group.g:311:4: STRING ':' keyValue { STRING10=(Token)match(input,STRING,FOLLOW_STRING_in_keyValuePair678); match(input,20,FOLLOW_20_in_keyValuePair680); pushFollow(FOLLOW_keyValue_in_keyValuePair682); keyValue11=keyValue(); state._fsp--; mapping.put(Misc.replaceEscapes(Misc.strip((STRING10!=null?STRING10.getText():null), 1)), keyValue11); } } catch (RecognitionException re) { reportError(re); recover(input,re); } finally { // do for sure before leaving } } // $ANTLR end "keyValuePair"
public final void keyValuePair(Map<String,Object> mapping) throws RecognitionException { Token STRING10=null; Object keyValue11 =null; try { // org/stringtemplate/v4/compiler/Group.g:338:2: ( STRING ':' keyValue ) // org/stringtemplate/v4/compiler/Group.g:338:4: STRING ':' keyValue { STRING10=(Token)match(input,STRING,FOLLOW_STRING_in_keyValuePair678); match(input,20,FOLLOW_20_in_keyValuePair680); pushFollow(FOLLOW_keyValue_in_keyValuePair682); keyValue11=keyValue(); state._fsp--; mapping.put(Misc.replaceEscapes(Misc.strip((STRING10!=null?STRING10.getText():null), 1)), keyValue11); } } catch (RecognitionException re) { reportError(re); recover(input,re); } finally { // do for sure before leaving } } // $ANTLR end "keyValuePair"