Example #1
0
        public ExpressionParser(Stop stop, bool asStatement)
        {
            this.stop        = stop;
            this.asStatement = asStatement;

            freeParser = new FreeParser();
        }
Example #2
0
 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();
 }
Example #3
0
 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();
 }
Example #4
0
        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);
        }
Example #5
0
        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();
 }
Example #7
0
 public ForParser()
     : base("^ /(|tabs| 'for') /b")
 {
     parser     = new FieldListParser();
     freeParser = new FreeParser();
 }
Example #8
0
 public MaybeParser() : base($"^ /(|tabs| 'maybe' /s*) /({REGEX_VARIABLE}) /(/s* '=' /s*)")
 {
     freeParser      = new FreeParser();
     endOfLineParser = new EndOfLineParser();
 }
Example #9
0
 public IterateParser() : base("^ /(|tabs| 'iterate') /b")
 {
     parser     = new FieldListParser();
     freeParser = new FreeParser();
 }
Example #10
0
 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();
 }
Example #13
0
 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();
 }