aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlemon <lsof@mailbox.org>2022-08-19 16:34:58 +0200
committerlemon <lsof@mailbox.org>2022-08-19 16:34:58 +0200
commit80f5dca7aa8c9a7f3bf467f9ae2bdc1eae0e9a2b (patch)
treeb23c31e3304e715c7bbdb43ded559e088484a193
parent57af02b91cb3a9eef66137c85aab7e47bdd7d0a5 (diff)
attrib
-rw-r--r--src/cffc.hff2
-rw-r--r--src/parse.cff13
2 files changed, 15 insertions, 0 deletions
diff --git a/src/cffc.hff b/src/cffc.hff
index 920f74a..9fd9080 100644
--- a/src/cffc.hff
+++ b/src/cffc.hff
@@ -288,6 +288,8 @@ struct Decl {
myenv *Env,
}
+def ATTR_LAX = 1u32;
+
struct ExpanArg {
name *const u8,
toks [#]Tok,
diff --git a/src/parse.cff b/src/parse.cff
index 2f5fbe2..3453485 100644
--- a/src/parse.cff
+++ b/src/parse.cff
@@ -2562,6 +2562,19 @@ fn parsedecls(P *Parser, loc Loc, yield DeclYielder, yarg *void, toplevel bool)
externp = #f,
name *const u8 = #null;
+ let attr u32 = 0;
+ if lexmatch(P, &tok, '#') {
+ lexexpect(P, '[');
+ while !lexmatch(P, #null, ']') {
+ let a = (tok = lexexpect(P, :ident)).u.ident;
+ if streq(a, "lax") {
+ attr |= ATTR_LAX;
+ } else {
+ err(P, tok.loc, "unknown attribute %qT", tok);
+ }
+ }
+ }
+
if lexmatch(P, &tok, :kw_extern) {
externp = #t;
if (tok = lexpeek(P)).t != :kw_fn and tok.t != :kw_static {