Skip to content

Commit

Permalink
kranc2.peg: Identify lower and upper indices in the parser
Browse files Browse the repository at this point in the history
Previously this logic was in Kranc, where it has to be more complicated.
  • Loading branch information
ianhinder committed Feb 6, 2012
1 parent 1e4cc8e commit 01a4164
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Auxiliary/Grammars/kranc2.peg
Expand Up @@ -3,7 +3,9 @@ int = [0-9]+
end = ([ \t]+|#.*)*\r*\n
name = [A-Za-z][A-Za-z0-9]*
uname = [A-Za-z][A-Za-z0-9_]*
indices = ([_^]({index_symbol}|\({index_expr}(,{index_expr})*\))+)*
lower_index = ({index_symbol}|\({index_expr}(,{index_expr})*\))
upper_index = ({index_symbol}|\({index_expr}(,{index_expr})*\))
indices = (\_{lower_index}+|\^{upper_index}+)*
index_symbol = [a-zA-Z]'*|[0-9]
index_expr = {index_symbol}([+-]{int}|)
tensor = {name}{indices}
Expand Down

0 comments on commit 01a4164

Please sign in to comment.