| 902 | } |
| 903 | |
| 904 | static RefPtr<Decl> ParseDeclWithModifiers( |
| 905 | Parser* parser, |
| 906 | ContainerDecl* containerDecl, |
| 907 | Modifiers const& modifiers ) |
| 908 | { |
| 909 | RefPtr<Decl> decl; |
| 910 | |
| 911 | // TODO: actual dispatch! |
| 912 | if (parser->LookAheadToken("shader") || parser->LookAheadToken("module")) |
| 913 | decl = parser->ParseShader(); |
| 914 | else if (parser->LookAheadToken("template")) |
| 915 | decl = parser->ParseTemplateShader(); |
| 916 | else if (parser->LookAheadToken("pipeline")) |
| 917 | decl = parser->ParsePipeline(); |
| 918 | else if (parser->LookAheadToken("struct")) |
| 919 | decl = parser->ParseStruct(); |
| 920 | else if (parser->LookAheadToken("typedef")) |
| 921 | decl = ParseTypeDef(parser); |
| 922 | else if (parser->LookAheadToken("using")) |
| 923 | decl = ParseUsing(parser); |
| 924 | else if (parser->LookAheadToken("world")) |
| 925 | decl = parser->ParseWorld(); |
| 926 | else if (parser->LookAheadToken("import")) |
| 927 | decl = parser->ParseImportOperator(); |
| 928 | else if (parser->LookAheadToken("stage")) |
| 929 | decl = parser->ParseStage(); |
| 930 | else if (parser->LookAheadToken("interface")) |
| 931 | decl = parser->ParseInterface(); |
| 932 | else if (AdvanceIf(parser, TokenType::Semicolon)) |
| 933 | { |
| 934 | // empty declaration |
| 935 | } |
| 936 | else |
| 937 | decl = ParseDeclaratorDecl(parser, containerDecl); |
| 938 | |
| 939 | if (decl) |
| 940 | { |
| 941 | decl->modifiers = modifiers; |
| 942 | if (containerDecl) |
| 943 | { |
| 944 | containerDecl->Members.Add(decl); |
| 945 | } |
| 946 | } |
| 947 | return decl; |
| 948 | } |
| 949 | |
| 950 | static RefPtr<Decl> ParseDecl( |
| 951 | Parser* parser, |
no test coverage detected