Example #1
0
        public override bool IsImplicitMatch(CSharpLexer lexer)
        {
            if (!char.IsWhiteSpace(lexer.Previous) &&
                !lexer.IsSpecialSymbol(lexer.Previous, DelimiterType.End))
            {
                return(false);
            }

            bool matchedNumber = false;

            while (!lexer.EndOfStream)
            {
                if (IsNumberOrDecimalPoint(lexer.ReadNext()))
                {
                    matchedNumber = true;
                    lexer.Commit();
                }
                else
                {
                    lexer.Rollback();
                    break;
                }
            }

            return(matchedNumber);
        }
Example #2
0
        public bool IsMatch(CSharpLexer lexer)
        {
            if (IsImplicitMatch(lexer))
            {
                lexer.Commit();
                return(true);
            }

            lexer.Rollback();
            return(false);
        }