SpecExtractor.java seems to work
[cdsspec-compiler.git] / src / edu / uci / eecs / specCompiler / specExtraction / SpecExtractor.java
index ba04343..2d28fce 100644 (file)
@@ -57,25 +57,29 @@ public class SpecExtractor {
                                        if (trimedLine.startsWith("/**")) {
                                                _beginLine = reader.getLineNumber();
                                                _foundHead = true;
+                                               specText.append("\n");
+                                               specText.append(curLine);
                                                if (trimedLine.endsWith("*/")) {
                                                        _endLine = reader.getLineNumber();
                                                        _foundHead = false;
                                                        
                                                        System.out.println("Spec<" + specIndex + "> Begin: "
                                                                        + _beginLine + "  End: " + _endLine);
-                                                       System.out.println(curLine);
+                                                       System.out.println(specText);
+                                                       specIndex++;
                                                }
                                        }
                                } else {
+                                       specText.append("\n");
+                                       specText.append(curLine);
                                        if (trimedLine.endsWith("*/")) {
                                                _endLine = reader.getLineNumber();
                                                _foundHead = false;
-                                               specText.append("\n");
-                                               specText.append(curLine);
                                                
                                                System.out.println("Spec<" + specIndex + "> Begin: "
                                                                + _beginLine + "  End: " + _endLine);
-                                               System.out.println(curLine);
+                                               System.out.println(specText);
+                                               specIndex++;
                                                
                                                specText = new StringBuilder();
                                        } else {
@@ -95,16 +99,12 @@ public class SpecExtractor {
                char ch;
                for (i = 0; i < line.length(); i++) {
                        ch = line.charAt(i);
-                       if (ch == ' ' || ch == '\t')
-                               i++;
-                       else
+                       if (ch != ' ' && ch != '\t')
                                break;
                }
                for (j = line.length() - 1; j >= 0; j--) {
                        ch = line.charAt(j);
-                       if (ch == ' ' || ch == '\t')
-                               j--;
-                       else
+                       if (ch != ' ' && ch != '\t')
                                break;
                }
                if (i > j)