lots of change and add notes
[cdsspec-compiler.git] / src / edu / uci / eecs / specCompiler / specExtraction / SpecExtractor.java
index 3c462c17b4735e5a425326420c556163f82dcda5..1d34199ea2fcd5e1adcdfd81b3515df488448416 100644 (file)
@@ -71,11 +71,13 @@ public class SpecExtractor {
                                                                continue;
                                                        Construct inst = SpecParser.parseSpec(specText
                                                                        .toString());
-                                                       if (inst instanceof InterfaceConstruct) {
+                                                       if (inst instanceof InterfaceConstruct
+                                                                       || inst instanceof InterfaceDefineConstruct) {
                                                                funcDecl = readFunctionDecl(reader);
                                                                specConstruct = new SpecConstruct(
                                                                                specText.toString(), file,
-                                                                               _beginLineNum, _endLineNum, inst, funcDecl);
+                                                                               _beginLineNum, _endLineNum, inst,
+                                                                               funcDecl);
                                                        } else {
                                                                specConstruct = new SpecConstruct(
                                                                                specText.toString(), file,
@@ -83,7 +85,7 @@ public class SpecExtractor {
                                                        }
                                                        _constructs.add(specConstruct);
                                                        specText = new StringBuilder();
-//                                                     System.out.println(specConstruct);
+                                                       // System.out.println(specConstruct);
                                                }
                                        }
                                } else {
@@ -98,19 +100,20 @@ public class SpecExtractor {
                                                }
                                                Construct inst = SpecParser.parseSpec(specText
                                                                .toString());
-                                               if (inst instanceof InterfaceConstruct) {
+                                               if (inst instanceof InterfaceConstruct
+                                                               || inst instanceof InterfaceDefineConstruct) {
                                                        funcDecl = readFunctionDecl(reader);
                                                        specConstruct = new SpecConstruct(
-                                                                       specText.toString(), file,
-                                                                       _beginLineNum, _endLineNum, inst, funcDecl);
+                                                                       specText.toString(), file, _beginLineNum,
+                                                                       _endLineNum, inst, funcDecl);
                                                } else {
                                                        specConstruct = new SpecConstruct(
-                                                                       specText.toString(), file,
-                                                                       _beginLineNum, _endLineNum, inst);
+                                                                       specText.toString(), file, _beginLineNum,
+                                                                       _endLineNum, inst);
                                                }
                                                _constructs.add(specConstruct);
                                                specText = new StringBuilder();
-//                                             System.out.println(specConstruct);
+                                               // System.out.println(specConstruct);
                                        }
                                }
                        }
@@ -133,15 +136,14 @@ public class SpecExtractor {
                        e.printStackTrace();
                }
        }
-       
+
        private void printSpecInfo(File file, String text) {
                System.out.println("Error in spec!");
                System.out.println("File: " + file.getAbsolutePath());
-               System.out.println("Begin: "
-                               + _beginLineNum + "  End: " + _endLineNum);
+               System.out.println("Begin: " + _beginLineNum + "  End: " + _endLineNum);
                System.out.println(text);
        }
-       
+
        private boolean isComment(String specText) {
                if (specText.indexOf("@Begin") != -1)
                        return false;
@@ -181,7 +183,7 @@ public class SpecExtractor {
                else
                        return line.substring(i, j + 1);
        }
-       
+
        public ArrayList<SpecConstruct> getConstructs() {
                return this._constructs;
        }