public static Expression Extract(SyntaxContext context, Expression expression) { if (expression.isFinally) { return(expression); } expression.Extract(context); if (context.isCutting) { context.isCutting = false; return(context.cuttingExp); } else if (expression.isBinder) { return(expression); } else { var ret = Wrapper(expression, context.NewUID()); context.Add(ret.Value); if (expression.type == Expression.Type.Call) { return(new UnpackExpression(ret.Key)); } else { return(ret.Key); } } }
public override void Extract(SyntaxContext context) { context = new SyntaxContext(context.parser, context.level + 1); foreach (var item in itemsList) { item.Extract(context); context.Add(item); } itemsList = context.list; }
public override void Extract(SyntaxContext context) { item1Exp = ParserHelper.Extract(context, item1Exp); var itemKey = context.NewUID(); var step1Item = ParserHelper.Wrapper(item1Exp, itemKey); var step2Item = ParserHelper.Wrapper(item2Exp, itemKey); var condExp = new IfElseExpression(item1Exp, step2Item.Value, step1Item.Value); context.Add(condExp); context.isCutting = true; context.cuttingExp = step1Item.Key; }