version 1.48, 2015/10/10 19:28:54 |
version 1.49, 2015/11/23 09:58:55 |
|
|
static ssize_t cs(const char *); |
static ssize_t cs(const char *); |
static ssize_t as(const char *); |
static ssize_t as(const char *); |
static ssize_t node(ssize_t, ...); |
static ssize_t node(ssize_t, ...); |
static void emit(ssize_t); |
static void emit(ssize_t, int); |
static void emit_macro(int, ssize_t); |
static void emit_macro(int, ssize_t); |
static void free_tree(void); |
static void free_tree(void); |
static ssize_t numnode(int); |
static ssize_t numnode(int); |
|
|
|
|
input_item : semicolon_list NEWLINE |
input_item : semicolon_list NEWLINE |
{ |
{ |
emit($1); |
emit($1, 0); |
macro_char = reset_macro_char; |
macro_char = reset_macro_char; |
putchar('\n'); |
putchar('\n'); |
free_tree(); |
free_tree(); |
|
|
} |
} |
|
|
static void |
static void |
emit(ssize_t i) |
emit(ssize_t i, int level) |
{ |
{ |
if (instructions[i].index >= 0) |
if (level > 1000) |
while (instructions[i].index != END_NODE) |
errx(1, "internal error: tree level > 1000"); |
emit(instructions[i++].index); |
if (instructions[i].index >= 0) { |
else |
while (instructions[i].index != END_NODE && |
|
instructions[i].index != i) { |
|
emit(instructions[i].index, level + 1); |
|
i++; |
|
} |
|
} else if (instructions[i].index != END_NODE) |
fputs(instructions[i].u.cstr, stdout); |
fputs(instructions[i].u.cstr, stdout); |
} |
} |
|
|
|
|
emit_macro(int node, ssize_t code) |
emit_macro(int node, ssize_t code) |
{ |
{ |
putchar('['); |
putchar('['); |
emit(code); |
emit(code, 0); |
printf("]s%s\n", instructions[node].u.cstr); |
printf("]s%s\n", instructions[node].u.cstr); |
nesting--; |
nesting--; |
} |
} |
|
|
!isprint((unsigned char)yytext[0])) |
!isprint((unsigned char)yytext[0])) |
n = asprintf(&str, |
n = asprintf(&str, |
"%s: %s:%d: %s: ascii char 0x%02x unexpected", |
"%s: %s:%d: %s: ascii char 0x%02x unexpected", |
__progname, filename, lineno, s, yytext[0]); |
__progname, filename, lineno, s, yytext[0] & 0xff); |
else |
else |
n = asprintf(&str, "%s: %s:%d: %s: %s unexpected", |
n = asprintf(&str, "%s: %s:%d: %s: %s unexpected", |
__progname, filename, lineno, s, yytext); |
__progname, filename, lineno, s, yytext); |