File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
tool/src/main/java/org/antlr/tool Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -271,9 +271,14 @@ protected void aliasTokenIDsAndLiterals(Grammar root) {
271271 String tokenID = entry .getKey ();
272272 String literal = entry .getValue ();
273273 if ( literal .charAt (0 )=='\'' && stringLiterals .get (literal )!=null ) {
274- stringLiterals .put (literal , tokens .get (tokenID ));
275- // an alias still means you need a lexer rule for it
276274 Integer typeI = tokens .get (tokenID );
275+ if (typeI == null ) {
276+ // must have been imported from a tokenVocab
277+ typeI = grammar .composite .tokenIDToTypeMap .get (tokenID );
278+ }
279+
280+ stringLiterals .put (literal , typeI );
281+ // an alias still means you need a lexer rule for it
277282 if ( !tokenRuleDefs .contains (tokenID ) ) {
278283 root .defineLexerRuleForAliasedStringLiteral (tokenID , literal , typeI );
279284 }
You can’t perform that action at this time.
0 commit comments