Beispiel #1
0
    } // Accept

    static void CDecls(IntSet followers)
    {
        // Cdecls = { DecList } EOF .
        if (FirstCdecls.Contains(sym.kind))
        {
            while (FirstDecList.Contains(sym.kind))
            {
                DecList(followers.Union(FollowDecList));
            }
            Accept(EOFSym, "EOF expected");
        }
        else
        {
            ReportError("Error occured in Production Rule: CDecls");
        }
    } // CDecls
Beispiel #2
0
    } // CDecls

    static void DecList(IntSet followers)
    {
        // DecList = Type OneDecl { "," OneDecl } ";" .
        Test(FirstDecList, followers, "Invalid start to DecList");

        if (FirstDecList.Contains(sym.kind))
        {
            Type(followers.Union(FollowType));
            OneDecl(followers.Union(FollowOneDecl));

            while (sym.kind == commaSym)
            {
                Accept(commaSym, ", expected");
                OneDecl(followers.Union(FollowOneDecl));
            }

            Accept(semiSym, "; expected");
            Test(followers, new IntSet(), "Invalid start after Declist");
        }
        else
        {
            ReportError("Invalid Type in Production Rule: DecList.");
        }
    }