Skip to content

Commit

Permalink
ttcn: Skip comments correctly
Browse files Browse the repository at this point in the history
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
  • Loading branch information
karolba committed Aug 28, 2021
1 parent 10c03fd commit f769ca3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Units/parser-ttcn.r/ttcn-types.d/input.ttcn
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions parsers/ttcn.c
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,7 @@ static int getNonWhiteSpaceChar (void)
{
/* Line comment */
while (((c = getcFromInputFile()) != EOF) && (c != '\n'));
continue;
}
else if (c2=='*')
{
Expand All @@ -358,6 +359,7 @@ static int getNonWhiteSpaceChar (void)
ungetcToInputFile(c2);
}
}
continue;
}
else
{
Expand Down

0 comments on commit f769ca3

Please sign in to comment.