http://git-wip-us.apache.org/repos/asf/airavata-sandbox/blob/4231ac35/datacat/cup_flex/method.flex ---------------------------------------------------------------------- diff --git a/datacat/cup_flex/method.flex b/datacat/cup_flex/method.flex new file mode 100644 index 0000000..81e9c28 --- /dev/null +++ b/datacat/cup_flex/method.flex @@ -0,0 +1,171 @@ +import java_cup.runtime.*; + +%% + +%class MethodLexer +%public +%unicode +%cup +%cupdebug +%state ITER +%state ITER1 +%state IGNOREALL +%standalone +%8bit + +/* ___________________________________________ + Copied verbatim into generated lexer class: +*/ +%{ + public static boolean DEBUG = false; +%} + +LineTerminator = \r|\n|\r\n +InputCharacter = [^\r\n] +WhiteSpace = {LineTerminator} | [ \t\f] +Comment = {TraditionalComment} | {EndOfLineComment} | {DocumentationComment} +TraditionalComment = "/*" [^*] ~"*/" +EndOfLineComment = "//" {InputCharacter}* {LineTerminator} +DocumentationComment = "/**" {CommentContent} "*"+ "/" +CommentContent = ( [^*] | \*+ [^/*] )* /* adjust syntax font-coloring */ +Identifier = [:jletter:] [:jletterdigit:]* +dec_int_lit = 0 | [1-9][0-9]* +dec_int_id = [A-Za-z_][A-Za-z_0-9]* +DIGIT = [0-9] +FLOAT = [+|-]?{DIGIT}+"."{DIGIT}+ +INT = [+|-]?{DIGIT}+ +BOOL = [T|F] +EQ = "=" +STRING = [A-Z]+ +GRAB = [^(" "|\r|\n|\r\n| \t\f)]+ + +%% + +<YYINITIAL>{ + "----------------------" { + if (Settings.DEBUG) System.out.println("MethodFlex: Found Gaussian 98"); + yybegin(ITER); + return new Symbol(MethodSym.FOUNDITER); + } +} + +<ITER> { + "opt" { + System.out.println("MethodFlex: Found opt "); + System.out.println(yytext()); + try{ + PrintStream temp = new PrintStream(new FileOutputStream("runtype1")); + temp.print(yytext()); + System.out.println(yytext());} + catch (IOException ie){ System.out.println("Error in Gaussian Lexer");} + + yybegin(IGNOREALL); + return new Symbol(MethodSym.RUNTYP); + } +/* + "scf" { + if (Settings.DEBUG) System.out.println("MethodFlex: Found scf "); + if (Settings.DEBUG) System.out.println(yytext()); + try{ + PrintStream temp = new PrintStream(new FileOutputStream("runtype1")); + temp.print(yytext()); + System.out.println(yytext());} + catch (IOException ie){ System.out.println("Error in Gaussian Lexer");} + + yybegin(IGNOREALL); + return new Symbol(MethodSym.RUNTYP); + } +*/ + + "G1" { + if (Settings.DEBUG) System.out.println("MethodFlex: Found G1"); + if (Settings.DEBUG) System.out.println(yytext()); + try{ + PrintStream temp = new PrintStream(new FileOutputStream("runtype1")); + temp.print(yytext()); + System.out.println(yytext());} + catch (IOException ie){ System.out.println("Error in Gaussian Lexer");} + yybegin(IGNOREALL); + return new Symbol(MethodSym.RUNTYP); + } + + "G2" { + if (Settings.DEBUG) System.out.println("MethodFlex: Found G2"); + if (Settings.DEBUG) System.out.println(yytext()); + try{ + PrintStream temp = new PrintStream(new FileOutputStream("runtype1")); + temp.print(yytext()); + System.out.println(yytext());} + catch (IOException ie){ System.out.println("Error in Gaussian Lexer");} + yybegin(IGNOREALL); + return new Symbol(MethodSym.RUNTYP); + } + + "CBS-Q" { + if (Settings.DEBUG) System.out.println("MethodFlex: Found CBS-Q"); + if (Settings.DEBUG) System.out.println(yytext()); + try{ + PrintStream temp = new PrintStream(new FileOutputStream("runtype1")); + temp.print(yytext()); + System.out.println(yytext());} + catch (IOException ie){ System.out.println("Error in Gaussian Lexer");} + yybegin(IGNOREALL); + return new Symbol(MethodSym.RUNTYP); + } + + "RUNTYP=ENERGY" { + if (Settings.DEBUG) System.out.println("MethodFlex: RUNTYP=ENERGY"); + if (Settings.DEBUG) System.out.println(yytext()); + try{ + PrintStream temp = new PrintStream(new FileOutputStream("runtype1")); + temp.print("energy"); + System.out.println(yytext());} + catch (IOException ie){ System.out.println("Error in Gaussian Lexer");} + yybegin(IGNOREALL); + return new Symbol(MethodSym.RUNTYP); + } + + "RUNTYP=GRADIENT" { + if (Settings.DEBUG) System.out.println("MethodFlex: RUNTYP=GRADIENT"); + if (Settings.DEBUG) System.out.println(yytext()); + try{ + PrintStream temp = new PrintStream(new FileOutputStream("runtype1")); + temp.print("gradient"); + System.out.println(yytext());} + catch (IOException ie){ System.out.println("Error in Gaussian Lexer");} + yybegin(IGNOREALL); + return new Symbol(MethodSym.RUNTYP); +} + + "RUNTYP=OPTIMIZE" { + if (Settings.DEBUG) System.out.println("MethodFlex: RUNTYP=ENERGY"); + if (Settings.DEBUG) System.out.println(yytext()); + try{ + PrintStream temp = new PrintStream(new FileOutputStream("runtype1")); + temp.print("optimize"); + System.out.println(yytext());} + catch (IOException ie){ System.out.println("Error in Gaussian Lexer");} + yybegin(IGNOREALL); + return new Symbol(MethodSym.RUNTYP); + } +/* + "OPTG" { + System.out.println("MethodFlex: Molpro OPTG"); + System.out.println(yytext()); + try{ + PrintStream temp = new PrintStream(new FileOutputStream("runtype1")); + temp.print("optimize"); + System.out.println(yytext());} + catch (IOException ie){ System.out.println("Error in Gaussian Lexer");} + yybegin(IGNOREALL); + return new Symbol(MethodSym.RUNTYP); + } +*/ +} + + +<IGNOREALL>{ + .|\n {} +} + +.|\n {}
http://git-wip-us.apache.org/repos/asf/airavata-sandbox/blob/4231ac35/datacat/cup_flex/method1.flex ---------------------------------------------------------------------- diff --git a/datacat/cup_flex/method1.flex b/datacat/cup_flex/method1.flex new file mode 100644 index 0000000..ca0f514 --- /dev/null +++ b/datacat/cup_flex/method1.flex @@ -0,0 +1,171 @@ +import java_cup.runtime.*; + +%% + +%class Method1Lexer +%public +%unicode +%cup +%cupdebug +%state ITER +%state ITER1 +%state IGNOREALL +%standalone +%8bit + +/* ___________________________________________ + Copied verbatim into generated lexer class: +*/ +%{ + public static boolean DEBUG = false; +%} + +LineTerminator = \r|\n|\r\n +InputCharacter = [^\r\n] +WhiteSpace = {LineTerminator} | [ \t\f] +Comment = {TraditionalComment} | {EndOfLineComment} | {DocumentationComment} +TraditionalComment = "/*" [^*] ~"*/" +EndOfLineComment = "//" {InputCharacter}* {LineTerminator} +DocumentationComment = "/**" {CommentContent} "*"+ "/" +CommentContent = ( [^*] | \*+ [^/*] )* /* adjust syntax font-coloring */ +Identifier = [:jletter:] [:jletterdigit:]* +dec_int_lit = 0 | [1-9][0-9]* +dec_int_id = [A-Za-z_][A-Za-z_0-9]* +DIGIT = [0-9] +FLOAT = [+|-]?{DIGIT}+"."{DIGIT}+ +INT = [+|-]?{DIGIT}+ +BOOL = [T|F] +EQ = "=" +STRING = [A-Z]+ +GRAB = [^(" "|\r|\n|\r\n| \t\f)]+ + +%% + +<YYINITIAL>{ + "******************************" { + if (Settings.DEBUG) System.out.println("MethodFlex: Found Gaussian 98"); + yybegin(ITER); + return new Symbol(MethodSym.FOUNDITER); + } +} + +<ITER> { + "OPTG" { + System.out.println("MethodFlex: Found opt "); + System.out.println(yytext()); + try{ + PrintStream temp = new PrintStream(new FileOutputStream("runtype1")); + temp.print(yytext()); + System.out.println(yytext());} + catch (IOException ie){ System.out.println("Error in Gaussian Lexer");} + + yybegin(IGNOREALL); + return new Symbol(MethodSym.RUNTYP); + } +/* + "scf" { + if (Settings.DEBUG) System.out.println("MethodFlex: Found scf "); + if (Settings.DEBUG) System.out.println(yytext()); + try{ + PrintStream temp = new PrintStream(new FileOutputStream("runtype1")); + temp.print(yytext()); + System.out.println(yytext());} + catch (IOException ie){ System.out.println("Error in Gaussian Lexer");} + + yybegin(IGNOREALL); + return new Symbol(MethodSym.RUNTYP); + } +*/ + + "G1" { + if (Settings.DEBUG) System.out.println("MethodFlex: Found G1"); + if (Settings.DEBUG) System.out.println(yytext()); + try{ + PrintStream temp = new PrintStream(new FileOutputStream("runtype1")); + temp.print(yytext()); + System.out.println(yytext());} + catch (IOException ie){ System.out.println("Error in Gaussian Lexer");} + yybegin(IGNOREALL); + return new Symbol(MethodSym.RUNTYP); + } + + "G2" { + if (Settings.DEBUG) System.out.println("MethodFlex: Found G2"); + if (Settings.DEBUG) System.out.println(yytext()); + try{ + PrintStream temp = new PrintStream(new FileOutputStream("runtype1")); + temp.print(yytext()); + System.out.println(yytext());} + catch (IOException ie){ System.out.println("Error in Gaussian Lexer");} + yybegin(IGNOREALL); + return new Symbol(MethodSym.RUNTYP); + } + + "CBS-Q" { + if (Settings.DEBUG) System.out.println("MethodFlex: Found CBS-Q"); + if (Settings.DEBUG) System.out.println(yytext()); + try{ + PrintStream temp = new PrintStream(new FileOutputStream("runtype1")); + temp.print(yytext()); + System.out.println(yytext());} + catch (IOException ie){ System.out.println("Error in Gaussian Lexer");} + yybegin(IGNOREALL); + return new Symbol(MethodSym.RUNTYP); + } + + "RUNTYP=ENERGY" { + if (Settings.DEBUG) System.out.println("MethodFlex: RUNTYP=ENERGY"); + if (Settings.DEBUG) System.out.println(yytext()); + try{ + PrintStream temp = new PrintStream(new FileOutputStream("runtype1")); + temp.print("energy"); + System.out.println(yytext());} + catch (IOException ie){ System.out.println("Error in Gaussian Lexer");} + yybegin(IGNOREALL); + return new Symbol(MethodSym.RUNTYP); + } + + "RUNTYP=GRADIENT" { + if (Settings.DEBUG) System.out.println("MethodFlex: RUNTYP=GRADIENT"); + if (Settings.DEBUG) System.out.println(yytext()); + try{ + PrintStream temp = new PrintStream(new FileOutputStream("runtype1")); + temp.print("gradient"); + System.out.println(yytext());} + catch (IOException ie){ System.out.println("Error in Gaussian Lexer");} + yybegin(IGNOREALL); + return new Symbol(MethodSym.RUNTYP); +} + + "RUNTYP=OPTIMIZE" { + if (Settings.DEBUG) System.out.println("MethodFlex: RUNTYP=ENERGY"); + if (Settings.DEBUG) System.out.println(yytext()); + try{ + PrintStream temp = new PrintStream(new FileOutputStream("runtype1")); + temp.print("optimize"); + System.out.println(yytext());} + catch (IOException ie){ System.out.println("Error in Gaussian Lexer");} + yybegin(IGNOREALL); + return new Symbol(MethodSym.RUNTYP); + } +/* + "OPTG" { + System.out.println("MethodFlex: Molpro OPTG"); + System.out.println(yytext()); + try{ + PrintStream temp = new PrintStream(new FileOutputStream("runtype1")); + temp.print("optimize"); + System.out.println(yytext());} + catch (IOException ie){ System.out.println("Error in Gaussian Lexer");} + yybegin(IGNOREALL); + return new Symbol(MethodSym.RUNTYP); + } +*/ +} + + +<IGNOREALL>{ + .|\n {} +} + +.|\n {} http://git-wip-us.apache.org/repos/asf/airavata-sandbox/blob/4231ac35/datacat/cup_flex/mfinalcoord.cup ---------------------------------------------------------------------- diff --git a/datacat/cup_flex/mfinalcoord.cup b/datacat/cup_flex/mfinalcoord.cup new file mode 100644 index 0000000..12025ec --- /dev/null +++ b/datacat/cup_flex/mfinalcoord.cup @@ -0,0 +1,129 @@ +import java_cup.runtime.*; +import javax.swing.*; +import java.util.*; +import java.io.*; + + + +/* +OUTPUT FORMAT:____________________________________________________________ +1NSERCH= 0 + more text + SCF Done: E(RHF) = -7.85284496695 A.U. after 8 cycles + more text + Maximum Force 0.000000 0.000450 YES + RMS Force 0.000000 0.000300 YES + more text +TO MONITOR:____________________________________________________________ + iteration, energy + +MANUALLY ADD TO CUP-GENERATED CLASS IN SCFaParser.java:________________ + + +//add to CUP$SCFaParser$actions +public ParseSCF2 parseSCF; + +//add to the constructor of CUP$SCFaParser$actions + parseSCF = new ParseSCF2(); + +*/ + +action code {: + //__________________________________ + public static boolean DEBUG = true; + private static JTable table; + private static final String tableLabel = "SCF Intermediate Results:"; +// private static String cycle = "0"; + + + public static JTable getTable() { + return table; + } + + public static String getTableLabel() { + return tableLabel; + } + +// } +:} + + + + +terminal INPUT1, FOUNDITER, SCFDONE, DASH1, DASH2; +terminal Integer INPUT2, INPUT3, INPUT4, ITERATION; +terminal Float ENERGY, INPUT5, INPUT6, INPUT7; +non terminal startpt, scfintro, scfpat, scfcycle, cycle, grad1, grad2; +non terminal inp2, inp3, inp5, inp6, inp7, cycle1, cycle2, cycle3; + + +/* ___________ + The grammer */ + +startpt ::= scfintro + scfpat + SCFDONE + ; + + + + +scfintro ::= + FOUNDITER + {: if (DEBUG) System.out.println("CUP:Input: found the start of Iteration"); :} +; + +scfpat ::= scfpat scfcycle + {: if (DEBUG) System.out.println("CUP:Input: in scfpat"); :} + | + scfcycle +; + +scfcycle ::= INPUT1 DASH1 cycle1 DASH2 +; + +cycle1 ::= cycle1 cycle2 + | + cycle2 +; + +cycle2 ::= +inp2 +inp3 +INPUT4 +inp5 +inp6 +inp7 +; + + +inp2 ::= INPUT2:in2 +{: //___________________________________________________________________ + if (DEBUG) System.out.println("CUP:Input: center number "+in2); + :} + ; + + +inp3 ::= INPUT3:in3 +{: //___________________________________________________________________ + if (DEBUG) System.out.println("CUP:Input: atomic number "+in3); + :} + ; + +inp5 ::= INPUT5:in5 +{: //___________________________________________________________________ + if (DEBUG) System.out.println("CUP:Input: x coordinate "+in5); + :} + ; + +inp6 ::= INPUT6:in6 +{: //___________________________________________________________________ + if (DEBUG) System.out.println("CUP:Input: y coordinate "+in6); + :} + ; + +inp7 ::= INPUT7:in7 +{: //___________________________________________________________________ + if (DEBUG) System.out.println("CUP:Input: z coordinate "+in7); + :} + ; http://git-wip-us.apache.org/repos/asf/airavata-sandbox/blob/4231ac35/datacat/cup_flex/mfinalcoord.flex ---------------------------------------------------------------------- diff --git a/datacat/cup_flex/mfinalcoord.flex b/datacat/cup_flex/mfinalcoord.flex new file mode 100644 index 0000000..81578dc --- /dev/null +++ b/datacat/cup_flex/mfinalcoord.flex @@ -0,0 +1,151 @@ +import java_cup.runtime.*; + +%% + +%class MFinalCoordLexer +%public +%unicode +%cup +%cupdebug +%state ITER +%state ITER2 +%state ITER3 +%state INTVALUE +%state FLOATVALUE +%state FLOAT1 +%state FLOAT2 +%state IGNOREALL +%state INPUT +%state INPUTA +%state INPUTB +%state INPUTC +%state INPUTD +%state INPUTE +%state INPUTF +%standalone +%8bit + +/* ___________________________________________ + Copied verbatim into generated lexer class: +*/ +%{ + public static boolean DEBUG = false; +%} + +LineTerminator = \r|\n|\r\n +MFinalCoordCharacter = [^\r\n] +WhiteSpace = {LineTerminator} | [ \t\f] +Comment = {TraditionalComment} | {EndOfLineComment} | {DocumentationComment} +TraditionalComment = "/*" [^*] ~"*/" +EndOfLineComment = "//" {MFinalCoordCharacter}* {LineTerminator} +DocumentationComment = "/**" {CommentContent} "*"+ "/" +CommentContent = ( [^*] | \*+ [^/*] )* /* adjust syntax font-coloring */ +Identifier = [:jletter:] [:jletterdigit:]* +dec_int_lit = 0 | [1-9][0-9]* +dec_int_id = [A-Za-z_] | [A-Za-z][0-9]* +DIGIT = [0-9] +FLOAT = [+|-]?{DIGIT}+"."{DIGIT}+ +INT = [+|-]?{DIGIT}+ +BOOL = [T|F] +EQ = "=" +STRING = [A-Z]+ +GRAB = [^(" "|\r|\n|\r\n| \t\f)]+ + +%% + +<YYINITIAL>{ + "ATOMIC COORDINATES" { + yybegin(ITER); + return new Symbol(MFinalCoordSym.FOUNDITER); + } + "Z-Matrix orientation:" { + yybegin(ITER); + return new Symbol(MFinalCoordSym.FOUNDITER); + } +} + +<ITER>{ + "NR ATOM CHARGE " { + yybegin(INPUTF); + return new Symbol(MFinalCoordSym.INPUT1);} + + "THE_END_OF_FILE" { + yybegin(IGNOREALL); + return new Symbol(MFinalCoordSym.SCFDONE);} + + "Bond lengths in Bohr" { + yybegin(IGNOREALL); + return new Symbol(MFinalCoordSym.SCFDONE);} + + .|\n {} + +} + + +<INPUTF> { + "X Y Z" + { + yybegin (INPUT); + return new Symbol(MFinalCoordSym.DASH1); +} +} + +<INPUT> { + {INT} { + yybegin (INPUTA); + return new Symbol(MFinalCoordSym.INPUT2, new Integer(yytext())); +} + + "---------------------------------------------------------------------" + { + yybegin (ITER); + return new Symbol(MFinalCoordSym.DASH2); +} + +} + + +<INPUTA> { + {dec_int_id} { + yybegin (INPUTB); + return new Symbol(MFinalCoordSym.INPUT3); +} +} + +<INPUTB> { + {FLOAT} { + yybegin (INPUTC); + return new Symbol(MFinalCoordSym.INPUT4, new Float(yytext())); +} +} + +<INPUTC> { + {FLOAT} { + yybegin (INPUTD); + return new Symbol(MFinalCoordSym.INPUT5, new Float(yytext())); +} +} + +<INPUTD> { + {FLOAT} { + yybegin (INPUTE); + return new Symbol(MFinalCoordSym.INPUT6, new Float(yytext())); +} +} + + +<INPUTE> { + {FLOAT} { + yybegin (INPUT); + return new Symbol(MFinalCoordSym.INPUT7, new Float(yytext())); +} +} + + + + +<IGNOREALL>{ + .|\n {} +} + +.|\n {} http://git-wip-us.apache.org/repos/asf/airavata-sandbox/blob/4231ac35/datacat/cup_flex/mopt.flex ---------------------------------------------------------------------- diff --git a/datacat/cup_flex/mopt.flex b/datacat/cup_flex/mopt.flex new file mode 100644 index 0000000..16729b5 --- /dev/null +++ b/datacat/cup_flex/mopt.flex @@ -0,0 +1,169 @@ +import java_cup.runtime.*; + +%% + +%class MOptaLexer +%public +%unicode +%cup +%cupdebug +%state SCF1 +%state ITER +%state ITER2 +%state ITER8 +%state DASH +%state INTVALUE +%state ITER4 +%state ITER5 +%state ITER6 +%state ITER7 +%state ITER8 +%state ITER9 +%state ITER10 +%state ITER11 +%state ITER12 +%state IGNOREALL +%standalone +%8bit + +/* ___________________________________________ + Copied verbatim into generated lexer class: +*/ +%{ + public static boolean DEBUG = false; +%} + +LineTerminator = \r|\n|\r\n +InputCharacter = [^\r\n] +WhiteSpace = {LineTerminator} | [ \t\f] +Comment = {TraditionalComment} | {EndOfLineComment} | {DocumentationComment} +TraditionalComment = "/*" [^*] ~"*/" +EndOfLineComment = "//" {InputCharacter}* {LineTerminator} +DocumentationComment = "/**" {CommentContent} "*"+ "/" +CommentContent = ( [^*] | \*+ [^/*] )* /* adjust syntax font-coloring */ +Identifier = [:jletter:] [:jletterdigit:]* +dec_int_lit = 0 | [1-9][0-9]* +dec_int_id = [A-Za-z_][A-Za-z_0-9]* +DIGIT = [0-9] +FLOAT = [+|-]?{DIGIT}+"."{DIGIT}+ +INT = [+|-]?{DIGIT}+ +BOOL = [T|F] +EQ = "=" +STRING = [A-Z]+ +GRAB = [^(" "|\r|\n|\r\n| \t\f)]+ + +%% + +<YYINITIAL>{ + " ITER. ENERGY(OLD) ENERGY(NEW) DE GRADMAX GRADNORM GRADRMS STEPMAX STEPLEN STEPRMS" { + if (Settings.DEBUG) System.out.println("MOptaFlex: Found START OF"); + yybegin(ITER); + return new Symbol(MOptaSym.FOUNDITER); + } + .|\n {} +} + + +<ITER>{ + {dec_int_lit} { + if (Settings.DEBUG) System.out.println("MOptaFlex: Found the first integer in the iteration"); + if (Settings.DEBUG) System.out.println(yytext()); + yybegin(ITER4); + return new Symbol(MOptaSym.INTCycle, new Integer(yytext()));} + + "Geometry written to block 1 of record 700" { + if (Settings.DEBUG) System.out.println("MOptaFlex: Found the dash"); + yybegin(DASH);} + +} + +<ITER4>{ + {FLOAT} { + if (Settings.DEBUG) System.out.println("MOptaFlex: Found the energy"); + if (Settings.DEBUG) System.out.println(yytext()); + yybegin(ITER5); + return new Symbol(MOptaSym.ENERGY, new Float(yytext()));} +} + +<ITER5>{ + {FLOAT} { if (Settings.DEBUG) System.out.println("MOptaFlex: ITER5"); + if (Settings.DEBUG) System.out.println("MOptaFlex: Found float1"); + yybegin (ITER6); + return new Symbol(MOptaSym.FLOAT1); +} +} + +<ITER6>{ + {FLOAT} { + if (Settings.DEBUG) System.out.println("MOptaFlex: Found float2"); + yybegin (ITER7); + return new Symbol(MOptaSym.FLOAT2); +} +} + + +<ITER7>{ + {FLOAT} { + if (Settings.DEBUG) System.out.println("MOptaFlex: Found float3"); + yybegin(ITER8); + return new Symbol(MOptaSym.FLOAT3);} + .|\n {} +} + + + +<ITER8>{ + {FLOAT} { + if (Settings.DEBUG) System.out.println("MOptaFlex: Found float4"); + yybegin(ITER9); + return new Symbol(MOptaSym.FLOAT4);} + .|\n {} +} + +<ITER9>{ + {FLOAT} { + if (Settings.DEBUG) System.out.println("MOptaFlex: Found float5"); + yybegin(ITER10); + return new Symbol(MOptaSym.FLOAT5);} + .|\n {} +} + +<ITER10>{ + {FLOAT} { + if (Settings.DEBUG) System.out.println("MOptaFlex: Found float6"); + yybegin(ITER11); + return new Symbol(MOptaSym.FLOAT6);} + .|\n {} +} + +<ITER11>{ + {FLOAT} { + if (Settings.DEBUG) System.out.println("MOptaFlex: Found float7"); + yybegin(ITER12); + return new Symbol(MOptaSym.FLOAT7);} + .|\n {} +} + +<ITER12>{ + {FLOAT} { + if (Settings.DEBUG) System.out.println("MOptaFlex: Found float8"); + yybegin(ITER); + return new Symbol(MOptaSym.FLOAT8);} + .|\n {} +} + + + +<DASH>{ + "*********************" { + yybegin(IGNOREALL); + return new Symbol(MOptaSym.SCFDONE); + } + .|\n {} +} + +<IGNOREALL>{ + .|\n {} +} + +.|\n {} http://git-wip-us.apache.org/repos/asf/airavata-sandbox/blob/4231ac35/datacat/cup_flex/mopta.cup ---------------------------------------------------------------------- diff --git a/datacat/cup_flex/mopta.cup b/datacat/cup_flex/mopta.cup new file mode 100644 index 0000000..27bac86 --- /dev/null +++ b/datacat/cup_flex/mopta.cup @@ -0,0 +1,132 @@ +import java_cup.runtime.*; +import javax.swing.*; +import java.util.*; +import java.io.*; + + + +/* +OUTPUT FORMAT:____________________________________________________________ + -------------------------- + RHF SCF CALCULATION + -------------------------- + + NUCLEAR ENERGY = 6.1221376700 + MAXIT = 30 NPUNCH= 2 + EXTRAP=T DAMP=F SHIFT=F RSTRCT=F DIIS=F DEM=F SOSCF=F + DENSITY CONV= 1.00E-05 + MEMORY REQUIRED FOR RHF STEP= 30441 WORDS. + + ITER EX DEM TOTAL ENERGY E CHANGE DENSITY CHANGE DIIS ERROR + 1 0 0 -37.172577283 -37.172577283 0.380764107 0.000000000 + 2 1 0 -37.227975620 -0.055398337 0.131481807 0.000000000 + 3 2 0 -37.231732248 -0.003756628 0.046548652 0.000000000 + 4 3 0 -37.232193210 -0.000460963 0.016847695 0.000000000 + +TO MONITOR:____________________________________________________________ + iteration, energy + +MANUALLY ADD TO CUP-GENERATED CLASS IN SCFaParser.java:________________ + + +//add to CUP$SCFaParser$actions +public ParseSCF2 parseSCF; + +//add to the constructor of CUP$SCFaParser$actions + parseSCF = new ParseSCF2(); + +*/ + +action code {: + //__________________________________ + public static boolean DEBUG = true; + private static JTable table; + private static final String tableLabel = "SCF Intermediate Results:"; +// private static String cycle = "0"; + + + public static JTable getTable() { + return table; + } + + public static String getTableLabel() { + return tableLabel; + } + +/* public static void main(String[] args) throws IOException { + File temp = new File("temporary"); + boolean append = true; + try{ + FileWriter temp1 = new FileWriter(temp, append); + PrintWriter temp2 = new PrintWriter(temp1);} + + catch (FileNotFoundException e) { + System.out.println("no file, dude!"); + } */ +// } +:} + + + + +terminal FOUNDITER, SCFDONE; +terminal Integer INT1, INT2, INT3, INTCycle; +terminal Float FLOAT, FLOAT1, FLOAT2, FLOAT3, ENERGY, FLOAT4; +terminal Float FLOAT5, FLOAT6, FLOAT7, FLOAT8; +non terminal startpt, scfintro, scfpat, scfcycle, en; + + + + +/* ___________ + The grammer */ + +startpt ::= scfintro + scfpat + SCFDONE + {: if (DEBUG) System.out.println("CUP:gscfa: end of parse tree "); + table = new JTable(); + +// table = parseSCF.getTable(); + :} + ; + + + + +scfintro ::= + FOUNDITER + {: if (DEBUG) System.out.println("CUP:gscfa: found start of SCF Iteration"); :} +; + +scfpat ::= scfpat scfcycle + {: if (DEBUG) System.out.println("CUP:gscfa: in scfpat"); :} + | + scfcycle +; + +scfcycle ::= +INTCycle:c +{: //___________________________________________________________________ + if (DEBUG) System.out.println("CUP:gscfa:scfcycle: ITERATION "+c); +// temp2.print(c); +// temp2.print(" "); +// cycle = c; + +// parseSCF.putField("iteration "+cycle, cycle); + :} +en +FLOAT1 FLOAT2 FLOAT3 FLOAT4 FLOAT5 FLOAT6 FLOAT7 FLOAT8 +; + + + + +en ::= +ENERGY:e +{: //___________________________________________________________________ + if (DEBUG) System.out.println("CUP:gscfa:scfcycle: ENERGY "+e); +// temp2.println(e); +// parseSCF.putField("iteration "+cycle, "energy", e); + :} + ; http://git-wip-us.apache.org/repos/asf/airavata-sandbox/blob/4231ac35/datacat/cup_flex/mopta.flex ---------------------------------------------------------------------- diff --git a/datacat/cup_flex/mopta.flex b/datacat/cup_flex/mopta.flex new file mode 100644 index 0000000..749d5f5 --- /dev/null +++ b/datacat/cup_flex/mopta.flex @@ -0,0 +1,179 @@ +import java_cup.runtime.*; + +%% + +%class MOptaLexer +%public +%unicode +%cup +%cupdebug +%state SCF1 +%state ITER +%state ITER2 +%state ITER8 +%state DASH +%state INTVALUE +%state ITER4 +%state ITER5 +%state ITER6 +%state ITER7 +%state ITER8 +%state ITER9 +%state ITER10 +%state ITER11 +%state ITER12 +%state IGNOREALL +%standalone +%8bit + +/* ___________________________________________ + Copied verbatim into generated lexer class: +*/ +%{ + public static boolean DEBUG = false; +%} + +LineTerminator = \r|\n|\r\n +InputCharacter = [^\r\n] +WhiteSpace = {LineTerminator} | [ \t\f] +Comment = {TraditionalComment} | {EndOfLineComment} | {DocumentationComment} +TraditionalComment = "/*" [^*] ~"*/" +EndOfLineComment = "//" {InputCharacter}* {LineTerminator} +DocumentationComment = "/**" {CommentContent} "*"+ "/" +CommentContent = ( [^*] | \*+ [^/*] )* /* adjust syntax font-coloring */ +Identifier = [:jletter:] [:jletterdigit:]* +dec_int_lit = 0 | [1-9][0-9]* +dec_int_id = [A-Za-z_][A-Za-z_0-9]* +DIGIT = [0-9] +FLOAT = [+|-]?"."{DIGIT}+ | [+|-]?{DIGIT}+"."{DIGIT}+ +INT = [+|-]?{DIGIT}+ +BOOL = [T|F] +EQ = "=" +STRING = [A-Z]+ +GRAB = [^(" "|\r|\n|\r\n| \t\f)]+ + +%% + +<YYINITIAL>{ + "ITER. ENERGY(OLD) ENERGY(NEW) DE GRADMAX GRADNORM GRADRMS STEPMAX STEPLEN STEPRMS" { + if (Settings.DEBUG) System.out.println("MOptaFlex: Found START OF"); + yybegin(ITER); + return new Symbol(MOptaSym.FOUNDITER); + } + .|\n {} +} + + +<ITER>{ + + {dec_int_lit} { + if (Settings.DEBUG) System.out.println("MOptaFlex: Found the first integer in the iteration"); + if (Settings.DEBUG) System.out.println(yytext()); + yybegin(ITER4); + return new Symbol(MOptaSym.INTCycle, new Integer(yytext()));} + + "Geometry written to block 1 of record 700" { + if (Settings.DEBUG) System.out.println("MOptaFlex: Found the dash"); + yybegin(DASH);} + +} + +<ITER4>{ + {FLOAT} { + if (Settings.DEBUG) System.out.println("MOptaFlex: Found the energy"); + if (Settings.DEBUG) System.out.println(yytext()); + yybegin(ITER5); + return new Symbol(MOptaSym.ENERGY, new Float(yytext()));} +} + +<ITER5>{ + {FLOAT} { + if (Settings.DEBUG) System.out.println("MOptaFlex: ITER5"); + if (Settings.DEBUG) System.out.println("MOptaFlex: Found float1"); + System.out.println(yytext()); + yybegin (ITER6); + return new Symbol(MOptaSym.FLOAT1); +} +} + +<ITER6>{ + {FLOAT} { + if (Settings.DEBUG) System.out.println("MOptaFlex: Found float2"); + if (Settings.DEBUG) System.out.println(yytext()); + yybegin (ITER7); + return new Symbol(MOptaSym.FLOAT2); +} +} + + +<ITER7>{ + {FLOAT} { + if (Settings.DEBUG) System.out.println("MOptaFlex: Found float3"); + if (Settings.DEBUG) System.out.println(yytext()); + yybegin(ITER8); + return new Symbol(MOptaSym.FLOAT3);} + .|\n {} +} + + + +<ITER8>{ + {FLOAT} { + if (Settings.DEBUG) System.out.println("MOptaFlex: Found float4"); + if (Settings.DEBUG) System.out.println(yytext()); + yybegin(ITER9); + return new Symbol(MOptaSym.FLOAT4);} + .|\n {} +} + +<ITER9>{ + {FLOAT} { + if (Settings.DEBUG) System.out.println("MOptaFlex: Found float5"); + if (Settings.DEBUG) System.out.println(yytext()); + yybegin(ITER10); + return new Symbol(MOptaSym.FLOAT5);} + .|\n {} +} + +<ITER10>{ + {FLOAT} { + if (Settings.DEBUG) System.out.println("MOptaFlex: Found float6"); + if (Settings.DEBUG) System.out.println(yytext()); + yybegin(ITER11); + return new Symbol(MOptaSym.FLOAT6);} + .|\n {} +} + +<ITER11>{ + {FLOAT} { + if (Settings.DEBUG) System.out.println("MOptaFlex: Found float7"); + if (Settings.DEBUG) System.out.println(yytext()); + yybegin(ITER12); + return new Symbol(MOptaSym.FLOAT7);} + .|\n {} +} + +<ITER12>{ + {FLOAT} { + if (Settings.DEBUG) System.out.println("MOptaFlex: Found float8"); + if (Settings.DEBUG) System.out.println(yytext()); + yybegin(ITER); + return new Symbol(MOptaSym.FLOAT8);} + .|\n {} +} + + + +<DASH>{ + "*********************" { + yybegin(IGNOREALL); + return new Symbol(MOptaSym.SCFDONE); + } + .|\n {} +} + +<IGNOREALL>{ + .|\n {} +} + +.|\n {} http://git-wip-us.apache.org/repos/asf/airavata-sandbox/blob/4231ac35/datacat/cup_flex/mp2to5a.cup ---------------------------------------------------------------------- diff --git a/datacat/cup_flex/mp2to5a.cup b/datacat/cup_flex/mp2to5a.cup new file mode 100644 index 0000000..238a085 --- /dev/null +++ b/datacat/cup_flex/mp2to5a.cup @@ -0,0 +1,27 @@ +import java_cup.runtime.*; + +parser code {: ///public static boolean DEBUG = false; :} + +init with {: if(Settings.DEBUG) System.out.println("CUP:mp2to5a: entry"); :}; + +terminal E2, EUMP2, MP4_T, E3, E4_DQ, E4_SDQ, E4_SDTQ, EUMP3, UMP4_DQ, UMP4_SDQ, UMP4_SDTQ; +terminal String FCOPT, FCOPT2, ALGOPT, MP2OPT, VAR, LIM, FLOAT; +non terminal Object startpt, element; + +/* ___________ + The grammer */ + +startpt ::= startpt element + | + element + ; + +element ::= + VAR:s + {: if(Settings.DEBUG) System.out.println("CUP:mp2to5a: MP2-Specific Option: "+s); + ParseMP2to5.put("Variations of MP4: ", s); :} + | + LIM:s + {: if(Settings.DEBUG) System.out.println("CUP:mp2to5a: MP2-Specific Option: "+s); + ParseMP2to5.put("Limitations to MP5: ", s); :} + ; http://git-wip-us.apache.org/repos/asf/airavata-sandbox/blob/4231ac35/datacat/cup_flex/mp2to5a.flex ---------------------------------------------------------------------- diff --git a/datacat/cup_flex/mp2to5a.flex b/datacat/cup_flex/mp2to5a.flex new file mode 100644 index 0000000..e7884f9 --- /dev/null +++ b/datacat/cup_flex/mp2to5a.flex @@ -0,0 +1,172 @@ +/* MP2 to MP5 Keywords + Last Update: 12/31/2000 + http://www.gaussian.com/00000456.htm +*/ + +import java_cup.runtime.*; + + + +%% + + + +%class MP2to5aLexer +%public +%unicode +%cup +%cupdebug +/* %ignorecase */ + +%state FLOATVAL +%state IGNOREALL + +%standalone +%8bit +%{ + public static boolean DEBUG = false; +%} + +/* ______ + Macros */ +LineTerminator = \r|\n|\r\n +InputCharacter = [^\r\n] +WhiteSpace = {LineTerminator} | [ \t\f] + +/* ________ + Comments */ +Comment = {TraditionalComment} | {EndOfLineComment} | {DocumentationComment} +TraditionalComment = "/*" [^*] ~"*/" +EndOfLineComment = "//" {InputCharacter}* {LineTerminator} +DocumentationComment = "/**" {CommentContent} "*"+ "/" +CommentContent = ( [^*] | \*+ [^/*] )* /* adjust syntax font-lock */ +Identifier = [:jletter:] [:jletterdigit:]* + +/* ________________________________________________________________ + A literal integer is is a number beginning with a number between + one and nine followed by zero or more numbers between + zero and nine or just a zero. + + A identifier integer is a word beginning a letter between A and Z, + a and z, or an underscore followed by zero or more letters between + A and Z, a and z, zero and nine, or an underscore. */ +dec_int_lit = 0 | [1-9][0-9]* +dec_int_id = [A-Za-z_][A-Za-z_0-9]* +DIGIT = [0-9] +FLOAT = [+|-]?{DIGIT}+"."{DIGIT}*(["D"|"d"|"E"|"e"]([+|-]?){DIGIT}+)? +INT = [+|-]?{DIGIT}+ +BOOL = [T|F] +WORD = [A-Za-z]+ +WORDLIST = ["("]? [1A-Za-z]+ (","[A-Za-z]+)* [")"]? +GRAB = [^(" "|\r|\n|\r\n| \t\f)]+ +TOEOL = ~(\r|\n|\r\n) + + + +%% + + + +/* +<YYINITIAL>{ + [R|U]?"MP5" {if(Settings.DEBUG) System.out.println("JFlex:pound:POUND: "+yytext()); + } + [R|U]?"MP5"{WORDLIST} {if(Settings.DEBUG) System.out.println("JFlex:pound:POUND: "+yytext()); + } + [R|U]?"MP5="{WORD} {if(Settings.DEBUG) System.out.println("JFlex:pound:POUND: "+yytext()); + } + [R|U]?"MP5="{WORDLIST} {if(Settings.DEBUG) System.out.println("JFlex:pound:POUND: "+yytext()); + } + [R|U]?"MP4(SD)" {if(Settings.DEBUG) System.out.println("JFlex:pound:POUND: "+yytext()); + } + [R|U]?"MP4(SD)"{WORDLIST} {if(Settings.DEBUG) System.out.println("JFlex:pound:POUND: "+yytext()); + } + [R|U]?"MP4(SD)="{WORD} {if(Settings.DEBUG) System.out.println("JFlex:pound:POUND: "+yytext()); + } + [R|U]?"MP4(SD)="{WORDLIST} {if(Settings.DEBUG) System.out.println("JFlex:pound:POUND: "+yytext()); + } + [R|U]?"MP4(DQ)" {if(Settings.DEBUG) System.out.println("JFlex:pound:POUND: "+yytext()); + } + [R|U]?"MP4(DQ)"{WORDLIST} {if(Settings.DEBUG) System.out.println("JFlex:pound:POUND: "+yytext()); + } + [R|U]?"MP4(DQ)="{WORD} {if(Settings.DEBUG) System.out.println("JFlex:pound:POUND: "+yytext()); + } + [R|U]?"MP4(DQ)="{WORDLIST} {if(Settings.DEBUG) System.out.println("JFlex:pound:POUND: "+yytext()); + } + [R|U]?"MP4(SDQ)" {if(Settings.DEBUG) System.out.println("JFlex:pound:POUND: "+yytext()); + } + [R|U]?"MP4(SDQ)"{WORDLIST} {if(Settings.DEBUG) System.out.println("JFlex:pound:POUND: "+yytext()); + } + [R|U]?"MP4(SDQ)="{WORD} {if(Settings.DEBUG) System.out.println("JFlex:pound:POUND: "+yytext()); + } + [R|U]?"MP4(SDQ)="{WORDLIST} {if(Settings.DEBUG) System.out.println("JFlex:pound:POUND: "+yytext()); + } + [R|U]?"MP4(SDTQ)" {if(Settings.DEBUG) System.out.println("JFlex:pound:POUND: "+yytext()); + } + [R|U]?"MP4(SDTQ)"{WORDLIST} {if(Settings.DEBUG) System.out.println("JFlex:pound:POUND: "+yytext()); + } + [R|U]?"MP4(SDTQ)="{WORD} {if(Settings.DEBUG) System.out.println("JFlex:pound:POUND: "+yytext()); + } + [R|U]?"MP4(SDTQ)="{WORDLIST} {if(Settings.DEBUG) System.out.println("JFlex:pound:POUND: "+yytext()); + } + [R|U]?"MP4SDTQ" {if(Settings.DEBUG) System.out.println("JFlex:pound:POUND: "+yytext()); + } + [R|U]?"MP4SDTQ"{WORDLIST} {if(Settings.DEBUG) System.out.println("JFlex:pound:POUND: "+yytext()); + } + [R|U]?"MP4SDTQ="{WORD} {if(Settings.DEBUG) System.out.println("JFlex:pound:POUND: "+yytext()); + } + [R|U]?"MP4SDTQ="{WORDLIST} {if(Settings.DEBUG) System.out.println("JFlex:pound:POUND: "+yytext()); + } + [R|U]?"MP"{INT} {if(Settings.DEBUG) System.out.println("JFlex:pound:POUND: "+yytext()); + } + [R|U]?"MP"{INT}{WORDLIST} {if(Settings.DEBUG) System.out.println("JFlex:pound:POUND: "+yytext()); + } + [R|U]?"MP"{INT}"="{WORD} {if(Settings.DEBUG) System.out.println("JFlex:pound:POUND: "+yytext()); + } + [R|U]?"MP"{INT}"="{WORDLIST} {if(Settings.DEBUG) System.out.println("JFlex:pound:POUND: "+yytext()); + } +.|\n {} +} +*/ + + + +<YYINITIAL>{ +/* _________________ + Variations of MP4 */ + + "MP4(DQ)" {if(Settings.DEBUG) System.out.println("JFlex:mp2to5: "+yytext()); + return new Symbol(MP2to5aSym.VAR, yytext()); + } + "MP4(SDQ)" {if(Settings.DEBUG) System.out.println("JFlex:mp2to5: "+yytext()); + return new Symbol(MP2to5aSym.VAR, yytext()); + } + "MP4(SDTQ)" {if(Settings.DEBUG) System.out.println("JFlex:mp2to5: "+yytext()); + return new Symbol(MP2to5aSym.VAR, yytext()); + } +/* __________________ + Limitations to MP5 */ + + "MP5" {if(Settings.DEBUG) System.out.println("JFlex:mp2to5: "+yytext()); + return new Symbol(MP2to5aSym.LIM, yytext()); + } + "UMP5" {if(Settings.DEBUG) System.out.println("JFlex:mp2to5: "+yytext()); + return new Symbol(MP2to5aSym.LIM, yytext()); + } + .|\n {} +} + +<FLOATVAL>{ + {FLOAT} {if(Settings.DEBUG) System.out.println("JFlex:mp2to5: "+yytext()); + yybegin(YYINITIAL); + return new Symbol(MP2to5aSym.FLOAT, yytext()); + } +} + + +<IGNOREALL>{ + .|\n {} +} + +.|\n {} + http://git-wip-us.apache.org/repos/asf/airavata-sandbox/blob/4231ac35/datacat/cup_flex/mp2to5b.cup ---------------------------------------------------------------------- diff --git a/datacat/cup_flex/mp2to5b.cup b/datacat/cup_flex/mp2to5b.cup new file mode 100644 index 0000000..b07cb70 --- /dev/null +++ b/datacat/cup_flex/mp2to5b.cup @@ -0,0 +1,27 @@ +import java_cup.runtime.*; + +parser code {: ///public static boolean DEBUG = false; :} + +init with {: if(Settings.DEBUG) System.out.println("CUP:mp2to5b: entry"); :}; + +terminal E2, EUMP2, MP4_T, E3, E4_DQ, E4_SDQ, E4_SDTQ, EUMP3, UMP4_DQ, UMP4_SDQ, UMP4_SDTQ; +terminal String FCOPT, FCOPT2, ALGOPT, MP2OPT, VAR, LIM, FLOAT; +non terminal Object startpt, element; + +/* ___________ + The grammer */ + +startpt ::= startpt element + | + element + ; + +element ::= + FCOPT:s + {: if(Settings.DEBUG) System.out.println("CUP:mp2to5b: Frozen Core Option: "+s); + ParseMP2to5.put("Frozen Core Option: ", s); :} + | + FCOPT2:s + {: if(Settings.DEBUG) System.out.println("CUP:mp2to5b: Frozen Core Option: "+s); + ParseMP2to5.put("Frozen Core Option? (Check raw output) ", s); :} + ; http://git-wip-us.apache.org/repos/asf/airavata-sandbox/blob/4231ac35/datacat/cup_flex/mp2to5b.flex ---------------------------------------------------------------------- diff --git a/datacat/cup_flex/mp2to5b.flex b/datacat/cup_flex/mp2to5b.flex new file mode 100644 index 0000000..13b3697 --- /dev/null +++ b/datacat/cup_flex/mp2to5b.flex @@ -0,0 +1,187 @@ +/* MP2 to MP5 Keywords + Last Update: 12/31/2000 + http://www.gaussian.com/00000456.htm +*/ + +import java_cup.runtime.*; + + + +%% + + + +%class MP2to5bLexer +%public +%unicode +%cup +%cupdebug +/* %ignorecase */ + +%state FLOATVAL +%state IGNOREALL + +%standalone +%8bit +%{ + public static boolean DEBUG = false; +%} + +/* ______ + Macros */ +LineTerminator = \r|\n|\r\n +InputCharacter = [^\r\n] +WhiteSpace = {LineTerminator} | [ \t\f] + +/* ________ + Comments */ +Comment = {TraditionalComment} | {EndOfLineComment} | {DocumentationComment} +TraditionalComment = "/*" [^*] ~"*/" +EndOfLineComment = "//" {InputCharacter}* {LineTerminator} +DocumentationComment = "/**" {CommentContent} "*"+ "/" +CommentContent = ( [^*] | \*+ [^/*] )* /* adjust syntax font-lock */ +Identifier = [:jletter:] [:jletterdigit:]* + +/* ________________________________________________________________ + A literal integer is is a number beginning with a number between + one and nine followed by zero or more numbers between + zero and nine or just a zero. + + A identifier integer is a word beginning a letter between A and Z, + a and z, or an underscore followed by zero or more letters between + A and Z, a and z, zero and nine, or an underscore. */ +dec_int_lit = 0 | [1-9][0-9]* +dec_int_id = [A-Za-z_][A-Za-z_0-9]* +DIGIT = [0-9] +FLOAT = [+|-]?{DIGIT}+"."{DIGIT}*(["D"|"d"|"E"|"e"]([+|-]?){DIGIT}+)? +INT = [+|-]?{DIGIT}+ +BOOL = [T|F] +WORD = [A-Za-z]+ +WORDLIST = ["("]? [1A-Za-z]+ (","[A-Za-z]+)* [")"]? +GRAB = [^(" "|\r|\n|\r\n| \t\f)]+ +TOEOL = ~(\r|\n|\r\n) + + + +%% + + + +/* +<YYINITIAL>{ + [R|U]?"MP5" {if(Settings.DEBUG) System.out.println("JFlex:pound:POUND: "+yytext()); + } + [R|U]?"MP5"{WORDLIST} {if(Settings.DEBUG) System.out.println("JFlex:pound:POUND: "+yytext()); + } + [R|U]?"MP5="{WORD} {if(Settings.DEBUG) System.out.println("JFlex:pound:POUND: "+yytext()); + } + [R|U]?"MP5="{WORDLIST} {if(Settings.DEBUG) System.out.println("JFlex:pound:POUND: "+yytext()); + } + [R|U]?"MP4(SD)" {if(Settings.DEBUG) System.out.println("JFlex:pound:POUND: "+yytext()); + } + [R|U]?"MP4(SD)"{WORDLIST} {if(Settings.DEBUG) System.out.println("JFlex:pound:POUND: "+yytext()); + } + [R|U]?"MP4(SD)="{WORD} {if(Settings.DEBUG) System.out.println("JFlex:pound:POUND: "+yytext()); + } + [R|U]?"MP4(SD)="{WORDLIST} {if(Settings.DEBUG) System.out.println("JFlex:pound:POUND: "+yytext()); + } + [R|U]?"MP4(DQ)" {if(Settings.DEBUG) System.out.println("JFlex:pound:POUND: "+yytext()); + } + [R|U]?"MP4(DQ)"{WORDLIST} {if(Settings.DEBUG) System.out.println("JFlex:pound:POUND: "+yytext()); + } + [R|U]?"MP4(DQ)="{WORD} {if(Settings.DEBUG) System.out.println("JFlex:pound:POUND: "+yytext()); + } + [R|U]?"MP4(DQ)="{WORDLIST} {if(Settings.DEBUG) System.out.println("JFlex:pound:POUND: "+yytext()); + } + [R|U]?"MP4(SDQ)" {if(Settings.DEBUG) System.out.println("JFlex:pound:POUND: "+yytext()); + } + [R|U]?"MP4(SDQ)"{WORDLIST} {if(Settings.DEBUG) System.out.println("JFlex:pound:POUND: "+yytext()); + } + [R|U]?"MP4(SDQ)="{WORD} {if(Settings.DEBUG) System.out.println("JFlex:pound:POUND: "+yytext()); + } + [R|U]?"MP4(SDQ)="{WORDLIST} {if(Settings.DEBUG) System.out.println("JFlex:pound:POUND: "+yytext()); + } + [R|U]?"MP4(SDTQ)" {if(Settings.DEBUG) System.out.println("JFlex:pound:POUND: "+yytext()); + } + [R|U]?"MP4(SDTQ)"{WORDLIST} {if(Settings.DEBUG) System.out.println("JFlex:pound:POUND: "+yytext()); + } + [R|U]?"MP4(SDTQ)="{WORD} {if(Settings.DEBUG) System.out.println("JFlex:pound:POUND: "+yytext()); + } + [R|U]?"MP4(SDTQ)="{WORDLIST} {if(Settings.DEBUG) System.out.println("JFlex:pound:POUND: "+yytext()); + } + [R|U]?"MP4SDTQ" {if(Settings.DEBUG) System.out.println("JFlex:pound:POUND: "+yytext()); + } + [R|U]?"MP4SDTQ"{WORDLIST} {if(Settings.DEBUG) System.out.println("JFlex:pound:POUND: "+yytext()); + } + [R|U]?"MP4SDTQ="{WORD} {if(Settings.DEBUG) System.out.println("JFlex:pound:POUND: "+yytext()); + } + [R|U]?"MP4SDTQ="{WORDLIST} {if(Settings.DEBUG) System.out.println("JFlex:pound:POUND: "+yytext()); + } + [R|U]?"MP"{INT} {if(Settings.DEBUG) System.out.println("JFlex:pound:POUND: "+yytext()); + } + [R|U]?"MP"{INT}{WORDLIST} {if(Settings.DEBUG) System.out.println("JFlex:pound:POUND: "+yytext()); + } + [R|U]?"MP"{INT}"="{WORD} {if(Settings.DEBUG) System.out.println("JFlex:pound:POUND: "+yytext()); + } + [R|U]?"MP"{INT}"="{WORDLIST} {if(Settings.DEBUG) System.out.println("JFlex:pound:POUND: "+yytext()); + } +.|\n {} +} +*/ + + + +<YYINITIAL>{ +/* ___________________ + Frozen Core Options */ + + "FC" {if(Settings.DEBUG) System.out.println("JFlex:mp2to5: "+yytext()); + return new Symbol(MP2to5bSym.FCOPT, yytext()); + } + "Full" {if(Settings.DEBUG) System.out.println("JFlex:mp2to5: "+yytext()); + return new Symbol(MP2to5bSym.FCOPT, yytext()); + } + "RW" {if(Settings.DEBUG) System.out.println("JFlex:mp2to5: "+yytext()); + return new Symbol(MP2to5bSym.FCOPT, yytext()); + } + "0,0" {if(Settings.DEBUG) System.out.println("JFlex:mp2to5: "+yytext()); + return new Symbol(MP2to5bSym.FCOPT2, yytext()); + } + "5,0" {if(Settings.DEBUG) System.out.println("JFlex:mp2to5: "+yytext()); + return new Symbol(MP2to5bSym.FCOPT2, yytext()); + } + "5,-4" {if(Settings.DEBUG) System.out.println("JFlex:mp2to5: "+yytext()); + return new Symbol(MP2to5bSym.FCOPT2, yytext()); + } + "6,22" {if(Settings.DEBUG) System.out.println("JFlex:mp2to5: "+yytext()); + return new Symbol(MP2to5bSym.FCOPT2, yytext()); + } + "-6" {if(Settings.DEBUG) System.out.println("JFlex:mp2to5: "+yytext()); + return new Symbol(MP2to5bSym.FCOPT2, yytext()); + } + "ReadWindow" {if(Settings.DEBUG) System.out.println("JFlex:mp2to5: "+yytext()); + return new Symbol(MP2to5bSym.FCOPT, yytext()); + } + "Window=" {if(Settings.DEBUG) System.out.println("JFlex:mp2to5: "+yytext()); + return new Symbol(MP2to5bSym.FCOPT, yytext()); + } + "CASSCF" {if(Settings.DEBUG) System.out.println("JFlex:mp2to5: "+yytext()); + return new Symbol(MP2to5bSym.FCOPT, yytext()); + } + .|\n {} +} + +<FLOATVAL>{ + {FLOAT} {if(Settings.DEBUG) System.out.println("JFlex:mp2to5: "+yytext()); + yybegin(YYINITIAL); + return new Symbol(MP2to5bSym.FLOAT, yytext()); + } +} + + +<IGNOREALL>{ + .|\n {} +} + +.|\n {} + http://git-wip-us.apache.org/repos/asf/airavata-sandbox/blob/4231ac35/datacat/cup_flex/mp2to5c.cup ---------------------------------------------------------------------- diff --git a/datacat/cup_flex/mp2to5c.cup b/datacat/cup_flex/mp2to5c.cup new file mode 100644 index 0000000..2623353 --- /dev/null +++ b/datacat/cup_flex/mp2to5c.cup @@ -0,0 +1,27 @@ +import java_cup.runtime.*; + +parser code {: ///public static boolean DEBUG = false; :} + +init with {: if(Settings.DEBUG) System.out.println("CUP:mp2to5c: entry"); :}; + +terminal E2, EUMP2, MP4_T, E3, E4_DQ, E4_SDQ, E4_SDTQ, EUMP3, UMP4_DQ, UMP4_SDQ, UMP4_SDTQ; +terminal String FCOPT, FCOPT2, ALGOPT, MP2OPT, VAR, LIM, FLOAT; +non terminal Object startpt, element; + +/* ___________ + The grammer */ + +startpt ::= startpt element + | + element + ; + +element ::= + ALGOPT:s + {: if(Settings.DEBUG) System.out.println("CUP:mp2to5c: Algorithm Option: "+s); + ParseMP2to5.put("Algorithm Option: ", s); :} + | + MP2OPT:s + {: if(Settings.DEBUG) System.out.println("CUP:mp2to5c: MP2-Specific Option: "+s); + ParseMP2to5.put("MP2-Specific Option: ", s); :} + ; http://git-wip-us.apache.org/repos/asf/airavata-sandbox/blob/4231ac35/datacat/cup_flex/mp2to5c.flex ---------------------------------------------------------------------- diff --git a/datacat/cup_flex/mp2to5c.flex b/datacat/cup_flex/mp2to5c.flex new file mode 100644 index 0000000..375b2b0 --- /dev/null +++ b/datacat/cup_flex/mp2to5c.flex @@ -0,0 +1,174 @@ +/* MP2 to MP5 Keywords + Last Update: 12/31/2000 + http://www.gaussian.com/00000456.htm +*/ + +import java_cup.runtime.*; + + + +%% + + + +%class MP2to5cLexer +%public +%unicode +%cup +%cupdebug +/* %ignorecase */ + +%state FLOATVAL +%state IGNOREALL + +%standalone +%8bit +%{ + public static boolean DEBUG = false; +%} + +/* ______ + Macros */ +LineTerminator = \r|\n|\r\n +InputCharacter = [^\r\n] +WhiteSpace = {LineTerminator} | [ \t\f] + +/* ________ + Comments */ +Comment = {TraditionalComment} | {EndOfLineComment} | {DocumentationComment} +TraditionalComment = "/*" [^*] ~"*/" +EndOfLineComment = "//" {InputCharacter}* {LineTerminator} +DocumentationComment = "/**" {CommentContent} "*"+ "/" +CommentContent = ( [^*] | \*+ [^/*] )* /* adjust syntax font-lock */ +Identifier = [:jletter:] [:jletterdigit:]* + +/* ________________________________________________________________ + A literal integer is is a number beginning with a number between + one and nine followed by zero or more numbers between + zero and nine or just a zero. + + A identifier integer is a word beginning a letter between A and Z, + a and z, or an underscore followed by zero or more letters between + A and Z, a and z, zero and nine, or an underscore. */ +dec_int_lit = 0 | [1-9][0-9]* +dec_int_id = [A-Za-z_][A-Za-z_0-9]* +DIGIT = [0-9] +FLOAT = [+|-]?{DIGIT}+"."{DIGIT}*(["D"|"d"|"E"|"e"]([+|-]?){DIGIT}+)? +INT = [+|-]?{DIGIT}+ +BOOL = [T|F] +WORD = [A-Za-z]+ +WORDLIST = ["("]? [1A-Za-z]+ (","[A-Za-z]+)* [")"]? +GRAB = [^(" "|\r|\n|\r\n| \t\f)]+ +TOEOL = ~(\r|\n|\r\n) + + + +%% + + + +/* +<YYINITIAL>{ + [R|U]?"MP5" {if(Settings.DEBUG) System.out.println("JFlex:pound:POUND: "+yytext()); + } + [R|U]?"MP5"{WORDLIST} {if(Settings.DEBUG) System.out.println("JFlex:pound:POUND: "+yytext()); + } + [R|U]?"MP5="{WORD} {if(Settings.DEBUG) System.out.println("JFlex:pound:POUND: "+yytext()); + } + [R|U]?"MP5="{WORDLIST} {if(Settings.DEBUG) System.out.println("JFlex:pound:POUND: "+yytext()); + } + [R|U]?"MP4(SD)" {if(Settings.DEBUG) System.out.println("JFlex:pound:POUND: "+yytext()); + } + [R|U]?"MP4(SD)"{WORDLIST} {if(Settings.DEBUG) System.out.println("JFlex:pound:POUND: "+yytext()); + } + [R|U]?"MP4(SD)="{WORD} {if(Settings.DEBUG) System.out.println("JFlex:pound:POUND: "+yytext()); + } + [R|U]?"MP4(SD)="{WORDLIST} {if(Settings.DEBUG) System.out.println("JFlex:pound:POUND: "+yytext()); + } + [R|U]?"MP4(DQ)" {if(Settings.DEBUG) System.out.println("JFlex:pound:POUND: "+yytext()); + } + [R|U]?"MP4(DQ)"{WORDLIST} {if(Settings.DEBUG) System.out.println("JFlex:pound:POUND: "+yytext()); + } + [R|U]?"MP4(DQ)="{WORD} {if(Settings.DEBUG) System.out.println("JFlex:pound:POUND: "+yytext()); + } + [R|U]?"MP4(DQ)="{WORDLIST} {if(Settings.DEBUG) System.out.println("JFlex:pound:POUND: "+yytext()); + } + [R|U]?"MP4(SDQ)" {if(Settings.DEBUG) System.out.println("JFlex:pound:POUND: "+yytext()); + } + [R|U]?"MP4(SDQ)"{WORDLIST} {if(Settings.DEBUG) System.out.println("JFlex:pound:POUND: "+yytext()); + } + [R|U]?"MP4(SDQ)="{WORD} {if(Settings.DEBUG) System.out.println("JFlex:pound:POUND: "+yytext()); + } + [R|U]?"MP4(SDQ)="{WORDLIST} {if(Settings.DEBUG) System.out.println("JFlex:pound:POUND: "+yytext()); + } + [R|U]?"MP4(SDTQ)" {if(Settings.DEBUG) System.out.println("JFlex:pound:POUND: "+yytext()); + } + [R|U]?"MP4(SDTQ)"{WORDLIST} {if(Settings.DEBUG) System.out.println("JFlex:pound:POUND: "+yytext()); + } + [R|U]?"MP4(SDTQ)="{WORD} {if(Settings.DEBUG) System.out.println("JFlex:pound:POUND: "+yytext()); + } + [R|U]?"MP4(SDTQ)="{WORDLIST} {if(Settings.DEBUG) System.out.println("JFlex:pound:POUND: "+yytext()); + } + [R|U]?"MP4SDTQ" {if(Settings.DEBUG) System.out.println("JFlex:pound:POUND: "+yytext()); + } + [R|U]?"MP4SDTQ"{WORDLIST} {if(Settings.DEBUG) System.out.println("JFlex:pound:POUND: "+yytext()); + } + [R|U]?"MP4SDTQ="{WORD} {if(Settings.DEBUG) System.out.println("JFlex:pound:POUND: "+yytext()); + } + [R|U]?"MP4SDTQ="{WORDLIST} {if(Settings.DEBUG) System.out.println("JFlex:pound:POUND: "+yytext()); + } + [R|U]?"MP"{INT} {if(Settings.DEBUG) System.out.println("JFlex:pound:POUND: "+yytext()); + } + [R|U]?"MP"{INT}{WORDLIST} {if(Settings.DEBUG) System.out.println("JFlex:pound:POUND: "+yytext()); + } + [R|U]?"MP"{INT}"="{WORD} {if(Settings.DEBUG) System.out.println("JFlex:pound:POUND: "+yytext()); + } + [R|U]?"MP"{INT}"="{WORDLIST} {if(Settings.DEBUG) System.out.println("JFlex:pound:POUND: "+yytext()); + } +.|\n {} +} +*/ + + + +<YYINITIAL>{ +/* ___________________________ + Algorithm Selection Options */ + + "FullDirect" {if(Settings.DEBUG) System.out.println("JFlex:mp2to5: "+yytext()); + return new Symbol(MP2to5cSym.ALGOPT, yytext()); + } + "SemiDirect" {if(Settings.DEBUG) System.out.println("JFlex:mp2to5: "+yytext()); + return new Symbol(MP2to5cSym.ALGOPT, yytext()); + } + "Direct" {if(Settings.DEBUG) System.out.println("JFlex:mp2to5: "+yytext()); + return new Symbol(MP2to5cSym.ALGOPT, yytext()); + } + "InCore" {if(Settings.DEBUG) System.out.println("JFlex:mp2to5: "+yytext()); + return new Symbol(MP2to5cSym.ALGOPT, yytext()); + } +/* ____________________ + MP2-Specific Options */ + "Stingy" {if(Settings.DEBUG) System.out.println("JFlex:mp2to5: "+yytext()); + return new Symbol(MP2to5cSym.MP2OPT, yytext()); + } + "VeryStingy" {if(Settings.DEBUG) System.out.println("JFlex:mp2to5: "+yytext()); + return new Symbol(MP2to5cSym.MP2OPT, yytext()); + } + .|\n {} +} + +<FLOATVAL>{ + {FLOAT} {if(Settings.DEBUG) System.out.println("JFlex:mp2to5: "+yytext()); + yybegin(YYINITIAL); + return new Symbol(MP2to5cSym.FLOAT, yytext()); + } +} + + +<IGNOREALL>{ + .|\n {} +} + +.|\n {} + http://git-wip-us.apache.org/repos/asf/airavata-sandbox/blob/4231ac35/datacat/cup_flex/mp2to5d.cup ---------------------------------------------------------------------- diff --git a/datacat/cup_flex/mp2to5d.cup b/datacat/cup_flex/mp2to5d.cup new file mode 100644 index 0000000..afc7011 --- /dev/null +++ b/datacat/cup_flex/mp2to5d.cup @@ -0,0 +1,63 @@ +import java_cup.runtime.*; + +parser code {: ///public static boolean DEBUG = false; :} + +init with {: if(Settings.DEBUG) System.out.println("CUP:mp2to5d: entry"); :}; + +terminal E2, EUMP2, MP4_T, E3, E4_DQ, E4_SDQ, E4_SDTQ, EUMP3, UMP4_DQ, UMP4_SDQ, UMP4_SDTQ; +terminal String FCOPT, FCOPT2, ALGOPT, MP2OPT, VAR, LIM, FLOAT; +non terminal Object startpt, element; + +/* ___________ + The grammer */ + +startpt ::= startpt element + | + element + ; + +element ::= + E2 FLOAT:f + {: if(Settings.DEBUG) System.out.println("CUP:mp2to5d: E2"+f); + ParseMP2to5.put("E2", f); :} + | + EUMP2 FLOAT:f + {: if(Settings.DEBUG) System.out.println("CUP:mp2to5d: MP2 energy EUMP2"+f); + ParseMP2to5.put("MP2 energy EUMP2", f); :} + | + MP4_T FLOAT:f + {: if(Settings.DEBUG) System.out.println("CUP:mp2to5d: MP4(T)"+f); + ParseMP2to5.put("MP4(T)", f); :} + | + E3 FLOAT:f + {: if(Settings.DEBUG) System.out.println("CUP:mp2to5d: E3"+f); + ParseMP2to5.put("E3", f); :} + | + E4_DQ FLOAT:f + {: if(Settings.DEBUG) System.out.println("CUP:mp2to5d: E4(DQ)"+f); + ParseMP2to5.put("E4(DQ)", f); :} + | + E4_SDQ FLOAT:f + {: if(Settings.DEBUG) System.out.println("CUP:mp2to5d: E4(SDQ)"+f); + ParseMP2to5.put("E4(SDQ)", f); :} + | + E4_SDTQ FLOAT:f + {: if(Settings.DEBUG) System.out.println("CUP:mp2to5d: E4(SDTQ)"+f); + ParseMP2to5.put("E4(SDTQ)", f); :} + | + EUMP3 FLOAT:f + {: if(Settings.DEBUG) System.out.println("CUP:mp2to5d: MP3 correction EUMP3"+f); + ParseMP2to5.put("MP3 correction EUMP3", f); :} + | + UMP4_DQ FLOAT:f + {: if(Settings.DEBUG) System.out.println("CUP:mp2to5d: MP4 correction UMP4(DQ)"+f); + ParseMP2to5.put("MP4 correction UMP4(DQ)", f); :} + | + UMP4_SDQ FLOAT:f + {: if(Settings.DEBUG) System.out.println("CUP:mp2to5d: MP4 correction UMP4(SDQ)"+f); + ParseMP2to5.put("MP4 correction UMP4(SDQ)", f); :} + | + UMP4_SDTQ FLOAT:f + {: if(Settings.DEBUG) System.out.println("CUP:mp2to5d: MP4 correction UMP4(SDTQ)"+f); + ParseMP2to5.put("MP4 correction UMP4(SDTQ)", f); :} + ; http://git-wip-us.apache.org/repos/asf/airavata-sandbox/blob/4231ac35/datacat/cup_flex/mp2to5d.flex ---------------------------------------------------------------------- diff --git a/datacat/cup_flex/mp2to5d.flex b/datacat/cup_flex/mp2to5d.flex new file mode 100644 index 0000000..c94c60a --- /dev/null +++ b/datacat/cup_flex/mp2to5d.flex @@ -0,0 +1,198 @@ +/* MP2 to MP5 Keywords + Last Update: 12/31/2000 + http://www.gaussian.com/00000456.htm +*/ + +import java_cup.runtime.*; + + + +%% + + + +%class MP2to5dLexer +%public +%unicode +%cup +%cupdebug +/* %ignorecase */ + +%state FLOATVAL +%state IGNOREALL + +%standalone +%8bit +%{ + public static boolean DEBUG = false; +%} + +/* ______ + Macros */ +LineTerminator = \r|\n|\r\n +InputCharacter = [^\r\n] +WhiteSpace = {LineTerminator} | [ \t\f] + +/* ________ + Comments */ +Comment = {TraditionalComment} | {EndOfLineComment} | {DocumentationComment} +TraditionalComment = "/*" [^*] ~"*/" +EndOfLineComment = "//" {InputCharacter}* {LineTerminator} +DocumentationComment = "/**" {CommentContent} "*"+ "/" +CommentContent = ( [^*] | \*+ [^/*] )* /* adjust syntax font-lock */ +Identifier = [:jletter:] [:jletterdigit:]* + +/* ________________________________________________________________ + A literal integer is is a number beginning with a number between + one and nine followed by zero or more numbers between + zero and nine or just a zero. + + A identifier integer is a word beginning a letter between A and Z, + a and z, or an underscore followed by zero or more letters between + A and Z, a and z, zero and nine, or an underscore. */ +dec_int_lit = 0 | [1-9][0-9]* +dec_int_id = [A-Za-z_][A-Za-z_0-9]* +DIGIT = [0-9] +FLOAT = [+|-]?{DIGIT}+"."{DIGIT}*(["D"|"d"|"E"|"e"]([+|-]?){DIGIT}+)? +INT = [+|-]?{DIGIT}+ +BOOL = [T|F] +WORD = [A-Za-z]+ +WORDLIST = ["("]? [1A-Za-z]+ (","[A-Za-z]+)* [")"]? +GRAB = [^(" "|\r|\n|\r\n| \t\f)]+ +TOEOL = ~(\r|\n|\r\n) + + + +%% + + + +/* +<YYINITIAL>{ + [R|U]?"MP5" {if(Settings.DEBUG) System.out.println("JFlex:pound:POUND: "+yytext()); + } + [R|U]?"MP5"{WORDLIST} {if(Settings.DEBUG) System.out.println("JFlex:pound:POUND: "+yytext()); + } + [R|U]?"MP5="{WORD} {if(Settings.DEBUG) System.out.println("JFlex:pound:POUND: "+yytext()); + } + [R|U]?"MP5="{WORDLIST} {if(Settings.DEBUG) System.out.println("JFlex:pound:POUND: "+yytext()); + } + [R|U]?"MP4(SD)" {if(Settings.DEBUG) System.out.println("JFlex:pound:POUND: "+yytext()); + } + [R|U]?"MP4(SD)"{WORDLIST} {if(Settings.DEBUG) System.out.println("JFlex:pound:POUND: "+yytext()); + } + [R|U]?"MP4(SD)="{WORD} {if(Settings.DEBUG) System.out.println("JFlex:pound:POUND: "+yytext()); + } + [R|U]?"MP4(SD)="{WORDLIST} {if(Settings.DEBUG) System.out.println("JFlex:pound:POUND: "+yytext()); + } + [R|U]?"MP4(DQ)" {if(Settings.DEBUG) System.out.println("JFlex:pound:POUND: "+yytext()); + } + [R|U]?"MP4(DQ)"{WORDLIST} {if(Settings.DEBUG) System.out.println("JFlex:pound:POUND: "+yytext()); + } + [R|U]?"MP4(DQ)="{WORD} {if(Settings.DEBUG) System.out.println("JFlex:pound:POUND: "+yytext()); + } + [R|U]?"MP4(DQ)="{WORDLIST} {if(Settings.DEBUG) System.out.println("JFlex:pound:POUND: "+yytext()); + } + [R|U]?"MP4(SDQ)" {if(Settings.DEBUG) System.out.println("JFlex:pound:POUND: "+yytext()); + } + [R|U]?"MP4(SDQ)"{WORDLIST} {if(Settings.DEBUG) System.out.println("JFlex:pound:POUND: "+yytext()); + } + [R|U]?"MP4(SDQ)="{WORD} {if(Settings.DEBUG) System.out.println("JFlex:pound:POUND: "+yytext()); + } + [R|U]?"MP4(SDQ)="{WORDLIST} {if(Settings.DEBUG) System.out.println("JFlex:pound:POUND: "+yytext()); + } + [R|U]?"MP4(SDTQ)" {if(Settings.DEBUG) System.out.println("JFlex:pound:POUND: "+yytext()); + } + [R|U]?"MP4(SDTQ)"{WORDLIST} {if(Settings.DEBUG) System.out.println("JFlex:pound:POUND: "+yytext()); + } + [R|U]?"MP4(SDTQ)="{WORD} {if(Settings.DEBUG) System.out.println("JFlex:pound:POUND: "+yytext()); + } + [R|U]?"MP4(SDTQ)="{WORDLIST} {if(Settings.DEBUG) System.out.println("JFlex:pound:POUND: "+yytext()); + } + [R|U]?"MP4SDTQ" {if(Settings.DEBUG) System.out.println("JFlex:pound:POUND: "+yytext()); + } + [R|U]?"MP4SDTQ"{WORDLIST} {if(Settings.DEBUG) System.out.println("JFlex:pound:POUND: "+yytext()); + } + [R|U]?"MP4SDTQ="{WORD} {if(Settings.DEBUG) System.out.println("JFlex:pound:POUND: "+yytext()); + } + [R|U]?"MP4SDTQ="{WORDLIST} {if(Settings.DEBUG) System.out.println("JFlex:pound:POUND: "+yytext()); + } + [R|U]?"MP"{INT} {if(Settings.DEBUG) System.out.println("JFlex:pound:POUND: "+yytext()); + } + [R|U]?"MP"{INT}{WORDLIST} {if(Settings.DEBUG) System.out.println("JFlex:pound:POUND: "+yytext()); + } + [R|U]?"MP"{INT}"="{WORD} {if(Settings.DEBUG) System.out.println("JFlex:pound:POUND: "+yytext()); + } + [R|U]?"MP"{INT}"="{WORDLIST} {if(Settings.DEBUG) System.out.println("JFlex:pound:POUND: "+yytext()); + } +.|\n {} +} +*/ + + + +<YYINITIAL>{ +/* __________________ + Examples, Energies */ + + "E2=" {if(Settings.DEBUG) System.out.println("JFlex:mp2to5: "+yytext()); + yybegin(FLOATVAL); + return new Symbol(MP2to5dSym.E2); + } + "EUMP2=" {if(Settings.DEBUG) System.out.println("JFlex:mp2to5: "+yytext()); + yybegin(FLOATVAL); + return new Symbol(MP2to5dSym.EUMP2); + } + "E3=" {if(Settings.DEBUG) System.out.println("JFlex:mp2to5: "+yytext()); + yybegin(FLOATVAL); + return new Symbol(MP2to5dSym.E3); + } + "EUMP3=" {if(Settings.DEBUG) System.out.println("JFlex:mp2to5: "+yytext()); + yybegin(FLOATVAL); + return new Symbol(MP2to5dSym.EUMP3); + } + "MP4(T)=" {if(Settings.DEBUG) System.out.println("JFlex:mp2to5: "+yytext()); + yybegin(FLOATVAL); + return new Symbol(MP2to5dSym.MP4_T); + } + "E4(DQ)=" {if(Settings.DEBUG) System.out.println("JFlex:mp2to5: "+yytext()); + yybegin(FLOATVAL); + return new Symbol(MP2to5dSym.E4_DQ); + } + "E4(SDQ)=" {if(Settings.DEBUG) System.out.println("JFlex:mp2to5: "+yytext()); + yybegin(FLOATVAL); + return new Symbol(MP2to5dSym.E4_SDQ); + } + "E4(SDTQ)=" {if(Settings.DEBUG) System.out.println("JFlex:mp2to5: "+yytext()); + yybegin(FLOATVAL); + return new Symbol(MP2to5dSym.E4_SDTQ); + } + "UMP4(DQ)=" {if(Settings.DEBUG) System.out.println("JFlex:mp2to5: "+yytext()); + yybegin(FLOATVAL); + return new Symbol(MP2to5dSym.UMP4_DQ); + } + "UMP4(SDQ)=" {if(Settings.DEBUG) System.out.println("JFlex:mp2to5: "+yytext()); + yybegin(FLOATVAL); + return new Symbol(MP2to5dSym.UMP4_SDQ); + } + "UMP4(SDTQ)=" {if(Settings.DEBUG) System.out.println("JFlex:mp2to5: "+yytext()); + yybegin(FLOATVAL); + return new Symbol(MP2to5dSym.UMP4_SDTQ); + } + .|\n {} +} + +<FLOATVAL>{ + {FLOAT} {if(Settings.DEBUG) System.out.println("JFlex:mp2to5: "+yytext()); + yybegin(YYINITIAL); + return new Symbol(MP2to5dSym.FLOAT, yytext()); + } +} + + +<IGNOREALL>{ + .|\n {} +} + +.|\n {} + http://git-wip-us.apache.org/repos/asf/airavata-sandbox/blob/4231ac35/datacat/cup_flex/numatom.cup ---------------------------------------------------------------------- diff --git a/datacat/cup_flex/numatom.cup b/datacat/cup_flex/numatom.cup new file mode 100644 index 0000000..3ad191e --- /dev/null +++ b/datacat/cup_flex/numatom.cup @@ -0,0 +1,99 @@ +import java_cup.runtime.*; +import javax.swing.*; +import java.util.*; +import java.io.*; + + + +/* +OUTPUT FORMAT:____________________________________________________________ +1NSERCH= 0 + more text + SCF Done: E(RHF) = -7.85284496695 A.U. after 8 cycles + more text + Maximum Force 0.000000 0.000450 YES + RMS Force 0.000000 0.000300 YES + more text +TO MONITOR:____________________________________________________________ + iteration, energy + +MANUALLY ADD TO CUP-GENERATED CLASS IN SCFaParser.java:________________ + + +//add to CUP$SCFaParser$actions +public ParseSCF2 parseSCF; + +//add to the constructor of CUP$SCFaParser$actions + parseSCF = new ParseSCF2(); + +*/ + +action code {: + //__________________________________ + public static boolean DEBUG = true; + private static JTable table; + private static final String tableLabel = "SCF Intermediate Results:"; +// private static String cycle = "0"; + + + public static JTable getTable() { + return table; + } + + public static String getTableLabel() { + return tableLabel; + } + +// } +:} + + + + +terminal INPUT1, FOUNDITER, SCFDONE, DASH1, DASH2; +terminal Integer INPUT2, INPUT3, INPUT4, ITERATION; +terminal Float ENERGY, INPUT5, INPUT6, INPUT7; +non terminal startpt, scfintro, scfpat, scfcycle, cycle, grad1, grad2; +non terminal inp3, inp5, inp6, inp7, cycle1, cycle2, cycle3; + + +/* ___________ + The grammer */ + +startpt ::= scfintro + scfpat + SCFDONE + ; + + + + +scfintro ::= + FOUNDITER + {: if (DEBUG) System.out.println("CUP:NumAtom: found the start of Iteration"); :} +; + +scfpat ::= scfpat scfcycle + {: if (DEBUG) System.out.println("CUP:NumAtom: in scfpat"); :} + | + scfcycle +; + +scfcycle ::= INPUT1 DASH1 cycle1 DASH2 +; + +cycle1 ::= cycle1 cycle2 + | + cycle2 +; + +cycle2 ::= INPUT2:in2 +{: //___________________________________________________________________ + if (DEBUG) System.out.println("CUP:NumAtom: number of atom "+in2); + :} +INPUT3 +INPUT4 +INPUT5 +INPUT6 +INPUT7 +; http://git-wip-us.apache.org/repos/asf/airavata-sandbox/blob/4231ac35/datacat/cup_flex/pound.cup ---------------------------------------------------------------------- diff --git a/datacat/cup_flex/pound.cup b/datacat/cup_flex/pound.cup new file mode 100644 index 0000000..6b11531 --- /dev/null +++ b/datacat/cup_flex/pound.cup @@ -0,0 +1,60 @@ +import java_cup.runtime.*; +import javax.swing.*; +import java.util.*; + + + + +/* +MANUALLY ADD TO CUP-GENERATED CLASS IN Pound.java????????? + + //add to CUP$Pound$actions + public LexerParserBroker broker; + + //add to the constructor of CUP$Pound$actions + broker = new LexerParserBroker(); + +*/ +action code {: + //__________________________________ + public static boolean DEBUG = true; +:} + + + + +terminal LINK, PERCENT_SPEC, POUNDLINE; +non terminal Object startpt, pattern; + + + + +/* ___________ + The grammer */ + +startpt ::= POUNDLINE + | + POUNDLINE + pattern + ; + +pattern ::= pattern + LINK + POUNDLINE + | + pattern + LINK + PERCENT_SPEC + POUNDLINE + | + LINK + POUNDLINE + | + LINK + PERCENT_SPEC + POUNDLINE + ; + + + +
