public SendMessageParser(bool useBlockOrLambda, string pattern = REGEX_SEND_MESSAGE) : base(pattern) { this.useBlockOrLambda = useBlockOrLambda; blockOrLambdaParser = new BlockOrLambdaParser(); extraMessageWordParser = new ExtraMessageWordParser(); }
public override Verb CreateVerb(string[] tokens) { var functionName = tokens[2]; Color(position, tokens[1].Length, Whitespaces); Color(functionName.Length, IsClassName(functionName) ? Types : Invokeables); Color(tokens[3].Length, Structures); Color(tokens[4].Length, Whitespaces); if (GetExpression(source, NextPosition, CloseParenthesis()) is Some <(Block, int)> some) { (var block, var index) = some.Value; var arguments = new Arguments(block); var blockOrLambdaParser = new BlockOrLambdaParser(); if (blockOrLambdaParser.Scan(source, index)) { index = blockOrLambdaParser.Position; var value = blockOrLambdaParser.Value; arguments.AddArgument(value); } overridePosition = index; return(new FunctionInvoke(functionName, arguments)); } return(null); }
public ExtraMessageWordParser() { matcher = new Matcher(); blockParser = new BlockOrLambdaParser(); }
public SimpleSendMessageParser(BlockOrLambdaParser blockOrLambdaParser) : base($"^ /(/s* '.') /({REGEX_VARIABLE}) /('(')?") => this.blockOrLambdaParser = blockOrLambdaParser;