syntax BibtexWithComplexForeachPropertyInits { -- simple basic syntax containing articles and authors, used as Hello Word example primitiveTemplate identifier for String default using NAME: value = "unescapeString(%token%)"; template BibTextFile main context : [entries] -- entries each in new line ; template BibTextEntry abstract; template Article : "article" "{" [ key "," author{referenceBy="name", lookupScope="OCL:bibtexFile.entries->select(oclIsKindOf(Author)).oclAsType(Author)" } ] "}" ; template Author : "author" "=" name "." {{ key=lookIn("OCL:name"), revenues=foreach("OCL:self.articles", when="self.key.size() < 5", mode=short, as=RevenueLedger, when="self.key.size() >= 5 and self.key.size() < 10", mode=medium, as=RevenueLedger, mode=long, as=RevenueLedger) }} ; template RevenueLedger #short : {{ article=lookIn("OCL:#foreach(BibText::Article)"), revenueInEUR=lookIn("OCL:#foreach(BibText::Article).key.size()") }} ; template RevenueLedger #medium : {{ article=lookIn("OCL:#foreach(BibText::Article)"), revenueInEUR=lookIn("OCL:#foreach(BibText::Article).key.size() * 2") }} ; template RevenueLedger #long : {{ article=lookIn("OCL:#foreach(BibText::Article)"), revenueInEUR=lookIn("OCL:#foreach(BibText::Article).key.size() * 3") }} ; -- BEGIN Special symbols -- Possible modifications: symbols { -- lsquare = "["; -- rsquare = "]" : rightSpace; -- excl = "!"; coma = "," : leftNone, rightSpace; -- lparen = "("; -- rparen = ")" : leftNone, rightSpace; lcurly = "{" : leftSpace; rcurly = "}" : leftNone, rightSpace; -- semi = ";" : leftNone, rightSpace; -- colon = ":" : leftSpace, rightSpace; -- pipe = "|" : leftSpace, rightSpace; -- sharp = "#" : leftSpace; -- qmark = "?"; -- coloncolon = "::" : leftNone, rightNone; -- operator symbols -- point = "." : leftNone; -- rarrow = "->" : leftNone; -- minus = "-" : leftSpace, rightSpace; -- star = "*" : leftSpace, rightSpace; -- slash = "/" : leftSpace, rightSpace; -- plus = "+" : leftSpace, rightSpace; -- eq = "=" : leftSpace, rightSpace; -- gt = ">" : leftSpace, rightSpace; -- lt = "<" : leftSpace, rightSpace; -- ge = ">=" : leftSpace, rightSpace; -- le = "<=" : leftSpace, rightSpace; -- ne = "<>" : leftSpace, rightSpace; -- larrow = "<-" : leftSpace, rightSpace; } -- END Special symbols -- BEGIN Operator table -- Defines all operators with their priority, arity, and associativity. -- All defined operators must be used in operator templates. -- Specify operator table(s) here if necessary. -- END Operator table token COMMENT : endOfLine(start = "--"); }