Exemple #1
0
 public Tokenizer(TextReader input, bool ignoreCase)
 {
     this.ignoreCase     = false;
     this.regexpMatchers = new ArrayList();
     this.stringMatcher  = new StringTokenMatcher(ignoreCase);
     this.input          = new LookAheadReader(input);
     this.ignoreCase     = ignoreCase;
 }
Exemple #2
0
        public void Reset(TextReader input)
        {
            this.input.Close();
            this.input         = new LookAheadReader(input);
            this.previousToken = null;
            this.stringMatcher.Reset();
            var num = this.regexpMatchers.Count - 1;

            for (var i = 0; i <= num; i++)
            {
                ((RegExpTokenMatcher)this.regexpMatchers[i]).Reset(this.input);
            }
        }
Exemple #3
0
        public object MatchFrom(LookAheadReader input, int pos, bool caseInsensitive)
        {
            object result = null;
            var    c      = input.Peek(pos);
            var    flag   = this.tree != null && c >= 0;

            if (flag)
            {
                var state = this.tree.Find(Convert.ToChar(c), caseInsensitive);
                var flag2 = state != null;
                if (flag2)
                {
                    result = RuntimeHelpers.GetObjectValue(state.MatchFrom(input, pos + 1, caseInsensitive));
                }
            }
            return(Interaction.IIf(result == null, RuntimeHelpers.GetObjectValue(this.value), RuntimeHelpers.GetObjectValue(result)));
        }
Exemple #4
0
 public void Reset(LookAheadReader input)
 {
     this.matcher.Reset(input);
 }
Exemple #5
0
 public RegExpTokenMatcher(TokenPattern pattern, bool ignoreCase, LookAheadReader input)
 {
     this.pattern = pattern;
     this.regExp  = new RegExp(pattern.Pattern, ignoreCase);
     this.matcher = this.regExp.Matcher(input);
 }
Exemple #6
0
 public bool Match(LookAheadReader input)
 {
     this.Reset();
     this.tokenPattern = (TokenPattern)this.start.MatchFrom(input, 0, this.ignoreCase);
     return(this.tokenPattern != null);
 }