Exemplo n.º 1
0
        protected LexToken parseName(LexToken token)
        {
            token.setType(LexTokenTypes.NAME);
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.Append(base.current());
            bool flag = this.isSpecial(base.current());
            char c    = base.next();

            while (c != '\0')
            {
                if (!char.IsLetter(c) && !char.IsDigit(c) && c != '_' && !this.m_LexTokenizerConfig.isNameChar(c))
                {
                    break;
                }
                stringBuilder.Append(c);
                c    = base.next();
                flag = (flag && this.isSpecial(c));
            }
            if (this.m_LexTokenizerConfig.isAllowLongSpecifiedName() && this.m_LexTokenizerConfig.getLongNameDelimiter() == c)
            {
                int currentPosition = base.getCurrentPosition();
                base.next();
                LexToken lexToken = this.nextToken();
                if (!lexToken.isName())
                {
                    base.backTo(currentPosition);
                }
                else
                {
                    token.setType(LexTokenTypes.LONG_NAME);
                    stringBuilder.Append(c);
                    stringBuilder.Append(lexToken.getToken());
                }
            }
            token.setToken(stringBuilder.ToString());
            return(token);
        }
Exemplo n.º 2
0
 public static bool IsSQLParameterToken(LexToken token)
 {
     return(token != null && token.getToken() != null && token.getToken().Length > 0 && (token.isName() || token.isSpecial()) && "#@:?".IndexOf(token.getToken().ToCharArray()[0]) >= 0);
 }