public override bool Parse(SyntacticState state)
        {
            // this terminal consists of two lexical punctuators
            // and should be parsed in a special way
            if (state.InnerPosition + 1 >= state.InnerLength)
            {
                return(false);
            }

            LexicalEntry e1 = state.GetInner(state.InnerPosition);

            if (state.GetOuter(e1) != ">")
            {
                return(false);
            }

            LexicalEntry e2 = state.GetInner(state.InnerPosition + 1);

            if (state.GetOuter(e2) != ">=")
            {
                return(false);
            }

            if (e2.StartPosition != e1.StartPosition + 1)
            {
                return(false);
            }

            state.AddAbsolute(
                Key,
                state.InnerPosition + 2,
                state.OuterPosition + 3);

            return(true);
        }
示例#2
0
        public override bool Parse(SyntacticState state)
        {
            if (state.IsEndOfData)
            {
                return(false);
            }

            // ensure that identifier is captured
            LexicalEntry entry = state.GetInner(state.InnerPosition);

            if (entry.Key != Identifier.S.Key)
            {
                return(false);
            }

            // check that identifier consists only of specified letters
            string       checkOuter = state.GetOuter(entry);
            LexicalState checkState = new LexicalState(checkOuter);

            if (!m_check.ParseFull(checkState))
            {
                return(false);
            }

            state.AddAbsolute(
                Key,
                state.InnerPosition + 1,
                entry.EndPosition);

            return(true);
        }
        public override bool Parse(SyntacticState state)
        {
            if (state.IsEndOfData)
                return false;

            LexicalEntry entry = state.GetInner(state.InnerPosition);
            if (entry.Key != Identifier.S.Key)
                return false;

            // parse all identidiers except those
            // which are similar to LINQ keywords
            string name = state.GetOuter(entry);
            if (name == "ascending"
                || name == "by"
                || name == "descending"
                || name == "equals"
                || name == "from"
                || name == "group"
                || name == "in"
                || name == "into"
                || name == "join"
                || name == "let"
                || name == "on"
                || name == "orderby"
                || name == "select"
                || name == "where")
                return false;

            state.AddAbsolute(
                Key,
                state.InnerPosition + 1,
                entry.EndPosition);

            return true;
        }
        public override bool Parse(SyntacticState state)
        {
            // this terminal consists of two lexical punctuators
            // and should be parsed in a special way
            if (state.InnerPosition + 1 >= state.InnerLength)
                return false;

            LexicalEntry e1 = state.GetInner(state.InnerPosition);
            if (state.GetOuter(e1) != ">")
                return false;

            LexicalEntry e2 = state.GetInner(state.InnerPosition + 1);
            if (state.GetOuter(e2) != ">=")
                return false;

            if (e2.StartPosition != e1.StartPosition + 1)
                return false;

            state.AddAbsolute(
                Key,
                state.InnerPosition + 2,
                state.OuterPosition + 3);

            return true;
        }
示例#5
0
        /// <summary>
        /// Tries to parse an entity from the specified syntactic machine state.
        /// In case of success returns true and advances parsing position.
        /// </summary>
        public override bool Parse(SyntacticState state)
        {
            if (state.IsEndOfData)
                return false;

            LexicalEntry entry = state.GetInner(state.InnerPosition);
            if (entry.Key != m_item.Key)
                return false;

            state.AddAbsolute(
                Key,
                state.InnerPosition + 1,
                entry.EndPosition);

            return true;
        }
示例#6
0
        /// <summary>
        /// Tries to parse an entity from the specified syntactic machine state.
        /// In case of success returns true and advances parsing position.
        /// </summary>
        public override bool Parse(SyntacticState state)
        {
            if (state.IsEndOfData)
                return false;

            LexicalEntry entry = state.GetInner(state.InnerPosition);
            string text = state.GetOuter(entry);
            if (text != m_text)
                return false;

            state.AddAbsolute(
                Key,
                state.InnerPosition + 1,
                entry.EndPosition);

            return true;
        }
        public override bool Parse(SyntacticState state)
        {
            if (state.IsEndOfData)
            {
                return(false);
            }

            LexicalEntry entry = state.GetInner(state.InnerPosition);

            if (entry.Key != Identifier.S.Key)
            {
                return(false);
            }

            // parse all identidiers except those
            // which are similar to LINQ keywords
            string name = state.GetOuter(entry);

            if (name == "ascending" ||
                name == "by" ||
                name == "descending" ||
                name == "equals" ||
                name == "from" ||
                name == "group" ||
                name == "in" ||
                name == "into" ||
                name == "join" ||
                name == "let" ||
                name == "on" ||
                name == "orderby" ||
                name == "select" ||
                name == "where")
            {
                return(false);
            }

            state.AddAbsolute(
                Key,
                state.InnerPosition + 1,
                entry.EndPosition);

            return(true);
        }
示例#8
0
        public override bool Parse(SyntacticState state)
        {
            if (state.IsEndOfData)
                return false;

            // ensure that identifier is captured
            LexicalEntry entry = state.GetInner(state.InnerPosition);
            if (entry.Key != Identifier.S.Key)
                return false;

            // check that identifier consists only of specified letters
            string checkOuter = state.GetOuter(entry);
            LexicalState checkState = new LexicalState(checkOuter);
            if (!m_check.ParseFull(checkState))
                return false;

            state.AddAbsolute(
                Key,
                state.InnerPosition + 1,
                entry.EndPosition);

            return true;
        }