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

Function Expect

Source/SpireCore/Preprocessor.cpp:877–893  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

875}
876
877static bool Expect(PreprocessorDirectiveContext* context, CoreLib::Text::TokenType tokenType, DiagnosticInfo const& diagnostic, Token* outToken = NULL)
878{
879 if (PeekTokenType(context) != tokenType)
880 {
881 // Only report the first parse error within a directive
882 if (!context->parseError)
883 {
884 GetSink(context)->diagnose(PeekLoc(context), diagnostic, tokenType, GetDirectiveName(context));
885 context->parseError = true;
886 }
887 return false;
888 }
889 Token const& token = AdvanceToken(context);
890 if (outToken)
891 *outToken = token;
892 return true;
893}
894
895
896

Callers 5

HandleIncludeDirectiveFunction · 0.85
HandleDefineDirectiveFunction · 0.85
HandleUndefDirectiveFunction · 0.85
HandleLineDirectiveFunction · 0.85

Calls 5

PeekTokenTypeFunction · 0.85
GetSinkFunction · 0.85
PeekLocFunction · 0.85
AdvanceTokenFunction · 0.85
diagnoseMethod · 0.80

Tested by

no test coverage detected