public static NonTerminalNode CreateNode(Rule rule) { Debug.Assert(rule != null); NonTerminalNode node = _implTypes.ContainsKey(rule.Index) ? _implTypes.CreateInstance(rule.Index) : new NonTerminalNode(); node.Rule = rule; return node; }
public NonTerminalNode(Parser theParser) { m_rule = theParser.ReductionRule; }
/// <summary> /// Read rule information. /// </summary> private void ReadRules(BinaryReader reader) { Int32 index = ReadInt16Entry(reader); Symbol nonTerminal = m_SymbolTable[ReadInt16Entry(reader)]; ReadEmptyEntry(reader); var symbols = new Symbol[m_EntryCount]; for (Int32 i = 0; i < symbols.Length; i++) { symbols[i] = m_SymbolTable[ReadInt16Entry(reader)]; } var rule = new Rule(index, nonTerminal, symbols); m_RuleTable[index] = rule; }
/// <summary> /// Reads table record counts and initializes tables. /// </summary> private void ReadTableCounts(BinaryReader reader) { // Initialize tables m_SymbolTable = new Symbol[ReadInt16Entry(reader)]; m_CharSetTable = new String[ReadInt16Entry(reader)]; m_RuleTable = new Rule[ReadInt16Entry(reader)]; m_DfaStateTable = new DfaState[ReadInt16Entry(reader)]; m_LRStateTable = new LRState[ReadInt16Entry(reader)]; }
/// <summary> /// Read rule information. /// </summary> private void ReadRules() { int index = ReadInt16Entry(); Symbol nonTerminal = m_symbolTable[ReadInt16Entry()]; ReadEmptyEntry(); Symbol[] symbols = new Symbol[m_entryCount]; for (int i = 0; i < symbols.Length; i++) { symbols[i] = m_symbolTable[ReadInt16Entry()]; } Rule rule = new Rule(index, nonTerminal, symbols); m_ruleTable[index] = rule; }
public NonTerminal(Rule rule) { Rule = rule; }