scan:
SCANINIT();
+ if (*cursor == '\0')
+ goto endofinput;
/*!re2c
/* standard decimal integer */
ws+ { goto scan; }
- [\000] {
- parser_nasm->state = INITIAL;
- RETURN(s->tok[0]);
- }
+ [\000] { goto endofinput; }
any {
yasm_warn_set(YASM_WARN_UNREC_CHAR,
/* %line linenum+lineinc filename */
linechg:
SCANINIT();
+ if (*cursor == '\0')
+ goto endofinput;
/*!re2c
digit+ {
RETURN(INTNUM);
}
- [\000] {
- parser_nasm->state = INITIAL;
- RETURN(s->tok[0]);
- }
+ [\000] { goto endofinput; }
"+" {
RETURN(s->tok[0]);
linechg2:
SCANINIT();
+ if (*cursor == '\0')
+ goto endofinput;
/*!re2c
- [\000] {
- parser_nasm->state = INITIAL;
- RETURN(s->tok[0]);
- }
+ [\000] { goto endofinput; }
- "\r" { }
+ "\r" { goto linechg2; }
(any \ [\000])+ {
parser_nasm->state = LINECHG;
/* directive: [name value] */
directive:
SCANINIT();
+ if (*cursor == '\0')
+ goto endofinput;
/*!re2c
- [\]\000] {
- parser_nasm->state = INITIAL;
- RETURN(s->tok[0]);
- }
+ [\]\000] { goto endofinput; }
[a-zA-Z_][a-zA-Z_0-9]* {
lvalp->str_val = yasm__xstrndup(TOK, TOKLEN);
/* section directive (the section name portion thereof) */
section_directive:
SCANINIT();
+ if (*cursor == '\0')
+ goto endofinput;
/*!re2c
[a-zA-Z0-9_$#@~.?-]+ {
goto section_directive;
}
- "]" {
- parser_nasm->state = INITIAL;
- RETURN(s->tok[0]);
- }
-
- [\000] {
- parser_nasm->state = INITIAL;
- RETURN(s->tok[0]);
- }
+ [\]\000] { goto endofinput; }
any {
yasm_warn_set(YASM_WARN_UNREC_CHAR,
/* inner part of directive */
directive2:
SCANINIT();
+ if (*cursor == '\0')
+ goto endofinput;
/*!re2c
/* standard decimal integer */
[-+|^*&/%~$():=,\[] { RETURN(s->tok[0]); }
/* handle ] for directives */
- "]" {
- parser_nasm->state = INITIAL;
- RETURN(s->tok[0]);
- }
+ "]" { goto endofinput; }
/* forced identifier; within directive, don't strip '$', this is
* handled later.
ws+ { goto directive2; }
- [\000] {
- parser_nasm->state = INITIAL;
- RETURN(s->tok[0]);
- }
+ [\000] { goto endofinput; }
any {
yasm_warn_set(YASM_WARN_UNREC_CHAR,
stringconst_scan:
SCANINIT();
+ if (*cursor == '\0')
+ goto stringconst_error;
/*!re2c
- [\000] {
- yasm_error_set(YASM_ERROR_SYNTAX, N_("unterminated string"));
- strbuf[count] = '\0';
- lvalp->str.contents = (char *)strbuf;
- lvalp->str.len = count;
- RETURN(STRING);
- }
+ [\000] { goto stringconst_error; }
any {
- if (s->tok[0] == endch) {
- strbuf[count] = '\0';
- lvalp->str.contents = (char *)strbuf;
- lvalp->str.len = count;
- RETURN(STRING);
- }
+ if (s->tok[0] == endch)
+ goto stringconst_end;
strbuf[count++] = s->tok[0];
if (count >= strbuf_size) {
goto stringconst_scan;
}
*/
+
+stringconst_error:
+ yasm_error_set(YASM_ERROR_SYNTAX, N_("unterminated string"));
+
+stringconst_end:
+ strbuf[count] = '\0';
+ lvalp->str.contents = (char *)strbuf;
+ lvalp->str.len = count;
+ RETURN(STRING);
+
+endofinput:
+ parser_nasm->state = INITIAL;
+ RETURN(s->tok[0]);
}