diff --git a/spec/data-model/README.md b/spec/data-model/README.md index 1548a20d97..e0d187bf87 100644 --- a/spec/data-model/README.md +++ b/spec/data-model/README.md @@ -93,21 +93,14 @@ Each message _declaration_ is represented by a `Declaration`, which connects the `name` of a _variable_ with its _expression_ `value`. The `name` does not include the initial `$` of the _variable_. - -The `name` of an `InputDeclaration` MUST be the same -as the `name` in the `VariableRef` of its `VariableExpression` `value`. +If the `value` has a `VariableRef` `arg` with the same `name` +as the `Declaration`, +it represents an _input-declaration_. +Otherwise, it represents a _local-declaration_. ```ts -type Declaration = InputDeclaration | LocalDeclaration; - -interface InputDeclaration { - type: "input"; - name: string; - value: VariableExpression; -} - -interface LocalDeclaration { - type: "local"; +interface Declaration { + type: "declaration"; name: string; value: Expression; } @@ -149,21 +142,11 @@ expressions or markup. ```ts type Pattern = Array; -type Expression = - | LiteralExpression - | VariableExpression - | FunctionExpression; - -interface LiteralExpression { - type: "expression"; - arg: Literal; - function?: FunctionRef; - attributes: Attributes; -} +type Expression = OperandExpression | FunctionExpression; -interface VariableExpression { +interface OperandExpression { type: "expression"; - arg: VariableRef; + arg: Literal | VariableRef; function?: FunctionRef; attributes: Attributes; } diff --git a/spec/data-model/message.dtd b/spec/data-model/message.dtd index bc51dd1590..848ebc6c8f 100644 --- a/spec/data-model/message.dtd +++ b/spec/data-model/message.dtd @@ -3,12 +3,8 @@ (pattern | (selectors,variant+)) )> - - + diff --git a/spec/data-model/message.json b/spec/data-model/message.json index b669af4627..c06c3734f6 100644 --- a/spec/data-model/message.json +++ b/spec/data-model/message.json @@ -82,19 +82,10 @@ } }, - "input-declaration": { + "declaration": { "type": "object", "properties": { - "type": { "const": "input" }, - "name": { "type": "string" }, - "value": { "$ref": "#/$defs/variable-expression" } - }, - "required": ["type", "name", "value"] - }, - "local-declaration": { - "type": "object", - "properties": { - "type": { "const": "local" }, + "type": { "const": "declaration" }, "name": { "type": "string" }, "value": { "$ref": "#/$defs/expression" } }, @@ -102,12 +93,7 @@ }, "declarations": { "type": "array", - "items": { - "oneOf": [ - { "$ref": "#/$defs/input-declaration" }, - { "$ref": "#/$defs/local-declaration" } - ] - } + "items": { "$ref": "#/$defs/declaration" } }, "variant-key": {