Skip to content

Commit

Permalink
KrancScript.m: Raise an error if an unexpected item is found in a thorn
Browse files Browse the repository at this point in the history
  • Loading branch information
ianhinder committed Jan 28, 2012
1 parent 6bc7001 commit e2d1be2
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions Tools/CodeGen/KrancScript.m
Expand Up @@ -95,9 +95,14 @@

process[thorn:"thorn"[content___]] :=
Module[
{calcs, name,options},
calcs = Cases[thorn, c:"calculation"[___]:>process[c]];
name = Cases[thorn, "name"[n_]:>n][[1]];
{calcs = {}, name, options},

Do[Switch[el,
"calculation"[___], AppendTo[calcs,process[el]],
"name"[_], name = el[[1]],
_, ThrowError["Unrecognised element '"<>Head[el]<>"' in thorn"]],
{el, {content}}];

options = {Calculations -> calcs};
CreateThornTTExpression[groups,parentDirectory,name,Sequence@@options]];

Expand Down

0 comments on commit e2d1be2

Please sign in to comment.