Skip to content

Commit

Permalink
Update sitemap syntax for icon
Browse files Browse the repository at this point in the history
Icon value can now reference an icon source:iconset:icon name.
Icon value can no more be any string.

Keep the ability to surround the value with simple or double quotes for better backward compatibility

Signed-off-by: Laurent Garnier <[email protected]>
  • Loading branch information
lolodomo committed Feb 25, 2023
1 parent fafadd4 commit 389a76a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ Selection:
('visibility=[' (Visibility+=VisibilityRule (',' Visibility+=VisibilityRule)* ']'))?);

List:
'List' (('item=' item=ItemRef) & ('label=' label=(ID | STRING))? & ('icon=' icon=Icon)?
'List' (('item=' item=ItemRef) & ('label=' label=(ID | STRING))? & ('icon=' icon=Icon)? &
('separator=' separator=STRING) &
('labelcolor=[' (LabelColor+=ColorArray (',' LabelColor+=ColorArray)* ']'))? &
('valuecolor=[' (ValueColor+=ColorArray (',' ValueColor+=ColorArray)* ']'))? &
Expand Down Expand Up @@ -142,7 +142,12 @@ GroupItemRef:
ID;

Icon returns ecore::EString:
STRING | ID;
ICON_SEGMENT_ID (':' ICON_SEGMENT_ID (':' ICON_SEGMENT_ID)?)? |
'"' ICON_SEGMENT_ID (':' ICON_SEGMENT_ID (':' ICON_SEGMENT_ID)?)? '"' |
"'" ICON_SEGMENT_ID (':' ICON_SEGMENT_ID (':' ICON_SEGMENT_ID)?)? "'";

terminal ICON_SEGMENT_ID:
('a'..'z' | 'A'..'Z' | '_') ('a'..'z' | 'A'..'Z' | '_' | '-' | '0'..'9')*;

ColorArray:
((item=ID)? (condition=("==" | ">" | "<" | ">=" | "<=" | "!="))? (sign=('-' | '+'))? (state=XState) '=')?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public IValueConverter<String> Icon() {

@Override
public String toValue(String string, INode node) throws ValueConverterException {
if (string != null && string.startsWith("\"")) {
if (string != null && (string.startsWith("\"") || string.startsWith("'"))) {
return string.substring(1, string.length() - 1);
}
return string;
Expand Down

0 comments on commit 389a76a

Please sign in to comment.