mirror of
https://github.com/LuaJIT/LuaJIT.git
synced 2025-02-07 23:24:09 +00:00
FFI: Parse #line NN and #NN.
This commit is contained in:
parent
39eddd3b96
commit
89982b7849
@ -1744,6 +1744,16 @@ static void cp_pragma(CPState *cp, BCLine pragmaline)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Handle line number. */
|
||||||
|
static void cp_line(CPState *cp, BCLine hashline)
|
||||||
|
{
|
||||||
|
BCLine newline = cp->val.u32;
|
||||||
|
/* TODO: Handle file name and include it in error messages. */
|
||||||
|
while (cp->tok != CTOK_EOF && cp->linenumber == hashline)
|
||||||
|
cp_next(cp);
|
||||||
|
cp->linenumber = newline;
|
||||||
|
}
|
||||||
|
|
||||||
/* Parse multiple C declarations of types or extern identifiers. */
|
/* Parse multiple C declarations of types or extern identifiers. */
|
||||||
static void cp_decl_multi(CPState *cp)
|
static void cp_decl_multi(CPState *cp)
|
||||||
{
|
{
|
||||||
@ -1756,12 +1766,23 @@ static void cp_decl_multi(CPState *cp)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (cp->tok == '#') { /* Workaround, since we have no preprocessor, yet. */
|
if (cp->tok == '#') { /* Workaround, since we have no preprocessor, yet. */
|
||||||
BCLine pragmaline = cp->linenumber;
|
BCLine hashline = cp->linenumber;
|
||||||
if (!(cp_next(cp) == CTOK_IDENT &&
|
CPToken tok = cp_next(cp);
|
||||||
cp->str->hash == H_(f5e6b4f8,1d509107))) /* pragma */
|
if (tok == CTOK_INTEGER) {
|
||||||
cp_errmsg(cp, cp->tok, LJ_ERR_XSYMBOL);
|
cp_line(cp, hashline);
|
||||||
cp_pragma(cp, pragmaline);
|
|
||||||
continue;
|
continue;
|
||||||
|
} else if (tok == CTOK_IDENT &&
|
||||||
|
cp->str->hash == H_(187aab88,fcb60b42)) { /* line */
|
||||||
|
if (cp_next(cp) != CTOK_INTEGER) cp_err_token(cp, tok);
|
||||||
|
cp_line(cp, hashline);
|
||||||
|
continue;
|
||||||
|
} else if (tok == CTOK_IDENT &&
|
||||||
|
cp->str->hash == H_(f5e6b4f8,1d509107)) { /* pragma */
|
||||||
|
cp_pragma(cp, hashline);
|
||||||
|
continue;
|
||||||
|
} else {
|
||||||
|
cp_errmsg(cp, cp->tok, LJ_ERR_XSYMBOL);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
scl = cp_decl_spec(cp, &decl, CDF_TYPEDEF|CDF_EXTERN|CDF_STATIC);
|
scl = cp_decl_spec(cp, &decl, CDF_TYPEDEF|CDF_EXTERN|CDF_STATIC);
|
||||||
if ((cp->tok == ';' || cp->tok == CTOK_EOF) &&
|
if ((cp->tok == ';' || cp->tok == CTOK_EOF) &&
|
||||||
|
Loading…
Reference in New Issue
Block a user