public virtual void VisitShaderProperties(ShaderPropertiesSyntax node) { DefaultVisit(node); }
private ShaderSyntax ParseUnityShader() { var shaderKeyword = Match(SyntaxKind.ShaderKeyword); var nameToken = Match(SyntaxKind.StringLiteralToken); var openBraceToken = Match(SyntaxKind.OpenBraceToken); ShaderPropertiesSyntax properties = null; if (Current.Kind == SyntaxKind.PropertiesKeyword) { properties = ParseUnityShaderProperties(); } CgIncludeSyntax cgInclude = null; if (Current.Kind == SyntaxKind.CgIncludeKeyword) { cgInclude = ParseUnityCgInclude(); } var statements = new List <SyntaxNode>(); while (Current.Kind == SyntaxKind.SubShaderKeyword || Current.Kind == SyntaxKind.CategoryKeyword) { switch (Current.Kind) { case SyntaxKind.SubShaderKeyword: statements.Add(ParseUnitySubShader()); break; case SyntaxKind.CategoryKeyword: statements.Add(ParseUnityCategory()); break; } } var stateProperties = new List <CommandSyntax>(); var shouldContinue = true; while (shouldContinue && Current.Kind != SyntaxKind.CloseBraceToken) { switch (Current.Kind) { case SyntaxKind.FallbackKeyword: stateProperties.Add(ParseUnityFallback()); break; case SyntaxKind.CustomEditorKeyword: stateProperties.Add(ParseUnityCustomEditor()); break; case SyntaxKind.DependencyKeyword: stateProperties.Add(ParseUnityDependency()); break; default: shouldContinue = false; break; } } var closeBraceToken = Match(SyntaxKind.CloseBraceToken); return(new ShaderSyntax( shaderKeyword, nameToken, openBraceToken, properties, cgInclude, statements, stateProperties, closeBraceToken)); }