Example #1
0
        public FunCall(Identitifer name, Token tok, Type type) : base(tok, type)
        {
            funcName = name ?? Identitifer.Match();
            if (Parser.current.tag_value == '^')
            {
                Parser.Match('^');
                isSystemFunction = true;
            }
            Parser.Match('[');
            returnType = Identitifer.Match();
            if (Parser.current.tag_value == '|')
            {
                Parser.Match('|');
                arguments.Add(Identitifer.Match());
                while (Parser.current.tag_value == ',')
                {
                    Parser.Match(',');
                    arguments.Add(Identitifer.Match());
                }
            }
            Parser.Match(']');
            Parser.Match('(');
            if (Parser.current.tag_value == Tag.ID)
            {
                value.Add(BoolTree.Match());
                while (Parser.current.tag_value == ',')
                {
                    Parser.Match(',');
                    value.Add(BoolTree.Match());
                }
            }

            Parser.Match(')');
        }
Example #2
0
 private Unary(Token tok, LogicNode expr) : base(tok, Type.Max(Type.Int, expr.type))
 {
     if (type == null)
     {
         Error("TypeError");
     }
     Expr = expr;
 }
Example #3
0
 public RightShift(Token tok, Type type) : base(tok, type)
 {
     Parser.Match('#');
     Parser.Match('>');
     Name = Identitifer.Match();
     Parser.Match('>');
     value = Parser.current.ToString();
     Parser.Match(Tag.INT);
 }
Example #4
0
        private Type Check(Type lft, Type rht)
        {
            switch (Op.tag_value)
            {
            case Tag.OR:
            case Tag.AND: return((lft == Type.Bool && rht == Type.Bool) ? Type.Bool : null);

            default: return(lft == rht ? Type.Bool : null);
            }
        }
Example #5
0
 protected LogicNode(Token tok, Type type)
 {
     Op        = tok;
     this.type = type;
 }
Example #6
0
 public Hex(Token tok, Type type) : base(tok, type)
 {
     Parser.Match('(');
     value = Identitifer.Match().ILValue;
     Parser.Match(')');
 }
Example #7
0
 public variable(Identitifer name, Token tok, Type type) : base(tok, type)
 {
     Name = name;
 }
Example #8
0
 private Factor(Token tok, Type type) : base(tok, type)
 {
 }