Beispiel #1
0
        private Token?NextComment()
        {
            while (!IsEof())
            {
                char c = Code.GetChar(Index);
                if (c == '\'')
                {
                    ++Index;
                    return(NextComment(1, false));
                }
                else if (CharUtils.Equals(c, 'r'))
                {
                    char c2 = Code.GetChar(Index + 1);
                    char c3 = Code.GetChar(Index + 2);
                    char c4 = Code.GetChar(Index + 3);
                    if (CharUtils.Equals(c2, 'e') &&
                        CharUtils.Equals(c3, 'm') &&
                        CharUtils.IsWhiteSpace(c4))
                    {
                        Index += 3;
                        return(NextComment(3, true));
                    }
                    else
                    {
                        break;
                    }
                }
                else
                {
                    break;
                }
            }

            return(null);
        }
Beispiel #2
0
        public void SkipWhitespaces()
        {
            void SkipWSOnly()
            {
                char c = Code.GetChar(Index);

                while (CharUtils.IsWhiteSpace(c))
                {
                    c = Code.GetChar(++Index);
                }
            }

            while (!IsEof())
            {
                SkipWSOnly();
                char c = Code.GetChar(Index);
                if (c == '_')
                {
                    ++Index;
                    SkipWSOnly();
                    c = Code.GetChar(Index);
                    if (CharUtils.IsNewLine(c))
                    {
                        SkipNewline();
                    }
                    else
                    {
                        throw VBSyntaxError(VBSyntaxErrorCode.InvalidCharacter);
                    }
                }
                else
                {
                    break;
                }
            }
        }