summaryrefslogtreecommitdiff
path: root/src/lexparse.c
diff options
context:
space:
mode:
authorÁkos Kőrösi <korakos99@gmail.com>2026-05-21 19:11:09 +0200
committerÁkos Kőrösi <korakos99@gmail.com>2026-05-21 19:11:09 +0200
commit7d2348ece9b72cecd4d5417a4e39ee705c349e0a (patch)
treea2df777b505fa179e94d8787cf40abd582ecf56f /src/lexparse.c
parentc7115f26c54eeb436e5d8199814c51055eec707d (diff)
start building for dollar expansions
Diffstat (limited to 'src/lexparse.c')
-rw-r--r--src/lexparse.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/lexparse.c b/src/lexparse.c
index 3d48cfe..4ef228c 100644
--- a/src/lexparse.c
+++ b/src/lexparse.c
@@ -1,4 +1,5 @@
#include <ctype.h>
+#include <stddef.h>
#include "syntax.h"
#include "../src/utils.h"
@@ -38,6 +39,31 @@ MaybeToken consolidate_buffer(LexingBuffer* buf) {
}
+static MaybeChunk handle_dollar_expansion(char* line, size_t* pos, QuotationMode qmode) {
+ (*pos)++;
+
+ if (line[*pos] == '(') {
+ // TODO
+ exit(66);
+ } else if (line[*pos] == '_' || isalnum(line[*pos])){
+ String buf = make_String(256);
+ while (line[*pos] == '_' || isalnum(line[*pos])) {
+ push_to_String(&buf, line[(*pos)++]);
+ }
+ return (MaybeChunk){
+ .some = true,
+ .value = (Chunk){
+ .qmode = qmode,
+ .kind = CHUNK_VAR,
+ .as.varname = inner(&buf)
+ }
+ };
+ } else {
+ return (MaybeChunk){.some = false};
+ }
+}
+
+
static Chunk collect_un_q_literal(char* line, size_t* pos) {
String buf = make_String(256);
size_t i;