dhall 0.3.0 → 0.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/lib/dhall/coder.rb CHANGED
@@ -105,7 +105,12 @@ module Dhall
105
105
 
106
106
  refine List do
107
107
  def to_ruby(&decode)
108
- to_a.map(&decode)
108
+ arr = to_a.map(&decode)
109
+ unless element_type.is_a?(RecordType) &&
110
+ element_type.keys == ["mapKey", "mapValue"]
111
+ return arr
112
+ end
113
+ Hash[arr.map { |h| h.values_at("mapKey", "mapValue") }]
109
114
  end
110
115
  end
111
116
 
@@ -1,26 +1,37 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "dhall/builtins"
4
- require "dhall/visitor"
5
4
  require "dhall/util"
6
5
 
7
6
  module Dhall
8
- module ExpressionVisitor
7
+ class ExpressionVisitor
9
8
  ExpressionHash = Util::HashOf.new(
10
9
  ValueSemantics::Anything,
11
10
  ValueSemantics::Either.new([Expression, nil])
12
11
  )
13
12
 
14
- def self.new(&block)
15
- Visitor.new(
16
- Expression => block,
17
- Util::ArrayOf.new(Expression) => lambda do |x|
18
- x.map(&block)
19
- end,
20
- ExpressionHash => lambda do |x|
21
- Hash[x.map { |k, v| [k, v.nil? ? v : block[v]] }.sort]
22
- end
23
- )
13
+ ExpressionArray = Util::ArrayOf.new(Expression)
14
+
15
+ def initialize(&block)
16
+ @block = block
17
+ end
18
+
19
+ def visit(expr)
20
+ expr.to_h.each_with_object({}) do |(attr, value), h|
21
+ result = one_visit(value)
22
+ h[attr] = result if result
23
+ end
24
+ end
25
+
26
+ def one_visit(value)
27
+ case value
28
+ when Expression
29
+ @block[value]
30
+ when ExpressionArray
31
+ value.map(&@block)
32
+ when ExpressionHash
33
+ Hash[value.map { |k, v| [k, v.nil? ? v : @block[v]] }.sort]
34
+ end
24
35
  end
25
36
  end
26
37
 
@@ -51,7 +62,7 @@ module Dhall
51
62
  normalized = super
52
63
  return normalized.fuse if normalized.fuse
53
64
 
54
- if normalized.function.is_a?(Builtin) ||
65
+ if normalized.function.is_a?(BuiltinFunction) ||
55
66
  normalized.function.is_a?(Function) ||
56
67
  normalized.function.is_a?(RecordSelection)
57
68
  return normalized.function.call(normalized.argument)
@@ -120,7 +131,7 @@ module Dhall
120
131
  end
121
132
  end
122
133
 
123
- class FunctionProxy
134
+ class FunctionProxyRaw
124
135
  def shift(*)
125
136
  self
126
137
  end
@@ -138,6 +149,8 @@ module Dhall
138
149
  def shift(amount, name, min_index)
139
150
  return self if self.name != name || min_index > index
140
151
 
152
+ raise TypeError, "free variable" if (index + amount).negative?
153
+
141
154
  with(index: index + amount)
142
155
  end
143
156
 
@@ -232,7 +245,10 @@ module Dhall
232
245
 
233
246
  class RightBiasedRecordMerge
234
247
  def normalize
235
- lhs.normalize.merge(rhs.normalize)
248
+ n_lhs = lhs.normalize
249
+ n_rhs = rhs.normalize
250
+ return n_lhs if n_lhs == n_rhs
251
+ n_lhs.merge(n_rhs)
236
252
  end
237
253
  end
238
254
 
@@ -245,7 +261,7 @@ module Dhall
245
261
 
246
262
  class EmptyList
247
263
  def normalize
248
- super.with(element_type: element_type.normalize)
264
+ super.with(type: type.normalize)
249
265
  end
250
266
  end
251
267
 
@@ -265,6 +281,20 @@ module Dhall
265
281
  end
266
282
  end
267
283
 
284
+ class ToMap
285
+ def normalize
286
+ normalized = super
287
+ unless [Record, EmptyRecord].include?(normalized.record.class)
288
+ return normalized
289
+ end
290
+
291
+ List.of(*normalized.record.to_h.to_a.map do |(k, v)|
292
+ k = Text.new(value: k)
293
+ Record.new(record: { "mapKey" => k, "mapValue" => v })
294
+ end, type: normalized.type&.argument)
295
+ end
296
+ end
297
+
268
298
  class Merge
269
299
  def normalize
270
300
  normalized = super
@@ -316,7 +346,19 @@ module Dhall
316
346
 
317
347
  class RecordProjection
318
348
  def normalize
319
- record.normalize.slice(*selectors)
349
+ record.normalize.slice(*selectors.sort)
350
+ end
351
+ end
352
+
353
+ class RecordProjectionByExpression
354
+ def normalize
355
+ sel = selector.normalize
356
+
357
+ if sel.is_a?(RecordType)
358
+ RecordProjection.for(record, sel.keys).normalize
359
+ else
360
+ with(record: record.normalize, selector: sel)
361
+ end
320
362
  end
321
363
  end
322
364
 
@@ -415,20 +457,6 @@ module Dhall
415
457
  end
416
458
  end
417
459
 
418
- class LetBlock
419
- def normalize
420
- desugar.normalize
421
- end
422
-
423
- def shift(amount, name, min_index)
424
- unflatten.shift(amount, name, min_index)
425
- end
426
-
427
- def substitute(svar, with_expr)
428
- unflatten.substitute(svar, with_expr)
429
- end
430
- end
431
-
432
460
  class TypeAnnotation
433
461
  def normalize
434
462
  value.normalize
@@ -1,7 +1,10 @@
1
1
  grammar Dhall::Parser::CitrusParser
2
2
  root complete_expression
3
3
  rule end_of_line
4
- (/\n/i | (/(?:\r)(?:\n)/i))
4
+ (/\n/i | (/(?:\r)(?:\n)/i)) <Dhall::Parser::EndOfLine>
5
+ end
6
+ rule valid_non_ascii
7
+ (/[\u{80}-\u{d7ff}\u{e000}-\u{fffd}\u{10000}-\u{1fffd}\u{20000}-\u{2fffd}\u{30000}-\u{3fffd}\u{40000}-\u{4fffd}\u{50000}-\u{5fffd}\u{60000}-\u{6fffd}\u{70000}-\u{7fffd}\u{80000}-\u{8fffd}\u{90000}-\u{9fffd}\u{a0000}-\u{afffd}\u{b0000}-\u{bfffd}\u{c0000}-\u{cfffd}\u{d0000}-\u{dfffd}\u{e0000}-\u{efffd}\u{f0000}-\u{ffffd}\u{100000}-\u{10fffd}]/i)
5
8
  end
6
9
  rule tab
7
10
  (/\t/i)
@@ -10,13 +13,13 @@ rule block_comment
10
13
  (/(?:\u{7b})(?:\u{2d})/i (block_comment_continue))
11
14
  end
12
15
  rule block_comment_char
13
- !("{-" | "-}") (/[\u{20}-@\u{5b}-\u{10ffff}]/i | (tab) | (end_of_line))
16
+ !("{-" | "-}") (/[\u{20}-@\u{5b}-\u{7f}]/i | (valid_non_ascii) | (tab) | (end_of_line))
14
17
  end
15
18
  rule block_comment_continue
16
19
  ("-}" | block_comment_char+ block_comment_continue | (block_comment block_comment_continue))
17
20
  end
18
21
  rule not_end_of_line
19
- (/[\u{20}-@\u{5b}-\u{10ffff}]/i | (tab))
22
+ (/[\u{20}-@\u{5b}-\u{7f}]/i | (valid_non_ascii) | (tab))
20
23
  end
21
24
  rule line_comment
22
25
  (/(?:\u{2d})(?:\u{2d})/i ((not_end_of_line)*) (end_of_line))
@@ -36,6 +39,9 @@ end
36
39
  rule digit
37
40
  (/\d/i)
38
41
  end
42
+ rule alphanum
43
+ ((alpha) | (digit))
44
+ end
39
45
  rule hexdig
40
46
  ((digit) | /[a-f]/i | (digit) | /[a-f]/i)
41
47
  end
@@ -43,7 +49,7 @@ rule simple_label_first_char
43
49
  ((alpha) | `_`)
44
50
  end
45
51
  rule simple_label_next_char
46
- ((alpha) | (digit) | /[\u{2d}\/_]/i)
52
+ ((alphanum) | /[\u{2d}\/_]/i)
47
53
  end
48
54
  rule simple_label
49
55
  (keyword simple_label_next_char+ | !keyword (simple_label_first_char simple_label_next_char*))
@@ -67,16 +73,19 @@ rule double_quote_chunk
67
73
  ((interpolation) | (/\u{5c}/i (double_quote_escaped)) | (double_quote_char)) <Dhall::Parser::DoubleQuoteChunk>
68
74
  end
69
75
  rule double_quote_escaped
70
- (/["\u{24}\/\u{5c}bfnrt]/ | ("u" ((hexdig) 4*4))) <Dhall::Parser::DoubleQuoteEscaped>
76
+ (/["\u{24}\/\u{5c}bfnrt]/ | ("u" (unicode_escape))) <Dhall::Parser::DoubleQuoteEscaped>
77
+ end
78
+ rule unicode_escape
79
+ (((hexdig) 4*4) | (/\u{7b}/i ((hexdig)+) /\u{7d}/i))
71
80
  end
72
81
  rule double_quote_char
73
- (/[\u{20}!\u{23}-@\u{5b}\u{5d}-\u{10ffff}]/i)
82
+ (/[\u{20}!\u{23}-@\u{5b}\u{5d}-\u{7f}]/i | (valid_non_ascii))
74
83
  end
75
84
  rule double_quote_literal
76
85
  (/"/i ((double_quote_chunk)*) /"/i) <Dhall::Parser::DoubleQuoteLiteral>
77
86
  end
78
87
  rule single_quote_continue
79
- (((interpolation) (single_quote_continue)) | ((escaped_quote_pair) (single_quote_continue)) | ((escaped_interpolation) (single_quote_continue)) | ((single_quote_char) (single_quote_continue)) | (`''`)) <Dhall::Parser::SingleQuoteContinue>
88
+ (single_quote_char+ single_quote_continue | interpolation single_quote_continue | escaped_quote_pair single_quote_continue | escaped_interpolation single_quote_continue | "''") <Dhall::Parser::SingleQuoteContinue>
80
89
  end
81
90
  rule escaped_quote_pair
82
91
  (`'''`) <Dhall::Parser::EscapedQuotePair>
@@ -85,7 +94,7 @@ rule escaped_interpolation
85
94
  (/(?:''(?:\u{24}))(?:\u{7b})/i) <Dhall::Parser::EscapedInterpolation>
86
95
  end
87
96
  rule single_quote_char
88
- (/[\u{20}-@\u{5b}-\u{10ffff}]/i | (tab) | (end_of_line))
97
+ !("${" | "''") (/[\u{20}-@\u{5b}-\u{7f}]/i | (valid_non_ascii) | (tab) | (end_of_line))
89
98
  end
90
99
  rule single_quote_literal
91
100
  (`''` (end_of_line) (single_quote_continue)) <Dhall::Parser::SingleQuoteLiteral>
@@ -132,11 +141,17 @@ end
132
141
  rule some
133
142
  ("Some")
134
143
  end
144
+ rule tomap
145
+ ("toMap")
146
+ end
147
+ rule assert
148
+ ("assert")
149
+ end
135
150
  rule keyword
136
- ((if) | (then) | (else) | (let) | (in) | (using) | (missing) | (as) | (infinity) | (nan) | (merge) | (some))
151
+ ((if) | (then) | (else) | (let) | (in) | (using) | (missing) | (as) | (infinity) | (nan) | (merge) | (some) | (tomap))
137
152
  end
138
153
  rule builtin
139
- ((natural_fold) | (natural_build) | (natural_iszero) | (natural_even) | (natural_odd) | (natural_tointeger) | (natural_show) | (integer_todouble) | (integer_show) | (double_show) | (list_build) | (list_fold) | (list_length) | (list_head) | (list_last) | (list_indexed) | (list_reverse) | (optional_fold) | (optional_build) | (text_show) | (bool) | (true) | (false) | (optional) | (none) | (natural) | (integer) | (double) | (text) | (list) | (type) | (kind) | (sort)) <Dhall::Parser::Builtin>
154
+ ((natural_fold) | (natural_build) | (natural_iszero) | (natural_even) | (natural_odd) | (natural_tointeger) | (natural_show) | (integer_todouble) | (integer_show) | (natural_subtract) | (double_show) | (list_build) | (list_fold) | (list_length) | (list_head) | (list_last) | (list_indexed) | (list_reverse) | (optional_fold) | (optional_build) | (text_show) | (bool) | (true) | (false) | (optional) | (none) | (natural) | (integer) | (double) | (text) | (list) | (type) | (kind) | (sort)) <Dhall::Parser::Builtin>
140
155
  end
141
156
  rule optional
142
157
  ("Optional")
@@ -147,6 +162,9 @@ end
147
162
  rule list
148
163
  ("List")
149
164
  end
165
+ rule location
166
+ ("Location")
167
+ end
150
168
  rule bool
151
169
  ("Bool")
152
170
  end
@@ -198,6 +216,9 @@ end
198
216
  rule natural_show
199
217
  ("Natural" /\//i "s" "h" "o" "w")
200
218
  end
219
+ rule natural_subtract
220
+ ("Natural" /\//i "s" "u" "b" "t" "r" "a" "c" "t")
221
+ end
201
222
  rule integer_todouble
202
223
  ("Integer" /\//i "t" "o" "D" "o" "u" "b" "l" "e")
203
224
  end
@@ -243,6 +264,9 @@ end
243
264
  rule combine_types
244
265
  (/\u{2a53}/i | (/(?:(?:(?:\/)(?:\/))(?:\u{5c}))(?:\u{5c})/i))
245
266
  end
267
+ rule equivalent
268
+ (/\u{2261}/i | (/(?:(?:=)(?:=))(?:=)/i))
269
+ end
246
270
  rule prefer
247
271
  (/\u{2afd}/i | (/(?:\/)(?:\/)/i))
248
272
  end
@@ -286,7 +310,7 @@ rule path_character
286
310
  (/[!\u{24}-'\u{2a}\u{2b}\u{2d}\u{2e}0-;=@\u{5e}-z\u{7c}~]/i)
287
311
  end
288
312
  rule quoted_path_character
289
- (/[\u{20}!\u{23}-\u{2e}0-@\u{5b}-\u{10ffff}]/i)
313
+ (/[\u{20}!\u{23}-\u{2e}0-@\u{5b}-\u{7f}]/i | (valid_non_ascii))
290
314
  end
291
315
  rule unquoted_path_component
292
316
  ((path_character)+)
@@ -316,19 +340,22 @@ rule absolute_path
316
340
  (path) <Dhall::Parser::AbsolutePath>
317
341
  end
318
342
  rule scheme
319
- ("http" ("s"?))
343
+ ("http" ("s"?)) <Dhall::Parser::Scheme>
320
344
  end
321
345
  rule http_raw
322
- ((scheme) /(?::(?:\/))(?:\/)/i (authority) (path) ((/\u{3f}/i (query))?))
346
+ ((scheme) /(?::(?:\/))(?:\/)/i (authority) (url_path) ((/\u{3f}/i (query))?))
347
+ end
348
+ rule url_path
349
+ (((path_component) | (/\//i (segment)))*) <Dhall::Parser::UrlPath>
323
350
  end
324
351
  rule authority
325
- ((((userinfo) /@/i)?) (host) ((`:` (port))?))
352
+ ((((userinfo) /@/i)?) (host) ((`:` (port))?)) <Dhall::Parser::Authority>
326
353
  end
327
354
  rule userinfo
328
355
  (((unreserved) | (pct_encoded) | (sub_delims) | `:`)*)
329
356
  end
330
357
  rule host
331
- ((ip_literal) | (ipv4address) | (reg_name))
358
+ ((ip_literal) | (ipv4address) | (domain))
332
359
  end
333
360
  rule port
334
361
  ((digit)*)
@@ -354,8 +381,14 @@ end
354
381
  rule dec_octet
355
382
  ((/25(?:[0-5])/i) | (/2(?:[0-4])/i (digit)) | (`1` ((digit) 2*2)) | (/[1-9]/i (digit)) | (digit))
356
383
  end
357
- rule reg_name
358
- (((unreserved) | (pct_encoded) | (sub_delims))*)
384
+ rule domain
385
+ ((domainlabel) ((/\u{2e}/i (domainlabel))*) (/\u{2e}/i?))
386
+ end
387
+ rule domainlabel
388
+ (((alphanum)+) (((/\u{2d}/i+) ((alphanum)+))*))
389
+ end
390
+ rule segment
391
+ ((pchar)*)
359
392
  end
360
393
  rule pchar
361
394
  ((unreserved) | (pct_encoded) | (sub_delims) | /[:@]/i)
@@ -367,19 +400,19 @@ rule pct_encoded
367
400
  (/%/i (hexdig) (hexdig))
368
401
  end
369
402
  rule unreserved
370
- ((alpha) | (digit) | /[\u{2d}\u{2e}_~]/i)
403
+ ((alphanum) | /[\u{2d}\u{2e}_~]/i)
371
404
  end
372
405
  rule sub_delims
373
- (/[!\u{24}&-,;=]/i)
406
+ (/[!\u{24}&'\u{2a}\u{2b};=]/i)
374
407
  end
375
408
  rule http
376
- ((http_raw) (((whsp) (using) (whsp1) ((import_hashed) | (/\u{28}/i (whsp) (import_hashed) (whsp) /\u{29}/i)))?)) <Dhall::Parser::Http>
409
+ ((http_raw) (((whsp) (using) (whsp1) (import_expression))?)) <Dhall::Parser::Http>
377
410
  end
378
411
  rule env
379
412
  (`env:` ((bash_environment_variable) | (/"/i (posix_environment_variable) /"/i))) <Dhall::Parser::Env>
380
413
  end
381
414
  rule bash_environment_variable
382
- (((alpha) | `_`) (((alpha) | (digit) | `_`)*))
415
+ (((alpha) | `_`) (((alphanum) | `_`)*))
383
416
  end
384
417
  rule posix_environment_variable
385
418
  ((posix_environment_variable_character)+) <Dhall::Parser::PosixEnvironmentVariable>
@@ -397,10 +430,10 @@ rule import_hashed
397
430
  ((import_type) (((whsp1) (hash))?)) <Dhall::Parser::ImportHashed>
398
431
  end
399
432
  rule import
400
- ((import_hashed) (((whsp) (as) (whsp1) (text))?)) <Dhall::Parser::Import>
433
+ ((import_hashed) (((whsp) (as) (whsp1) ((text) | (location)))?)) <Dhall::Parser::Import>
401
434
  end
402
435
  rule expression
403
- (((lambda) (whsp) /\u{28}/i (whsp) (nonreserved_label) (whsp) `:` (whsp1) (expression) (whsp) /\u{29}/i (whsp) (arrow) (whsp) (expression)) | ((if) (whsp1) (expression) (whsp) (then) (whsp1) (expression) (whsp) (else) (whsp1) (expression)) | (((let_binding)+) (in) (whsp1) (expression)) | ((forall) (whsp) /\u{28}/i (whsp) (nonreserved_label) (whsp) `:` (whsp1) (expression) (whsp) /\u{29}/i (whsp) (arrow) (whsp) (expression)) | ((operator_expression) (whsp) (arrow) (whsp) (expression)) | ((merge) (whsp1) (import_expression) (whsp1) (import_expression) (whsp) `:` (whsp1) (application_expression)) | (/\u{5b}/i (whsp) ((empty_collection) | (non_empty_optional))) | (annotated_expression)) <Dhall::Parser::Expression>
436
+ (((lambda) (whsp) /\u{28}/i (whsp) (nonreserved_label) (whsp) `:` (whsp1) (expression) (whsp) /\u{29}/i (whsp) (arrow) (whsp) (expression)) | ((if) (whsp1) (expression) (whsp) (then) (whsp1) (expression) (whsp) (else) (whsp1) (expression)) | (((let_binding)+) (in) (whsp1) (expression)) | ((forall) (whsp) /\u{28}/i (whsp) (nonreserved_label) (whsp) `:` (whsp1) (expression) (whsp) /\u{29}/i (whsp) (arrow) (whsp) (expression)) | ((operator_expression) (whsp) (arrow) (whsp) (expression)) | ((merge) (whsp1) (import_expression) (whsp1) (import_expression) (whsp) `:` (whsp1) (application_expression)) | (empty_list_literal) | ((tomap) (whsp1) (import_expression) (whsp) `:` (whsp1) (application_expression)) | ((assert) (whsp) `:` (whsp1) (expression)) | (annotated_expression)) <Dhall::Parser::Expression>
404
437
  end
405
438
  rule annotated_expression
406
439
  ((operator_expression) (((whsp) `:` (whsp1) (expression))?)) <Dhall::Parser::AnnotatedExpression>
@@ -408,11 +441,8 @@ end
408
441
  rule let_binding
409
442
  ((let) (whsp1) (nonreserved_label) (whsp) ((`:` (whsp1) (expression) (whsp))?) /=/i (whsp) (expression) (whsp)) <Dhall::Parser::LetBinding>
410
443
  end
411
- rule empty_collection
412
- (/\u{5d}/i (whsp) `:` (whsp1) ((list) | (optional)) (whsp) (import_expression)) <Dhall::Parser::EmptyCollection>
413
- end
414
- rule non_empty_optional
415
- ((expression) (whsp) /\u{5d}/i (whsp) `:` (whsp1) (optional) (whsp) (import_expression)) <Dhall::Parser::NonEmptyOptional>
444
+ rule empty_list_literal
445
+ (/\u{5b}/i (whsp) /\u{5d}/i (whsp) `:` (whsp1) (application_expression))
416
446
  end
417
447
  rule operator_expression
418
448
  (import_alt_expression)
@@ -451,13 +481,16 @@ rule equal_expression
451
481
  ((not_equal_expression) (((whsp) /(?:=)(?:=)/i (whsp) (not_equal_expression))*)) <Dhall::Parser::EqualExpression>
452
482
  end
453
483
  rule not_equal_expression
454
- ((application_expression) (((whsp) /(?:!)(?:=)/i (whsp) (application_expression))*)) <Dhall::Parser::NotEqualExpression>
484
+ ((equivalent_expression) (((whsp) /(?:!)(?:=)/i (whsp) (equivalent_expression))*)) <Dhall::Parser::NotEqualExpression>
485
+ end
486
+ rule equivalent_expression
487
+ ((application_expression) (((whsp) (equivalent) (whsp) (application_expression))*)) <Dhall::Parser::EquivalentExpression>
455
488
  end
456
489
  rule application_expression
457
490
  ((first_application_expression) (((whsp1) (import_expression))*)) <Dhall::Parser::ApplicationExpression>
458
491
  end
459
492
  rule first_application_expression
460
- (((merge) (whsp1) (import_expression) (whsp1) (import_expression)) | ((some) (whsp1) (import_expression)) | (import_expression)) <Dhall::Parser::FirstApplicationExpression>
493
+ (((merge) (whsp1) (import_expression) (whsp1) (import_expression)) | ((some) (whsp1) (import_expression)) | ((tomap) (whsp1) (import_expression)) | (import_expression)) <Dhall::Parser::FirstApplicationExpression>
461
494
  end
462
495
  rule import_expression
463
496
  ((import) | (selector_expression))
@@ -466,13 +499,16 @@ rule selector_expression
466
499
  ((primitive_expression) (((whsp) /\u{2e}/i (whsp) (selector))*)) <Dhall::Parser::SelectorExpression>
467
500
  end
468
501
  rule selector
469
- ((any_label) | (labels))
502
+ ((any_label) | (labels) | (type_selector)) <Dhall::Parser::Selector>
470
503
  end
471
504
  rule labels
472
- (/\u{7b}/i (whsp) (((any_label) (whsp) ((/,/i (whsp) (any_label) (whsp))*))?) /\u{7d}/i) <Dhall::Parser::Labels>
505
+ (/\u{7b}/i (whsp) (((any_label) (whsp) ((/,/i (whsp) (any_label) (whsp))*))?) /\u{7d}/i)
506
+ end
507
+ rule type_selector
508
+ (/\u{28}/i (whsp) (expression) (whsp) /\u{29}/i)
473
509
  end
474
510
  rule primitive_expression
475
- ((double_literal) | (natural_literal) | (integer_literal) | (text_literal) | (/\u{7b}/i (whsp) (record_type_or_literal) (whsp) /\u{7d}/i) | (/</i (whsp) (union_type_or_literal) (whsp) />/i) | (non_empty_list_literal) | (identifier) | (/\u{28}/i (complete_expression) /\u{29}/i)) <Dhall::Parser::PrimitiveExpression>
511
+ ((double_literal) | (natural_literal) | (integer_literal) | (text_literal) | (/\u{7b}/i (whsp) (record_type_or_literal) (whsp) /\u{7d}/i) | (/</i (whsp) (union_type) (whsp) />/i) | (non_empty_list_literal) | (identifier) | (/\u{28}/i (complete_expression) /\u{29}/i)) <Dhall::Parser::PrimitiveExpression>
476
512
  end
477
513
  rule record_type_or_literal
478
514
  ((empty_record_literal) | (non_empty_record_type_or_literal) | (empty_record_type))
@@ -498,24 +534,18 @@ end
498
534
  rule record_literal_entry
499
535
  ((any_label) (whsp) /=/i (whsp) (expression)) <Dhall::Parser::RecordLiteralEntry>
500
536
  end
501
- rule union_type_or_literal
502
- ((non_empty_union_type_or_literal) | (empty_union_type))
537
+ rule union_type
538
+ ((non_empty_union_type) | (empty_union_type))
503
539
  end
504
540
  rule empty_union_type
505
541
  ("") <Dhall::Parser::EmptyUnionType>
506
542
  end
507
- rule non_empty_union_type_or_literal
508
- ((any_label) (((whsp) ((union_literal_variant_value) | (union_type_or_literal_variant_type)))?)) <Dhall::Parser::NonEmptyUnionTypeOrLiteral>
509
- end
510
- rule union_literal_variant_value
511
- (/=/i (whsp) (expression) (((whsp) /\u{7c}/i (whsp) (union_type_entry))*)) <Dhall::Parser::UnionLiteralVariantValue>
543
+ rule non_empty_union_type
544
+ ((union_type_entry) (((whsp) /\u{7c}/i (whsp) (union_type_entry))*)) <Dhall::Parser::NonEmptyUnionType>
512
545
  end
513
546
  rule union_type_entry
514
547
  ((any_label) (((whsp) `:` (whsp1) (expression))?)) <Dhall::Parser::UnionTypeEntry>
515
548
  end
516
- rule union_type_or_literal_variant_type
517
- (((`:` (whsp1) (expression))?) (((whsp) /\u{7c}/i (whsp) (non_empty_union_type_or_literal))?)) <Dhall::Parser::UnionTypeOrLiteralVariantType>
518
- end
519
549
  rule non_empty_list_literal
520
550
  (/\u{5b}/i (whsp) (expression) (whsp) ((/,/i (whsp) (expression) (whsp))*) /\u{5d}/i) <Dhall::Parser::NonEmptyListLiteral>
521
551
  end