MCPcopy Create free account
hub / github.com/csyonghe/Spire / ParseDeclWithModifiers

Function ParseDeclWithModifiers

Source/SpireCore/Parser.cpp:904–948  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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,

Callers 1

ParseDeclFunction · 0.85

Calls 14

ParseTypeDefFunction · 0.85
ParseUsingFunction · 0.85
AdvanceIfFunction · 0.85
ParseDeclaratorDeclFunction · 0.85
ParseShaderMethod · 0.80
ParseTemplateShaderMethod · 0.80
ParsePipelineMethod · 0.80
ParseStructMethod · 0.80
ParseWorldMethod · 0.80
ParseImportOperatorMethod · 0.80
ParseStageMethod · 0.80
ParseInterfaceMethod · 0.80

Tested by

no test coverage detected