allow shorter spec --- @Interface is not mandatory
[cdsspec-compiler.git] / src / edu / uci / eecs / specExtraction / SpecExtractor.java
index 959e51f2a7fda8cbcdbdc6edb1e3177d3a60c0c6..afa42f78033b5d34475c38c5601fa251950563fc 100644 (file)
@@ -268,11 +268,12 @@ public class SpecExtractor {
                annotations.add(curLine);
                // System.out.println(curLine);
                // Initial settings for matching lines
-               // "\*/( |\t)*$"
-               Pattern regexpEnd = Pattern.compile("\\*/( |\\t)*$");
+               // "\*/\s*$"
+               Pattern regexpEnd = Pattern.compile("\\*/\\s*$");
                Matcher matcher = regexpEnd.matcher(curLine);
-               if (matcher.find()) { // The beginning line is also the end line
-                       annotations.add(curLine);
+               if (matcher.find()) {
+                       // The beginning line is also the end line
+                       // In this case, we have already add the curLine
                        return annotations;
                } else {
                        try {
@@ -623,7 +624,7 @@ public class SpecExtractor {
                        lineReader = new LineNumberReader(br);
                        // "/\*\*\s*@(DeclareState|Interface)"
                        Pattern regexpBegin = Pattern
-                                       .compile("/\\*\\*\\s*@(DeclareState|Interface|Define)");
+                                       .compile("/\\*\\*\\s*@(DeclareState|Interface|PreCondition|Transition|PostCondition|Define)");
                        Matcher matcher = regexpBegin.matcher("");
 
                        String line;
@@ -651,7 +652,10 @@ public class SpecExtractor {
                                        if (constructName.equals(SpecNaming.DeclareState)) {
                                                extractGlobalConstruct(file, lineReader, line,
                                                                beginLineNum);
-                                       } else if (constructName.equals(SpecNaming.Interface)) {
+                                       } else if (constructName.equals(SpecNaming.Interface)
+                                                       || constructName.equals(SpecNaming.PreCondition)
+                                                       || constructName.equals(SpecNaming.Transition)
+                                                       || constructName.equals(SpecNaming.PostCondition)) {
                                                extractInterfaceConstruct(file, lineReader, line,
                                                                beginLineNum);
                                        } else if (constructName.equals(SpecNaming.Define)) {