public override Verb CreateVerb(string[] tokens) { Color(position, length, IDEColor.EntityType.Structures); if (GetExpression(source, NextPosition, CloseParenthesis()).If(out var block, out var index)) { overridePosition = index; return(new Push(block)); } var shortLambdaParser = new ShortLambdaParser(""); if (shortLambdaParser.Scan(source, NextPosition)) { overridePosition = shortLambdaParser.Position; return(shortLambdaParser.Verb); } return(null); }
public static IMaybe <(Block, int)> GetExpression(string source, int index, Stop stop) { var parser = new ShortLambdaParser("", stop); return(maybe(parser.Scan(source, index), () => (parser.Lambda.Block, parser.Position))); }