summary refs log tree commit diff
path: root/bin/hilex/mdoc.l
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2020-12-28 22:58:29 -0500
committerJune McEnroe <june@causal.agency>2020-12-28 22:58:29 -0500
commitfe8ed38249d7dd6c857408238d71f311621cee3e (patch)
tree06bb3367dc231169c9a7840d1b5523691c7d5915 /bin/hilex/mdoc.l
parentAdd mdoc lexer (diff)
downloadsrc-fe8ed38249d7dd6c857408238d71f311621cee3e.tar.gz
src-fe8ed38249d7dd6c857408238d71f311621cee3e.zip
Generate Tag tokens for mdoc headings
Diffstat (limited to '')
-rw-r--r--bin/hilex/mdoc.l16
1 files changed, 15 insertions, 1 deletions
diff --git a/bin/hilex/mdoc.l b/bin/hilex/mdoc.l
index d5c76a04..cb4c248e 100644
--- a/bin/hilex/mdoc.l
+++ b/bin/hilex/mdoc.l
@@ -21,7 +21,7 @@
 #include "hilex.h"
 %}
 
-%s MacroLine
+%s MacroLine Heading
 
 %%
 
@@ -38,6 +38,11 @@
 		return Normal;
 	}
 
+	S[hs] {
+		BEGIN(Heading);
+		return Keyword;
+	}
+
 	%[ABCDIJNOPQRTUV]|A[cdnopqrt]|B[cdfkloqtx]|Br[coq]|Bsx|C[dm]|D[1bcdloqtvx] |
 	E[cdfklmnorsvx]|F[acdlnortx]|Hf|I[cnt]|L[bikp]|M[st]|N[dmosx]|O[copstx] |
 	P[acfopq]|Q[cloq]|R[esv]|S[chmoqstxy]|T[an]|U[dx]|V[at]|X[cor] {
@@ -47,6 +52,15 @@
 	"\""([^""]|"\\\"")*"\"" { return String; }
 }
 
+<Heading>{
+	"\n" {
+		BEGIN(0);
+		return Normal;
+	}
+
+	[^[:space:]].* { return Tag; }
+}
+
 "\\"(.|"("..|"["[^]]*"]") { return String; }
 
 [[:blank:]]+|[^.\n""\\[:space:]]+|.|\n { return Normal; }