59 for(i = 0; keywds[i].name; i++)
60 enter(keywds[i].name, keywds[i].terminal);
63 typedef struct IOstack IOstack;
82 b = Bopen(file, OREAD);
84 b = Bopen("/fd/0", OREAD);
89 error("pushfile: %s: %r", file);
91 io = malloc(sizeof(IOstack));
94 io->name = strdup(file);
110 io = malloc(sizeof(IOstack));
115 io->name = strdup("<string>");
120 io->text = strdup(s->string->string);
133 Binit(lexio->fin, 0, OREAD);
144 if(lexio->prev == 0){
171 i = snprint(buf, sizeof(buf), "%s:%d", e->name, line);
174 if(initialising && e->prev == 0)
176 i += snprint(buf+i, sizeof(buf)-i, " [%s:%d]", e->name, e->line);
179 snprint(buf, sizeof(buf), "no file:0");
202 c = Bgetc(lexio->fin);
220 if(c >= '0' && c <= '9') {
226 error("%d: <eof> in escape sequence", line);
227 if(strchr("0123456789xX", c) == 0) {
232 error("string escape too long");
236 return strtol(buf, 0, 0);
256 error("%d: <eof> in string constant", line);
259 error("newline in string constant");
283 error("string token too long");
287 yylval.string = strnode(buf);
299 error("eof in comment");
319 Bprint(bout, "\nacid: ");
373 if(strchr(vfmt, c) == 0) {
406 yylval.ival = escchar(lexc());
474 int c, isbin, isfloat, ishex;
487 if(isdigit(*p++) || isfloat) {
491 error("%d: <eof> eating symbols", line);
495 sel = "01234567890.xb";
497 sel = "01234567890abcdefABCDEF";
501 sel = "01234567890eE-+";
503 if(strchr(sel, c) == 0) {
509 if(!isbin && c == 'x')
511 if(!ishex && c == 'b')
517 yylval.fval = atof(symbol);
522 yylval.ival = strtoull(symbol+2, 0, 2);
524 yylval.ival = strtoull(symbol, 0, 0);
531 error("%d <eof> eating symbols", line);
534 if(c != '_' && c != '$' && c <= '~' && !isalnum(c)) { /* checking against ~ lets UTF names through */
545 s = enter(symbol, Tid);
552 enter(char *name, int t)
560 for(p = name; *p; p++)
564 s = gmalloc(sizeof(Lsym));
565 memset(s, 0, sizeof(Lsym));
566 s->name = strdup(name);
572 v = gmalloc(sizeof(Value));
577 memset(v, 0, sizeof(Value));
590 for(p = name; *p; p++)
594 for(s = hash[h]; s; s = s->hash)
595 if(strcmp(name, s->name) == 0)