예제 #1
0
        protected LexToken getPrefixBlankToken()
        {
            LexToken      lexToken      = base.createToken();
            StringBuilder stringBuilder = new StringBuilder();
            char          c             = base.current();

            while (c != '\0' && char.IsWhiteSpace(c))
            {
                stringBuilder.Append(c);
                c = base.next();
            }
            LexToken result;

            if (stringBuilder != null && stringBuilder.Length > 0)
            {
                lexToken.setToken(stringBuilder.ToString());
                lexToken.setType(LexTokenTypes.BLANK);
                lexToken.setEndRowIndex(base.getCurrentRowIndex());
                lexToken.setPrevBlanks(null);
                result = lexToken;
            }
            else
            {
                result = null;
            }
            return(result);
        }
예제 #2
0
        public override LexToken nextToken()
        {
            LexToken prefixBlankToken = this.getPrefixBlankToken();
            LexToken result;

            if (base.current() == '\0')
            {
                result = prefixBlankToken;
            }
            else
            {
                LexToken lexToken = this.parseToken();
                if (lexToken != null)
                {
                    lexToken.setEndRowIndex(base.getCurrentRowIndex());
                    lexToken.setPrevBlanks(prefixBlankToken);
                }
                result = lexToken;
            }
            return(result);
        }