Show in Frame No Frame
Up Previous Next Title Page Index Contents Search

6.9 Syntax

STRING: "'" <CHAR>* "'"
where CHAR is any character; a ' character must be doubled
COMMENT: "/*" <CHAR>* "*/"
NUMBER: ("0".."9")+
NAMECHAR: <NORMCHAR> | <ESCAPECHAR>
NORMCHAR:Anything except whitespace or: |.#>~,;:=<>(){}';@\/^*$%
ESCAPECHAR: "\" <ECHAR>
where ECHAR is anything that is not a letter, number or underscore
NAME: <NAMECHAR>+
| <NAMECHAR>+ (" " <NAMECHAR>+)+ ";"
If NAME contains an unescaped space, the whole name should have a ";" after it, or one of ".>~#" forming the start of the next element in the same chainClause. A linebreak or syntax element beginning with a punctuation mark, e.g. "{" for a block, will also end a name.
WILDNAME: ["^"] ("<" "="?)? (<NAMECHAR> | "*" | "#")+
If WILDNAME contains an unescaped space, the whole name should have a ";" after it.
# Design element access and output commands (6.1)
chainOutputClause: (propClauseWithLevel | propClause | (graphEltClause+ propClause)) [";"] [translatorNames] [";"];
translatorNames: ("%" <NAME>)+;
propClauseWithLevel: propClause levelNumber [";"];
levelNumber: [";"] " " "* ["-"] <NUMBER>+;
propClause: ":" (<NAME> | "()");
graphEltClause: (objClause | relClause | roleClause | portClause) [";"]
objClause: "." typeChoiceClause
relClause: ">" typeChoiceClause
roleClause: "~" typeChoiceClause
portClause: "#" typeChoiceClause
typeChoiceClause: NAME
| "()"
| "(" <WILDNAME> {" | " <WILDNAME>}* ")"
# General commands (6.2)
report: oldreport | newreport;
oldreport: "report" <STRING> clause* "endreport";
newreport: [newheadersection] clause*;
newheadersection: <NAME> "(" ["@"<NAME> ("," "@"<NAME>)*] ")" ;
Note there must be no space between the name and first parenthesis
clause: (comment
| basicClause
| loop
| ifClause
| subreportClause
| fileClause
| md5Clause
| executeClause
| promptAskClause
| variableAssign
| variableClause
| translationClause
| mathClause
| chainOutputClause
;
comment: <comment>;
basicClause: atomicClause | iterableClause;
atomicClause: newlineClause | separatorClause | literal | variableRef | simpleClause
| newSubreportClause;
newlineClause: "newline" [";"];
separatorClause: "sep" [";"];
literal: <STRING> [translatorNames] [";"];
variableRef : ("$" "@") <NAME> [translatorNames] [";"];
simpleClause: ("id" | "type" | "metatype" | "oid" | "projectid" | "objectid" | "project") [levelNumber] [";"] [translatorNames] [";"]
|
("x" | "y" | "left" | "right" | "top" | "bottom" | "centerX" | "centerY" | "width" | "height" | "area") [levelNumber] [";"] [translatorNames] [";"];
iterableClause: ("decompositions" | "explosions" | "containers" | "contents" | "stack" | "graphs") [";"];
# Control and navigation commands (6.3)
ifClause: "if" [condition]
"then" [";"] (clause* | ";")
["else" [";"] clause*]
"endif" [";"];
condition: ("not" condition)
| (condition "and" condition)
| (condition "or" condition)
| ("(" condition ")")
| expression;
expression: comparison | unary;
unary: comparableClause;
comparison: comparableClause comp comparableClause ["num"];
comparableClause : atomicClause | chainClause;
comp: "<" | ">" | "<=" | ">=" | "=" | "<>" | "=~" | "=/";
loop: ("do" | "dowhile")
(chainClause | atomicClause)
[whereClause] [filterClause]
"{" clause* "}" [";"]
|
"foreach"
graphEltClause [";"]
[whereClause] [filterClause]
"{" clause* "}" [";"];
chainClause: (chainElementClause [levelNumber] [";"])+;
chainElementClause: graphEltClause | propClause | iterableClause;
whereClause: "where" condition;
filterClause: orderbyClause [uniqueClause]
| uniqueClause;
orderbyClause : "orderby" orderCriterion ("," orderCriterion)*;
uniqueClause : "unique" [clause+ ("," clause+)*];
orderCriterion: clause+ ["num"] ["asc" | "desc"];
subreportClause: ("subreport" | "subgenerator") [";"] clause* [argumentsClause] ("run" | "runSuper") [";"];
argumentsClause: "arguments" [clause+ ("," clause+)*];
newSubreportClause:<NAME>"(" [clause+ ("," clause+)*] ")" [";"];
Note there can be no space between NAME and the first parenthesis
# External I/O and integration commands (6.4)
fileClause: outputFileClause | filenameReadClause | filenamePrintClause;
outputFileClause: "filename" [";"] clause*
["encoding" [";"] clause+]
["md5start" [";"] clause+]
["md5stop" [";"] clause+]
modeClause clause*
"close" [";"];
modeClause: ("write" | "merge" | "append") [";"];
filenameReadClause: "filename" [";"] clause*
["encoding" [";"] clause+]
"read" [";"];
filenamePrintClause: "filename" [";"] clause* "print" [";"];
md5Clause: "md5id" [";"] clause* "md5Block" [";"]
clause*
"md5sum" [";"];
executeClause: ("external" | "internal") [";"]
clause*
("execute" | "executeBlocking" | "read")) [";"];
promptAskClause: "prompt" [";"] clause* ("ask"|"askFilename") [";"];
# String and number commands (6.5)
variableClause: variableReadClause | variableWriteClause;
variableReadClause: ("variable" | "local") [";"] clause+ "read" [";"];
variableWriteClause: ("variable" | "local") [";"] clause+
variableModeClause clause*
"close" [";"];
variableModeClause: ("write" | "append") [";"];
variableAssign: ("$" | "@") <NAME> "=" [";"]
(variableAssign | basicClause | chainOutputClause);
translationClause: "to" [";"] clause*
["translate" [";"] clause*]
"endto" [";"];
mathClause: "math" [";"] clause* "evaluate" [";"];

Show in Frame No Frame
Up Previous Next Title Page Index Contents Search