示例#1
0
 public LoopNode(ExprNode init, ExprNode cond, ExprNode inc, ExprNode body, Lexer.Position pos) : base(ExprType.Loop, pos)
 {
     Init = init;
     Cond = cond;
     Inc  = inc;
     Body = body;
 }
示例#2
0
 AssignNode MakeDictAssign(DictGetNode n, ExprNode n1, Lexer.TokenType op, Lexer.Position pos)
 {
     if (op == Lexer.TokenType.TOK_ASSIGN)
     {
         return(new AsgDictNode(n.Left, n.Right, n1, pos));
     }
     switch (op)
     {
     case Lexer.TokenType.TOK_PLUS:
     case Lexer.TokenType.TOK_MINUS:
     case Lexer.TokenType.TOK_MUL:
     case Lexer.TokenType.TOK_DIV:
     case Lexer.TokenType.TOK_MOD:
     case Lexer.TokenType.TOK_SHL:
     case Lexer.TokenType.TOK_SHR:
     //case Lexer.TokenType.TOK_NOTAR:
     case Lexer.TokenType.TOK_AND:
     case Lexer.TokenType.TOK_OR:
     case Lexer.TokenType.TOK_XOR:
     case Lexer.TokenType.TOK_PLUSPLUS:
     case Lexer.TokenType.TOK_MINUSMINUS:
     case Lexer.TokenType.FTOK_PLUSPLUS_PREF:
     case Lexer.TokenType.FTOK_MINUSMINUS_PREF:
         return(new AsgArifmDictNode(n.Left, n.Right, n1, op, pos));
     }
     throw new ParserException("Can't assign to " + n.OpType, pos);
 }
示例#3
0
 AssignNode MakeAssign(ExprNode n, ExprNode n1, Lexer.TokenType op, Lexer.Position pos)
 {
     if (n.OpType == ExprType.Ident)
     {
         return(MakeIdentAssign(n as IdentNode, n1, op, pos));
     }
     else if (n.OpType == ExprType.DictGet)
     {
         return(MakeDictAssign(n as DictGetNode, n1, op, pos));
     }
     throw new ParserException("Can't assign to " + n.OpType, pos);
 }
示例#4
0
        ExprNode ParseComma(Func <ExprNode> ParseExpr)
        {
            List <ExprNode> list = null;
            var             n    = ParseExpr();

            Lexer.Position pos = Lexer.Describe();
            while (Lexer.Token == Lexer.TokenType.TOK_COMMA)
            {
                Lexer.NextToken();
                if (list == null)
                {
                    list = new List <ExprNode>();
                    list.Add(n);
                }
                var n1 = ParseExpr();
                list.Add(n1);
            }
            if (list == null)
            {
                return(n);
            }
            return(new CommaNode(list, pos));
        }
示例#5
0
 public ContinueNode(Lexer.Position pos) : base(ExprType.Continue, pos)
 {
 }
示例#6
0
 public EmptyNode(Lexer.Position pos) : base(ExprType.Empty, pos)
 {
 }
示例#7
0
 public DeclareVarNode(IdentNode name, ExprNode value, Lexer.Position pos) : base(ExprType.DeclareVar, pos)
 {
     Ident = name;
     Value = value;
 }
示例#8
0
 public ReturnNode(ExprNode l, Lexer.Position pos) : base(ExprType.Return, pos)
 {
     RetValue = l;
 }
示例#9
0
 public DictGetNode(ExprNode l, ExprNode r, Lexer.Position pos) : base(l, r, ExprType.DictGet, pos)
 {
 }
示例#10
0
 public FuncNode(string name, ExprNode args, ExprNode body, Lexer.Position pos) : base(ExprType.Func, pos)
 {
     Name = name;
     Args = args;
     Body = body;
 }
示例#11
0
 public UndefinedNode(Lexer.Position pos) : base(ExprType.Undef, pos)
 {
 }
示例#12
0
 protected ObjectNode(ExprType t, Lexer.Position pos) : base(t, pos)
 {
 }
示例#13
0
 public IdentNode(string v, Lexer.Position pos) : base(ExprType.Ident, pos)
 {
     Val = v;
 }
示例#14
0
 protected ExprNode(ExprType t, Lexer.Position pos)
 {
     OpType = t;
     Pos    = pos;
 }
示例#15
0
 public IfElseNode(ExprNode cond, ExprNode bodyIf, ExprNode bodyElse, Lexer.Position pos) : base(ExprType.IfElse, pos)
 {
     Cond = cond;
     If   = bodyIf;
     Else = bodyElse;
 }
示例#16
0
 public TryCatchNode(ExprNode t, ExprNode c, string varName, Lexer.Position pos) : base(ExprType.TryCatch, pos)
 {
     Try     = t;
     Catch   = c;
     VarName = varName;
 }
示例#17
0
 public CommaNode(List <ExprNode> vals, Lexer.Position pos) : base(ExprType.Comma, pos)
 {
     Values = vals;
 }
示例#18
0
 public NullNode(Lexer.Position pos) : base(ExprType.Null, pos)
 {
 }
示例#19
0
 public ArrayNode(ExprNode vals, ExprNode length, Lexer.Position pos) : base(ExprType.NewArray, pos)
 {
     Content = vals;
     Length  = length;
 }
示例#20
0
 protected NumberNode(ExprType t, Lexer.Position pos) : base(t, pos)
 {
 }
示例#21
0
 public CallNode(ExprNode l, ExprNode r, Lexer.Position pos) : base(l, r, ExprType.Call, pos)
 {
 }
示例#22
0
 public StringNode(string s, Lexer.Position pos) : base(ExprType.String, pos)
 {
     Str = s;
 }
示例#23
0
 public ThrowNode(ExprNode l, Lexer.Position pos) : base(ExprType.Throw, pos)
 {
     ThrowValue = l;
 }
示例#24
0
 public IntNode(long value, Lexer.Position pos) : base(ExprType.Int, pos)
 {
     Val = value;
 }
示例#25
0
 protected LRExprNode(ExprNode l, ExprNode r, ExprType t, Lexer.Position pos) : base(t, pos)
 {
     Left  = l;
     Right = r;
 }
示例#26
0
 public FloatNode(float value, Lexer.Position pos) : base(ExprType.Float, pos)
 {
     Val = value;
 }
示例#27
0
 public BreakNode(Lexer.Position pos) : base(ExprType.Break, pos)
 {
 }
示例#28
0
 public DictNode(Dictionary <string, ExprNode> val, Lexer.Position pos) : base(ExprType.Dict, pos)
 {
     Values = val;
 }
示例#29
0
 public UnaryExprNode(ExprNode l, Lexer.TokenType op, Lexer.Position pos) : base(ExprType.Unary, pos)
 {
     Left    = l;
     ArifmOp = op;
 }
示例#30
0
 public Sequence(List <ExprNode> v, Lexer.Position pos) : base(ExprType.Seq, pos)
 {
     Values = v;
 }