Example #1
0
        public override bool Scan(string[] tokens, int position, Replacer replacer)
        {
            var name = tokens[1];

            name = replacer.Replace(name);
            var type = tokens[2];

            type = replacer.Replace(type);
            var anyReference = Replacer.ResolveAsterisk(name);
            var key          = anyReference.Map(r => r.Key).DefaultTo(() => "");

            if (anyReference.If(out var reference))
            {
                name = reference.Name;
            }

            var rootParser = new RootParser(name, replacer, type, key);

            Result = rootParser.Parse(Source, position + 1);
            var index = rootParser.Position;

            overridePosition = (index + 1).Some();

            return(true);
        }
Example #2
0
        public ObjectGraph Parse(string configs = DEFAULT_CONFIGS)
        {
            var replacer = Duplicate(Replacer, source);

            Replacer            = replacer.Some();
            replacer["configs"] = configs;
            if (anyConfigFolder.If(out var configFolder))
            {
                replacer["config"] = configFolder;
            }

            var parsed = replacer.Parse();

            BaseParser.TabCount = -1;
            var rootParser  = new RootParser(GRAPH_ROOT, replacer);
            var lines       = preprocess(parsed, replacer);
            var objectGraph = rootParser.Parse(lines);

            setPath("", objectGraph);

            return(objectGraph);
        }