/** Get a meaningful name for a token type useful during code generation. * Literals without associated names are converted to the string equivalent * of their integer values. Used to generate x==ID and x==34 type comparisons * etc... Essentially we are looking for the most obvious way to refer * to a token type in the generated code. If in the lexer, return the * char literal translated to the target language. For example, ttype=10 * will yield '\n' from the getTokenDisplayName method. That must * be converted to the target languages literals. For most C-derived * languages no translation is needed. */ public String getTokenTypeAsTargetLabel(int ttype) { if ( grammar.type==Grammar.LEXER ) { String name = grammar.getTokenDisplayName(ttype); return target.getTargetCharLiteralFromANTLRCharLiteral(this,name); } return target.getTokenTypeAsTargetLabel(this,ttype); }
/** Get a meaningful name for a token type useful during code generation. * Literals without associated names are converted to the string equivalent * of their integer values. Used to generate x==ID and x==34 type comparisons * etc... Essentially we are looking for the most obvious way to refer * to a token type in the generated code. If in the lexer, return the * char literal translated to the target language. For example, ttype=10 * will yield '\n' from the getTokenDisplayName method. That must * be converted to the target languages literals. For most C-derived * languages no translation is needed. */ public String getTokenTypeAsTargetLabel(int ttype) { if ( grammar.type==Grammar.LEXER ) { String name = grammar.getTokenDisplayName(ttype); return target.getTargetCharLiteralFromANTLRCharLiteral(this,name); } return target.getTokenTypeAsTargetLabel(this,ttype); }
/** Get a meaningful name for a token type useful during code generation. * Literals without associated names are converted to the string equivalent * of their integer values. Used to generate x==ID and x==34 type comparisons * etc... Essentially we are looking for the most obvious way to refer * to a token type in the generated code. If in the lexer, return the * char literal translated to the target language. For example, ttype=10 * will yield '\n' from the getTokenDisplayName method. That must * be converted to the target languages literals. For most C-derived * languages no translation is needed. */ public String getTokenTypeAsTargetLabel(int ttype) { if ( grammar.type==Grammar.LEXER ) { String name = grammar.getTokenDisplayName(ttype); return target.getTargetCharLiteralFromANTLRCharLiteral(this,name); } return target.getTokenTypeAsTargetLabel(this,ttype); }
/** Get a meaningful name for a token type useful during code generation. * Literals without associated names are converted to the string equivalent * of their integer values. Used to generate x==ID and x==34 type comparisons * etc... Essentially we are looking for the most obvious way to refer * to a token type in the generated code. If in the lexer, return the * char literal translated to the target language. For example, ttype=10 * will yield '\n' from the getTokenDisplayName method. That must * be converted to the target languages literals. For most C-derived * languages no translation is needed. */ public String getTokenTypeAsTargetLabel(int ttype) { if ( grammar.type==Grammar.LEXER ) { String name = grammar.getTokenDisplayName(ttype); return target.getTargetCharLiteralFromANTLRCharLiteral(this,name); } return target.getTokenTypeAsTargetLabel(this,ttype); }