Beispiel #1
0
        private void ParsePass()
        {
            var pass = new Ast.Pass() {Span = currentToken.Span};

            // Get Pass name if any.
            var ident = NextToken();
            if (ident.Type == TokenType.Identifier)
            {
                pass.Name = ident.Value;
                NextToken();
            }

            if (!Expect(TokenType.LeftCurlyBrace))
                return;

            // Add the technique being parsed
            currentPass = pass;

            bool continueParsingTecnhique = true;
            bool isParseOk = false;
            do
            {
                var token = NextToken();
                switch (token.Type)
                {
                    case TokenType.Identifier:
                        if (!ParseStatement())
                            continueParsingTecnhique = false;
                        break;

                    case TokenType.RightCurlyBrace:
                        isParseOk = true;
                        continueParsingTecnhique = false;
                        break;

                    // fxc doesn't support empty statements, so we don't support them.
                    //case TokenType.SemiColon:
                    //    // Skip empty statements
                    //    break;

                    default:
                        Logger.Error("Unexpected token [{0}]. Expecting tokens ['identifier','}}']", currentToken.Span, currentToken);
                        continueParsingTecnhique = false;
                        break;
                }
            } while (continueParsingTecnhique);

            if (isParseOk)
                currentTechnique.Passes.Add(pass);
        }
Beispiel #2
0
        private void ParsePass()
        {
            var pass = new Ast.Pass()
            {
                Span = currentToken.Span
            };

            // Get Pass name if any.
            var ident = NextToken();

            if (ident.Type == TokenType.Identifier)
            {
                pass.Name = ident.Value;
                NextToken();
            }

            if (!Expect(TokenType.LeftCurlyBrace))
            {
                return;
            }

            // Add the technique being parsed
            currentPass = pass;

            bool continueParsingTecnhique = true;
            bool isParseOk = false;

            do
            {
                var token = NextToken();
                switch (token.Type)
                {
                case TokenType.Identifier:
                    if (!ParseStatement())
                    {
                        continueParsingTecnhique = false;
                    }
                    break;

                case TokenType.RightCurlyBrace:
                    isParseOk = true;
                    continueParsingTecnhique = false;
                    break;

                // fxc doesn't support empty statements, so we don't support them.
                //case TokenType.SemiColon:
                //    // Skip empty statements
                //    break;

                default:
                    Logger.Error("Unexpected token [{0}]. Expecting tokens ['identifier','}}']", currentToken.Span, currentToken);
                    continueParsingTecnhique = false;
                    break;
                }
            } while (continueParsingTecnhique);

            if (isParseOk)
            {
                currentTechnique.Passes.Add(pass);
            }
        }