MCPcopy Create free account
hub / github.com/KhronosGroup/glslang / extraTokenCheck

Method extraTokenCheck

glslang/MachineIndependent/preprocessor/Pp.cpp:365–394  ·  view source on GitHub ↗

Call when there should be no more tokens left on a line.

Source from the content-addressed store, hash-verified

363
364// Call when there should be no more tokens left on a line.
365int TPpContext::extraTokenCheck(int contextAtom, TPpToken* ppToken, int token)
366{
367 if (token != '\n' && token != EndOfInput) {
368 static const char* message = "unexpected tokens following directive";
369
370 const char* label;
371 if (contextAtom == PpAtomElse)
372 label = "#else";
373 else if (contextAtom == PpAtomElif)
374 label = "#elif";
375 else if (contextAtom == PpAtomEndif)
376 label = "#endif";
377 else if (contextAtom == PpAtomIf)
378 label = "#if";
379 else if (contextAtom == PpAtomLine)
380 label = "#line";
381 else
382 label = "";
383
384 if (parseContext.relaxedErrors())
385 parseContext.ppWarn(ppToken->loc, message, label, "");
386 else
387 parseContext.ppError(ppToken->loc, message, label, "");
388
389 while (token != '\n' && token != EndOfInput)
390 token = scanToken(ppToken);
391 }
392
393 return token;
394}
395
396enum eval_prec {
397 MIN_PRECEDENCE,

Callers

nothing calls this directly

Calls 3

relaxedErrorsMethod · 0.80
ppWarnMethod · 0.80
ppErrorMethod · 0.80

Tested by

no test coverage detected