more
[cdsspec-compiler.git] / src / edu / uci / eecs / specCompiler / specExtraction / ParserUtils.java
index 232f483c5c353ed3d69540b716a7e49cda2963e9..201bb8c5829bbc43d553cb414c886583d43a15b4 100644 (file)
@@ -7,9 +7,8 @@ import java.io.IOException;
 import java.util.ArrayList;
 
 import edu.uci.eecs.specCompiler.codeGenerator.Environment;
-import edu.uci.eecs.specCompiler.codeGenerator.SemanticsChecker;
-import edu.uci.eecs.specCompiler.grammerParser.ParseException;
-import edu.uci.eecs.specCompiler.grammerParser.SpecParser;
+import edu.uci.eecs.specCompiler.grammerParser.utilParser.ParseException;
+import edu.uci.eecs.specCompiler.grammerParser.utilParser.UtilParser;
 
 public class ParserUtils {
        public static String trimSpace(String line) {
@@ -47,8 +46,9 @@ public class ParserUtils {
 
        public static String getTemplateStr(String templateLine) {
                String templateStr = null;
+               ArrayList<VariableDeclaration> templateArgs;
                try {
-                       ArrayList<VariableDeclaration> templateArgs = SpecParser.getTemplateArg(templateLine);
+                       templateArgs = UtilParser.getTemplateArg(templateLine);
                        templateStr = "<" + templateArgs.get(0).name;
                        for (int i = 1; i < templateArgs.size(); i++) {
                                templateStr = templateStr + ", " + templateArgs.get(i).name;
@@ -57,11 +57,14 @@ public class ParserUtils {
                } catch (ParseException e) {
                        e.printStackTrace();
                }
+
                return templateStr;
        }
-       
+
        public static void write2File(File file, ArrayList<String> content) {
-               String newFileName = Environment.GENERATED_FILE_DIR + "/" + file.getName();
+               String newFileName = Environment.GENERATED_FILE_DIR + "/"
+                               + file.getParentFile().getName() + "/" + file.getName();
+
                File newFile = new File(newFileName);
                newFile.getParentFile().mkdirs();
                if (!newFile.exists()) {