From e9453bae6f48f0e939e9a173adf5d17bc9bf18f6 Mon Sep 17 00:00:00 2001 From: Laurent Garnier Date: Tue, 11 Apr 2023 13:48:40 +0200 Subject: [PATCH] Extend item syntax for category/icon The icon value can now contain until 3 segments separated by a semi-column. First segment is the icon source. Example: oh, if, iconify, material, ... Second segment is the icon set (and can be empty). Example: classic Third segment is the icon name (and can contain hyphen). Example: temperature In case only two segments are provided, the icon source is assumed to be the openHAB server and the first segment is then the icon set and the second the icon name. In case only one segment is provided, the icon source is assumed to be the openHAB server and its classic icon set and the value is then the icon name. Ability to use a string containing anything has been removed. Related to #3052 Signed-off-by: Laurent Garnier --- .../src/org/openhab/core/model/Items.xtext | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/bundles/org.openhab.core.model.item/src/org/openhab/core/model/Items.xtext b/bundles/org.openhab.core.model.item/src/org/openhab/core/model/Items.xtext index 02ca3871528..13cfaf86af3 100644 --- a/bundles/org.openhab.core.model.item/src/org/openhab/core/model/Items.xtext +++ b/bundles/org.openhab.core.model.item/src/org/openhab/core/model/Items.xtext @@ -16,7 +16,7 @@ ItemModel: ModelItem: (ModelNormalItem | ModelGroupItem) name=ID (label=STRING)? - ('<' icon=(ID|STRING) '>')? + ('<' icon=Icon '>')? ('(' groups+=ID (',' groups+=ID)* ')')? ('[' tags+=(ID|STRING) (',' tags+=(ID|STRING))* ']')? ('{' bindings+=ModelBinding (',' bindings+=ModelBinding)* '}')? @@ -64,6 +64,22 @@ NUMBER returns ecore::EBigDecimal: ('-')? ID ('.' ID )? ; +Icon: + (IconSource ':' IconSet? ':' IconName) | (IconSet ':' IconName) | IconName +; + +IconSource: + ID +; + +IconSet: + ID +; + +IconName: + ID +; + terminal ID: '^'?('a'..'z'|'A'..'Z'|'_'|'0'..'9') ('a'..'z'|'A'..'Z'|'_'|'-'|'0'..'9')*; terminal STRING: