From b183e521adfba783d062cca1dda7119818b73dad Mon Sep 17 00:00:00 2001 From: Johannes Mey <johannes.mey@tu-dresden.de> Date: Tue, 25 Jun 2019 15:35:17 +0200 Subject: [PATCH] fix handling of multiline comments --- src/main/jastadd/RelAst.flex | 2 +- src/test/jastadd/relations/Relations.relast | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/main/jastadd/RelAst.flex b/src/main/jastadd/RelAst.flex index 7cccbe3..1704925 100644 --- a/src/main/jastadd/RelAst.flex +++ b/src/main/jastadd/RelAst.flex @@ -36,7 +36,7 @@ import org.jastadd.relast.parser.RelAstParser.Terminals; %} WhiteSpace = [ ] | \t | \f | \n | \r | \r\n -TraditionalComment = "/*" [^*] ~"*/" | "/*" "*"+ "/" +TraditionalComment = [/][*][^*]*[*]+([^*/][^*]*[*]+)*[/] EndOfLineComment = "//" [^\n|\r|\r\n]* Comment = {TraditionalComment} | {EndOfLineComment} diff --git a/src/test/jastadd/relations/Relations.relast b/src/test/jastadd/relations/Relations.relast index 892ad39..bdcc878 100644 --- a/src/test/jastadd/relations/Relations.relast +++ b/src/test/jastadd/relations/Relations.relast @@ -1,3 +1,5 @@ +// do line comments work? + Root ::= A* B*; A ::= <Name> /SomeNTA:A/; B ::= <Name>; @@ -6,6 +8,23 @@ rel A.Di1 -> B; rel A.Di2? -> B; rel A.Di3* -> B; +/* + do multiline comments work +*/ + +/**/ + +/* + * work? +*/ + +/** + * The root of a Java AST. + * + * <p>A Java program consists of multiple compilation units that represent the + * source files of the program. + */ + rel A.Bi1 <-> B.Bi1; rel A.Bi2 <-> B.Bi2?; rel A.Bi3 <-> B.Bi3*; -- GitLab