From 80f5dca7aa8c9a7f3bf467f9ae2bdc1eae0e9a2b Mon Sep 17 00:00:00 2001 From: lemon Date: Fri, 19 Aug 2022 16:34:58 +0200 Subject: attrib --- src/cffc.hff | 2 ++ src/parse.cff | 13 +++++++++++++ 2 files changed, 15 insertions(+) (limited to 'src') 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 { -- cgit v1.2.3