private void AddSymbolsToProduction(Production prod, List <string> list) { // Version 1.3.1 sends even empty lists to this method. // Furthermore, version 1.3.1 no longer explicitly calls // FixInternalReduction(). It is easier to adopt a consistent // approach and let AddXxxToProd check for a trailing action // prior to adding symbols or a new action. // if (list != null) { if (prod.semanticAction != null || prod.precSpan != null) { FixInternalReduction(prod); } foreach (string str in list) { Symbol symbol = null; switch (TokenOf(str)) { case Token.litchar: // This is a character literal symbol if (GPCG.ImportedTokens && Terminal.BumpsMax(str)) { handler.ListError(this.CurrentLocationSpan, 82, str, '\0'); } symbol = grammar.LookupTerminal(Token.litchar, str); break; case Token.litstring: // This is a uned occurrence of a terminal alias. String s = CharacterUtilities.CanonicalizeAlias(str); if (!grammar.aliasTerms.ContainsKey(s)) { handler.ListError(this.CurrentLocationSpan, 83, str, '\0'); } else { symbol = grammar.aliasTerms[s]; if (symbol == Terminal.Ambiguous) // Use of an ambiguous alias. { handler.ListError(this.CurrentLocationSpan, 84, str, '\0'); } } break; case Token.ident: // This is a used occurrence of a terminal name. if (grammar.terminals.ContainsKey(str)) { symbol = grammar.terminals[str]; } else { symbol = grammar.LookupNonTerminal(str); } break; } prod.rhs.Add(symbol); } } }