Skip to content

Commit 7d99e35

Browse files
authored
Adjust syntax for conditions in DSL Rule (#5501)
Fix #5488 Fix #5489 Also avoids the 'a' keyword. Signed-off-by: Laurent Garnier <lg.hc@free.fr>
1 parent eb87e75 commit 7d99e35

2 files changed

Lines changed: 10 additions & 10 deletions

File tree

  • bundles/org.openhab.core.model.rule/src/org/openhab/core/model/rule
  • itests/org.openhab.core.model.rule.tests/src/main/java/org/openhab/core/model/rule/runtime

bundles/org.openhab.core.model.rule/src/org/openhab/core/model/rule/Rules.xtext

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,19 +116,19 @@ TimeOfDayCondition:
116116
;
117117

118118
DayOfWeekCondition:
119-
'Day' 'is' weekDays+=WeekDay ('or' weekDays+=WeekDay)*
119+
'Day' 'is' weekDays+=WeekDay (',' weekDays+=WeekDay)*
120120
;
121121

122122
WeekdayCondition:
123-
'Day' ('offset' '='? offset=SIGNED_INT)? 'is' 'a' type=('weekday' | 'weekend')
123+
'Day' ('offset' '='? offset=SIGNED_INT)? 'is' type=('weekday' | 'weekend')
124124
;
125125

126126
HolidayCondition:
127-
'Day' ('offset' '='? offset=SIGNED_INT)? 'is' (negation?='not')? 'a' 'holiday'
127+
'Day' ('offset' '='? offset=SIGNED_INT)? 'is' (negation?='not')? holiday='holiday'
128128
;
129129

130130
InDaysetCondition:
131-
'Day' ('offset' '='? offset=SIGNED_INT)? 'is' 'in' dayset=(STRING|ID)
131+
'Day' ('offset' '='? offset=SIGNED_INT)? 'in' dayset=(STRING|ID)
132132
;
133133

134134
IntervalCondition:

itests/org.openhab.core.model.rule.tests/src/main/java/org/openhab/core/model/rule/runtime/DSLRuleProviderTest.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -265,12 +265,12 @@ public void testAllConditions() {
265265
" Item X received command ON\n" + //
266266
"but only if\n" + //
267267
" Time is between 19:20 and 22:10 and\n" + //
268-
" Day is Thursday or Tuesday or Sunday and\n" + //
269-
" Day is a weekday and\n" + //
270-
" Day is a weekend and\n" + //
271-
" Day offset 3 is a holiday and\n" + //
272-
" Day offset = -2 is not a holiday and\n" + //
273-
" Day is in \"my-dayset\" and\n" + //
268+
" Day is Thursday, Tuesday, Sunday and\n" + //
269+
" Day is weekday and\n" + //
270+
" Day is weekend and\n" + //
271+
" Day offset 3 is holiday and\n" + //
272+
" Day offset = -2 is not holiday and\n" + //
273+
" Day in \"my-dayset\" and\n" + //
274274
" Thing \"T1\" is ONLINE and\n" + //
275275
" Thing \"T2\" is not UNKNOWN and\n" + //
276276
" Item W = \"a value\" and\n" + //

0 commit comments

Comments
 (0)