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; }
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); }
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); }
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)); }
public ContinueNode(Lexer.Position pos) : base(ExprType.Continue, pos) { }
public EmptyNode(Lexer.Position pos) : base(ExprType.Empty, pos) { }
public DeclareVarNode(IdentNode name, ExprNode value, Lexer.Position pos) : base(ExprType.DeclareVar, pos) { Ident = name; Value = value; }
public ReturnNode(ExprNode l, Lexer.Position pos) : base(ExprType.Return, pos) { RetValue = l; }
public DictGetNode(ExprNode l, ExprNode r, Lexer.Position pos) : base(l, r, ExprType.DictGet, pos) { }
public FuncNode(string name, ExprNode args, ExprNode body, Lexer.Position pos) : base(ExprType.Func, pos) { Name = name; Args = args; Body = body; }
public UndefinedNode(Lexer.Position pos) : base(ExprType.Undef, pos) { }
protected ObjectNode(ExprType t, Lexer.Position pos) : base(t, pos) { }
public IdentNode(string v, Lexer.Position pos) : base(ExprType.Ident, pos) { Val = v; }
protected ExprNode(ExprType t, Lexer.Position pos) { OpType = t; Pos = pos; }
public IfElseNode(ExprNode cond, ExprNode bodyIf, ExprNode bodyElse, Lexer.Position pos) : base(ExprType.IfElse, pos) { Cond = cond; If = bodyIf; Else = bodyElse; }
public TryCatchNode(ExprNode t, ExprNode c, string varName, Lexer.Position pos) : base(ExprType.TryCatch, pos) { Try = t; Catch = c; VarName = varName; }
public CommaNode(List <ExprNode> vals, Lexer.Position pos) : base(ExprType.Comma, pos) { Values = vals; }
public NullNode(Lexer.Position pos) : base(ExprType.Null, pos) { }
public ArrayNode(ExprNode vals, ExprNode length, Lexer.Position pos) : base(ExprType.NewArray, pos) { Content = vals; Length = length; }
protected NumberNode(ExprType t, Lexer.Position pos) : base(t, pos) { }
public CallNode(ExprNode l, ExprNode r, Lexer.Position pos) : base(l, r, ExprType.Call, pos) { }
public StringNode(string s, Lexer.Position pos) : base(ExprType.String, pos) { Str = s; }
public ThrowNode(ExprNode l, Lexer.Position pos) : base(ExprType.Throw, pos) { ThrowValue = l; }
public IntNode(long value, Lexer.Position pos) : base(ExprType.Int, pos) { Val = value; }
protected LRExprNode(ExprNode l, ExprNode r, ExprType t, Lexer.Position pos) : base(t, pos) { Left = l; Right = r; }
public FloatNode(float value, Lexer.Position pos) : base(ExprType.Float, pos) { Val = value; }
public BreakNode(Lexer.Position pos) : base(ExprType.Break, pos) { }
public DictNode(Dictionary <string, ExprNode> val, Lexer.Position pos) : base(ExprType.Dict, pos) { Values = val; }
public UnaryExprNode(ExprNode l, Lexer.TokenType op, Lexer.Position pos) : base(ExprType.Unary, pos) { Left = l; ArifmOp = op; }
public Sequence(List <ExprNode> v, Lexer.Position pos) : base(ExprType.Seq, pos) { Values = v; }