public static void RegisterPunctuation(params string[] symbols) { foreach (string symbol in symbols) { SymbolTerminal term = SymbolTerminal.GetSymbol(symbol); term.SetOption(TermOptions.IsPunctuation); } }
public static void RegisterOperators(int precedence, Associativity associativity, params string[] opSymbols) { foreach (string op in opSymbols) { SymbolTerminal opSymbol = SymbolTerminal.GetSymbol(op); opSymbol.SetOption(TermOptions.IsOperator, true); opSymbol.Precedence = precedence; opSymbol.Associativity = associativity; } }
public static SymbolTerminal GetSymbol(string symbol) { SymbolTerminal term; if (_symbols.TryGetValue(symbol, out term)) { return term; } term = new SymbolTerminal(symbol); term.SetOption(TermOptions.IsGrammarSymbol, true); _symbols[symbol] = term; return term; }
public static SymbolTerminal GetSymbol(string symbol) { SymbolTerminal term; if (_symbols.TryGetValue(symbol, out term)) { return(term); } term = new SymbolTerminal(symbol); term.SetOption(TermOptions.IsGrammarSymbol, true); _symbols[symbol] = term; return(term); }