Beispiel #1
0
 bool ExpectTerminal(Type t)
 {
     if (Expect(t))
     {
         CreateTerminalChild(previous);
         return(true);
     }
     return(false);
 }
Beispiel #2
0
 bool Accept(Type t)
 {
     if (current.Is(t))
     {
         Debug("Accepted " + t + " Content: " + current.Content);
         PC++;
         Debug(PC + "");
         return(true);
     }
     return(false);
 }
Beispiel #3
0
 bool Expect(Type t)
 {
     if (Accept(t))
     {
         return(true);
     }
     else
     {
         Error("Unexpected Token: " + current.Content + " expecting " + t.ToString());
     }
     return(false);
 }
Beispiel #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);
        }
    }
Beispiel #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);
        }
    }
    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);
        }
    }
Beispiel #7
0
 bool ExpectTerminal(Type t)
 {
     if (Expect (t)) {
         CreateTerminalChild (previous);
         return true;
     }
     return false;
 }
Beispiel #8
0
 bool Expect(Type t)
 {
     if (Accept (t)) {
         return true;
     } else {
         Error("Unexpected Token: " + current.Content + " expecting " + t.ToString());
     }
     return false;
 }
Beispiel #9
0
 bool Accept(Type t)
 {
     if (current.Is (t)) {
         Debug ("Accepted " + t + " Content: " + current.Content);
         PC++;
         Debug (PC + "");
         return true;
     }
     return false;
 }
 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;
     }
 }