예제 #1
0
 public void moveToPrevToken(LexToken t)
 {
     if (null != t)
     {
         this.token = string.Concat(new string[]
         {
             t.getToken(),
             (this.getSuffix() == null) ? "" : this.getSuffix(),
             (this.getPrevBlanks() == null) ? "" : this.getPrevBlanks().getToken(),
             (this.getPrefix() == null) ? "" : this.getPrefix(),
             this.getToken()
         });
         this.prefix        = t.prefix;
         this.m_prevBlanks  = t.m_prevBlanks;
         this.beginColumn   = t.beginColumn;
         this.beginRowIndex = t.beginRowIndex;
     }
 }
예제 #2
0
        public override bool Equals(object obj)
        {
            bool result;

            if (null == obj)
            {
                result = false;
            }
            else if (obj is LexToken)
            {
                LexToken lexToken = (LexToken)obj;
                result = (lexToken.getToken().Equals(this.getToken()) && lexToken.getType() == this.getType());
            }
            else
            {
                string value = obj.ToString();
                result = this.getToken().Equals(value);
            }
            return(result);
        }
예제 #3
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);
        }
예제 #4
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);
 }