Пример #1
0
        private TPath Primary()
        {
            if (this.LookMatch(0, TokenType.BAREKEY))
            {
                return(new TPathKey(this.Consume(TokenType.BAREKEY).Text, this.currentLine));
            }

            if (this.Match(TokenType.LBRACKET))
            {
                var index = Int32.Parse(this.Consume(TokenType.BAREKEY).Text);
                this.Match(TokenType.RBRACKET);

                return(new TPathIndex(null, index));
            }

            if (this.Match(TokenType.STAR))
            {
                TPath result = new TPathAllValues();
                while (this.Match(TokenType.STAR))
                {
                    result = new TPathDot(result, new TPathAllValues());
                }

                return(result);
            }

            throw new Exception();
        }
Пример #2
0
        private TPath Dot()
        {
            var result = Index();

            while (this.Match(TokenType.DOT))
            {
                result = new TPathDot(result, this.Dot());
            }

            return(result);
        }