private static AcceptAction CreateAcceptAction(ActionSubRecord record, SymbolCollection symbols) { SymbolTerminal symbol = symbols[record.SymbolIndex] as SymbolTerminal; return(new AcceptAction(symbol)); }
private static ReduceAction CreateReduceAction(ActionSubRecord record, SymbolCollection symbols, RuleCollection rules) { SymbolTerminal symbol = symbols[record.SymbolIndex] as SymbolTerminal; Rule rule = rules[record.Target]; return(new ReduceAction(symbol, rule)); }
private static ShiftAction CreateShiftAction(ActionSubRecord record, SymbolCollection symbols, StateCollection states) { State state = states[record.Target]; SymbolTerminal symbol = symbols[record.SymbolIndex] as SymbolTerminal; //todo: exception symbol type return(new ShiftAction(symbol, state)); }
}//methods private bool CheckConflictResolutionByPrecedence(ActionRecord action) { SymbolTerminal opTerm = SymbolTerminal.GetSymbol(action.Key); if (opTerm != null && opTerm.IsSet(TermOptions.IsOperator)) { action.ActionType = ParserActionType.Operator; action.ConflictResolved = true; return(true); } return(false); }
public EndState(int id, SymbolTerminal acceptSymbol) : base(id) { this.acceptSymbol = acceptSymbol; }
/// <summary> /// Creates a new shift action. /// </summary> /// <param name="symbol">The symbol that the token must be for this action to be done.</param> /// <param name="state">The new current state for the LALR parser.</param> public ShiftAction(SymbolTerminal symbol, State state) { this.symbol = symbol; this.state = state; }
/// <summary> /// Creates a new ReduceAction. /// </summary> /// <param name="symbol">The symbol that a token must be for this action /// to be done.</param> /// <param name="rule">The rule to be used to reduce tokens.</param> public ReduceAction(SymbolTerminal symbol, Rule rule) { this.symbol = symbol; this.rule = rule; }
/// <summary> /// Creates a new accept action. /// </summary> /// <param name="symbol">The symbol that a token must be for it to be accepted.</param> public AcceptAction(SymbolTerminal symbol) { this.symbol = symbol; }
public SymbolTerminal Symbol(string symbol, string name) { SymbolTerminal term; if (SymbolTerms.TryGetValue(symbol, out term)) { //update name if it was specified now and not before if (string.IsNullOrEmpty(term.Name) && !string.IsNullOrEmpty(name)) term.Name = name; return term; } //create new term if (!CaseSensitive) symbol = symbol.ToLower(); string.Intern(symbol); term = new SymbolTerminal(symbol, name); SymbolTerms[symbol] = term; return term; }
protected void InitCommand(String myCommand, String myShortInfo, String myInformation) { _Command = myCommand.ToUpper(); _ShortInfo = myShortInfo; _Information = myInformation; CLICommandNonTerminal = new NonTerminal(_Command); CLICommandSymbolTerminal = Symbol(_Command); }