示例#1
0
        private string[] ParseKeyedValues(VPPTextParser parser, string key)
        {
            parser.SetPosition(0);
            int defIndex;

            List <string> ret = new();

            while ((defIndex = parser.Seek(key)) != -1)
            {
                parser.Eat(key);
                parser.EatWhiteSpace();

                if (parser.Is('\"'))
                {
                    continue;
                }

                int pstart = parser.Eat('<');
                int end    = parser.EatUntil('>');
                parser.SetPosition(pstart + 1);

                ret.Add(parser.Get(end - pstart - 1));
                parser.Set(pstart, '\"');
                parser.Set(end, '\"');
            }

            return(ret.ToArray());
        }
示例#2
0
        private VPPMakro ParseFuncDefine(int start, string var, VPPTextParser parser)
        {
            parser.Eat('(');
            List <string> p = ParseList(parser, x => x.Is(')'));

            parser.Eat(')');

            parser.EatWhiteSpace();

            int pStart = parser.Eat('{');
            int end    = parser.FindClosing('{', '}');

            parser.SetPosition(pStart + 1);
            string block = parser.Get(end - pStart - 1).Trim();

            parser.SetPosition(start);
            parser.Remove(end + 1 - start);

            return(new VPPTextMakro(var, block, p.Select(x => new VPPMakroParameter {
                Name = x
            }).ToList()));
        }