This means that e.g.
printf("hello")
where no marks are declared will not treat
("
as an known mark, but instead find
(
and then a string.
This is important for skipping over C code in 'parsergen'.
Signed-off-by: NeilBrown <neilb@suse.de>
If no known mark is found we will test against strings and comments
below before giving up and assuming an unknown mark.
If no known mark is found we will test against strings and comments
below before giving up and assuming an unknown mark.
+
+If an unknown mark contains a quote character or a comment marker, and
+that token is not being ignored, then we terminate the unknown mark
+before that quote or comment. This ensure that an unknown mark
+immediately before a string is handled correctly.
+
If `TK_mark` is ignored, then unknown marks as returned as an error.
###### token types
If `TK_mark` is ignored, then unknown marks as returned as an error.
###### token types
tk.num = TK_error;
while (is_mark(ch, state->conf)) {
int n;
tk.num = TK_error;
while (is_mark(ch, state->conf)) {
int n;
close_token(state, &tk);
n = find_known(state->conf, tk.txt);
if (n >= 0)
close_token(state, &tk);
n = find_known(state->conf, tk.txt);
if (n >= 0)
close_token(state, &tk);
return tk;
}
close_token(state, &tk);
return tk;
}
+ prev = ch;
+ if (prev == '/')
+ save_unget_state(state);
+ if (!(ignored && (1<<TK_string)) && is_quote(ch))
+ break;
+ if (!(ignored && (1<<TK_line_comment)) &&
+ prev == '/' && ch == '/') {
+ restore_unget_state(state);
+ break;
+ }
+ if (!(ignored && (1<<TK_block_comment)) &&
+ prev == '/' && ch == '*') {
+ restore_unget_state(state);
+ break;
+ }
}
unget_char(state);
if (tk.num != TK_error)
}
unget_char(state);
if (tk.num != TK_error)