openehr 1.1.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,44 +0,0 @@
1
- module OpenEHR
2
- module Parser
3
- module CADL
4
- class ArchetypeNode
5
- attr_reader :parent
6
- attr_accessor :path, :id
7
-
8
- def initialize(parent = nil)
9
- @parent = parent
10
- @path = '/' if parent.nil?
11
- end
12
-
13
- def root?
14
- return parent.nil?
15
- end
16
- end
17
-
18
- class CDvQuantityItems < Treetop::Runtime::SyntaxNode
19
- def value(node)
20
- property = prop.value unless prop.empty?
21
- list = ql.value(node) unless ql.empty?
22
- av = aqv.value unless aqv.empty?
23
- OpenEHR::AM::OpenEHRProfile::DataTypes::Quantity::CDvQuantity.new(
24
- :path => node.path, :rm_type_name => 'DvQuantity',
25
- :occurrences => OpenEHR::AssumedLibraryTypes::Interval.new(
26
- :upper => 1, :lower => 1),
27
- :property => property, :list => list, :assumed_value => av)
28
- end
29
- end
30
-
31
- class AssumedValueItems < Treetop::Runtime::SyntaxNode
32
- def value
33
- magnitude, precision = nil
34
- magnitude = mag.val.value unless mag.empty?
35
- precision = prec.val.value unless prec.empty?
36
- OpenEHR::RM::DataTypes::Quantity::DvQuantity.new(
37
- :units => units.value,
38
- :magnitude => magnitude,
39
- :precision => precision)
40
- end
41
- end
42
- end
43
- end
44
- end
@@ -1,13 +0,0 @@
1
- module OpenEHR
2
- module Parser
3
- module DADLGrammar
4
- class Base < Treetop::Runtime::SyntaxNode
5
-
6
- end
7
-
8
- class DADL < Base
9
-
10
- end
11
- end
12
- end
13
- end
@@ -1,358 +0,0 @@
1
- require 'shared_token_grammar'
2
- require 'dadl'
3
-
4
- module OpenEHR
5
- module Parser
6
- grammar DADLGrammar
7
-
8
- include SharedToken
9
-
10
- rule V_DADL_TEXT
11
- attr_vals space {
12
- def value
13
- attr_vals.value
14
- end
15
- }
16
- / complex_object_block space {
17
- def value
18
- complex_object_block.value
19
- end
20
- }
21
- end
22
-
23
- rule attr_vals
24
- first:attr_val second:(';'? space attr_val space)* {
25
- def value
26
- attrs.inject({ }) {|val, a| val.update a.value}
27
- end
28
-
29
- def attrs
30
- [first] + second.elements.map {|e| e.attr_val}
31
- end
32
- }
33
- end
34
-
35
- rule attr_val
36
- attr_id SYM_EQ object_block {
37
- def value
38
- {attr_id.value => object_block.value}
39
- end
40
- }
41
- end
42
-
43
- rule attr_id
44
- id:V_ATTRIBUTE_IDENTIFIER white_space {
45
- def value
46
- id.value
47
- end
48
- }
49
- end
50
-
51
- rule object_block
52
- complex_object_block space {
53
- def value
54
- complex_object_block.value
55
- end
56
- }
57
- / primitive_object_block space {
58
- def value
59
- primitive_object_block.value
60
- end
61
- }
62
- end
63
-
64
- rule complex_object_block
65
- single_attr_object_block '' {
66
- def value
67
- single_attr_object_block.value
68
- end
69
- }
70
- / multiple_attr_object_block '' {
71
- def value
72
- multiple_attr_object_block.value
73
- end
74
- }
75
- end
76
-
77
- rule multiple_attr_object_block
78
- type_identifier? untyped_multiple_attr_object_block {
79
- def value
80
- untyped_multiple_attr_object_block.value
81
- end
82
- }
83
- end
84
-
85
- rule untyped_multiple_attr_object_block
86
- multiple_attr_object_block_head keyed_objects SYM_END_DBLOCK {
87
- def value
88
- keyed_objects.value
89
- end
90
- }
91
- end
92
-
93
- rule multiple_attr_object_block_head
94
- SYM_START_DBLOCK
95
- end
96
-
97
- rule keyed_objects
98
- keyed_object+ {
99
- def value
100
- elements.inject({ }) {|val, e| val.update e.value}
101
- end
102
- }
103
- end
104
-
105
- rule keyed_object
106
- object_key SYM_EQ object_block {
107
- def value
108
- {object_key.value => object_block.value}
109
- end
110
- }
111
- end
112
-
113
- rule object_key
114
- '[' simple_value ']' white_space {
115
- def value
116
- simple_value.value
117
- end
118
- }
119
- end
120
-
121
- rule single_attr_object_block
122
- type_identifier? untyped_single_attr_object_block {
123
- def value
124
- untyped_single_attr_object_block.value
125
- end
126
- }
127
- end
128
-
129
- rule untyped_single_attr_object_block
130
- single_attr_object_complex_head attr_vals SYM_END_DBLOCK {
131
- def value
132
- elements[1].value
133
- end
134
- }
135
- / single_attr_object_complex_head SYM_END_DBLOCK {
136
- def value
137
- nil
138
- end
139
- }
140
- end
141
-
142
- rule single_attr_object_complex_head
143
- SYM_START_DBLOCK
144
- end
145
-
146
- rule primitive_object_block
147
- type_identifier? untyped_primitive_object_block {
148
- def value
149
- untyped_primitive_object_block.value
150
- end
151
- }
152
- end
153
-
154
- rule untyped_primitive_object_block
155
- SYM_START_DBLOCK primitive_object_value SYM_END_DBLOCK {
156
- def value
157
- primitive_object_value.value
158
- end
159
- }
160
- end
161
-
162
- rule primitive_object_value
163
- term_code_list_value '' {
164
- def value
165
- term_code_list_value.value
166
- end
167
- }
168
- / term_code '' {
169
- def value
170
- term_code.value
171
- end
172
- }
173
- / simple_list_value '' {
174
- def value
175
- simple_list_value.value
176
- end
177
- }
178
- / simple_interval_value '' {
179
- def value
180
- simple_interval_value.value
181
- end
182
- }
183
- / simple_value '' {
184
- def value
185
- simple_value.value
186
- end
187
- }
188
- end
189
-
190
- rule simple_value
191
- integer_value '' {
192
- def value
193
- integer_value.value
194
- end
195
- }
196
- / real_value '' {
197
- def value
198
- real_value.value
199
- end
200
- }
201
- / boolean_value '' {
202
- def value
203
- boolean_value.value
204
- end
205
- }
206
- / uri_value '' {
207
- def value
208
- uri_value.value
209
- end
210
- }
211
- / date_value '' {
212
- def value
213
- date_value.value
214
- end
215
- }
216
- / time_value '' {
217
- def value
218
- time_value.value
219
- end
220
- }
221
- / date_time_value '' {
222
- def value
223
- date_time_value.value
224
- end
225
- }
226
- / duration_value '' {
227
- def value
228
- duration_value.value
229
- end
230
- }
231
- / string_value '' {
232
- def value
233
- string_value.value
234
- end
235
- }
236
- / character_value '' {
237
- def value
238
- character_value.value
239
- end
240
- }
241
- end
242
-
243
- rule simple_list_value
244
- integer_list_value '' {
245
- def value
246
- integer_list_value.value
247
- end
248
- }
249
- / real_list_value '' {
250
- def value
251
- real_list_value.value
252
- end
253
- }
254
- / boolean_list_value '' {
255
- def value
256
- boolean_list_value.value
257
- end
258
- }
259
- / character_list_value '' {
260
- def value
261
- character_list_value.value
262
- end
263
- }
264
- / date_list_value '' {
265
- def value
266
- date_list_value.value
267
- end
268
- }
269
- / time_list_value '' {
270
- def value
271
- time_list_value.value
272
- end
273
- }
274
- / date_time_list_value '' {
275
- def value
276
- date_time_list_value.value
277
- end
278
- }
279
- / duration_list_value '' {
280
- def value
281
- duration_list_value.value
282
- end
283
- }
284
- / string_list_value '' {
285
- def value
286
- string_list_value.value
287
- end
288
- }
289
- end
290
-
291
- rule simple_interval_value
292
- integer_interval_value '' {
293
- def value
294
- integer_interval_value.value
295
- end
296
- }
297
- / real_interval_value '' {
298
- def value
299
- real_interval_value.value
300
- end
301
- }
302
- / date_interval_value '' {
303
- def value
304
- date_interval_value.value
305
- end
306
- }
307
- / time_interval_value '' {
308
- def value
309
- time_interval_value.value
310
- end
311
- }
312
- / date_time_interval_value '' {
313
- def value
314
- date_time_interval_value.value
315
- end
316
- }
317
- / duration_interval_value '' {
318
- def value
319
- duration_interval_value.value
320
- end
321
- }
322
- end
323
-
324
- rule term_code
325
- vtref:V_QUALIFIED_TERM_CODE_REF '' {
326
- def value
327
- vtref.value
328
- end
329
- }
330
- end
331
-
332
- rule term_code_list_value
333
- first:term_code more:(',' term_code)+ {
334
- def value
335
- term_codes.map {|t| t.value}
336
- end
337
-
338
- def term_codes
339
- [first] + more.elements.map {|e| e.term_code}
340
- end
341
- }
342
- / term_code ',' SYM_LIST_CONTINUE {
343
- def value
344
- [term_code.value]
345
- end
346
- }
347
- end
348
-
349
- rule uri_value
350
- uri:V_URI '' {
351
- def value
352
- uri.value
353
- end
354
- }
355
- end
356
- end
357
- end
358
- end
@@ -1,1229 +0,0 @@
1
- require 'openehr/assumed_library_types'
2
- require 'openehr/rm/data_types/quantity'
3
-
4
- module OpenEHR
5
- module Parser
6
- grammar SharedToken
7
-
8
- rule any_identifier
9
- type_identifier '' {
10
- def value
11
- type_identifier.value
12
- end
13
- }
14
- / V_ATTRIBUTE_IDENTIFIER '' {
15
- def value
16
- V_ATTRIBUTE_IDENTIFIER.value
17
- end
18
- }
19
- end
20
-
21
- rule type_identifier
22
- '(' id:V_GENERIC_TYPE_IDENTIFIER ')' white_space {
23
- def value
24
- id.value
25
- end
26
- }
27
- / id:V_GENERIC_TYPE_IDENTIFIER white_space {
28
- def value
29
- id.value
30
- end
31
- }
32
- / '(' id:V_TYPE_IDENTIFIER ')' white_space {
33
- def value
34
- id.value
35
- end
36
- }
37
- / id:V_TYPE_IDENTIFIER white_space {
38
- def value
39
- id.value
40
- end
41
- }
42
- end
43
-
44
- rule boolean_value
45
- SYM_TRUE {
46
- def value
47
- true
48
- end
49
- }
50
- / SYM_FALSE {
51
- def value
52
- false
53
- end
54
- }
55
- end
56
-
57
- rule boolean_list_value
58
- boolean_value (',' white_space more_bool:(boolean_value ''))+ {
59
- def value
60
- booelans.map {|b| b.value}
61
- end
62
-
63
- def booleans
64
- [boolean_value] + more_bool.elements.map { |b| b.boolean_value }
65
- end
66
- }
67
- / boolean_value white_space SYM_LIST_CONTINUE {
68
- def value
69
- [boolean_value.value]
70
- end
71
- }
72
- end
73
-
74
- rule integer_value
75
- [+-]? V_INTEGER '' {
76
- def value
77
- text_value.to_i
78
- end
79
- }
80
- end
81
-
82
- rule integer_list_value
83
- integer_value more_i:(',' white_space integer_value)+ {
84
- def value
85
- integers.map { |i| i.value }
86
- end
87
-
88
- def integers
89
- [integer_value] + more_i.elements.map { |i| i.integer_value }
90
- end
91
- }
92
- / integer_value ',' white_space SYM_LIST_CONTINUE {
93
- def value
94
- [integer_value.value]
95
- end
96
- }
97
- end
98
-
99
- rule integer_interval_value
100
- SYM_INTERVAL_DELIM SYM_GT lo:integer_value SYM_ELLIPSIS SYM_LT up:integer_value SYM_INTERVAL_DELIM {
101
- def value
102
- OpenEHR::AssumedLibraryTypes::Interval.new(:lower => lo.value,
103
- :upper => up.value,
104
- :lower_included => false,
105
- :upper_included => false)
106
- end
107
- }
108
- / SYM_INTERVAL_DELIM SYM_GT lo:integer_value SYM_ELLIPSIS up:integer_value SYM_INTERVAL_DELIM {
109
- def value
110
- OpenEHR::AssumedLibraryTypes::Interval.new(:lower => lo.value,
111
- :upper => up.value,
112
- :lower_included => false,
113
- :upper_included => true)
114
- end
115
- }
116
- / SYM_INTERVAL_DELIM lo:integer_value SYM_ELLIPSIS SYM_LT up:integer_value SYM_INTERVAL_DELIM {
117
- def value
118
- OpenEHR::AssumedLibraryTypes::Interval.new(:lower => lo.value,
119
- :upper => up.value,
120
- :lower_included => true,
121
- :upper_included => false)
122
- end
123
- }
124
- / SYM_INTERVAL_DELIM lo:integer_value SYM_ELLIPSIS up:integer_value SYM_INTERVAL_DELIM {
125
- def value
126
- OpenEHR::AssumedLibraryTypes::Interval.new(:lower => lo.value,
127
- :upper => up.value,
128
- :lower_included => true,
129
- :upper_included => true)
130
- end
131
- }
132
- / SYM_INTERVAL_DELIM SYM_LT up:integer_value SYM_INTERVAL_DELIM {
133
- def value
134
- OpenEHR::AssumedLibraryTypes::Interval.new(
135
- :upper => up.value,
136
- :lower_unbounded => true,
137
- :upper_included => false)
138
- end
139
- }
140
- / SYM_INTERVAL_DELIM SYM_LE up:integer_value SYM_INTERVAL_DELIM {
141
- def value
142
- OpenEHR::AssumedLibraryTypes::Interval.new(
143
- :upper => up.value,
144
- :lower_unbounded => true,
145
- :upper_included => true)
146
- end
147
- }
148
- / SYM_INTERVAL_DELIM SYM_GT lo:integer_value SYM_INTERVAL_DELIM {
149
- def value
150
- OpenEHR::AssumedLibraryTypes::Interval.new(
151
- :lower => lo.value,
152
- :uppper_unbounded => true,
153
- :lower_included => false)
154
- end
155
- }
156
- / SYM_INTERVAL_DELIM SYM_GE iv:integer_value SYM_INTERVAL_DELIM {
157
- def value
158
- OpenEHR::AssumedLibraryTypes::Interval.new(
159
- :lower => iv.value,
160
- :upper_unbounded => true,
161
- :lower_included => true)
162
- end
163
- }
164
- / SYM_INTERVAL_DELIM val:integer_value SYM_INTERVAL_DELIM {
165
- def value
166
- OpenEHR::AssumedLibraryTypes::Interval.new(
167
- :lower => val.value,
168
- :upper => val.value,
169
- :upper_included => true,
170
- :lower_included => true)
171
- end
172
- }
173
- end
174
-
175
- rule real_value
176
- ('+' / '-')? V_REAL {
177
- def value
178
- text_value.to_f
179
- end
180
- }
181
- end
182
-
183
- rule real_list_value
184
- real_value more_i:(',' white_space real_value)* {
185
- def value
186
- reals.map { |i| i.value }
187
- end
188
-
189
- def reals
190
- [real_value] + more_i.elements.map { |i| i.real_value }
191
- end
192
- }
193
- / real_value ',' white_space SYM_LIST_CONTINUE {
194
- def value
195
- [real_value.value]
196
- end
197
- }
198
- end
199
-
200
- rule real_interval_value
201
- SYM_INTERVAL_DELIM SYM_GT lo:real_value SYM_ELLIPSIS SYM_LT up:real_value SYM_INTERVAL_DELIM {
202
- def value
203
- OpenEHR::AssumedLibraryTypes::Interval.new(:lower => lo.value,
204
- :upper => up.value,
205
- :lower_included => false,
206
- :upper_included => false)
207
- end
208
- }
209
- / SYM_INTERVAL_DELIM SYM_GT lo:real_value SYM_ELLIPSIS up:real_value SYM_INTERVAL_DELIM {
210
- def value
211
- OpenEHR::AssumedLibraryTypes::Interval.new(:lower => lo.value,
212
- :upper => up.value,
213
- :lower_included => false,
214
- :upper_included => true)
215
- end
216
- }
217
- / SYM_INTERVAL_DELIM lo:real_value SYM_ELLIPSIS SYM_LT up:real_value SYM_INTERVAL_DELIM {
218
- def value
219
- OpenEHR::AssumedLibraryTypes::Interval.new(:lower => lo.value,
220
- :upper => up.value,
221
- :lower_included => true,
222
- :upper_included => false)
223
- end
224
- }
225
- / SYM_INTERVAL_DELIM lo:real_value SYM_ELLIPSIS up:real_value SYM_INTERVAL_DELIM {
226
- def value
227
- OpenEHR::AssumedLibraryTypes::Interval.new(:lower => lo.value,
228
- :upper => up.value,
229
- :lower_included => true,
230
- :upper_included => true)
231
- end
232
- }
233
- / SYM_INTERVAL_DELIM SYM_LT up:real_value SYM_INTERVAL_DELIM {
234
- def value
235
- OpenEHR::AssumedLibraryTypes::Interval.new(
236
- :upper => up.value,
237
- :lower_unbounded => true,
238
- :upper_included => false)
239
- end
240
- }
241
- / SYM_INTERVAL_DELIM SYM_LE up:real_value SYM_INTERVAL_DELIM {
242
- def value
243
- OpenEHR::AssumedLibraryTypes::Interval.new(
244
- :upper => up.value,
245
- :lower_unbounded => true,
246
- :upper_included => true)
247
- end
248
- }
249
- / SYM_INTERVAL_DELIM SYM_GT lo:real_value SYM_INTERVAL_DELIM {
250
- def value
251
- OpenEHR::AssumedLibraryTypes::Interval.new(
252
- :lower => lo.value,
253
- :uppper_unbounded => true,
254
- :lower_included => false)
255
- end
256
- }
257
- / SYM_INTERVAL_DELIM SYM_GE lo:real_value SYM_INTERVAL_DELIM {
258
- def value
259
- OpenEHR::AssumedLibraryTypes::Interval.new(
260
- :lower => lo.value,
261
- :upper_unbounded => true,
262
- :lower_included => true)
263
- end
264
- }
265
- / SYM_INTERVAL_DELIM val:real_value SYM_INTERVAL_DELIM {
266
- def value
267
- OpenEHR::AssumedLibraryTypes::Interval.new(
268
- :lower => val.value,
269
- :upper => val.value,
270
- :upper_included => true,
271
- :lower_included => true)
272
- end
273
- }
274
- end
275
-
276
- rule character_value
277
- V_CHAR '' {
278
- def value
279
- text_value
280
- end
281
- }
282
- end
283
-
284
- rule character_list_value
285
- character_value (',' white_space more_chars:(character_value))+ {
286
- def value
287
- characters.map {|c| c.value }
288
- end
289
-
290
- def characters
291
- [character_value] + more_chars.elements.map {|c| c.character_value}
292
- end
293
- }
294
- / character_value ',' SYM_LIST_CONTINUE {
295
- def value
296
- [character_value.value]
297
- end
298
- }
299
- end
300
-
301
- rule string_value
302
- str:V_STRING '' {
303
- def value
304
- str.value
305
- end
306
- }
307
- end
308
-
309
- rule string_list_value
310
- first:string_value second:(',' white_space string_value)+ {
311
- def value
312
- strings.map {|s| s.value}
313
- end
314
-
315
- def strings
316
- [first] + second.elements.map {|s| s.string_value}
317
- end
318
- }
319
- / str:V_STRING ',' white_space SYM_LIST_CONTINUE {
320
- def value
321
- [str.value]
322
- end
323
- }
324
- end
325
-
326
- rule date_value
327
- ed:V_ISO8601_EXTENDED_DATE '' {
328
- def value
329
- ::OpenEHR::RM::DataTypes::Quantity::DateTime::DvDate.new(
330
- :value => ed.text_value)
331
- end
332
- }
333
- end
334
-
335
- rule date_list_value
336
- date_value more_dates:(',' white_space date_value)+ {
337
- def value
338
- dates.map {|d| d.value}
339
- end
340
-
341
- def dates
342
- [date_value] + more_dates.elements.map {|d| d.date_value}
343
- end
344
- }
345
- / date_value ',' white_space SYM_LIST_CONTINUE {
346
- def value
347
- [date_value.value]
348
- end
349
- }
350
- end
351
-
352
- rule date_interval_value
353
- SYM_INTERVAL_DELIM SYM_GT lo:date_value SYM_ELLIPSIS SYM_LT up:date_value SYM_INTERVAL_DELIM {
354
- def value
355
- OpenEHR::AssumedLibraryTypes::Interval.new(:lower => lo.value,
356
- :upper => up.value,
357
- :lower_included => false,
358
- :upper_included => false)
359
- end
360
- }
361
- / SYM_INTERVAL_DELIM SYM_GT lo:date_value SYM_ELLIPSIS up:date_value SYM_INTERVAL_DELIM {
362
- def value
363
- OpenEHR::AssumedLibraryTypes::Interval.new(:lower => lo.value,
364
- :upper => up.value,
365
- :lower_included => false,
366
- :upper_included => true)
367
- end
368
- }
369
- / SYM_INTERVAL_DELIM lo:date_value SYM_ELLIPSIS SYM_LT up:date_value SYM_INTERVAL_DELIM {
370
- def value
371
- OpenEHR::AssumedLibraryTypes::Interval.new(:lower => lo.value,
372
- :upper => up.value,
373
- :lower_included => true,
374
- :upper_included => false)
375
- end
376
- }
377
- / SYM_INTERVAL_DELIM lo:date_value SYM_ELLIPSIS up:date_value SYM_INTERVAL_DELIM {
378
- def value
379
- OpenEHR::AssumedLibraryTypes::Interval.new(:lower => lo.value,
380
- :upper => up.value,
381
- :lower_included => true,
382
- :upper_included => true)
383
- end
384
- }
385
- / SYM_INTERVAL_DELIM SYM_LT up:date_value SYM_INTERVAL_DELIM {
386
- def value
387
- OpenEHR::AssumedLibraryTypes::Interval.new(
388
- :upper => up.value,
389
- :lower_unbounded => true,
390
- :upper_included => false)
391
- end
392
- }
393
- / SYM_INTERVAL_DELIM SYM_LE up:date_value SYM_INTERVAL_DELIM {
394
- def value
395
- OpenEHR::AssumedLibraryTypes::Interval.new(
396
- :upper => up.value,
397
- :lower_unbounded => true,
398
- :upper_included => true)
399
- end
400
- }
401
- / SYM_INTERVAL_DELIM SYM_GT lo:date_value SYM_INTERVAL_DELIM {
402
- def value
403
- OpenEHR::AssumedLibraryTypes::Interval.new(
404
- :lower => lo.value,
405
- :uppper_unbounded => true,
406
- :lower_included => false)
407
- end
408
- }
409
- / SYM_INTERVAL_DELIM SYM_GE val:date_value SYM_INTERVAL_DELIM {
410
- def value
411
- OpenEHR::AssumedLibraryTypes::Interval.new(
412
- :lower => val.value,
413
- :upper_unbounded => true,
414
- :lower_included => true)
415
- end
416
- }
417
- / SYM_INTERVAL_DELIM val:date_value SYM_INTERVAL_DELIM {
418
- def value
419
- OpenEHR::AssumedLibraryTypes::Interval.new(
420
- :lower => val.value,
421
- :upper => val.value,
422
- :upper_included => true,
423
- :lower_included => true)
424
- end
425
- }
426
- end
427
-
428
- rule time_value
429
- ti:V_ISO8601_EXTENDED_TIME '' {
430
- def value
431
- ::OpenEHR::RM::DataTypes::Quantity::DateTime::DvTime.new(
432
- :value => ti.text_value)
433
- end
434
- }
435
- end
436
-
437
- rule time_list_value
438
- time_value more_t:(',' white_space time_value)+ {
439
- def value
440
- times.map {|t| t.value}
441
- end
442
-
443
- def times
444
- [time_value] + more_t.elements.map {|t| t.time_value}
445
- end
446
- }
447
- / time_value ',' white_space SYM_LIST_CONTINUE {
448
- def value
449
- [time_value.value]
450
- end
451
- }
452
- end
453
-
454
- rule time_interval_value
455
- SYM_INTERVAL_DELIM SYM_GT lo:time_value SYM_ELLIPSIS SYM_LT up:time_value SYM_INTERVAL_DELIM {
456
- def value
457
- OpenEHR::AssumedLibraryTypes::Interval.new(:lower => lo.value,
458
- :upper => up.value,
459
- :lower_included => false,
460
- :upper_included => false)
461
- end
462
- }
463
- / SYM_INTERVAL_DELIM SYM_GT lo:time_value SYM_ELLIPSIS up:time_value SYM_INTERVAL_DELIM {
464
- def value
465
- OpenEHR::AssumedLibraryTypes::Interval.new(:lower => lo.value,
466
- :upper => up.value,
467
- :lower_included => false,
468
- :upper_included => true)
469
- end
470
- }
471
- / SYM_INTERVAL_DELIM lo:time_value SYM_ELLIPSIS SYM_LT up:time_value SYM_INTERVAL_DELIM {
472
- def value
473
- OpenEHR::AssumedLibraryTypes::Interval.new(:lower => lo.value,
474
- :upper => up.value,
475
- :lower_included => true,
476
- :upper_included => false)
477
- end
478
- }
479
- / SYM_INTERVAL_DELIM lo:time_value SYM_ELLIPSIS up:time_value SYM_INTERVAL_DELIM {
480
- def value
481
- OpenEHR::AssumedLibraryTypes::Interval.new(:lower => lo.value,
482
- :upper => up.value,
483
- :lower_included => true,
484
- :upper_included => true)
485
- end
486
- }
487
- / SYM_INTERVAL_DELIM SYM_LT up:time_value SYM_INTERVAL_DELIM {
488
- def value
489
- OpenEHR::AssumedLibraryTypes::Interval.new(
490
- :upper => up.value,
491
- :lower_unbounded => true,
492
- :upper_included => false)
493
- end
494
- }
495
- / SYM_INTERVAL_DELIM SYM_LE up:time_value SYM_INTERVAL_DELIM {
496
- def value
497
- OpenEHR::AssumedLibraryTypes::Interval.new(
498
- :upper => up.value,
499
- :lower_unbounded => true,
500
- :upper_included => true)
501
- end
502
- }
503
- / SYM_INTERVAL_DELIM SYM_GT lo:time_value SYM_INTERVAL_DELIM {
504
- def value
505
- OpenEHR::AssumedLibraryTypes::Interval.new(
506
- :lower => lo.value,
507
- :uppper_unbounded => true,
508
- :lower_included => false)
509
- end
510
- }
511
- / SYM_INTERVAL_DELIM SYM_GE tv:time_value SYM_INTERVAL_DELIM {
512
- def value
513
- OpenEHR::AssumedLibraryTypes::Interval.new(
514
- :lower => tv.value,
515
- :upper_unbounded => true,
516
- :lower_included => true)
517
- end
518
- }
519
- / SYM_INTERVAL_DELIM val:time_value SYM_INTERVAL_DELIM {
520
- def value
521
- OpenEHR::AssumedLibraryTypes::Interval.new(
522
- :lower => val.value,
523
- :upper => val.value,
524
- :upper_included => true,
525
- :lower_included => true)
526
- end
527
- }
528
- end
529
-
530
- rule date_time_value
531
- dt:V_ISO8601_EXTENDED_DATE_TIME '' {
532
- def value
533
- ::OpenEHR::RM::DataTypes::Quantity::DateTime::DvDateTime.new(
534
- :value => dt.text_value)
535
- end
536
- }
537
- end
538
-
539
- rule date_time_list_value
540
- date_time_value (',' more_dt:date_time_value)+ {
541
- def value
542
- date_times.map {|t| t.value}
543
- end
544
-
545
- def date_times
546
- [date_time_value] + more_dt.elements.map {|dt| dt.date_time_value}
547
- end
548
- }
549
- / date_time_value ',' SYM_LIST_CONTINUE {
550
- def value
551
- [date_time_value.value]
552
- end
553
- }
554
- end
555
-
556
- rule date_time_interval_value
557
- SYM_INTERVAL_DELIM SYM_GT lo:date_time_value SYM_ELLIPSIS SYM_LT up:date_time_value SYM_INTERVAL_DELIM {
558
- def value
559
- OpenEHR::AssumedLibraryTypes::Interval.new(:lower => lo.value,
560
- :upper => up.value,
561
- :lower_included => false,
562
- :upper_included => false)
563
- end
564
- }
565
- / SYM_INTERVAL_DELIM SYM_GT lo:date_time_value SYM_ELLIPSIS up:date_time_value SYM_INTERVAL_DELIM {
566
- def value
567
- OpenEHR::AssumedLibraryTypes::Interval.new(:lower => lo.value,
568
- :upper => up.value,
569
- :lower_included => false,
570
- :upper_included => true)
571
- end
572
- }
573
- / SYM_INTERVAL_DELIM lo:date_time_value SYM_ELLIPSIS SYM_LT up:date_time_value SYM_INTERVAL_DELIM {
574
- def value
575
- OpenEHR::AssumedLibraryTypes::Interval.new(:lower => lo.value,
576
- :upper => up.value,
577
- :lower_included => true,
578
- :upper_included => false)
579
- end
580
- }
581
- / SYM_INTERVAL_DELIM lo:date_time_value SYM_ELLIPSIS up:date_time_value SYM_INTERVAL_DELIM {
582
- def value
583
- OpenEHR::AssumedLibraryTypes::Interval.new(:lower => lo.value,
584
- :upper => up.value,
585
- :lower_included => true,
586
- :upper_included => true)
587
- end
588
- }
589
- / SYM_INTERVAL_DELIM SYM_LT up:date_time_value SYM_INTERVAL_DELIM {
590
- def value
591
- OpenEHR::AssumedLibraryTypes::Interval.new(
592
- :upper => up.value,
593
- :lower_unbounded => true,
594
- :upper_included => false)
595
- end
596
- }
597
- / SYM_INTERVAL_DELIM SYM_LE up:date_time_value SYM_INTERVAL_DELIM {
598
- def value
599
- OpenEHR::AssumedLibraryTypes::Interval.new(
600
- :upper => up.value,
601
- :lower_unbounded => true,
602
- :upper_included => true)
603
- end
604
- }
605
- / SYM_INTERVAL_DELIM SYM_GT lo:date_time_value SYM_INTERVAL_DELIM {
606
- def value
607
- OpenEHR::AssumedLibraryTypes::Interval.new(
608
- :lower => lo.value,
609
- :uppper_unbounded => true,
610
- :lower_included => false)
611
- end
612
- }
613
- / SYM_INTERVAL_DELIM SYM_GE dt:date_time_value SYM_INTERVAL_DELIM {
614
- def value
615
- OpenEHR::AssumedLibraryTypes::Interval.new(
616
- :lower => dt.value,
617
- :upper_unbounded => true,
618
- :lower_included => true)
619
- end
620
- }
621
- / SYM_INTERVAL_DELIM val:date_time_value SYM_INTERVAL_DELIM {
622
- def value
623
- OpenEHR::AssumedLibraryTypes::Interval.new(
624
- :lower => val.value,
625
- :upper => val.value,
626
- :upper_included => true,
627
- :lower_included => true)
628
- end
629
- }
630
- end
631
-
632
- rule duration_value
633
- du:V_ISO8601_DURATION '' {
634
- def value
635
- ::OpenEHR::RM::DataTypes::Quantity::DateTime::DvDuration.new(
636
- :value => du.text_value)
637
- end
638
- }
639
- end
640
-
641
- rule duration_list_value
642
- duration_value more_d:(',' duration_value)+ {
643
- def value
644
- durations.map {|d| d.value}
645
- end
646
-
647
- def durations
648
- [duration_value] + more_d.elements.map {|d| d.duration_value}
649
- end
650
- }
651
- / duration_value ',' SYM_LIST_CONTINUE {
652
- def value
653
- [duration_value.value]
654
- end
655
- }
656
- end
657
-
658
- rule duration_interval_value
659
- SYM_INTERVAL_DELIM SYM_GT lo:duration_value SYM_ELLIPSIS SYM_LT up:duration_value SYM_INTERVAL_DELIM {
660
- def value
661
- OpenEHR::AssumedLibraryTypes::Interval.new(:lower => lo.value,
662
- :upper => up.value,
663
- :lower_included => false,
664
- :upper_included => false)
665
- end
666
- }
667
- / SYM_INTERVAL_DELIM SYM_GT lo:duration_value SYM_ELLIPSIS up:duration_value SYM_INTERVAL_DELIM {
668
- def value
669
- OpenEHR::AssumedLibraryTypes::Interval.new(:lower => lo.value,
670
- :upper => up.value,
671
- :lower_included => false,
672
- :upper_included => true)
673
- end
674
- }
675
- / SYM_INTERVAL_DELIM lo:duration_value SYM_ELLIPSIS SYM_LT up:duration_value SYM_INTERVAL_DELIM {
676
- def value
677
- OpenEHR::AssumedLibraryTypes::Interval.new(:lower => lo.value,
678
- :upper => up.value,
679
- :lower_included => true,
680
- :upper_included => false)
681
- end
682
- }
683
- / SYM_INTERVAL_DELIM lo:duration_value SYM_ELLIPSIS up:duration_value SYM_INTERVAL_DELIM {
684
- def value
685
- OpenEHR::AssumedLibraryTypes::Interval.new(:lower => lo.value,
686
- :upper => up.value,
687
- :lower_included => true,
688
- :upper_included => true)
689
- end
690
- }
691
- / SYM_INTERVAL_DELIM SYM_LT up:duration_value SYM_INTERVAL_DELIM {
692
- def value
693
- OpenEHR::AssumedLibraryTypes::Interval.new(
694
- :upper => up.value,
695
- :lower_unbounded => true,
696
- :upper_included => false)
697
- end
698
- }
699
- / SYM_INTERVAL_DELIM SYM_LE up:duration_value SYM_INTERVAL_DELIM {
700
- def value
701
- OpenEHR::AssumedLibraryTypes::Interval.new(
702
- :upper => up.value,
703
- :lower_unbounded => true,
704
- :upper_included => true)
705
- end
706
- }
707
- / SYM_INTERVAL_DELIM SYM_GT lo:duration_value SYM_INTERVAL_DELIM {
708
- def value
709
- OpenEHR::AssumedLibraryTypes::Interval.new(
710
- :lower => lo.value,
711
- :uppper_unbounded => true,
712
- :lower_included => false)
713
- end
714
- }
715
- / SYM_INTERVAL_DELIM SYM_GE val:duration_value SYM_INTERVAL_DELIM {
716
- def value
717
- OpenEHR::AssumedLibraryTypes::Interval.new(
718
- :lower => val.value,
719
- :upper_unbounded => true,
720
- :lower_included => true)
721
- end
722
- }
723
- / SYM_INTERVAL_DELIM val:duration_value SYM_INTERVAL_DELIM {
724
- def value
725
- OpenEHR::AssumedLibraryTypes::Interval.new(
726
- :upper => val.value,
727
- :lower => val.value,
728
- :upper_included => true,
729
- :lower_included => true)
730
- end
731
- }
732
- end
733
-
734
- rule ALPHANUM
735
- [a-zA-Z0-9]
736
- end
737
-
738
- rule IDCHAR
739
- [a-zA-Z0-9_]
740
- end
741
-
742
- rule NAMECHAR
743
- [a-zA-Z0-9\._\-]
744
- end
745
-
746
- rule NAMECHAR_SPACE
747
- [a-zA-Z0-9\._\- ]
748
- end
749
-
750
- rule NAMECHAR_PAREN
751
- [a-zA-Z0-9\._\-\(\)]
752
- end
753
-
754
- rule NAMESTR
755
- [a-zA-Z] [a-zA-Z0-9_]+
756
- end
757
-
758
- rule space
759
- COMMENT* white_space
760
- end
761
-
762
- rule COMMENT
763
- white_space '--' [^\n]* "\n"
764
- end
765
-
766
- rule white_space
767
- [ \t\r\n]*
768
- end
769
-
770
- rule Minus_code
771
- '-'
772
- end
773
-
774
- rule Plus_Code
775
- '+'
776
- end
777
-
778
- rule Star_code
779
- '*'
780
- end
781
-
782
- rule Slash_code
783
- '/'
784
- end
785
-
786
- rule Carret_code
787
- '^'
788
- end
789
-
790
- rule Dot_code
791
- '.'
792
- end
793
-
794
- rule Semicolon_code
795
- ';'
796
- end
797
-
798
- rule Colon_code
799
- ':'
800
- end
801
-
802
- rule Comma_code
803
- ','
804
- end
805
-
806
- rule Expclamation_code
807
- '!'
808
- end
809
-
810
- rule Left_parenthesis_code
811
- '('
812
- end
813
-
814
- rule Right_parenthesis_code
815
- ')'
816
- end
817
-
818
- rule Dollar_code
819
- '$'
820
- end
821
-
822
- rule SYM_DT_UNKNOWN
823
- '??'
824
- end
825
-
826
- rule Question_mark_code
827
- '?'
828
- end
829
-
830
- rule SYM_INTERVAL_DELIM
831
- '|'
832
- end
833
-
834
- rule Left_bracket_code
835
- '[' space
836
- end
837
-
838
- rule Right_bracket_codde
839
- ']'
840
- end
841
-
842
- rule SYM_EQ
843
- '=' white_space
844
- end
845
-
846
- rule SYM_GE
847
- ('=>' / '>=') white_space
848
- end
849
-
850
- rule SYM_LE
851
- ('<=' / '=>') white_space
852
- end
853
-
854
- rule SYM_LT
855
- '<' white_space
856
- end
857
-
858
- rule SYM_GT
859
- '>' white_space
860
- end
861
-
862
- rule SYM_START_DBLOCK
863
- '<' space
864
- end
865
-
866
- rule SYM_END_DBLOCK
867
- '>' space
868
- end
869
-
870
- rule SYM_START_CBLOCK
871
- '{' space
872
- end
873
-
874
- rule SYM_END_CBLOCK
875
- '}'
876
- end
877
-
878
- rule SYM_ELLIPSIS
879
- '..'
880
- end
881
-
882
- rule SYM_LIST_CONTINUE
883
- '...'
884
- end
885
-
886
- rule SYM_INFINITY
887
- [Ii] [Nn] [Ff] [Ii] [Nn] [Ii] [Tt] [Yy] space
888
- end
889
-
890
- rule SYM_ARCHETYPE
891
- [Aa] [Rr] [Cc] [Hh] [Ee] [Tt] [Yy] [Pp] [Ee] space
892
- end
893
-
894
- rule SYM_MATCHES
895
- ([Mm] [Aa] [Tt] [Cc] [Hh] [Ee] [Ss] / [Ii] [Ss] '_' [Ii] [Nn]) white_space
896
- end
897
-
898
- rule SYM_THEN
899
- [Tt] [Hh] [Ee] [Nn] space
900
- end
901
-
902
- rule SYM_ELSE
903
- [Ee] [Ll] [Ss] [Ee] space
904
- end
905
-
906
- rule SYM_AND
907
- [Aa] [Nn] [Dd] space
908
- end
909
-
910
- rule SYM_OR
911
- [Oo] [Rr] space
912
- end
913
-
914
- rule SYM_XOR
915
- [Xx] [Oo] [Rr] space
916
- end
917
-
918
- rule SYM_NOT
919
- [Nn] [Oo] [Tt] space
920
- end
921
-
922
- rule SYM_IMPLIES
923
- [Ii] [Mm] [Pp] [Ll] [Ii] [Ee] [Ss] space
924
- end
925
-
926
- rule SYM_TRUE
927
- [Tt] [Rr] [Uu] [Ee] space
928
- end
929
-
930
- rule SYM_FALSE
931
- [Ff] [Aa] [Ll] [Ss] [Ee] space
932
- end
933
-
934
- rule SYM_FORALL
935
- [Ff] [Oo] [Rr] '_' [Aa] [Ll] [Ll] space
936
- end
937
-
938
- rule SYM_EXISTS
939
- [Ee] [Xx] [Ii] [Ss] [Tt] [Ss] space
940
- end
941
-
942
- rule SYM_EXISTENCE
943
- [Ee] [Xx] [Ii] [Ss] [Tt] [Ee] [Nn] [Cc] [Ee] space
944
- end
945
-
946
- rule SYM_OCCURRENCES
947
- [Oo] [Cc] [Cc] [Uu] [Rr] [Rr] [Ee] [Nn] [Cc] [Ee] [Ss] white_space
948
- end
949
-
950
- rule SYM_CARDINALITY
951
- [Cc] [Aa] [Rr] [Dd] [Ii] [Nn] [Aa] [Ll] [Ii] [Tt] [Yy] white_space
952
- end
953
-
954
- rule SYM_ORDERED
955
- [Oo] [Rr] [Dd] [Ee] [Rr] [Ee] [Dd] white_space
956
- end
957
-
958
- rule SYM_UNORDERD
959
- [Uu] [Nn] [Oo] [Rr] [Dd] [Ee] [Rr] [Ee] [Dd] white_space
960
- end
961
-
962
- rule SYM_UNIQUE
963
- [Uu] [Nn] [Ii] [Qq] [Uu] [Ee] space
964
- end
965
-
966
- rule SYM_INFINITY
967
- [Ii] [Nn] [Ff] [Ii] [Nn] [Ii] [Tt] [Yy] space
968
- end
969
-
970
- rule SYM_USE_NODE
971
- [Uu] [Ss] [Ee] '_' [Nn] [Oo] [Dd] [Ee] space
972
- end
973
-
974
- rule SYM_ALLOW_ARCHETYPE
975
- ([Aa] [Ll] [Ll] [Oo] [Ww] / [Uu] [Ss] [Ee]) '_' [Aa] [Rr] [Cc] [Hh] [Ee] [Tt] [Yy] [Pp] [Ee] space
976
- end
977
-
978
- rule SYM_INCLUDE
979
- [Ii] [Nn] [Cc] [Ll] [Uu] [Dd] [Ee] space
980
- end
981
-
982
- rule SYM_EXCLUDE
983
- [Ee] [Xx] [Cc] [Ll] [Uu] [Dd] [Ee] space
984
- end
985
-
986
- rule SYM_TEMPLATE_COMPONENT
987
- [Tt] [Ee] [Mm] [Pp] [Ll] [Aa] [Tt] [Ee] ' _' [Cc] [Oo] [Mm] [Pp] [Oo] [Nn] [Ee] [Nn] [Tt] space
988
- end
989
-
990
- rule SYM_TEMPLATE
991
- [Tt] [Ee] [Mm] [Pp] [Ll] [Aa] [Tt] [Ee] space
992
- end
993
-
994
- rule SYM_OPERATIONAL_TEMPLATE
995
- [Oo] [Pp] [Ee] [Rr] [Aa] [Tt] [Ii] [Oo] [Nn] [Aa] [Ll] '_' [Tt] [Ee] [Mm] [Pp] [Ll] [Aa] [Tt] [Ee] space
996
- end
997
-
998
- rule SYM_ADL_VERSION
999
- [Aa] [Dd] [Ll] '_' [Vv] [Ee] [Rr] [Ss] [Ii] [Oo] [Nn] space
1000
- end
1001
-
1002
- rule SYM_IS_CONTROLLED
1003
- [Cc] [Oo] [Nn] [Tt] [Rr] [Oo] [Ll] [Ll] [Ee] [Dd] space
1004
- end
1005
-
1006
- rule SYM_IS_GENERATED
1007
- [Gg] [Ee] [Nn] [Ee] [Rr] [Aa] [Tt] [Ee] [Dd] space
1008
- end
1009
-
1010
- rule SYM_SPECIALIZE
1011
- [Ss] [Pp] [Ee] [Cc] [Ii] [Aa] [Ll] [Ii] [SsZz] [Ee] space
1012
- end
1013
-
1014
- rule SYM_CONCEPT
1015
- [Cc] [Oo] [Nn] [Cc] [Ee] [Pp] [Tt] space
1016
- end
1017
-
1018
- rule SYM_LANGUAGE
1019
- [Ll] [Aa] [Nn] [Gg] [Uu] [Aa] [Gg] [Ee] space
1020
- end
1021
-
1022
- rule SYM_DESCRIPTION
1023
- [Dd] [Ee] [Ss] [Cc] [Rr] [Ii] [Pp] [Tt] [Ii] [Oo] [Nn] space
1024
- end
1025
-
1026
- rule SYM_DEFINITION
1027
- [Dd] [Ee] [Ff] [Ii] [Nn] [Ii] [Tt] [Ii] [Oo] [Nn] space
1028
- end
1029
-
1030
- rule SYM_INVARIANT
1031
- [Ii] [Nn] [Vv] [Aa] [Rr] [Ii] [Aa] [Nn] [Tt] space
1032
- end
1033
-
1034
- rule SYM_ONTOLOGY
1035
- [Oo] [Nn] [Tt] [Oo] [Ll] [Oo] [Gg] [Yy] space
1036
- end
1037
-
1038
- rule SYM_ANNOTATIONS
1039
- [Aa] [Nn] [Nn] [Oo] [Tt] [Aa] [Tt] [Ii] [Oo] [Nn] [Ss] space
1040
- end
1041
-
1042
- rule V_VERSION_STRING
1043
- [0-9]+ '.' [0-9]+ ('.' [0-9]+)* {
1044
- def value
1045
- text_value
1046
- end
1047
- }
1048
- end
1049
-
1050
- rule V_ARCHETYPE_ID
1051
- NAMESTR ('-' NAMESTR) 2..2 '.' NAMESTR ('-' NAMESTR)* '.v' [1-9] [0-9]* {
1052
- def value
1053
- text_value
1054
- end
1055
- }
1056
- end
1057
-
1058
- rule V_IDENTIFIER
1059
- [a-zA-Z] [a-zA-Z0-9_]* {
1060
- def value
1061
- text_value
1062
- end
1063
- }
1064
- end
1065
-
1066
- rule V_URI
1067
- [a-z]+ '://' [^<>|\\{}^~"\[\] ]* {
1068
- def value
1069
- text_value
1070
- end
1071
- }
1072
- end
1073
-
1074
- rule V_QUALIFIED_TERM_CODE_REF
1075
- '[' ti:(NAMECHAR_PAREN+) '::' cs:(NAMECHAR+) ']' {
1076
- def value
1077
- term_id = OpenEHR::RM::Support::Identification::TerminologyID.new(
1078
- :value => ti.text_value)
1079
- OpenEHR::RM::DataTypes::Text::CodePhrase.new(
1080
- :terminology_id => term_id, :code_string => cs.text_value)
1081
- end
1082
- }
1083
- end
1084
-
1085
- rule ERR_V_QUALIFIED_TERM_CODE_REF
1086
- '[' er:(NAMECHAR_PAREN+ '::' NAMECHAR_SPACE+) ']' {
1087
- def value
1088
- er.text_value
1089
- end
1090
- }
1091
- end
1092
-
1093
- rule V_LOCAL_TERM_CODE_REF
1094
- '[' lt:(ALPHANUM NAMECHAR*) ']' {
1095
- def value
1096
- lt.text_value
1097
- end
1098
- }
1099
- end
1100
-
1101
- rule V_LOCAL_CODE
1102
- 'a' [ct] [0-9\.]+ {
1103
- def value
1104
- text_value
1105
- end
1106
- }
1107
- end
1108
-
1109
- rule V_TERM_CODE
1110
- '[' code:([a-zA-Z0-9()._\-]+) '::' white_space {
1111
- def value
1112
- ::OpenEHR::RM::Support::Identification::TerminologyID.new(
1113
- :value => code.text_value)
1114
- end
1115
- }
1116
- end
1117
-
1118
- rule V_ISO8601_EXTENDED_DATE_TIME
1119
- ([0-9] 4..4 '-' [0-1] [0-9] '-' [0-3] [0-9] 'T' [0-2] [0-9] ':' [0-6] [0-9] ':' [0-6] [0-9] (',' [0-9]+)? ('Z' / [+-] [0-9] 4..4)? ) / ([0-9] 4..4 '-' [0-1] [0-9] '-' [0-3] [0-9] 'T' [0-2] [0-9] ':' [0-6] [0-9] ('Z' / [+-] [0-9] 4..4)?) / ([0-9] 4..4 '-' [0-1] [0-9] '-' [0-3] [0-9] 'T' [0-2] [0-9] ('Z' / [+-] [0-9] 4..4)?)
1120
- end
1121
-
1122
- rule V_ISO8601_EXTENDED_TIME
1123
- [0-2] [0-9] ':' [0-6] [0-9] ':' [0-6] [0-9] (',' [0-9]+)? ('Z' / [+-] [0-9] 4..4)? / [0-2] [0-9] ':' [0-6] [0-9] ('Z' / [+-] [0-9] 4..4)?
1124
- end
1125
-
1126
- rule V_ISO8601_EXTENDED_DATE
1127
- [0-9] 4..4 '-' [0-1] [0-9] '-' [0-3] [0-9] / [0-9] 4..4 '-' [0-1] [0-9]
1128
- end
1129
-
1130
- rule V_ISO8601_DURATION
1131
- 'P' ([0-9]+ [yY])? ([0-9]+ [mM])? ([0-9]+ [wW])? ([0-9]+ [dD])? 'T' ([0-9]+ [hH]) ([0-9]+ [mM])? ([0-9]+ ('.' [0-9]+)? [sS])?
1132
- / 'P' ([0-9]+ [yY])? ([0-9]+ [mM])? ([0-9]+ [wW])? ([0-9]+ [dD])? 'T' ([0-9]+ [hH])? ([0-9]+ [mM]) ([0-9]+ ('.' [0-9]+)? [sS])?
1133
- / 'P' ([0-9]+ [yY])? ([0-9]+ [mM])? ([0-9]+ [wW])? ([0-9]+ [dD])? 'T' ([0-9]+ [hH])? ([0-9]+ [mM])? ([0-9]+ ('.' [0-9]+)? [sS])?
1134
- / 'P' ([0-9]+ [yY]) ([0-9]+ [mM])? ([0-9]+ [wW])? ([0-9]+ [dD])?
1135
- / 'P' ([0-9]+ [yY])? ([0-9]+ [mM]) ([0-9]+ [wW])? ([0-9]+ [dD])?
1136
- / 'P' ([0-9]+ [yY])? ([0-9]+ [mM])? ([0-9]+ [wW]) ([0-9]+ [dD])?
1137
- / 'P' ([0-9]+ [yY])? ([0-9]+ [mM])? ([0-9]+ [wW])? ([0-9]+ [dD])
1138
- end
1139
-
1140
- rule V_ISO8601_DATE_CONSTRAINT_PATTERN
1141
- [yY] [yY] [yY] [yY] '-' [mM?X] [mM?X] '-' [dD?X] [dD?X]
1142
- end
1143
-
1144
- rule V_ISO8601_TIME_CONSTRAINT_PATTERN
1145
- [hH] [hH] ':' [mM?X] [mM?X] ':' [sS?X] [sS?X]
1146
- end
1147
-
1148
- rule V_ISO8601_DATE_TIME_CONSTRAINT_PATTERN
1149
- [yY] [yY] [yY] [yY] '-' [mM?X] [mM?X] '-' [dD?X] [dD?X] [Tt ] [hH?X] [hH?X] ':' [mM?X] [mM?X] ':' [sS?X] [sS?X]
1150
- end
1151
-
1152
- rule V_ISO8601_DURATION_CONSTRAINT_PATTERN
1153
- 'P' [yY]? [mM]? [wW]? [dD]? 'T' [hH] [mM]? [sS]?
1154
- / 'P' [yY]? [mM]? [wW]? [dD]? 'T' [hH]? [mM] [sS]?
1155
- / 'P' [yY]? [mM]? [wW]? [dD]? 'T' [hH]? [mM]? [sS]
1156
- / 'P' [yY] [mM]? [wW]? [dD]?
1157
- / 'P' [yY]? [mM] [wW]? [dD]?
1158
- / 'P' [yY]? [mM]? [wW] [dD]?
1159
- / 'P' [yY]? [mM]? [wW]? [dD]
1160
- end
1161
-
1162
- rule V_TYPE_IDENTIFIER
1163
- [A-Z] IDCHAR* {
1164
- def value
1165
- text_value
1166
- end
1167
- }
1168
- end
1169
-
1170
- rule V_GENERIC_TYPE_IDENTIFIER
1171
- [A-Z] IDCHAR* '<' [a-zA-Z0-9,_]+ '>' { # <>
1172
- def value
1173
- text_value
1174
- end
1175
- }
1176
- end
1177
-
1178
- rule V_ATTRIBUTE_IDENTIFIER
1179
- [a-z] IDCHAR* {
1180
- def value
1181
- text_value
1182
- end
1183
- }
1184
- end
1185
-
1186
- rule V_INTEGER
1187
- [0-9]+ [eE] [+-]? [0-9] {
1188
- def value
1189
- text_value.to_i
1190
- end
1191
- }
1192
- / [1-9] [0-9]+ {
1193
- def value
1194
- text_value.to_i
1195
- end
1196
- }
1197
- / [0-9] {
1198
- def value
1199
- text_value.to_i
1200
- end
1201
- }
1202
- end
1203
-
1204
- rule V_REAL
1205
- [0-9]+ '.' [0-9]+ [eE] [+-]? [0-9]+ / [1-9] [0-9]+ '.' [0-9]+ / [0-9] '.' [0-9]+ {
1206
- def value
1207
- text_value.to_f
1208
- end
1209
- }
1210
- end
1211
-
1212
- rule V_CHAR
1213
- [^\\\n\"] {
1214
- def value
1215
- text_value
1216
- end
1217
- }
1218
- end
1219
-
1220
- rule V_STRING
1221
- '"' str:(('\"' / !'"' .)*) '"' {
1222
- def value
1223
- str.text_value.tr_s('\\\\', '\\')
1224
- end
1225
- }
1226
- end
1227
- end
1228
- end
1229
- end