--- trunk/src/mdParser/MDParser.g 2005/12/16 02:57:00 814 +++ trunk/src/mdParser/MDParser.g 2013/07/16 17:16:45 1902 @@ -28,16 +28,23 @@ tokens COMPONENT = "component"; MOLECULE = "molecule"; ZCONSTRAINT = "zconstraint"; + RESTRAINT = "restraint"; ATOM = "atom"; BOND = "bond"; BEND = "bend"; TORSION = "torsion"; + INVERSION = "inversion"; RIGIDBODY = "rigidBody"; CUTOFFGROUP = "cutoffGroup"; FRAGMENT = "fragment"; MEMBERS = "members"; + CENTER = "center"; + SATELLITES = "satellites"; POSITION = "position"; ORIENTATION = "orientation"; + FLUCQ = "flucQ"; + RNEMD = "RNEMD"; + MINIMIZER = "minimizer"; ENDBLOCK; } @@ -46,16 +53,21 @@ statement : assignment ; statement : assignment - | componentblock - | moleculeblock - | zconstraintblock - ; - + | componentblock + | moleculeblock + | zconstraintblock + | restraintblock + | flucqblock + | rnemdblock + | minimizerblock + ; + assignment : ID ASSIGNEQUAL^ constant SEMICOLON! ; constant : intConst - | floatConst + | floatConst + | vectorConst | ID | StringLiteral ; @@ -65,6 +77,18 @@ zconstraintblock : ZCONSTRAINT^ LCURLY! (assignment)* zconstraintblock : ZCONSTRAINT^ LCURLY! (assignment)* RCURLY {#RCURLY->setType(ENDBLOCK);} ; + +restraintblock : RESTRAINT^ LCURLY! (assignment)* RCURLY {#RCURLY->setType(ENDBLOCK);} + ; + +flucqblock : FLUCQ^ LCURLY! (assignment)* RCURLY {#RCURLY->setType(ENDBLOCK);} + ; + +rnemdblock : RNEMD^ LCURLY! (assignment)* RCURLY {#RCURLY->setType(ENDBLOCK);} + ; + +minimizerblock : MINIMIZER^ LCURLY! (assignment)* RCURLY {#RCURLY->setType(ENDBLOCK);} + ; moleculeblock : MOLECULE^ LCURLY! (moleculestatement)* RCURLY {#RCURLY->setType(ENDBLOCK);} ; @@ -74,6 +98,7 @@ moleculestatement : assignment | bondblock | bendblock | torsionblock + | inversionblock | rigidbodyblock | cutoffgroupblock | fragmentblock @@ -109,6 +134,14 @@ torsionstatement : assignment | MEMBERS^ LPAREN! inttuple RPAREN! SEMICOLON! ; +inversionblock : INVERSION^ (LBRACKET! intConst! RBRACKET!)? LCURLY!(inversionstatement)* RCURLY {#RCURLY->setType(ENDBLOCK);} + ; + +inversionstatement : assignment + | CENTER^ LPAREN! intConst RPAREN! SEMICOLON! + | SATELLITES^ LPAREN! inttuple RPAREN! SEMICOLON! + ; + rigidbodyblock : RIGIDBODY^ LBRACKET! intConst RBRACKET! LCURLY!(rigidbodystatement)* RCURLY {#RCURLY->setType(ENDBLOCK);} ; @@ -153,7 +186,11 @@ floatConst NUM_FLOAT | NUM_DOUBLE ; - +protected +vectorConst + : + LPAREN^ doubleNumber COMMA doubleNumber COMMA doubleNumber RPAREN + ; class MDLexer extends Lexer; @@ -257,7 +294,7 @@ LineDirective } ("line")? // this would be for if the directive started "#line" (Space)+ - n:Decimal { setLine(oopse::lexi_cast(n->getText()) - 1); } + n:Decimal { setLine(OpenMD::lexi_cast(n->getText()) - 1); } (Space)+ (sl:StringLiteral) {std::string filename = sl->getText().substr(1,sl->getText().length()-2); observer->notify(filename);} ((Space)+ Decimal)* // To support cpp flags (GNU) @@ -457,7 +494,7 @@ EXPONENT // a couple protected methods to assist in matching floating point numbers protected EXPONENT - : ('e'|'E') ('+'|'-')? ('0'..'9')+ + : ('e'|'E'|'d'|'D') ('+'|'-')? ('0'..'9')+ ; protected