Ejemplo n.º 1
0
        private static bool CheckZeroOneWholeLine(LineObject lineObject, bool printFlag, CheckSt st, LexRecord lexObj,
                                                  CheckObject checkObject, UpdateLex updateLex)

        {
            bool flag = checkObject.IsNextStartStr(lineObject.GetLine());

            if (flag == true)

            {
                st.UpdateCurState(checkObject.GetNextState());
                lineObject.SetGoToNext(false);
                return(flag);
            }

            if (st.GetCurState() != st.GetLastState())

            {
                st.UpdateLastState();
                flag = CheckOneWholeLine(lineObject, printFlag, st, lexObj, checkObject, updateLex);
            }
            else

            {
                string line = lineObject.GetLine();
                st.UpdateLastState();
                ErrMsg.PrintErrMsg(printFlag, 82, lineObject, line, 0, line.Length, checkObject.IsTab());
            }

            return(flag);
        }
Ejemplo n.º 2
0
        private static bool CheckZeroMany(LineObject lineObject, bool printFlag, CheckSt st, LexRecord lexObj,
                                          CheckObject checkObject, UpdateLex updateLex, bool checkLength)

        {
            lineObject.SetGoToNext(true);
            st.UpdateLastState();

            bool flag = checkObject.IsNextStartStr(lineObject.GetLine());

            if (flag == true)

            {
                st.UpdateCurState(checkObject.GetNextState());
                lineObject.SetGoToNext(false);
                return(flag);
            }

            flag = LineCheck.CheckStartStr(lineObject, printFlag, checkObject);
            if (flag == true)

            {
                TokenObject tokenObject = new TokenObject();

                flag = LineCheck.CheckSlotFiller(lineObject, printFlag, checkObject, tokenObject, checkLength);


                if (flag == true)

                {
                    updateLex.Update(lexObj, tokenObject.GetToken());
                }
            }

            return(flag);
        }
Ejemplo n.º 3
0
        public static bool Check(LineObject lineObject, bool printFlag, CheckSt st, LexRecord lexObj,
                                 CheckObject checkObject, UpdateLex updateLex, int frequency, bool checkLength)

        {
            bool flag = false;

            switch (frequency)

            {
            case 1:
                flag = CheckOne(lineObject, printFlag, st, lexObj, checkObject, updateLex, checkLength, true);

                break;

            case 2:
                flag = CheckZeroOne(lineObject, printFlag, st, lexObj, checkObject, updateLex, checkLength);

                break;

            case 3:
                flag = CheckZeroMany(lineObject, printFlag, st, lexObj, checkObject, updateLex, checkLength);

                break;

            case 4:
                flag = CheckOneMany(lineObject, printFlag, st, lexObj, checkObject, updateLex, checkLength);

                break;

            case 5:
                flag = CheckOneWholeLine(lineObject, printFlag, st, lexObj, checkObject, updateLex);

                break;

            case 6:
                flag = CheckZeroOneWholeLine(lineObject, printFlag, st, lexObj, checkObject, updateLex);
                break;
            }


            return(flag);
        }
Ejemplo n.º 4
0
        private static bool CheckOneMany(LineObject lineObject, bool printFlag, CheckSt st, LexRecord lexObj,
                                         CheckObject checkObject, UpdateLex updateLex, bool checkLength)

        {
            bool flag = false;

            if (st.GetCurState() != st.GetLastState())

            {
                st.UpdateLastState();
                flag = CheckOne(lineObject, printFlag, st, lexObj, checkObject, updateLex, checkLength, false);
            }
            else

            {
                st.UpdateLastState();
                flag = CheckZeroMany(lineObject, printFlag, st, lexObj, checkObject, updateLex, checkLength);
            }

            return(flag);
        }
Ejemplo n.º 5
0
        private static bool CheckOneWholeLine(LineObject lineObject, bool printFlag, CheckSt st, LexRecord lexObj,
                                              CheckObject checkObject, UpdateLex updateLex)

        {
            lineObject.SetGoToNext(true);

            bool flag = LineCheck.CheckWholeLine(lineObject, printFlag, checkObject);


            if (flag == true)

            {
                st.UpdateLastState();
                st.UpdateCurState(checkObject.GetNextState());

                if (updateLex != null)

                {
                    updateLex.Update(lexObj, lineObject.GetLine());
                }
            }

            return(flag);
        }