--- /dev/null
+package edu.uci.eecs.specCompiler.specExtraction;
+
+import java.util.HashMap;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.LineNumberReader;
+
+import java.util.regex.Pattern;
+import java.util.regex.Matcher;
+
+/**
+ * <p>
+ * This class will scan all the input files, extract all the "special comments"
+ * (specifications). It should include information: 1. Beginning and end line of
+ * the specs; 2. The next two lines of code if it is interface constrcut.
+ * </p>
+ *
+ * @author peizhaoo
+ *
+ */
+public class SpecInfoScanner {
+ public final HashMap<File, Construct> constructs;
+
+ public SpecInfoScanner() {
+ constructs = new HashMap<File, Construct>();
+ }
+
+ /**
+ * <p>
+ * Scan
+ * </p>
+ *
+ * @param file
+ */
+ private void scanFile(File file) {
+ try {
+ FileReader fr = new FileReader(file);
+ LineNumberReader lnr = new LineNumberReader(fr);
+ String line = null;
+ // Info to keep when parsing the Spec
+ // 0 for default, 1 for potential sepc, 2 for in spec
+ int state = 0;
+ Pattern pBegin = Pattern.compile("^[\\s|\\t]*/**"), pEnd = Pattern
+ .compile("*/$");
+ while ((line = lnr.readLine()) != null) {
+ Matcher m1 = pBegin.matcher(line);
+ if (m1.matches())
+ state = 1; // Go to 'potential spec' state
+ if (state == 1) {
+
+ }
+ }
+ } catch (FileNotFoundException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ public void scanFiles(File[] files) {
+ for (int i = 0; i < files.length; i++) {
+ scanFile(files[i]);
+ }
+ }
+}