示例#1
0
        private List <IAstNode> Tokenize(string str)
        {
            List <IAstNode> tokens = new List <IAstNode>();

            // Used to make sure the string keeps shrinking on each iteration
            int oldStringLen  = str.Length + 1;
            int currentLength = str.Length;

            IAstNode preToken = new BaseAstNode();

            // Keep processing the string until it is empty
            while (currentLength > 0)
            {
                if (oldStringLen <= currentLength)
                {
                    // If the string stopped shrinking, there was a problem
                    MessageBox.Show(@"SQL Parseエラーが発生しました。" + Environment.NewLine
                                    + @"入力SQLとともに管理者に問い合わせください。"
                                    , @"重大なエラー [Line:" + preToken.StartLineNo + @"]"
                                    , MessageBoxButtons.OK
                                    , MessageBoxIcon.Error);
                    return(tokens);
                }

                oldStringLen = currentLength;

                IAstNode token = GetNextToken(str, preToken);
                tokens.Add(token);

                int tokenStrLength = token.OriginalValue.Length;
                str            = str.Substring(tokenStrLength);
                currentLength -= tokenStrLength;

                preToken = token;
            }
            tokens.Add(new BaseAstNode(preToken, string.Empty));
            return(tokens);
        }
示例#2
0
 public virtual bool Visit(BaseAstNode node)
 {
     return(true);
 }
示例#3
0
 public virtual bool Transform(BaseAstNode node)
 {
     return(true);
 }