@detectDelim @external prop implicitCompletion from './props' @top Problem { statement* } statement { ProblemDeclaration { ckw<"problem"> QualifiedName "." } | ClassDefinition { ckw<"abstract">? ckw<"class"> RelationName (ckw<"extends"> sep<",", RelationName>)? (ClassBody { "{" ReferenceDeclaration* "}" } | ".") } | EnumDefinition { ckw<"enum"> RelationName (EnumBody { "{" sep<",", IndividualNodeName> "}" } | ".") } | PredicateDefinition { ( (ckw<"error"> | ckw<"contained"> | ckw<"containment">) ckw<"pred">? | ckw<"pred"> ) RelationName ParameterList? PredicateBody { ("<->" sep)? "." } } | //RuleDefinition { // ckw<"rule"> // RuleName ParameterList? // RuleBody { ":" sep "==>" sep "." } //} | Assertion { ckw<"default">? (NotOp | UnknownOp)? RelationName ParameterList (":" LogicValue)? "." } | NodeValueAssertion { QualifiedName ":" Constant "." } | IndividualDeclaration { ckw<"indiv"> sep<",", IndividualNodeName> "." } | ScopeDeclaration { ckw<"scope"> sep<",", ScopeElement> "." } } ReferenceDeclaration { ( ExplicitContainmentReference[@dynamicPrecedence=1] { (ckw<"refers"> | ckw<"contains"> | ckw<"container">) RelationName ~containment } | ImplicitContainmentReference { RelationName ~containment } ) ("[" Multiplicity? "]")? RelationName (kw<"opposite"> RelationName)? ";"? } Parameter { Modality? RelationName? VariableName } Conjunction { ("," | Literal)+ } OrOp { ";" } Literal { Modality? (NotOp | ckw<"count">)? Modality? Atom ((":=" | "<:") LogicValue | ComparisonOp int)? } Atom { RelationName "+"? ParameterList } //Consequent { ("," | Action)+ } //Action { // ckw<"new"> VariableName ("<:" VariableName)? | // ckw<"delete"> VariableName | // Literal //} Argument { VariableName | Constant } AssertionArgument { NodeName | StarArgument | Constant } Constant { Real | String } LogicValue { ckw<"true"> | ckw<"false"> | ckw<"unknown"> | ckw<"error"> } Modality { ckw<"must"> | ckw<"may"> | ckw<"current"> } ScopeElement { RelationName ("=" | "+=") Multiplicity } Multiplicity { (IntMult "..")? (IntMult | StarMult)} RelationName { QualifiedName } //RuleName { QualifiedName } IndividualNodeName { QualifiedName } VariableName { QualifiedName } NodeName { QualifiedName } QualifiedName[implicitCompletion=true] { identifier ("::" identifier)* } kw { @specialize[@name={term},implicitCompletion=true] } ckw { @extend[@name={term},implicitCompletion=true] } ParameterList { "(" sep<",", content> ")" } sep { sep1? } sep1 { content (separator content)* } @skip { LineComment | BlockComment | whitespace } @tokens { whitespace { std.whitespace+ } LineComment { ("//" | "%") ![\n]* } BlockComment { "/*" blockCommentRest } blockCommentRest { ![*] blockCommentRest | "*" blockCommentAfterStar } blockCommentAfterStar { "/" | "*" blockCommentAfterStar | ![/*] blockCommentRest } @precedence { BlockComment, LineComment } identifier { $[A-Za-z_] $[a-zA-Z0-9_]* } int { $[0-9]+ } IntMult { int } StarMult { "*" } Real { "-"? (exponential | int ("." (int | exponential))?) } exponential { int ("e" | "E") ("+" | "-")? int } String { "'" (![\\'\n] | "\\" ![\n] | "\\\n")+ "'" | "\"" (![\\"\n] | "\\" (![\n] | "\n"))* "\"" } ComparisonOp { ">" | ">=" | "<" | "<=" | "==" } NotOp { "!" } UnknownOp { "?" } StarArgument { "*" } "{" "}" "(" ")" "[" "]" "." ".." "," ":" "<->" "~>" }