summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2021-01-13 16:04:52 -0500
committerJune McEnroe <june@causal.agency>2021-01-13 16:04:52 -0500
commit9775ce4b5d2afe9d8ef4ca6ba8e06571d55ddba6 (patch)
tree444495dbf3e9789d0122fdfb35525c12d1bb071c
parentTry to return strings as single tokens (diff)
downloadsrc-9775ce4b5d2afe9d8ef4ca6ba8e06571d55ddba6.tar.gz
src-9775ce4b5d2afe9d8ef4ca6ba8e06571d55ddba6.zip
Move text "lexer" to hilex.c
Diffstat (limited to '')
-rw-r--r--bin/Makefile1
-rw-r--r--bin/hilex.c8
-rw-r--r--bin/hilex.h1
-rw-r--r--bin/text.l35
4 files changed, 8 insertions, 37 deletions
diff --git a/bin/Makefile b/bin/Makefile
index 6220ec06..9cdf9848 100644
--- a/bin/Makefile
+++ b/bin/Makefile
@@ -88,7 +88,6 @@ OBJS.hilex += c11.o
 OBJS.hilex += hilex.o
 OBJS.hilex += make.o
 OBJS.hilex += mdoc.o
-OBJS.hilex += text.o
 
 hilex: ${OBJS.hilex}
 	${CC} ${LDFLAGS} ${OBJS.$@} ${LDLIBS.$@} -o $@
diff --git a/bin/hilex.c b/bin/hilex.c
index afcc5000..a5c682ac 100644
--- a/bin/hilex.c
+++ b/bin/hilex.c
@@ -35,6 +35,14 @@ static const char *Class[] = {
 #undef X
 };
 
+static FILE *yyin;
+static char *yytext;
+static int yylex(void) {
+	static size_t cap = 0;
+	return (getline(&yytext, &cap, yyin) < 0 ? None : Normal);
+}
+static const struct Lexer LexText = { yylex, &yyin, &yytext };
+
 static const struct {
 	const struct Lexer *lexer;
 	const char *name;
diff --git a/bin/hilex.h b/bin/hilex.h
index 5998e6a4..2a8d4ec0 100644
--- a/bin/hilex.h
+++ b/bin/hilex.h
@@ -47,4 +47,3 @@ struct Lexer {
 extern const struct Lexer LexC;
 extern const struct Lexer LexMake;
 extern const struct Lexer LexMdoc;
-extern const struct Lexer LexText;
diff --git a/bin/text.l b/bin/text.l
deleted file mode 100644
index e3d64814..00000000
--- a/bin/text.l
+++ /dev/null
@@ -1,35 +0,0 @@
-/* Copyright (C) 2020  C. McEnroe <june@causal.agency>
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-%option prefix="text"
-%option noyywrap
-
-%{
-#include "hilex.h"
-%}
-
-%%
-
-.*"\n"? { return Normal; }
-
-%{
-	(void)yyunput;
-	(void)input;
-%}
-
-%%
-
-const struct Lexer LexText = { yylex, &yyin, &yytext };
d>June McEnroe 2022-08-17Add The Book of Form and EmptinessJune McEnroe There are some nice things in here that I would really like in any other book, but not this one. 2022-08-15Load dates from ~/.config/when/datesJune McEnroe 2022-08-15Allow names with prefixes of months and daysJune McEnroe 2022-08-15Add named dates to whenJune McEnroe 2022-08-14Remove tweets text fileJune McEnroe Such link rot. 2022-08-04Add Conversations With FriendsJune McEnroe The better of the two, but largely the same. I feel like these books are a bit too autobiographical, but I don't know if I'm allowed to accuse an author of that. My real problem is that I read these books as largely uncritical of their characters. They behave in nonsense ways, are mostly uncritical of their own behaviour, and don't really have arcs of growth or change. I suppose this book had a bit of one, but only in the last two chapters. 2022-07-30Add Normal PeopleJune McEnroe Unbearably straight. Eyerolls and sighs per page off the charts. Shout out to Joanna, I guess. I kinda like the lack of quotation marks though to be honest. After half of the Ruth Ozeki novel and now this, I need to get back to some genre fiction. 2022-07-26Rewrite glitch from new pngoJune McEnroe 2022-07-26Update Care with time-to-ID and piercingsJune McEnroe 2022-07-26Add -w to upJune McEnroe 2022-07-13Set push.autoSetupRemoteJune McEnroe 2022-07-08Remove TOURJune McEnroe There is not that much distinct stuff here anymore. 2022-07-03Add The Bone Shard EmperorJune McEnroe Suffers a little bit from middle book but I really enjoyed it. Read it faster than the first one too, despite its length. 2022-06-25Bump xterm font size to 12June McEnroe 2022-06-10Handle subshells (and functions) inside substitutionsJune McEnroe 2022-06-10Switch to jorts Install scriptJune McEnroe 2022-06-08Indicate if still reading or no resultsJune McEnroe 2022-06-08Add Maiden, Mother, CroneJune McEnroe Mixed bag like most collections of short stories. Some of them are pretty good. The author of the worst written story also has the worst written bio. 2022-06-05FIRST SHOW IN 2.5 YEARS BABEY!!!June McEnroe 2022-06-03Set line number on File linesJune McEnroe 2022-06-03Stop polling stdin after EOFJune McEnroe 2022-06-02Set TABSIZE=4June McEnroe Absolutely indiscriminately. 2022-06-02Do basic match highlightingJune McEnroe 2022-06-02Clean up parsing a littleJune McEnroe 2022-06-02Don't duplicate path stringJune McEnroe 2022-06-02Use stderr instead of /dev/tty, realloc buffer if lines too longJune McEnroe For some reason I haven't been able to figure out, trying to poll /dev/tty returns POLLNVAL (and this was using 100% CPU looping), but using stderr instead works fine. 2022-06-02Add initial working version of qfJune McEnroe 2022-05-29Set prompt for okshJune McEnroe