示例#1
0
        // <Term> ::= <Factor> { <Action> } .
        private void ParseTerm()
        {
            ParseAction();

            _astBuilder.BeginTerm(_scanner.CurrentToken);

            ParseFactor();

            var factorStartTokens = new[]
            {
                TokenKind.Identifier, TokenKind.String, TokenKind.Action,
                TokenKind.LeftParen, TokenKind.LeftBracket, TokenKind.LeftBrace
            };

            while (factorStartTokens.Contains(_scanner.CurrentToken.TokenKind))
            {
                ParseFactor();
            }

            ParseAction();

            _astBuilder.EndTerm();
        }