MCPcopy Create free account
hub / github.com/RomanKubiak/ctrlr / statement

Function statement

Source/Misc/lua/src/lua.c:8847–8898  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8845
8846
8847static int statement (LexState *ls) {
8848int line = ls->linenumber; /* may be needed for error messages */
8849switch (ls->t.token) {
8850case TK_IF: { /* stat -> ifstat */
8851ifstat(ls, line);
8852return 0;
8853}
8854case TK_WHILE: { /* stat -> whilestat */
8855whilestat(ls, line);
8856return 0;
8857}
8858case TK_DO: { /* stat -> DO block END */
8859luaX_next(ls); /* skip DO */
8860block(ls);
8861check_match(ls, TK_END, TK_DO, line);
8862return 0;
8863}
8864case TK_FOR: { /* stat -> forstat */
8865forstat(ls, line);
8866return 0;
8867}
8868case TK_REPEAT: { /* stat -> repeatstat */
8869repeatstat(ls, line);
8870return 0;
8871}
8872case TK_FUNCTION: {
8873funcstat(ls, line); /* stat -> funcstat */
8874return 0;
8875}
8876case TK_LOCAL: { /* stat -> localstat */
8877luaX_next(ls); /* skip LOCAL */
8878if (testnext(ls, TK_FUNCTION)) /* local function? */
8879localfunc(ls);
8880else
8881localstat(ls);
8882return 0;
8883}
8884case TK_RETURN: { /* stat -> retstat */
8885retstat(ls);
8886return 1; /* must be last statement */
8887}
8888case TK_BREAK: { /* stat -> breakstat */
8889luaX_next(ls); /* skip BREAK */
8890breakstat(ls);
8891return 1; /* must be last statement */
8892}
8893default: {
8894exprstat(ls);
8895return 0; /* to avoid warnings */
8896}
8897}
8898}
8899
8900
8901static void chunk (LexState *ls) {

Callers 1

chunkFunction · 0.85

Calls 13

ifstatFunction · 0.85
whilestatFunction · 0.85
luaX_nextFunction · 0.85
blockFunction · 0.85
repeatstatFunction · 0.85
funcstatFunction · 0.85
testnextFunction · 0.85
localfuncFunction · 0.85
localstatFunction · 0.85
retstatFunction · 0.85
breakstatFunction · 0.85
exprstatFunction · 0.85

Tested by

no test coverage detected