| [5d30c1] | 1 | %option c++ prefix="MPQCIn" yylineno | 
|---|
|  | 2 |  | 
|---|
|  | 3 | %{ | 
|---|
|  | 4 |  | 
|---|
|  | 5 | #if !defined(SUN4) | 
|---|
|  | 6 | #include <string.h> | 
|---|
|  | 7 | #endif | 
|---|
|  | 8 |  | 
|---|
|  | 9 | #include <util/misc/exenv.h> | 
|---|
|  | 10 |  | 
|---|
|  | 11 | #include "mpqcin.h" | 
|---|
|  | 12 | #include "parse.h" | 
|---|
|  | 13 |  | 
|---|
|  | 14 | using namespace sc; | 
|---|
|  | 15 |  | 
|---|
|  | 16 | #define YY_NO_UNISTD_H | 
|---|
|  | 17 | extern "C" int MPQCInwrap(); | 
|---|
|  | 18 |  | 
|---|
|  | 19 | #ifndef yywrap | 
|---|
|  | 20 | #  define yywrap MPQCInwrap | 
|---|
|  | 21 | #endif | 
|---|
|  | 22 |  | 
|---|
|  | 23 | static inline char * | 
|---|
|  | 24 | cstr(char *yytext) | 
|---|
|  | 25 | { | 
|---|
|  | 26 | if (MPQCIn::checking()) return 0; | 
|---|
|  | 27 | char *ret; | 
|---|
|  | 28 | int strlenyytext = strlen(yytext); | 
|---|
|  | 29 | ret = (char *)malloc(strlenyytext+1); | 
|---|
|  | 30 | if (!ret) { | 
|---|
|  | 31 | ExEnv::outn() << "MPQC: malloc failed" | 
|---|
|  | 32 | << endl; | 
|---|
|  | 33 | abort(); | 
|---|
|  | 34 | } | 
|---|
|  | 35 | strcpy(ret,yytext); | 
|---|
|  | 36 | return ret; | 
|---|
|  | 37 | } | 
|---|
|  | 38 |  | 
|---|
|  | 39 | %} | 
|---|
|  | 40 | string  [A-Za-z0-9_\.*+-/']* | 
|---|
|  | 41 | qstring \"[^"\n]+\" | 
|---|
|  | 42 | %% | 
|---|
|  | 43 | "!"             { return T_NOT; } | 
|---|
|  | 44 | "ebc"           { return T_EBC; } | 
|---|
|  | 45 | "gbc"           { return T_GBC; } | 
|---|
|  | 46 | "cabs"          { return T_CABS; } | 
|---|
|  | 47 | "cabs+"         { return T_CABSP; } | 
|---|
|  | 48 | "abs"           { return T_ABS; } | 
|---|
|  | 49 | "abs+"          { return T_ABSP; } | 
|---|
|  | 50 | "memory"        { return T_MEMORY; } | 
|---|
|  | 51 | "molecule"      { return T_MOLECULE; } | 
|---|
|  | 52 | "multiplicity"  { return T_MULTIPLICITY; } | 
|---|
|  | 53 | "optimize"      { return T_OPTIMIZE; } | 
|---|
|  | 54 | "gradient"      { return T_GRADIENT; } | 
|---|
|  | 55 | "frequencies"   { return T_FREQUENCIES; } | 
|---|
|  | 56 | "yes"           { yylval.i = 1; return T_BOOL; } | 
|---|
|  | 57 | "no"            { yylval.i = 0; return T_BOOL; } | 
|---|
|  | 58 | "charge"        { return T_CHARGE; } | 
|---|
|  | 59 | "method"        { return T_METHOD; } | 
|---|
|  | 60 | "basis"         { return T_BASIS; } | 
|---|
|  | 61 | "auxbasis"      { return T_AUXBASIS; } | 
|---|
|  | 62 | "cartesian"     { return T_CARTESIAN; } | 
|---|
|  | 63 | "internal"      { return T_INTERNAL; } | 
|---|
|  | 64 | "redundant"     { return T_REDUNDANT; } | 
|---|
|  | 65 | "restart"       { return T_RESTART; } | 
|---|
|  | 66 | "checkpoint"    { return T_CHECKPOINT; } | 
|---|
|  | 67 | "xc"            { return T_XC; } | 
|---|
|  | 68 | "symmetry"      { return T_SYMMETRY; } | 
|---|
|  | 69 | "bohr"          { return T_BOHR; } | 
|---|
|  | 70 | "angstrom"      { return T_ANGSTROM; } | 
|---|
|  | 71 | "docc"          { return T_DOCC; } | 
|---|
|  | 72 | "socc"          { return T_SOCC; } | 
|---|
|  | 73 | "alpha"         { return T_ALPHA; } | 
|---|
|  | 74 | "beta"          { return T_BETA; } | 
|---|
|  | 75 | "frozen_docc"   { return T_FROZEN_DOCC; } | 
|---|
|  | 76 | "frozen_uocc"   { return T_FROZEN_UOCC; } | 
|---|
|  | 77 | "grid"          { return T_GRID; } | 
|---|
|  | 78 | "="             { return T_EQUALS; } | 
|---|
|  | 79 | ":"             { return T_COLON; } | 
|---|
|  | 80 | "("             { return T_BEG_OPT; } | 
|---|
|  | 81 | ")"             { return T_END_OPT; } | 
|---|
|  | 82 | "<"             { return T_OO_INPUT_KEYWORD; } | 
|---|
|  | 83 | "mpqc"          { return T_OO_INPUT_KEYWORD; } | 
|---|
|  | 84 | {string}        { yylval.str = cstr(yytext); | 
|---|
|  | 85 | return T_STRING; | 
|---|
|  | 86 | } | 
|---|
|  | 87 | {qstring}       { if (MPQCIn::checking()) return T_STRING; | 
|---|
|  | 88 | yylval.str = (char *)malloc(strlen(yytext)); | 
|---|
|  | 89 | if (!yylval.str) { | 
|---|
|  | 90 | ExEnv::outn() << "MPQC: {qstring} rule: malloc failed" | 
|---|
|  | 91 | << endl; | 
|---|
|  | 92 | abort(); | 
|---|
|  | 93 | } | 
|---|
|  | 94 | strcpy(yylval.str,&yytext[1]); | 
|---|
|  | 95 | yylval.str[strlen(yylval.str)-1] = '\0'; | 
|---|
|  | 96 | return(T_STRING); | 
|---|
|  | 97 | } | 
|---|
|  | 98 | [ \t]+          ; | 
|---|
|  | 99 | %.*$            ; | 
|---|
|  | 100 | [\n\r\f]        ; | 
|---|
|  | 101 | .               { ExEnv::outn() << "MPQC: Illegal character: \"" | 
|---|
|  | 102 | << yytext[0] <<"\"" << endl; } | 
|---|
|  | 103 | %% | 
|---|
|  | 104 |  | 
|---|
|  | 105 | int | 
|---|
|  | 106 | MPQCInwrap() | 
|---|
|  | 107 | { | 
|---|
|  | 108 | return 1; | 
|---|
|  | 109 | } | 
|---|