public static FuncCall TryParse(Expression expr, ref Source s) //TODO: funccall(Expr e, Expr[] args) { FuncCall res = null; Source tempSource = s.Clone(); ArgumentsFact tempArgs = ArgumentsFact.TryParse(ref tempSource); if (tempArgs == null) { //s.Rollback(); return(null); } s.currentPos = tempSource.currentPos; s.Save(); res = new FuncCall(expr); res.argsList = tempArgs; return(res); }
public static Value TryParse(ref Source s) { Value res = null; Null tempNull = Null.TryParse(ref s); if (tempNull != null) { res = tempNull; } Number tempNum = Number.TryParse(ref s); if (tempNum != null) { res = tempNum; } Bool tempBool = Bool.TryParse(ref s); if (tempBool != null) { res = tempBool; } FuncValue tempFunc = FuncValue.TryParse(ref s); if (tempFunc != null) { res = tempFunc; } Variable tempVar = Variable.TryParse(ref s); if (tempVar != null) { res = tempVar; } if (res != null) { res.argsList = ArgumentsFact.TryParse(ref s); //if (res.args != null && res.nodeType != ExprNodeType.Function) // return null; } return(res); }