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: ");
381 if(strchr(vfmt, c) == 0) {
405 yylval.ival = escchar(lexc());
473 int c, isbin, isfloat, ishex;
486 if(isdigit(*p++) || isfloat) {
490 error("%d: <eof> eating symbols", line);
494 sel = "01234567890.xb";
496 sel = "01234567890abcdefABCDEF";
500 sel = "01234567890eE-+";
502 if(strchr(sel, c) == 0) {
508 if(!isbin && c == 'x')
510 if(!ishex && c == 'b')
516 yylval.fval = atof(symbol);
521 yylval.ival = strtoull(symbol+2, 0, 2);
523 yylval.ival = strtoull(symbol, 0, 0);
530 error("%d <eof> eating symbols", line);
533 if(c != '_' && c != '$' && c <= '~' && !isalnum(c)) { /* checking against ~ lets UTF names through */
544 s = enter(symbol, Tid);
551 enter(char *name, int t)
559 for(p = name; *p; p++)
563 s = gmalloc(sizeof(Lsym));
564 memset(s, 0, sizeof(Lsym));
565 s->name = strdup(name);
571 v = gmalloc(sizeof(Value));
572 memset(v, 0, sizeof(Value));
589 for(p = name; *p; p++)
593 for(s = hash[h]; s; s = s->hash)
594 if(strcmp(name, s->name) == 0)