예제 #1
0
 public static void RegisterPunctuation(params string[] symbols)
 {
     foreach (string symbol in symbols)
     {
         SymbolTerminal term = SymbolTerminal.GetSymbol(symbol);
         term.SetOption(TermOptions.IsPunctuation);
     }
 }
예제 #2
0
 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;
     }
 }
예제 #3
0
    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;
    }
예제 #4
0
        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);
        }