From 3994abad3de76227fb94e324d7b0d2599a61bcf1 Mon Sep 17 00:00:00 2001 From: Steve Brandt Date: Thu, 3 May 2012 16:22:20 -0500 Subject: Made the MMA generated file parse correctly. --- Auxiliary/Grammars/kranc2.peg | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'Auxiliary') diff --git a/Auxiliary/Grammars/kranc2.peg b/Auxiliary/Grammars/kranc2.peg index cb2d352..6083ffa 100644 --- a/Auxiliary/Grammars/kranc2.peg +++ b/Auxiliary/Grammars/kranc2.peg @@ -11,7 +11,8 @@ index_op = [+-] index_expr = {index_symbol}({index_op}{int}|) tensor = {name}{indices} dname = D[a-z0-9]* -dtensor = {dname}{indices}? {tensor} # Can this "?" be removed? +rawmath = @\{[^}]*\} +dtensor = {rawmath}|({dname}{indices})? {tensor} number = -?[0-9]+(\.[0-9]*|)([eEdD][+-]?[0-9]+|) func = {name} \( ({expr}( , {expr})*|) \) value = {func}|{dtensor}|-?{tensor}|{number}|-?\( {expr} \) @@ -19,15 +20,15 @@ pow = {value}( \*\* {value}|) mulop = [*/%] mul = {pow}( {mulop} {pow})* addop = [+-] -expr = {mul}( {addop} {mul})* +mexpr = {mul}( {addop} {mul})* +expr = {mexpr}( \? {mexpr} : {mexpr})? eqn = ({dtensor}|{tensor}) \= {expr}{-end} deqn = {dtensor} \= {expr}{-end} eqns = {eqn}( {eqn})* deqns = {deqn}( {deqn})* at_or_in = (at|in) schedule = scheduled[ \t]+{at_or_in}[ \t]{uname} -thorn = begin[ ]+thorn {name}{-end}( {calculation}| {variables}| {temporaries}| {derivatives}| {option})* end[ ]+thorn -calculation = begin[ \t]+calculation[ \t]+{uname}[ \t]+{schedule}{-end} {eqns} end[ \t]+calculation +calculation = begin[ \t]+calculation[ \t]+{uname}([ \t]+{schedule}|){-end} {eqns} end[ \t]+calculation variables = begin[ \t]+variables{-end} ( end[ \t]+variables\b{brk}| {tensor})*{-end} temporaries = begin[ \t]+temporaries{-end} ( end[ \t]+temporaries\b{brk}| {tensor})*{-end} option = {inherit}|{use}|{disable}|{implement} @@ -37,3 +38,4 @@ use = use[ \t]+({feature}[ \t]*)+ disable = disable[ \t]+({feature}[ \t]*)+ implement = implement[ \t]+{uname}{-end} derivatives = begin[ \t]+derivatives{-end} {deqns} end[ \t]+derivatives +thorn = {-skipper}begin[ ]+thorn {uname}{-end}( {calculation}| {variables}| {temporaries}| {derivatives}| {option})* end[ ]+thorn -- cgit v1.2.3