Changeset 2788 for proto


Ignore:
Timestamp:
Dec 17, 2012, 11:30:49 PM (7 years ago)
Author:
ksherdy
Message:

Added template support. Additional work needed.

Location:
proto/pablo
Files:
14 added
1 deleted
1 edited
2 copied
1 moved

Legend:

Unmodified
Added
Removed
  • proto/pablo/runConfigurations/pabloJ.launch

    r2770 r2788  
    33<stringAttribute key="bad_container_name" value="/prot/pablo/runConfigurations"/>
    44<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
    5 <listEntry value="/pablo/src/applications/PabloS.java"/>
     5<listEntry value="/pablo/src/applicationGenerator/PabloJ.java"/>
    66</listAttribute>
    77<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
    88<listEntry value="1"/>
    99</listAttribute>
    10 <stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="applications.PabloS"/>
     10<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="applicationGenerator.PabloJ"/>
    1111<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-i ${workspace_loc}/pablo/input/test/pabloS/py2pablo/parabix2_pablo.pablos.exclude"/>
    1212<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="pablo"/>
  • proto/pablo/src/applicationGenerator/PabloJ.java

    r2775 r2788  
    1 package  applications;
     1package  applicationGenerator;
    22
    33import java.io.FileNotFoundException;
     
    2525@SuppressWarnings("unused")
    2626
    27 public class PabloS {
     27public class PabloJ {
    2828       
    2929        public static final String COMPILERNAME = "PabloJ";     
     
    3232        public static void main(String[] args) {
    3333               
    34                 Options options = ApplicationOptions.createOptions();
     34                Options options = CompilerOptions.createOptions();
    3535               
    3636                try {
    3737                        CommandLineParser parser = new PosixParser();
    3838                        CommandLine cli = parser.parse(options, args); 
    39                         ApplicationConfig applicationConfig = ApplicationConfigFactory.generate(cli);
     39                        CompilerConfig applicationConfig = CompilerConfigFactory.generate(cli);
    4040                        ApplicationGenerator applicationGenerator = new ApplicationGenerator(applicationConfig);
    4141                        applicationGenerator.generate();
     
    4444                        e.printStackTrace();
    4545                       
    46                         ApplicationOptions.exitWithUsageMessage(options);
     46                        CompilerOptions.exitWithUsageMessage(options);
    4747                }       
    4848        }
  • proto/pablo/src/compiler/template/FileTemplate.java

    r2749 r2788  
    55
    66public class FileTemplate implements Template {
    7         // Template Vars begin with Var_DELIMITER and followed by Var_START_CHAR.
    8         // Template Vars end with (optional) whitespace and (required) Var_DELIMITER.
     7        // Template Vars begin with VARIABLE_DELIMITER and followed by VARIABLE_STARTCHAR.
     8        // Template Vars end with (optional) whitespace and (required) VARIABLE_DELIMITER.
    99       
    10         private static final String Var_DELIMITER = "%";
    11         private static final char Var_START_CHAR = '@';
     10        private static final String VARIABLE_DELIMITER = "###";
     11        private static final char VARIABLE_STARTCHAR = '@';
    1212        private MemoryTemplate template;
    1313
    14         static String templateDirectory = ".";
     14        //static String templateDirectory = ".";
    1515       
    16         public static void setTemplateDirectory(String directory) {
    17                 templateDirectory = directory;
    18         }
     16        //public static void setTemplateDirectory(String directory) {
     17        //      templateDirectory = directory;
     18        //}
    1919       
     20        /*
    2021        private static String templateFilename(String filename) {
    2122                return templateDirectory + "/" + filename;
    2223        }
    23        
     24        */
    2425        public FileTemplate(String templateName, String filename) {
    2526                this.template = new MemoryTemplate(templateName);
    26                 constructTemplateFromFile(templateFilename(filename));
     27                constructTemplateFromFile(/*templateFilename(*/filename/*)*/);
    2728        }
    2829       
    2930        private void constructTemplateFromFile(String filename) {
    3031                String rawFile = stringForFile(filename);
    31                 String[] pieces = rawFile.split(Var_DELIMITER);
     32                String[] pieces = rawFile.split(VARIABLE_DELIMITER);
    3233               
    3334                for(String piece: pieces) {
     
    4344       
    4445        private boolean isAVar(String piece) {
    45                 return !piece.isEmpty() && (piece.charAt(0) == Var_START_CHAR);
     46                return !piece.isEmpty() && (piece.charAt(0) == VARIABLE_STARTCHAR);
    4647        }
    4748       
Note: See TracChangeset for help on using the changeset viewer.