diff options
| author | tjg <tjg> | 2000-11-27 12:46:10 +0000 |
|---|---|---|
| committer | Toby Goodwin <toby@paccrat.org> | 2015-05-16 21:23:18 +0100 |
| commit | cbc42d41142c2261b7d02ca74c2d43777847564d (patch) | |
| tree | fcbdf6e7a7a6e4e5afad8a8ae9918d002edcd71d | |
| parent | 9154b20cebe240270ce525ee39324835523005b9 (diff) | |
equals hack
| -rw-r--r-- | lex.c | 16 | ||||
| -rw-r--r-- | rc.h | 2 |
2 files changed, 13 insertions, 5 deletions
@@ -33,7 +33,7 @@ static void getpair(int); int lineno; -const char nw[] = { +char nw[] = { 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, @@ -44,7 +44,7 @@ const char nw[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -const char dnw[] = { +char dnw[] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, @@ -63,6 +63,8 @@ static bool prerror = FALSE; static wordstates w = NW; static int fd_left, fd_right; +int mbassign = 1; + #define checkfreecaret {if (w != NW) { w = NW; ugchar(c); return '^'; }} enum filedescriptors { @@ -74,7 +76,7 @@ extern int yylex() { bool saw_meta = FALSE; int c; size_t i; /* The purpose of all these local assignments is to */ - const char *meta; /* allow optimizing compilers like gcc to load these */ + char *meta; /* allow optimizing compilers like gcc to load these */ char *buf = realbuf; /* values into registers. On a sparc this is a */ YYSTYPE *y = &yylval; /* win, in code size *and* execution time */ if (errset) { @@ -93,6 +95,7 @@ top: while ((c = gchar()) == ' ' || c == '\t') w = NW; if (c == EOF) return END; + meta['='] = (mbassign == 1); if (!meta[(unsigned char) c]) { /* it's a word or keyword. */ checkfreecaret; w = RW; @@ -224,10 +227,15 @@ top: while ((c = gchar()) == ' ' || c == '\t') case ';': case '^': case ')': - case '=': case '{': case '}': w = NW; return c; + case '=': + if (mbassign == 1) { + w = NW; + return EQUALS; + } + return '='; case '&': w = NW; c = gchar(); @@ -282,7 +282,7 @@ extern int yylex(void); extern void inityy(void); extern void yyerror(const char *); extern void scanerror(char *); -extern const char nw[], dnw[]; +extern char nw[], dnw[]; /* list.c */ extern void listfree(List *); |