[PATCH] lex: allow dots in function names
Export this patch
Example usage:
fn ... cd ../..
---
See also https://lists.sr.ht/~sircmpwn/rc-users/%3CCWEVA3HZND0V.29Y3XIS88YJT9%40mxsr.de%3E
lex/lex.ha | 4 ++ --
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lex/lex.ha b/lex/lex.ha
index fea55d6..2e58493 100644
--- a/lex/lex.ha
+++ b/lex/lex.ha
@@ -98,7 +98,7 @@ export fn next(lex: *lexer, word: bool) (token | error) = {
};
if (word) {
- if (ascii::isalnum(rn) || rn == '_' || rn == '*') {
+ if (ascii::isalnum(rn) || rn == '_' || rn == '*' || rn == '.') {
unread(lex, rn);
return lexword(lex);
};
@@ -226,7 +226,7 @@ fn lexword(lex: *lexer) (token | error) = {
break;
};
- if (!ascii::isalnum(rn) && rn != '_' && rn != '*') {
+ if (!ascii::isalnum(rn) && rn != '_' && rn != '*' && rn != '.') {
unread(lex, rn);
break;
};
--
2.42.0
Thanks!
To git@git.sr.ht:~sircmpwn/rc
a5426c6..f34f923 master -> master
A more general solution might be to use params in the function
definition grammar, rather than words. But this is fine for now.