|
| 1 | +const time_predicate = token( |
| 2 | + choice( |
| 3 | + token( |
| 4 | + seq( |
| 5 | + optional(token(seq(/[\d]+/, "w"))), |
| 6 | + token(seq(/[\d]+/, "h", /[\d]+/)), |
| 7 | + ), |
| 8 | + ), |
| 9 | + token( |
| 10 | + seq( |
| 11 | + token(seq(/[\d]+/, "w")), |
| 12 | + optional(token(seq(/[\d]+/, "h"))), |
| 13 | + optional(token(seq(/[\d]+/, "m"))), |
| 14 | + optional(token(seq(/[\d]+/, "s"))), |
| 15 | + ), |
| 16 | + ), |
| 17 | + token( |
| 18 | + seq( |
| 19 | + optional(token(seq(/[\d]+/, "w"))), |
| 20 | + token(seq(/[\d]+/, "h")), |
| 21 | + optional(token(seq(/[\d]+/, "m"))), |
| 22 | + optional(token(seq(/[\d]+/, "s"))), |
| 23 | + ), |
| 24 | + ), |
| 25 | + token( |
| 26 | + seq( |
| 27 | + optional(token(seq(/[\d]+/, "w"))), |
| 28 | + optional(token(seq(/[\d]+/, "h"))), |
| 29 | + token(seq(/[\d]+/, "m")), |
| 30 | + optional(token(seq(/[\d]+/, "s"))), |
| 31 | + ), |
| 32 | + ), |
| 33 | + token( |
| 34 | + seq( |
| 35 | + optional(token(seq(/[\d]+/, "w"))), |
| 36 | + optional(token(seq(/[\d]+/, "h"))), |
| 37 | + optional(token(seq(/[\d]+/, "m"))), |
| 38 | + token(seq(/[\d]+/, "s")), |
| 39 | + ), |
| 40 | + ), |
| 41 | + ), |
| 42 | +); |
| 43 | + |
1 | 44 | module.exports = grammar({
|
2 | 45 | name: "liquidsoap",
|
3 | 46 |
|
@@ -108,41 +151,9 @@ module.exports = grammar({
|
108 | 151 | ),
|
109 | 152 | ),
|
110 | 153 |
|
111 |
| - time_predicate: $ => |
112 |
| - prec.left( |
113 |
| - 1, |
114 |
| - choice( |
115 |
| - seq(optional(seq(/[\d]+/, "w")), seq(/[\d]+/, "h", /[\d]+/)), |
116 |
| - seq( |
117 |
| - /[\d]+/, |
118 |
| - "w", |
119 |
| - optional(seq(/[\d]+/, "h")), |
120 |
| - optional(seq(/[\d]+/, "m")), |
121 |
| - optional(seq(/[\d]+/, "s")), |
122 |
| - ), |
123 |
| - seq( |
124 |
| - optional(seq(/[\d]+/, "w")), |
125 |
| - /[\d]+/, |
126 |
| - "h", |
127 |
| - optional(seq(/[\d]+/, "m")), |
128 |
| - optional(seq(/[\d]+/, "s")), |
129 |
| - ), |
130 |
| - seq( |
131 |
| - optional(seq(/[\d]+/, "w")), |
132 |
| - optional(seq(/[\d]+/, "h")), |
133 |
| - /[\d]+/, |
134 |
| - "m", |
135 |
| - optional(seq(/[\d]+/, "s")), |
136 |
| - ), |
137 |
| - seq( |
138 |
| - optional(seq(/[\d]+/, "w")), |
139 |
| - optional(seq(/[\d]+/, "h")), |
140 |
| - optional(seq(/[\d]+/, "m")), |
141 |
| - /[\d]+/, |
142 |
| - "s", |
143 |
| - ), |
144 |
| - ), |
145 |
| - ), |
| 154 | + time_predicate: $ => time_predicate, |
| 155 | + |
| 156 | + time_interval: $ => token(seq(time_predicate, "-", time_predicate)), |
146 | 157 |
|
147 | 158 | regexp: $ =>
|
148 | 159 | seq(
|
@@ -792,6 +803,7 @@ module.exports = grammar({
|
792 | 803 | $.or,
|
793 | 804 | $.infix,
|
794 | 805 | $.time_predicate,
|
| 806 | + $.time_interval, |
795 | 807 | ),
|
796 | 808 | },
|
797 | 809 | });
|
0 commit comments