From 43fad502979651e9a11cd90f8508564c42ceab28 Mon Sep 17 00:00:00 2001 From: "C. McEnroe" Date: Tue, 29 Dec 2020 15:05:39 -0500 Subject: Match function-like macro definitions as IdentifierTag --- bin/hilex/c.l | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) (limited to 'bin') diff --git a/bin/hilex/c.l b/bin/hilex/c.l index c0bd516d..29988c3f 100644 --- a/bin/hilex/c.l +++ b/bin/hilex/c.l @@ -21,7 +21,7 @@ #include "hilex.h" %} -%s MacroLine MacroInclude +%s MacroLine MacroInclude MacroDefine %x CharLiteral StringLiteral ident [_[:alpha:]][_[:alnum:]]* @@ -36,6 +36,10 @@ width "*"|[0-9]+ BEGIN(pop = MacroInclude); return Macro; } +^"#"[[:blank:]]*"define" { + BEGIN(pop = MacroDefine); + return Macro; +} ^[#%][[:blank:]]*{ident} { BEGIN(pop = MacroLine); return Macro; @@ -43,7 +47,18 @@ width "*"|[0-9]+ "<"[^>]+">" { return String; } -{ +{ + {ident}/"(" { + BEGIN(pop = MacroLine); + return IdentifierTag; + } + {ident} { + BEGIN(pop = MacroLine); + return Macro; + } +} + +{ "\n" { BEGIN(pop = INITIAL); return Normal; @@ -70,7 +85,7 @@ register|restrict|return|static|struct|switch|typedef|union|volatile|while | return Keyword; } -{ident} { return Macro; } +{ident} { return Macro; } {ident} { return Identifier; } "//"([^\n]|"\\\n")* | @@ -118,7 +133,7 @@ register|restrict|return|static|struct|switch|typedef|union|volatile|while | [^%\\""]+|. { return String; } } -. { return Macro; } +. { return Macro; } .|\n { return Normal; } -- cgit 1.4.1 n>
Commit message (Expand)Author
2025-12-26Update list of gearJune McEnroe
2025-12-26Add ability to specify chemistryJune McEnroe
2025-12-22Expand regular expressionJune McEnroe
2025-12-22Let -n prevent postingJune McEnroe
2025-12-22Dehtml pronoun fieldsJune McEnroe
2025-12-10Add Rose/HouseJune McEnroe
2025-11-19Bilingualize pronouns regexJune McEnroe
2025-11-19Hardcode a follower IDJune McEnroe
2025-11-18Add pronouns bot scriptJune McEnroe
2025-08-27Update DESCRIPTION of myselfJune McEnroe
2025-08-18Publish "time"June McEnroe
2025-08-18Add a bunch of film roll metadataJune McEnroe
2025-08-18Add a draftJune McEnroe