diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2025-05-15 12:43:37 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2025-05-15 12:43:37 -0300 |
| commit | 3fb7a77731e6140674a6b13b73979256bfb95ce3 (patch) | |
| tree | e877e7bb99ac7d2d6c7bf6a9c7c94948f0ddaf65 /llex.c | |
| parent | fded0b4a844990b1a6d0cda1aba25df33eb5f46f (diff) | |
| download | lua-3fb7a77731e6140674a6b13b73979256bfb95ce3.tar.gz lua-3fb7a77731e6140674a6b13b73979256bfb95ce3.tar.bz2 lua-3fb7a77731e6140674a6b13b73979256bfb95ce3.zip | |
Internalized string "break" kept by the parser
The parser uses "break" as fake label to compile "break" as "goto
break". To avoid producing this string at each use, it keeps it
available in its state.
Diffstat (limited to 'llex.c')
| -rw-r--r-- | llex.c | 3 |
1 files changed, 3 insertions, 0 deletions
| @@ -190,6 +190,9 @@ void luaX_setinput (lua_State *L, LexState *ls, ZIO *z, TString *source, | |||
| 190 | ls->lastline = 1; | 190 | ls->lastline = 1; |
| 191 | ls->source = source; | 191 | ls->source = source; |
| 192 | ls->envn = luaS_newliteral(L, LUA_ENV); /* get env name */ | 192 | ls->envn = luaS_newliteral(L, LUA_ENV); /* get env name */ |
| 193 | ls->brkn = luaS_newliteral(L, "break"); /* get "break" name */ | ||
| 194 | /* "break" cannot be collected, as it is a reserved word" */ | ||
| 195 | lua_assert(isreserved(ls->brkn)); | ||
| 193 | luaZ_resizebuffer(ls->L, ls->buff, LUA_MINBUFFER); /* initialize buffer */ | 196 | luaZ_resizebuffer(ls->L, ls->buff, LUA_MINBUFFER); /* initialize buffer */ |
| 194 | } | 197 | } |
| 195 | 198 | ||
