Ejemplo n.º 1
0
 public InitializedVariableParser()
     : base(@"^(\s*)" + Runtime.REGEX_CLASS_MEMBER + "(" + Runtime.REGEX_VARIABLE + @")(\s*=\s*)")
 {
     parsers = new List <Parser>
     {
         new HexParser(),
         new BinParser(),
         new OctParser(),
         //new BooleanParser(),
         new FloatParser(),
         new IntegerParser(),
         new StringParser(),
         new InterpolatedStringParser(),
         new ArrayLiteralParser(),
         new DateParser(),
         new ParameterParser(true),
         new SpecialValueParser(),
         new SymbolParser(),
         new BlockParser(),
         new PatternParser(),
         new FormatLiteralParser()
     };
     matcher           = new Matcher();
     multiMethodParser = new MultiMethodParser();
 }
Ejemplo n.º 2
0
 public SingleLineMethodParser()
     : base(@"^(\s*)" + Runtime.REGEX_CLASS_MEMBER + "(" + Runtime.REGEX_VARIABLE + @")(\()")
 {
     functionBodyParser = new FunctionBodyParser();
     equalBlockParser   = new EqualBlockParser();
     multiMethodParser  = new MultiMethodParser();
 }
Ejemplo n.º 3
0
        public override Verb CreateVerb(string[] tokens)
        {
            Color(position, tokens[1].Length, IDEColor.EntityType.Whitespace);
            string visibility = tokens[2];

            Color(visibility.Length, IDEColor.EntityType.Verb);
            string scope = tokens[3];

            Color(scope.Length, IDEColor.EntityType.Verb);
            ClassParser.SetScopeAndVisibility(scope, visibility, this);
            string messageName = tokens[4];

            Color(messageName.Length, IDEColor.EntityType.Variable);
            Color(tokens[5].Length, IDEColor.EntityType.Verb);

            if (closureParser.Scan(source, position + length))
            {
                var closure           = (Closure)closureParser.Result.Value;
                int parserPosition    = closureParser.Result.Position;
                var multiMethodParser = new MultiMethodParser();
                if (multiMethodParser.Scan(source, parserPosition))
                {
                    var block = (Block)multiMethodParser.Result.Value;
                    Builder.AddMultiMethod(messageName, closure, block, this);
                    overridePosition = multiMethodParser.Result.Position;
                }
                else
                {
                    Builder.AddMethod(messageName, closure, this);
                    overridePosition = parserPosition;
                }
                return(new NullOp());
            }
            if (parameterParser.Scan(source, position + length))
            {
                var closure = parameterParser.Result.Value as Closure;
                if (closure == null)
                {
                    return(null);
                }
                var multiMethodParser = new MultiMethodParser();
                int parserPosition    = parameterParser.Result.Position;
                if (multiMethodParser.Scan(source, parserPosition))
                {
                    var block = (Block)multiMethodParser.Result.Value;
                    Builder.AddMultiMethod(messageName, closure, block, this);
                    overridePosition = multiMethodParser.Result.Position;
                }
                else
                {
                    Builder.AddMethod(messageName, closure, this);
                    overridePosition = parserPosition;
                }
                return(new NullOp());
            }
            return(null);
        }