示例#1
0
    /// <summary>
    /// Function called when a <see cref="AssignBlock"/> block is read.
    /// Checks whether the assignment is to a variable or to an asset's attribute, and
    /// calls the corresponding functions that handle the assignment.
    /// Called by <see cref="INSTRUCTION"/>.
    /// </summary>
    void ASSIGNMENT()
    {
        Expect(32);        // set
        Expect(1);         // id
        string id = t.val;

        if (la.kind == 22) // '.'
        {
            try
            {
                QuadrupleManager.ReadAssetId(id);
                Get();
                ATTRIBUTE();                 // we don't need to verify the attribute as the UI forces the user to select a valid one
            }
            catch (Exception e) { SemErr(e.Message); }
        }
        else
        {
            try { QuadrupleManager.ReadIDVariable(id); }
            catch (Exception e) { SemErr(e.Message); }
        }

        Expect(33); // '='
        SUPER_EXP();

        try { QuadrupleManager.AssignEnd(); }
        catch (Exception e) { SemErr(e.Message); }
    }