more tests
This commit is contained in:
parent
d0f8b3e0ad
commit
1bcff515b7
22 changed files with 191 additions and 58 deletions
28
boot.c
28
boot.c
|
@ -230,25 +230,15 @@ int parse_int(int ch) {
|
|||
|
||||
int get_escaped_char() {
|
||||
int ch = getchar();
|
||||
if (ch == 'n') {
|
||||
ch = '\n';
|
||||
} else if (ch == 't') {
|
||||
ch = '\t';
|
||||
} else if (ch == 'r') {
|
||||
ch = '\r';
|
||||
} else if (ch == '0') {
|
||||
ch = '\0';
|
||||
} else if (ch == '\\') {
|
||||
ch = '\\';
|
||||
} else if (ch == '\'') {
|
||||
ch = '\'';
|
||||
} else if (ch == '\"') {
|
||||
ch = '\"';
|
||||
} else {
|
||||
fprintf(stderr, "unexpected escaped character: '\\%c'\n", ch);
|
||||
exit(1);
|
||||
}
|
||||
return ch;
|
||||
if (ch == 'n') return '\n';
|
||||
if (ch == 't') return '\t';
|
||||
if (ch == 'r') return '\r';
|
||||
if (ch == '0') return '\0';
|
||||
if (ch == '\\') return '\\';
|
||||
if (ch == '\'') return '\'';
|
||||
if (ch == '\"') return '\"';
|
||||
fprintf(stderr, "unexpected escaped character: '\\%c'\n", ch);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
int token_state;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue