public ExpressionParser(Stop stop, bool asStatement) { this.stop = stop; this.asStatement = asStatement; freeParser = new FreeParser(); }
public ShortLambdaParser(string prefix, Stop stop = null) : base($"^ /(' '*) /'{prefix}'") { valueParser = new FillInValueParser(); operatorParser = new InfixOperatorParser(); sendMessageParser = new SendMessageParser(false); freeParser = new FreeParser(); this.stop = stop ?? CloseParenthesis(); }
public CurriedFunctionParser(string functionName, Parameters firstParameters, Object.VisibilityType visibility, bool overriding) : base("^ /(|sp| '(')") { this.functionName = functionName; this.firstParameters = firstParameters; this.visibility = visibility; this.overriding = overriding; parametersParser = new ParametersParser(); freeParser = new FreeParser(); functionBodyParser = new FunctionBodyParser(); }
public static IMaybe <(Block block, int position)> GetOneOrMultipleBlock(string source, int index, string stopPattern = " ^ /s * ':' /s+") { var parser = new FreeParser(); if (parser.Scan(source, index, "^ ' '* 'then' /b")) { return(none <(Block, int)>()); } if (parser.Scan(source, index, stopPattern)) { parser.ColorAll(Structures); return(OneLineStatement(source, parser.Position)); } var oneOrMultipleBlock = GetBlock(source, index, true); oneOrMultipleBlock.Must().HaveValue().OrThrow(); return(oneOrMultipleBlock); }
public static IMaybe <(Block, int)> GetOneOrMultipleBlock(string source, int index, string stopPattern = " ^ /s * ':' /s+") { var parser = new FreeParser(); if (parser.Scan(source, index, "^ ' '* 'then' /b")) { return(none <(Block, int)>()); } if (parser.Scan(source, index, stopPattern)) { parser.ColorAll(Structures); return(OneLineStatement(source, parser.Position)); } var oneOrMultipleBlock = GetBlock(source, index, true); Assert(oneOrMultipleBlock.IsSome, "Statement parser", "Couldn't determine block"); return(oneOrMultipleBlock); }
public IndexedGetterSetterParser() : base($"^ /(' '* '.')? /({REGEX_VARIABLE}) '['") { freeParser = new FreeParser(); }
public ForParser() : base("^ /(|tabs| 'for') /b") { parser = new FieldListParser(); freeParser = new FreeParser(); }
public MaybeParser() : base($"^ /(|tabs| 'maybe' /s*) /({REGEX_VARIABLE}) /(/s* '=' /s*)") { freeParser = new FreeParser(); endOfLineParser = new EndOfLineParser(); }
public IterateParser() : base("^ /(|tabs| 'iterate') /b") { parser = new FieldListParser(); freeParser = new FreeParser(); }
public ArraySubComprehensionParser() : base($"^ ' '* /({REGEX_VARIABLE})") { fieldListParser = new FieldListParser(); freeParser = new FreeParser(); }
public ArrayComprehensionParser() : base("^ /(' '* '(') /'for' /b") { arraySubComprehensionParser = new ArraySubComprehensionParser(); freeParser = new FreeParser(); }
public InnerComprehensionParser() : base($"^ |sp| /({REGEX_VARIABLE})") { fieldListParser = new FieldListParser(); freeParser = new FreeParser(); }
public SignatureParser(bool tabs) : base($"^ /(|{(tabs ? "tabs" : "sp")}|) /(('req' | 'optional') /s+) /(('func' | 'get' | 'set' |" + $" 'before' | 'after' | 'require' | 'ensure' | 'invariant') /s+) /({REGEX_VARIABLE}) /(['(:'])") { freeParser = new FreeParser(); }