ConstantTerminal

Namespace: Irony
We found 10 examples in language CSharp for this search. You will see 37 fragments of code.
    public void Add(string lexeme, object value) {
      this.Table[lexeme] = value;
    }
    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, !Grammar.CaseSensitive)) continue; 
        Token tkn = Token.Create(this, context, 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.Table[lexeme] = value;
    }
    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, !Grammar.CaseSensitive)) continue; 
        Token tkn = Token.Create(this, context, 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 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, !Grammar.CaseSensitive)) continue; 
        Token tkn = Token.Create(this, context, 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) {
        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) {
        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;
    }

Irony.Parsing.ConstantTerminal : Terminal

Fields :

public ConstantsTable Constants
public TokenCategory Category
public Int32 Priority
public TokenEditorInfo EditorInfo
public Byte MultilineIndex
public Terminal IsPairFor
public String Name
public String ErrorAlias
public TermFlags Flags
public Int32 Precedence
public Associativity Associativity

Constructors :

public ConstantTerminal(String name = , Type nodeType = null)

Methods :

public Void Add(String lexeme = , Object value = )
public Void Init(GrammarData grammarData = )
public Token TryMatch(ParsingContext context = , ISourceStream source = )
public IList<String> GetFirsts()
public Terminal get_OutputTerminal()
public String TokenToString(Token token = )
public Void add_ValidateToken(EventHandler<ValidateTokenEventArgs> value = )
public Void remove_ValidateToken(EventHandler<ValidateTokenEventArgs> value = )
public Void add_ParserInputPreview(EventHandler<ParsingEventArgs> value = )
public Void remove_ParserInputPreview(EventHandler<ParsingEventArgs> value = )
public Void SetOutputTerminal(Grammar grammar = , Terminal outputTerminal = )
public String GetParseNodeCaption(ParseTreeNode node = )
public String ToString()
public Int32 GetHashCode()
public Grammar get_Grammar()
public Void SetFlag(TermFlags flag = )
public Void SetFlag(TermFlags flag = , Boolean value = )
public Void add_Shifting(EventHandler<ParsingEventArgs> value = )
public Void remove_Shifting(EventHandler<ParsingEventArgs> value = )
public Void add_AstNodeCreated(EventHandler<AstNodeEventArgs> value = )
public Void remove_AstNodeCreated(EventHandler<AstNodeEventArgs> value = )
public AstNodeConfig get_AstConfig()
public Void set_AstConfig(AstNodeConfig value = )
public Boolean HasAstConfig()
public BnfExpression Q()
public Type GetType()
public Boolean Equals(Object obj = )