Skip to content

Commit f1c4701

Browse files
committed
DSL Items Parser: Fix incorrect parsing of tags as start of item definition
When specifying tag names that match one of the valid item types, e.g. `Switch`, the parser incorrectly treated it as a new start of an item definition. Signed-off-by: Jimmy Tanagra <jcode@tanagra.id.au>
1 parent a4c6b49 commit f1c4701

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

  • bundles/org.openhab.core.model.item/src/org/openhab/core/model

bundles/org.openhab.core.model.item/src/org/openhab/core/model/Items.xtext

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,10 @@ ModelItem:
1717
(ModelNormalItem | ModelGroupItem) name=ID
1818
(label=STRING)?
1919
('<' icon=Icon '>')?
20-
('(' groups+=ID (',' groups+=ID)* ')')?
21-
('[' tags+=(ID|STRING) (',' tags+=(ID|STRING))* ']')?
22-
('{' bindings+=ModelBinding (',' bindings+=ModelBinding)* '}')?
20+
('(' groups+=ID (',' groups+=ID)* ')')?
21+
// Add BaseModelItemType as valid tags otherwise the parser treats [Switch] as start of item definition
22+
('[' tags+=(ID|STRING|BaseModelItemType) (',' tags+=(ID|STRING|BaseModelItemType))* ']')?
23+
('{' bindings+=ModelBinding (',' bindings+=ModelBinding)* '}')?
2324
;
2425

2526
ModelGroupItem:
@@ -56,7 +57,7 @@ ValueType returns ecore::EJavaObject:
5657
STRING | NUMBER | BOOLEAN
5758
;
5859

59-
BOOLEAN returns ecore::EBoolean:
60+
BOOLEAN returns ecore::EBoolean:
6061
'true' | 'false'
6162
;
6263

0 commit comments

Comments
 (0)