From 953c08c367f010acfa8838274ccd2f9b9084e832 Mon Sep 17 00:00:00 2001 From: lolodomo Date: Wed, 12 Apr 2023 17:40:24 +0200 Subject: [PATCH] Extend item syntax for category/icon (#3539) 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, f7, ... Second segment is the icon set. Example: classic Third segment is the icon name (and can contain hyphen). Example: temperature In case only two segments are provided, the first segment is the icon source and the second the icon name. "classic" icon set is assumed if icon source is "oh". 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 | 6 +++++- 1 file changed, 5 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 02ca38715..ce2d709d1 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,10 @@ NUMBER returns ecore::EBigDecimal: ('-')? ID ('.' ID )? ; +Icon: + (ID ':' (ID ':')?)? ID +; + terminal ID: '^'?('a'..'z'|'A'..'Z'|'_'|'0'..'9') ('a'..'z'|'A'..'Z'|'_'|'-'|'0'..'9')*; terminal STRING: