aboutsummaryrefslogtreecommitdiff
path: root/Auxiliary
diff options
context:
space:
mode:
authorSteve Brandt <sbrandt@sbrandt-think.cct.lsu.edu>2012-05-03 16:22:20 -0500
committerSteve Brandt <sbrandt@sbrandt-think.cct.lsu.edu>2012-05-03 16:22:20 -0500
commit3994abad3de76227fb94e324d7b0d2599a61bcf1 (patch)
tree827eed732002283302eaa6a2239534ec576534b1 /Auxiliary
parentdba02bc0a5d5679ec83538b5d7e9350708eea0f6 (diff)
Made the MMA generated file parse correctly.
Diffstat (limited to 'Auxiliary')
-rw-r--r--Auxiliary/Grammars/kranc2.peg10
1 files changed, 6 insertions, 4 deletions
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