ConstantsTable

Namespace: Irony
We found 10 examples in language CSharp for this search. You will see 38 fragments of code.

        public object GetConstant(int constantId)
        {
            return ConstantsTable[constantId];
        }

        public int BindConstant(object constant)
        {
            ConstantsTable.Add(constant);
            return ConstantsTable.Count - 1;
        }


    public void Add(string lexeme, object value) {
      this.Constants[lexeme] = value;
    }

    public override void Init(GrammarData grammarData) {
      base.Init(grammarData);
      if (this.EditorInfo == null)
        this.EditorInfo = new TokenEditorInfo(TokenType.Unknown, TokenColor.Text, TokenTriggers.None);
    }

    public override Token TryMatch(ParsingContext context, ISourceStream source) {
      string text = source.Text;
      foreach (var entry in Constants) {
        var constant = entry.Key;
        if (source.PreviewPosition + constant.Length > text.Length) continue;
        if (source.MatchSymbol(constant, !Grammar.CaseSensitive)) {
          source.PreviewPosition += constant.Length;
          return source.CreateToken(this.OutputTerminal, entry.Value);
        }
      }
      return null;
    }
    public override IList<string> GetFirsts() {
      string[] array = new string[Constants.Count];
      Constants.Keys.CopyTo(array, 0);
      return array;
    }

    public void Add(string lexeme, object value) {
      this.Table[lexeme] = value;
    }
    public override void Init(GrammarData grammarData) {
      base.Init(grammarData);
      if (this.EditorInfo == null)
        this.EditorInfo = new TokenEditorInfo(TokenType.Unknown, TokenColor.Text, TokenTriggers.None);
    }
    public override Token TryMatch(CompilerContext context, ISourceStream source) {
      string text = source.Text;
      foreach (string lexeme in Table.Keys) {
        if (source.Position + lexeme.Length > text.Length) continue;
        if (!source.MatchSymbol(lexeme, !OwnerGrammar.CaseSensitive)) continue; 
        Token tkn = new Token(this, source.TokenStart, lexeme, Table[lexeme]);
        source.Position += lexeme.Length;
        return tkn;
      }
      return null;
    }
    public override IList<string> GetFirsts() {
      string[] array = new string[Table.Count];
      Table.Keys.CopyTo(array, 0);
      return array;
    }


    public void Add(string lexeme, object value) {
      this.Constants[lexeme] = value;
    }

    public override void Init(GrammarData grammarData) {
      base.Init(grammarData);
      if (this.EditorInfo == null)
        this.EditorInfo = new TokenEditorInfo(TokenType.Unknown, TokenColor.Text, TokenTriggers.None);
    }

    public override Token TryMatch(ParsingContext context, ISourceStream source) {
      string text = source.Text;
      foreach (var entry in Constants) {
        source.PreviewPosition = source.Position;
        var constant = entry.Key;
        if (source.PreviewPosition + constant.Length > text.Length) continue;
        if (source.MatchSymbol(constant)) {
          source.PreviewPosition += constant.Length;
          if (!this.Grammar.IsWhitespaceOrDelimiter(source.PreviewChar))
            continue; //make sure it is delimiter
          return source.CreateToken(this.OutputTerminal, entry.Value);
        }
      }
      return null;
    }

    public override IList<string> GetFirsts() {
      string[] array = new string[Constants.Count];
      Constants.Keys.CopyTo(array, 0);
      return array;
    }


    public void Add(string lexeme, object value) {
      this.Constants[lexeme] = value;
    }

    public override void Init(GrammarData grammarData) {
      base.Init(grammarData);
      if (this.EditorInfo == null)
        this.EditorInfo = new TokenEditorInfo(TokenType.Unknown, TokenColor.Text, TokenTriggers.None);
    }

    public override Token TryMatch(ParsingContext context, ISourceStream source) {
      string text = source.Text;
      foreach (var entry in Constants) {
        var constant = entry.Key;
        if (source.PreviewPosition + constant.Length > text.Length) continue;
        if (source.MatchSymbol(constant, !Grammar.CaseSensitive)) {
          source.PreviewPosition += constant.Length;
          return source.CreateToken(this.OutputTerminal, entry.Value);
        }
      }
      return null;
    }
    public override IList<string> GetFirsts() {
      string[] array = new string[Constants.Count];
      Constants.Keys.CopyTo(array, 0);
      return array;
    }

    public void Add(string lexeme, object value) {
      this.Table[lexeme] = value;
    }
    public override void Init(GrammarData grammarData) {
      base.Init(grammarData);
      if (this.EditorInfo == null)
        this.EditorInfo = new TokenEditorInfo(TokenType.Unknown, TokenColor.Text, TokenTriggers.None);
    }
    public override Token TryMatch(CompilerContext context, ISourceStream source) {
      string text = source.Text;
      foreach (string lexeme in Table.Keys) {
        if (source.Position + lexeme.Length > text.Length) continue;
        if (!source.MatchSymbol(lexeme, !OwnerGrammar.CaseSensitive)) continue; 
        Token tkn = new Token(this, source.TokenStart, lexeme, Table[lexeme]);
        source.Position += lexeme.Length;
        return tkn;
      }
      return null;
    }
    public override IList<string> GetFirsts() {
      string[] array = new string[Table.Count];
      Table.Keys.CopyTo(array, 0);
      return array;
    }


    public void Add(string lexeme, object value) {
      this.Constants[lexeme] = value;
    }

    public override void Init(GrammarData grammarData) {
      base.Init(grammarData);
      if (this.EditorInfo == null)
        this.EditorInfo = new TokenEditorInfo(TokenType.Unknown, TokenColor.Text, TokenTriggers.None);
    }

    public override Token TryMatch(ParsingContext context, ISourceStream source) {
      string text = source.Text;
      foreach (var entry in Constants) {
        var constant = entry.Key;
        if (source.PreviewPosition + constant.Length > text.Length) continue;
        if (source.MatchSymbol(constant, !Grammar.CaseSensitive)) {
          source.PreviewPosition += constant.Length;
          return source.CreateToken(this.OutputTerminal, entry.Value);
        }
      }
      return null;
    }
    public override IList<string> GetFirsts() {
      string[] array = new string[Constants.Count];
      Constants.Keys.CopyTo(array, 0);
      return array;
    }


    public void Add(string lexeme, object value) {
      this.Constants[lexeme] = value;
    }

    public override void Init(GrammarData grammarData) {
      base.Init(grammarData);
      if (this.EditorInfo == null)
        this.EditorInfo = new TokenEditorInfo(TokenType.Unknown, TokenColor.Text, TokenTriggers.None);
    }

    public override Token TryMatch(ParsingContext context, ISourceStream source) {
      string text = source.Text;
      foreach (var entry in Constants) {
        var constant = entry.Key;
        if (source.PreviewPosition + constant.Length > text.Length) continue;
        if (source.MatchSymbol(constant, !Grammar.CaseSensitive)) {
          source.PreviewPosition += constant.Length;
          return source.CreateToken(this.OutputTerminal, entry.Value);
        }
      }
      return null;
    }
    public override IList<string> GetFirsts() {
      string[] array = new string[Constants.Count];
      Constants.Keys.CopyTo(array, 0);
      return array;
    }


    public void Add(string lexeme, object value) {
      this.Constants[lexeme] = value;
    }

    public override void Init(GrammarData grammarData) {
      base.Init(grammarData);
      if (this.EditorInfo == null)
        this.EditorInfo = new TokenEditorInfo(TokenType.Unknown, TokenColor.Text, TokenTriggers.None);
    }

    public override Token TryMatch(ParsingContext context, ISourceStream source) {
      string text = source.Text;
      foreach (var entry in Constants) {
        source.PreviewPosition = source.Position;
        var constant = entry.Key;
        if (source.PreviewPosition + constant.Length > text.Length) continue;
        if (source.MatchSymbol(constant)) {
          source.PreviewPosition += constant.Length;
          if (!this.Grammar.IsWhitespaceOrDelimiter(source.PreviewChar))
            continue; //make sure it is delimiter
          return source.CreateToken(this.OutputTerminal, entry.Value);
        }
      }
      return null;
    }

    public override IList<string> GetFirsts() {
      string[] array = new string[Constants.Count];
      Constants.Keys.CopyTo(array, 0);
      return array;
    }


    public void Add(string lexeme, object value) {
      this.Constants[lexeme] = value;
    }

    public override void Init(GrammarData grammarData) {
      base.Init(grammarData);
      if (this.EditorInfo == null)
        this.EditorInfo = new TokenEditorInfo(TokenType.Unknown, TokenColor.Text, TokenTriggers.None);
    }

    public override Token TryMatch(ParsingContext context, ISourceStream source) {
      string text = source.Text;
      foreach (var entry in Constants) {
        source.PreviewPosition = source.Position;
        var constant = entry.Key;
        if (source.PreviewPosition + constant.Length > text.Length) continue;
        if (source.MatchSymbol(constant)) {
          source.PreviewPosition += constant.Length;
          if (!this.Grammar.IsWhitespaceOrDelimiter(source.PreviewChar))
            continue; //make sure it is delimiter
          return source.CreateToken(this.OutputTerminal, entry.Value);
        }
      }
      return null;
    }

    public override IList<string> GetFirsts() {
      string[] array = new string[Constants.Count];
      Constants.Keys.CopyTo(array, 0);
      return array;
    }

Irony.Parsing.ConstantsTable : IDictionary

Constructors :

public ConstantsTable()

Methods :

public IEqualityComparer<String> get_Comparer()
public Int32 get_Count()
public KeyCollection<String, Object> get_Keys()
public ValueCollection<String, Object> get_Values()
public Object get_Item(String key = )
public Void set_Item(String key = , Object value = )
public Void Add(String key = , Object value = )
public Void Clear()
public Boolean ContainsKey(String key = )
public Boolean ContainsValue(Object value = )
public Enumerator<String, Object> GetEnumerator()
public Void GetObjectData(SerializationInfo info = , StreamingContext context = )
public Void OnDeserialization(Object sender = )
public Boolean Remove(String key = )
public Boolean Remove(String key = , Object& value = )
public Boolean TryGetValue(String key = , Object& value = )
public Boolean TryAdd(String key = , Object value = )
public Int32 EnsureCapacity(Int32 capacity = )
public Void TrimExcess()
public Void TrimExcess(Int32 capacity = )
public Type GetType()
public String ToString()
public Boolean Equals(Object obj = )
public Int32 GetHashCode()

Other methods