diff options
author | June McEnroe <june@causal.agency> | 2020-12-29 17:44:48 -0500 |
---|---|---|
committer | June McEnroe <june@causal.agency> | 2020-12-29 17:44:48 -0500 |
commit | 9e72c0acce13944e568b1a164058b779a4d537f6 (patch) | |
tree | 23f67535c762b45709d61d122bcd6eef03a4335a | |
parent | Match lex/yacc %% %{ %} lines as Macro (diff) | |
download | src-9e72c0acce13944e568b1a164058b779a4d537f6.tar.gz src-9e72c0acce13944e568b1a164058b779a4d537f6.zip |
Clean up hilex code somewhat
Diffstat (limited to '')
-rw-r--r-- | bin/hilex/hilex.c | 10 | ||||
-rw-r--r-- | bin/hilex/irc.c | 8 | ||||
-rw-r--r-- | bin/hilex/mdoc.l | 17 |
3 files changed, 18 insertions, 17 deletions
diff --git a/bin/hilex/hilex.c b/bin/hilex/hilex.c index d99b14bb..b2bebd5f 100644 --- a/bin/hilex/hilex.c +++ b/bin/hilex/hilex.c @@ -82,9 +82,13 @@ static const char *ClassName[] = { static void debugFormat(const char *opts[], enum Class class, const char *text) { - printf("%s(\33[3m", ClassName[class]); - FormatANSI.format(opts, class, text); - printf("\33[m)"); + if (class != Normal) { + printf("%s(", ClassName[class]); + FormatANSI.format(opts, class, text); + printf(")"); + } else { + printf("%s", text); + } } const struct Formatter FormatDebug = { .format = debugFormat }; diff --git a/bin/hilex/irc.c b/bin/hilex/irc.c index c760fc26..a83b55e6 100644 --- a/bin/hilex/irc.c +++ b/bin/hilex/irc.c @@ -22,10 +22,10 @@ #include "hilex.h" static const char *IRC[ClassCap] = { - [Keyword] = "\00315", - [Macro] = "\00303", - [Comment] = "\00302", - [String] = "\00310", + [Keyword] = "\00315", + [Macro] = "\0033", + [Comment] = "\0032", + [String] = "\00310", [StringFormat] = "\00311", }; diff --git a/bin/hilex/mdoc.l b/bin/hilex/mdoc.l index 2f01ce2a..4db147c8 100644 --- a/bin/hilex/mdoc.l +++ b/bin/hilex/mdoc.l @@ -25,6 +25,8 @@ %% +[[:blank:]]+ { return Normal; } + ^"." { BEGIN(MacroLine); return Keyword; @@ -32,7 +34,7 @@ ^".\\\"".* { return Comment; } -<MacroLine>{ +<MacroLine,Heading>{ "\n" { BEGIN(0); return Normal; @@ -52,18 +54,13 @@ "\""([^""]|"\\\"")*"\"" { return String; } } -<Heading>{ - "\n" { - BEGIN(0); - return Normal; - } - - [^[:space:]].* { return IdentifierTag; } -} +<Heading>[^[:space:]].* { return IdentifierTag; } "\\"(.|"("..|"["[^]]*"]") { return String; } -[[:blank:]]+|[^.\n""\\[:space:]]+|.|\n { return Normal; } +[^.\\""[:space:]]+ { return Normal; } + +.|\n { return Normal; } %{ (void)yyunput; |