diff options
author | June McEnroe <june@causal.agency> | 2020-12-29 17:13:26 -0500 |
---|---|---|
committer | June McEnroe <june@causal.agency> | 2020-12-29 17:13:26 -0500 |
commit | 321b5f4bc23174d4abacc951cdee45d4f6f5c97d (patch) | |
tree | 391fd89de41b139e38115c2f4cc9b21475725381 | |
parent | Match C type declarations as IdentifierTag (diff) | |
download | src-321b5f4bc23174d4abacc951cdee45d4f6f5c97d.tar.gz src-321b5f4bc23174d4abacc951cdee45d4f6f5c97d.zip |
Match top-level C definitions as IdentifierTag
Diffstat (limited to '')
-rw-r--r-- | bin/hilex/c.l | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/bin/hilex/c.l b/bin/hilex/c.l index 1eec5f31..f7370b01 100644 --- a/bin/hilex/c.l +++ b/bin/hilex/c.l @@ -30,6 +30,7 @@ width "*"|[0-9]+ %% static int pop = INITIAL; + static int braces = 0; [[:blank:]]+ { return Normal; } @@ -102,6 +103,11 @@ register|restrict|return|static|struct|switch|typedef|union|volatile|while | <MacroLine>{ident} { return Macro; } {ident} { return Identifier; } +{ident}/("["[^]]*"]")*[[:space:]]*"=" | +{ident}/"("[^)]*")"[[:space:]]*"{" { + return (!braces ? IdentifierTag : Identifier); +} + "//"([^\n]|"\\\n")* | "/*"([^*]|"*"[^/])*"*"+"/" { return Comment; @@ -147,6 +153,15 @@ register|restrict|return|static|struct|switch|typedef|union|volatile|while | [^%\\""]+|. { return String; } } +"{" { + braces++; + REJECT; +} +"}" { + braces--; + REJECT; +} + <MacroLine,MacroInclude,MacroDefine>. { return Macro; } .|\n { return Normal; } |