Exemplo n.º 1
0
		public ReduceEventArgs(Rule rule, NonterminalToken token, State newState)
		{
			this.rule = rule;
			this.token = token;
			this.newState = newState;
			this.contin = true;
		}
Exemplo n.º 2
0
		/// <summary>
		/// Creates a new nonterminal token.
		/// </summary>
		/// <param name="rule">The reduction rule.</param>
		/// <param name="tokens">The tokens that are reduced.</param>
		public NonterminalToken(Rule rule, Token[] tokens)
		{
			this.rule = rule;
			this.tokens = tokens;			
		}
Exemplo n.º 3
0
 public void Add(Rule rule)
 {
     list.Add(rule);
 }
Exemplo n.º 4
0
        private RuleCollection CreateRules(CGTContent content)
        {
            RuleCollection rules = new RuleCollection();
            foreach (RuleRecord ruleRecord in content.RuleTable)
            {
                SymbolNonterminal lhs = symbols[ruleRecord.Nonterminal] as SymbolNonterminal;
                //todo: exception handling?
                Symbol[] rhs = new Symbol[ruleRecord.Symbols.Count];
                for (int i = 0; i< rhs.Length; i++)
                {
                    rhs[i] = symbols[ruleRecord.Symbols[i]];
                }

                Rule rule = new Rule(ruleRecord.Index,lhs,rhs);
                rules.Add(rule);
            }
            return rules;
        }