changing {} style to match majority of previous style

This commit is contained in:
Philippe Teuwen 2019-03-10 11:20:22 +01:00
commit 961d929f4d
320 changed files with 5502 additions and 10485 deletions

View file

@ -49,8 +49,7 @@ static const char *const luaX_tokens [] = {
static l_noret lexerror(LexState *ls, const char *msg, int token);
static void save(LexState *ls, int c)
{
static void save(LexState *ls, int c) {
Mbuffer *b = ls->buff;
if (luaZ_bufflen(b) + 1 > luaZ_sizebuffer(b)) {
size_t newsize;
@ -63,8 +62,7 @@ static void save(LexState *ls, int c)
}
void luaX_init(lua_State *L)
{
void luaX_init(lua_State *L) {
int i;
for (i = 0; i < NUM_RESERVED; i++) {
TString *ts = luaS_new(L, luaX_tokens[i]);
@ -74,8 +72,7 @@ void luaX_init(lua_State *L)
}
const char *luaX_token2str(LexState *ls, int token)
{
const char *luaX_token2str(LexState *ls, int token) {
if (token < FIRST_RESERVED) { /* single-byte symbols? */
lua_assert(token == cast(unsigned char, token));
return (lisprint(token)) ? luaO_pushfstring(ls->L, LUA_QL("%c"), token) :
@ -90,8 +87,7 @@ const char *luaX_token2str(LexState *ls, int token)
}
static const char *txtToken(LexState *ls, int token)
{
static const char *txtToken(LexState *ls, int token) {
switch (token) {
case TK_NAME:
case TK_STRING:
@ -104,8 +100,7 @@ static const char *txtToken(LexState *ls, int token)
}
static l_noret lexerror(LexState *ls, const char *msg, int token)
{
static l_noret lexerror(LexState *ls, const char *msg, int token) {
char buff[LUA_IDSIZE];
luaO_chunkid(buff, getstr(ls->source), LUA_IDSIZE);
msg = luaO_pushfstring(ls->L, "%s:%d: %s", buff, ls->linenumber, msg);
@ -115,8 +110,7 @@ static l_noret lexerror(LexState *ls, const char *msg, int token)
}
l_noret luaX_syntaxerror(LexState *ls, const char *msg)
{
l_noret luaX_syntaxerror(LexState *ls, const char *msg) {
lexerror(ls, msg, ls->t.token);
}
@ -126,8 +120,7 @@ l_noret luaX_syntaxerror(LexState *ls, const char *msg)
** it will not be collected until the end of the function's compilation
** (by that time it should be anchored in function's prototype)
*/
TString *luaX_newstring(LexState *ls, const char *str, size_t l)
{
TString *luaX_newstring(LexState *ls, const char *str, size_t l) {
lua_State *L = ls->L;
TValue *o; /* entry for `str' */
TString *ts = luaS_newlstr(L, str, l); /* create new string */
@ -148,8 +141,7 @@ TString *luaX_newstring(LexState *ls, const char *str, size_t l)
** increment line number and skips newline sequence (any of
** \n, \r, \n\r, or \r\n)
*/
static void inclinenumber(LexState *ls)
{
static void inclinenumber(LexState *ls) {
int old = ls->current;
lua_assert(currIsNewline(ls));
next(ls); /* skip `\n' or `\r' */
@ -161,8 +153,7 @@ static void inclinenumber(LexState *ls)
void luaX_setinput(lua_State *L, LexState *ls, ZIO *z, TString *source,
int firstchar)
{
int firstchar) {
ls->decpoint = '.';
ls->L = L;
ls->current = firstchar;
@ -187,8 +178,7 @@ void luaX_setinput(lua_State *L, LexState *ls, ZIO *z, TString *source,
static int check_next(LexState *ls, const char *set)
{
static int check_next(LexState *ls, const char *set) {
if (ls->current == '\0' || !strchr(set, ls->current))
return 0;
save_and_next(ls);
@ -199,8 +189,7 @@ static int check_next(LexState *ls, const char *set)
/*
** change all characters 'from' in buffer to 'to'
*/
static void buffreplace(LexState *ls, char from, char to)
{
static void buffreplace(LexState *ls, char from, char to) {
size_t n = luaZ_bufflen(ls->buff);
char *p = luaZ_buffer(ls->buff);
while (n--)
@ -221,8 +210,7 @@ static void buffreplace(LexState *ls, char from, char to)
** in case of format error, try to change decimal point separator to
** the one defined in the current locale and check again
*/
static void trydecpoint(LexState *ls, SemInfo *seminfo)
{
static void trydecpoint(LexState *ls, SemInfo *seminfo) {
char old = ls->decpoint;
ls->decpoint = getlocaledecpoint();
buffreplace(ls, old, ls->decpoint); /* try new decimal separator */
@ -239,8 +227,7 @@ static void trydecpoint(LexState *ls, SemInfo *seminfo)
** this function is quite liberal in what it accepts, as 'luaO_str2d'
** will reject ill-formed numerals.
*/
static void read_numeral(LexState *ls, SemInfo *seminfo)
{
static void read_numeral(LexState *ls, SemInfo *seminfo) {
const char *expo = "Ee";
int first = ls->current;
lua_assert(lisdigit(ls->current));
@ -265,8 +252,7 @@ static void read_numeral(LexState *ls, SemInfo *seminfo)
** skip a sequence '[=*[' or ']=*]' and return its number of '='s or
** -1 if sequence is malformed
*/
static int skip_sep(LexState *ls)
{
static int skip_sep(LexState *ls) {
int count = 0;
int s = ls->current;
lua_assert(s == '[' || s == ']');
@ -279,8 +265,7 @@ static int skip_sep(LexState *ls)
}
static void read_long_string(LexState *ls, SemInfo *seminfo, int sep)
{
static void read_long_string(LexState *ls, SemInfo *seminfo, int sep) {
save_and_next(ls); /* skip 2nd `[' */
if (currIsNewline(ls)) /* string starts with a newline? */
inclinenumber(ls); /* skip it */
@ -317,8 +302,7 @@ endloop:
}
static void escerror(LexState *ls, int *c, int n, const char *msg)
{
static void escerror(LexState *ls, int *c, int n, const char *msg) {
int i;
luaZ_resetbuffer(ls->buff); /* prepare error message */
save(ls, '\\');
@ -328,8 +312,7 @@ static void escerror(LexState *ls, int *c, int n, const char *msg)
}
static int readhexaesc(LexState *ls)
{
static int readhexaesc(LexState *ls) {
int c[3], i; /* keep input for error message */
int r = 0; /* result accumulator */
c[0] = 'x'; /* for error message */
@ -343,8 +326,7 @@ static int readhexaesc(LexState *ls)
}
static int readdecesc(LexState *ls)
{
static int readdecesc(LexState *ls) {
int c[3], i;
int r = 0; /* result accumulator */
for (i = 0; i < 3 && lisdigit(ls->current); i++) { /* read up to 3 digits */
@ -358,8 +340,7 @@ static int readdecesc(LexState *ls)
}
static void read_string(LexState *ls, int del, SemInfo *seminfo)
{
static void read_string(LexState *ls, int del, SemInfo *seminfo) {
save_and_next(ls); /* keep delimiter (for error messages) */
while (ls->current != del) {
switch (ls->current) {
@ -443,8 +424,7 @@ no_save:
}
static int llex(LexState *ls, SemInfo *seminfo)
{
static int llex(LexState *ls, SemInfo *seminfo) {
luaZ_resetbuffer(ls->buff);
for (;;) {
switch (ls->current) {
@ -567,8 +547,7 @@ static int llex(LexState *ls, SemInfo *seminfo)
}
void luaX_next(LexState *ls)
{
void luaX_next(LexState *ls) {
ls->lastline = ls->linenumber;
if (ls->lookahead.token != TK_EOS) { /* is there a look-ahead token? */
ls->t = ls->lookahead; /* use this one */
@ -578,8 +557,7 @@ void luaX_next(LexState *ls)
}
int luaX_lookahead(LexState *ls)
{
int luaX_lookahead(LexState *ls) {
lua_assert(ls->lookahead.token == TK_EOS);
ls->lookahead.token = llex(ls, &ls->lookahead.seminfo);
return ls->lookahead.token;