private void ParseTechnique() { var technique = new Ast.Technique() { Span = currentToken.Span }; // Get Technique name if any. var ident = NextToken(); if (ident.Type == TokenType.Identifier) { technique.Name = ident.Value; NextToken(); } if (!Expect(TokenType.LeftCurlyBrace)) { return; } // Add the technique being parsed currentTechnique = technique; bool continueParsingTecnhique = true; bool isParseOk = false; do { var token = NextToken(); switch (token.Type) { case TokenType.Identifier: if (token.EqualString("pass")) { ParsePass(); } break; case TokenType.RightCurlyBrace: isParseOk = true; continueParsingTecnhique = false; break; default: Logger.Error("Unexpected token [{0}]. Expecting tokens ['pass','}}']", currentToken.Span, currentToken); continueParsingTecnhique = false; break; } } while (continueParsingTecnhique); if (isParseOk) { if (result.Shader == null) { result.Shader = new Ast.Shader(); } result.Shader.Techniques.Add(technique); } }
private void ParseTechnique() { var technique = new Ast.Technique() {Span = currentToken.Span}; // Get Technique name if any. var ident = NextToken(); if (ident.Type == TokenType.Identifier) { technique.Name = ident.Value; NextToken(); } if (!Expect(TokenType.LeftCurlyBrace)) return; // Add the technique being parsed currentTechnique = technique; bool continueParsingTecnhique = true; bool isParseOk = false; do { var token = NextToken(); switch (token.Type) { case TokenType.Identifier: if (token.EqualString("pass")) ParsePass(); break; case TokenType.RightCurlyBrace: isParseOk = true; continueParsingTecnhique = false; break; default: Logger.Error("Unexpected token [{0}]. Expecting tokens ['pass','}}']", currentToken.Span, currentToken); continueParsingTecnhique = false; break; } } while (continueParsingTecnhique); if (isParseOk) { if (result.Shader == null) result.Shader = new Ast.Shader(); result.Shader.Techniques.Add(technique); } }