ref: 8af6a0987f0841a7c4392b2738e64d7240fc920d
parent: 44143b94e3e716ffd9ebd1b5e08b9fcb69f22dd5
author: Jacob Moody <moody@posixcafe.org>
date: Fri Mar 7 22:48:02 EST 2025
yacc: allow unicode in identifiers
--- a/sys/src/cmd/yacc.c
+++ b/sys/src/cmd/yacc.c
@@ -3,8 +3,6 @@
#include <bio.h>
#include <ctype.h>
-#define Bungetrune Bungetc /* ok for now. */
-
/*
* all these are 32 bit
*/
@@ -1756,9 +1754,9 @@
Bungetrune(finput);
return NUMBER;
}
- if(islower(c) || isupper(c) || c=='_' || c=='.' || c=='$') {
+ if(isalpharune(c) || c=='_' || c=='.' || c=='$') {
i = 0;
- while(islower(c) || isupper(c) || isdigit(c) ||
+ while(isalpharune(c) || isdigit(c) ||
c == '-' || c=='_' || c=='.' || c=='$') {
if(reserve && isupper(c))
c += 'a'-'A';
@@ -2023,7 +2021,7 @@
}
goto loop;
}
- if(isupper(c) || islower(c) || c == '_' || c == '.') {
+ if(isalpharune(c) || c == '_' || c == '.') {
int tok; /* tok used oustide for type info */
/* look for $name */
--
⑨