14 using System.Collections;
15 using System.Collections.Generic;
17 using System.Text.RegularExpressions;
29 Prefixes.AddRange(prefixes);
34 Prefixes.AddRange(prefixes);
37 #region public properties
41 public Regex Expression {
42 get {
return _expression; }
47 base.Init(grammarData);
48 string workPattern =
@"\G(" + Pattern +
")";
49 RegexOptions options = (Grammar.CaseSensitive ? RegexOptions.None : RegexOptions.IgnoreCase);
50 _expression =
new Regex(workPattern, options);
51 if (this.EditorInfo == null)
60 Match m = _expression.Match(source.Text, source.PreviewPosition);
63 source.PreviewPosition += m.Length;
64 return source.CreateToken(this.OutputTerminal);
override void Init(GrammarData grammarData)
Interface for Terminals to access the source stream and produce tokens.
override Token TryMatch(ParsingContext context, ISourceStream source)
RegexBasedTerminal(string pattern, params string[] prefixes)
int PreviewPosition
Gets or sets the current preview position in the source file. Must be greater or equal to Location...
override IList< string > GetFirsts()
Tokens are produced by scanner and fed to parser, optionally passing through Token filters in between...
RegexBasedTerminal(string name, string pattern, params string[] prefixes)