From 6079191042d54828d5c1043d595bc615e50b6124 Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Tue, 3 Jun 2014 21:07:58 +1000 Subject: [PATCH] scanner: fix up detection of comments blended with marks. If we see the start of a comment in an unknown mark, we need to finish the mark before the start of the comment. Signed-off-by: NeilBrown --- csrc/scanner.mdc | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/csrc/scanner.mdc b/csrc/scanner.mdc index 113c9d2..cbb8d6f 100644 --- a/csrc/scanner.mdc +++ b/csrc/scanner.mdc @@ -347,25 +347,26 @@ Known marks are included in the same list as the list of known words. return tk; } prev = ch; - if (prev == '/') - save_unget_state(state); + save_unget_state(state); ch = get_char(state); if (!(ignored && (1< 1) { restore_unget_state(state); break; } - if (!(ignored && (1< 1) { restore_unget_state(state); break; } } unget_char(state); - if (tk.num != TK_error) + if (tk.num != TK_error) { + close_token(state, &tk); return tk; + } ###### unknown mark if (tk.txt.len) { @@ -506,7 +507,7 @@ it would not suffer from this rule. These two comment types are reported as two separate token types, and consequently can be ignored separately. When ignored a comment is -parsed and discarded. +still parsed, but is discarded. ###### token types TK_line_comment, -- 2.43.0