From f769ca3f56ac0ba5a2cbf2dbe34b6670558bdb8e Mon Sep 17 00:00:00 2001 From: Karol Baraniecki Date: Sat, 28 Aug 2021 15:31:05 +0200 Subject: [PATCH] ttcn: Skip comments correctly Right now comments don't get skipped all the way, leading to code like type enumerated Enum { /* a comment */ Value } or type enumerated Enum { // a comment Value } resulting in "Value" not being present in the output --- Units/parser-ttcn.r/ttcn-types.d/input.ttcn | 2 ++ parsers/ttcn.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/Units/parser-ttcn.r/ttcn-types.d/input.ttcn b/Units/parser-ttcn.r/ttcn-types.d/input.ttcn index 9bcf941fad..603bfdb025 100644 --- a/Units/parser-ttcn.r/ttcn-types.d/input.ttcn +++ b/Units/parser-ttcn.r/ttcn-types.d/input.ttcn @@ -14,7 +14,9 @@ type record Tee { record of integer nestedIntegersRecord, record length (0..5) of integer nestedRangedIntegersRecord, + /* a comment */ set of integer nestedIntegersSet, + // a comment set length (2..4) of integer nestedRangerdIntegersSet, enumerated {e_type1, e_type2} nestedEnum, union {Type1 t1, Type2 t2} nestedUnion diff --git a/parsers/ttcn.c b/parsers/ttcn.c index d61e1b5673..baeff4e0a1 100644 --- a/parsers/ttcn.c +++ b/parsers/ttcn.c @@ -344,6 +344,7 @@ static int getNonWhiteSpaceChar (void) { /* Line comment */ while (((c = getcFromInputFile()) != EOF) && (c != '\n')); + continue; } else if (c2=='*') { @@ -358,6 +359,7 @@ static int getNonWhiteSpaceChar (void) ungetcToInputFile(c2); } } + continue; } else {