@@ -81,7 +81,7 @@ public GrammarBundle build() {
8181 .startRuleIndex (resolveStartRuleIndex (parser .getRuleNames ()))
8282 .literalNames (literalNames )
8383 .symbolicNames (symbolicNames )
84- .tokenDictionary (buildTokenDictionary (vocabulary ))
84+ .tokenDictionary (buildTokenDictionary ())
8585 .ignoredTokens (buildIgnoredTokens (vocabulary ))
8686 .rulesToVisit (buildRulesToVisit (parser .getRuleNames ()))
8787 .build ();
@@ -90,12 +90,10 @@ public GrammarBundle build() {
9090 /**
9191 * Build the token dictionary — semantic name → token type ID mapping. Uses lexer constants since
9292 * token type IDs are defined by the lexer. The frontend autocomplete enrichment uses these to
93- * identify tokens like SPACE, PIPE, SOURCE by name.
93+ * identify tokens like PIPE and SOURCE by name.
9494 */
95- private static Map <String , Integer > buildTokenDictionary (Vocabulary vocabulary ) {
95+ private static Map <String , Integer > buildTokenDictionary () {
9696 Map <String , Integer > dict = new LinkedHashMap <>();
97- // SPACE token may not exist in this grammar (whitespace may be implicitly skipped).
98- // Resolve by searching symbolic names; use -1 if not found.
9997 dict .put ("WHITESPACE" , OpenSearchPPLLexer .WHITESPACE );
10098 dict .put ("FROM" , OpenSearchPPLLexer .FROM );
10199 dict .put ("OPENING_BRACKET" , OpenSearchPPLLexer .LT_PRTHS );
@@ -182,16 +180,6 @@ private static int[] buildRulesToVisit(String[] ruleNames) {
182180 return indices ;
183181 }
184182
185- /** Resolve a token type ID from the vocabulary by symbolic name. Returns -1 if not found. */
186- private static int resolveTokenType (Vocabulary vocabulary , String name ) {
187- for (int i = 0 ; i <= vocabulary .getMaxTokenType (); i ++) {
188- if (name .equals (vocabulary .getSymbolicName (i ))) {
189- return i ;
190- }
191- }
192- return -1 ;
193- }
194-
195183 private static int resolveStartRuleIndex (String [] ruleNames ) {
196184 int idx = Arrays .asList (ruleNames ).indexOf ("root" );
197185 return Math .max (idx , 0 );
0 commit comments