Exemplo n.º 1
0
        //関数定義内解析
        private List <Token> _ANA_Function_ReadBlock(string subBlockName)
        {
            var ana  = new TextAnalyzer(src, subBlockName, position, 1);
            var subs = new List <Token>();

            while (true)
            {
                Token t = ana.Next();
                if (t == null)
                {
                    throw new KarinException("ブロックが閉じられていません。");
                }
                if (t.Type == TokenType.Other && t.Text == "}")
                {
                    break;
                }
                subs.Add(t);
            }
            position = ana.position;
            line    += ana.line - 1;
            return(subs);
        }
Exemplo n.º 2
0
        //関数引数解析
        private List <Token>[] _ANA_Function_ReadArgs()
        {
            var args = new List <List <Token> >();

            while (true)
            {
                var   ana = new TextAnalyzer(src, BlockName, position, line);
                var   arg = new List <Token>();
                Token t;

                while (true)
                {
                    t = ana.Next();
                    if (t == null)
                    {
                        throw new KarinException("引数が閉じられていません。");
                    }
                    if (t.Type == TokenType.Other && (t.Text == "," || t.Text == "]"))
                    {
                        break;
                    }
                    arg.Add(t);
                }
                position = ana.position;
                //line += ana.line-1;
                line = ana.line;

                args.Add(arg);

                if (t.Text == "]")
                {
                    break;
                }
            }
            return(args.ToArray());
        }