예제 #1
0
 bool ExpectTerminal(Type t)
 {
     if (Expect(t))
     {
         CreateTerminalChild(previous);
         return(true);
     }
     return(false);
 }
예제 #2
0
 bool Accept(Type t)
 {
     if (current.Is(t))
     {
         Debug("Accepted " + t + " Content: " + current.Content);
         PC++;
         Debug(PC + "");
         return(true);
     }
     return(false);
 }
예제 #3
0
 bool Expect(Type t)
 {
     if (Accept(t))
     {
         return(true);
     }
     else
     {
         Error("Unexpected Token: " + current.Content + " expecting " + t.ToString());
     }
     return(false);
 }
예제 #4
0
    bool DataTypeSimple()
    {
        Type t = current.Type;

        if (t == Type.Number || t == Type.Boolean || t == Type.Text)
        {
            Debug("Is datatype");
            return(true);
        }
        else
        {
            return(false);
        }
    }
예제 #5
0
    bool DataType(bool Expect_Sub, out bool IsArray)     //, out YSToken TypeToken, out bool IsArray)
    {
        Debug("Checking if " + current.Type + " is a datatype");

        Type t = current.Type;

        if (DataTypeSimple())
        {
            PushParseNode(ParseNodeType.DataType);
            CreateTerminalChild(current);
            //TypeToken = current;
            PC++;
            IsArray = false;
            PopAndInsertParseNode();
            return(true);
        }
        else if (t == Type.Array)
        {
            PushParseNode(ParseNodeType.DataType);
            Accept(Type.Array);
            CreateTerminalChild(previous);
            Expect(Type.Of);
            if (!DataTypeSimple())
            {
                Error("Expecting a data type after array of");
            }
            CreateTerminalChild(current);
            //TypeToken = current;
            PC++;
            ArrayDimensions();
            IsArray = true;
            PopAndInsertParseNode();
            return(true);
        }
        else
        {
            if (Expect_Sub)
            {
                Error("Expecting a data type");
            }
            Debug("Not a datatype");
            //TypeToken = new YSToken (-1, YSToken.TokenType.None, "");
            IsArray = false;
            return(false);
        }
    }
예제 #6
0
    public IdentityType TranslateTokenTypeToIdentityType(Type current)
    {
        switch (current)
        {
        case Type.Number:
            return(IdentityType.Number);

        case Type.Text:
            return(IdentityType.Text);

        case Type.Boolean:
            return(IdentityType.Boolean);

        case Type.Structure:
            return(IdentityType.Structure);

        default:
            return(IdentityType.Unknown);
        }
    }
예제 #7
0
 bool ExpectTerminal(Type t)
 {
     if (Expect (t)) {
         CreateTerminalChild (previous);
         return true;
     }
     return false;
 }
예제 #8
0
 bool Expect(Type t)
 {
     if (Accept (t)) {
         return true;
     } else {
         Error("Unexpected Token: " + current.Content + " expecting " + t.ToString());
     }
     return false;
 }
예제 #9
0
 bool Accept(Type t)
 {
     if (current.Is (t)) {
         Debug ("Accepted " + t + " Content: " + current.Content);
         PC++;
         Debug (PC + "");
         return true;
     }
     return false;
 }
예제 #10
0
 public IdentityType TranslateTokenTypeToIdentityType(Type current)
 {
     switch (current) {
     case Type.Number:
         return IdentityType.Number;
     case Type.Text:
         return IdentityType.Text;
     case Type.Boolean:
         return IdentityType.Boolean;
     case Type.Structure:
         return IdentityType.Structure;
     default:
         return IdentityType.Unknown;
     }
 }