fig 0.1.77 → 0.1.79

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. data/Changes +58 -1
  2. data/bin/fig +1 -1
  3. data/lib/fig.rb +1 -1
  4. data/lib/fig/command.rb +3 -3
  5. data/lib/fig/command/action/dump_package_definition_parsed.rb +5 -4
  6. data/lib/fig/command/action/list_variables/all_configs.rb +2 -5
  7. data/lib/fig/command/action/publish_local.rb +1 -1
  8. data/lib/fig/command/action/role/list_variables_in_a_tree.rb +2 -5
  9. data/lib/fig/command/action/run_command_line.rb +10 -3
  10. data/lib/fig/command/action/run_command_statement.rb +1 -1
  11. data/lib/fig/command/options.rb +8 -7
  12. data/lib/fig/command/options/parser.rb +1 -1
  13. data/lib/fig/environment_variables/case_insensitive.rb +1 -1
  14. data/lib/fig/environment_variables/case_sensitive.rb +1 -1
  15. data/lib/fig/figrc.rb +10 -10
  16. data/lib/fig/{not_found_error.rb → file_not_found_error.rb} +1 -1
  17. data/lib/fig/grammar/v0.rb +174 -173
  18. data/lib/fig/grammar/v0.treetop +27 -21
  19. data/lib/fig/grammar/v1.rb +477 -171
  20. data/lib/fig/grammar/v1.treetop +34 -22
  21. data/lib/fig/operating_system.rb +139 -60
  22. data/lib/fig/package.rb +8 -4
  23. data/lib/fig/package_definition_text_assembler.rb +31 -23
  24. data/lib/fig/parser.rb +3 -5
  25. data/lib/fig/parser_package_build_state.rb +15 -14
  26. data/lib/fig/repository.rb +41 -28
  27. data/lib/fig/repository_package_publisher.rb +20 -25
  28. data/lib/fig/runtime_environment.rb +136 -87
  29. data/lib/fig/statement.rb +15 -116
  30. data/lib/fig/statement/archive.rb +6 -4
  31. data/lib/fig/statement/asset.rb +50 -35
  32. data/lib/fig/statement/command.rb +6 -2
  33. data/lib/fig/statement/configuration.rb +10 -2
  34. data/lib/fig/statement/environment_variable.rb +35 -0
  35. data/lib/fig/statement/grammar_version.rb +6 -2
  36. data/lib/fig/statement/include.rb +6 -2
  37. data/lib/fig/statement/override.rb +6 -2
  38. data/lib/fig/statement/path.rb +7 -8
  39. data/lib/fig/statement/resource.rb +7 -3
  40. data/lib/fig/statement/retrieve.rb +10 -2
  41. data/lib/fig/statement/set.rb +7 -8
  42. data/lib/fig/string_tokenizer.rb +195 -0
  43. data/lib/fig/tokenized_string.rb +22 -0
  44. data/lib/fig/tokenized_string/plain_segment.rb +24 -0
  45. data/lib/fig/tokenized_string/token.rb +18 -0
  46. data/lib/fig/unparser.rb +84 -1
  47. data/lib/fig/unparser/v0.rb +4 -0
  48. data/lib/fig/unparser/v1.rb +7 -7
  49. data/lib/fig/url.rb +12 -1
  50. data/lib/fig/{url_access_error.rb → url_access_disallowed_error.rb} +2 -2
  51. metadata +129 -128
  52. data/lib/fig/grammar/v0_asset_location.rb +0 -162
  53. data/lib/fig/grammar/v0_ish.rb +0 -1356
  54. data/lib/fig/grammar/v1_asset_location.rb +0 -162
  55. data/lib/fig/grammar/v2.rb +0 -1478
@@ -35,26 +35,26 @@ module Fig
35
35
  end
36
36
 
37
37
  rule archive
38
- statement_start:'archive' ws+ url:asset_url {
38
+ statement_start:'archive' ws+ location:asset_location {
39
39
  def to_package_statement(build_state)
40
40
  return build_state.new_asset_statement(
41
- Statement::Archive, statement_start, url.url
41
+ Statement::Archive, statement_start, location.location
42
42
  )
43
43
  end
44
44
  }
45
45
  end
46
46
 
47
47
  rule resource
48
- statement_start:'resource' ws+ url:asset_url {
48
+ statement_start:'resource' ws+ location:asset_location {
49
49
  def to_package_statement(build_state)
50
50
  return build_state.new_asset_statement(
51
- Statement::Resource, statement_start, url.url
51
+ Statement::Resource, statement_start, location.location
52
52
  )
53
53
  end
54
54
  }
55
55
  end
56
56
 
57
- rule asset_url
57
+ rule asset_location
58
58
  # Unquoted allows globbing for files, quoted does not.
59
59
  #
60
60
  # Unquoted, anything but:
@@ -62,15 +62,15 @@ module Fig
62
62
  # ' - Future expansion
63
63
  # "<>| - Characters not allowed in filenames on Windows
64
64
  # \s - Necessary for the "ws" token to work
65
- (url:[^@'"<>|\s]+ ws)
65
+ (location:[^@'"<>|\s]+ ws)
66
66
 
67
67
  # Quoted, anything but:
68
68
  # @ - To allow for package substitution
69
69
  # ' - Future expansion
70
70
  # "<>| - Characters not allowed in filenames on Windows
71
71
  # *?\[\]{} - Characters significant to Dir.glob()
72
- # \s - We just don't want these. :] (May need to allow space.)
73
- / ('"' url:[^@'"<>|*?\[\]{}\s]+ '"' ws)
72
+ # \s - We just don't want these. :]
73
+ / ('"' location:[^@'"<>|*?\[\]{}\s]+ '"' ws)
74
74
  end
75
75
 
76
76
  rule retrieve
@@ -123,39 +123,45 @@ module Fig
123
123
  }
124
124
  end
125
125
 
126
- rule path
127
- statement_start:('add' / 'append' / 'path') ws+ name_value:[\S]+ ws+ {
126
+ rule environment_variable_name
127
+ [a-zA-Z0-9_]+
128
+ end
129
+
130
+ rule set
131
+ statement_start:'set' ws+ environment_variable_name_value ws+ {
128
132
  def to_config_statement(build_state)
129
133
  return build_state.new_environment_variable_statement(
130
- Statement::Path, statement_start, name_value
134
+ Statement::Set, statement_start, environment_variable_name_value
131
135
  )
132
136
  end
133
137
  }
134
138
  end
135
139
 
136
- rule environment_variable_name
137
- [a-zA-Z0-9_]+
138
- end
139
-
140
- rule set
141
- statement_start:'set' ws+ name_value:[\S]+ ws+ {
140
+ rule path
141
+ statement_start:('add' / 'append' / 'path') ws+ environment_variable_name_value ws+ {
142
142
  def to_config_statement(build_state)
143
143
  return build_state.new_environment_variable_statement(
144
- Statement::Set, statement_start, name_value
144
+ Statement::Path, statement_start, environment_variable_name_value
145
145
  )
146
146
  end
147
147
  }
148
148
  end
149
149
 
150
+ rule environment_variable_name_value
151
+ [\S]+
152
+ end
153
+
150
154
  rule command
151
- statement_start:'command' ws+ string ws+ {
155
+ statement_start:'command' ws+ command_line ws+ {
152
156
  def to_config_statement(build_state)
153
- return build_state.new_command_statement(statement_start, string)
157
+ return build_state.new_command_statement(
158
+ statement_start, command_line
159
+ )
154
160
  end
155
161
  }
156
162
  end
157
163
 
158
- rule string
164
+ rule command_line
159
165
  '"' value:[^"]* '"'
160
166
  end
161
167
 
@@ -214,7 +214,7 @@ module Fig
214
214
  elements[0]
215
215
  end
216
216
 
217
- def url
217
+ def location
218
218
  elements[2]
219
219
  end
220
220
  end
@@ -222,7 +222,7 @@ module Fig
222
222
  module Archive1
223
223
  def to_package_statement(build_state)
224
224
  return build_state.new_asset_statement(
225
- Statement::Archive, statement_start, url
225
+ Statement::Archive, statement_start, location
226
226
  )
227
227
  end
228
228
  end
@@ -265,7 +265,7 @@ module Fig
265
265
  end
266
266
  s0 << r2
267
267
  if r2
268
- r4 = _nt_asset_url
268
+ r4 = _nt_asset_location
269
269
  s0 << r4
270
270
  end
271
271
  end
@@ -288,7 +288,7 @@ module Fig
288
288
  elements[0]
289
289
  end
290
290
 
291
- def url
291
+ def location
292
292
  elements[2]
293
293
  end
294
294
  end
@@ -296,7 +296,7 @@ module Fig
296
296
  module Resource1
297
297
  def to_package_statement(build_state)
298
298
  return build_state.new_asset_statement(
299
- Statement::Resource, statement_start, url
299
+ Statement::Resource, statement_start, location
300
300
  )
301
301
  end
302
302
  end
@@ -339,7 +339,7 @@ module Fig
339
339
  end
340
340
  s0 << r2
341
341
  if r2
342
- r4 = _nt_asset_url
342
+ r4 = _nt_asset_location
343
343
  s0 << r4
344
344
  end
345
345
  end
@@ -357,16 +357,22 @@ module Fig
357
357
  r0
358
358
  end
359
359
 
360
- module AssetUrl0
360
+ module AssetLocation0
361
361
  end
362
362
 
363
- module AssetUrl1
363
+ module AssetLocation1
364
364
  end
365
365
 
366
- def _nt_asset_url
366
+ module AssetLocation2
367
+ end
368
+
369
+ module AssetLocation3
370
+ end
371
+
372
+ def _nt_asset_location
367
373
  start_index = index
368
- if node_cache[:asset_url].has_key?(index)
369
- cached = node_cache[:asset_url][index]
374
+ if node_cache[:asset_location].has_key?(index)
375
+ cached = node_cache[:asset_location][index]
370
376
  if cached
371
377
  cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
372
378
  @index = cached.interval.end
@@ -387,11 +393,48 @@ module Fig
387
393
  if r2
388
394
  s3, i3 = [], index
389
395
  loop do
390
- if has_terminal?('\G[^"]', true, index)
391
- r4 = true
396
+ i4 = index
397
+ if has_terminal?('\G[^"\\\\]', true, index)
398
+ r5 = true
392
399
  @index += 1
393
400
  else
394
- r4 = nil
401
+ r5 = nil
402
+ end
403
+ if r5
404
+ r4 = r5
405
+ else
406
+ i6, s6 = index, []
407
+ if has_terminal?('\\', false, index)
408
+ r7 = instantiate_node(SyntaxNode,input, index...(index + 1))
409
+ @index += 1
410
+ else
411
+ terminal_parse_failure('\\')
412
+ r7 = nil
413
+ end
414
+ s6 << r7
415
+ if r7
416
+ if index < input_length
417
+ r8 = instantiate_node(SyntaxNode,input, index...(index + 1))
418
+ @index += 1
419
+ else
420
+ terminal_parse_failure("any character")
421
+ r8 = nil
422
+ end
423
+ s6 << r8
424
+ end
425
+ if s6.last
426
+ r6 = instantiate_node(SyntaxNode,input, i6...index, s6)
427
+ r6.extend(AssetLocation0)
428
+ else
429
+ @index = i6
430
+ r6 = nil
431
+ end
432
+ if r6
433
+ r4 = r6
434
+ else
435
+ @index = i4
436
+ r4 = nil
437
+ end
395
438
  end
396
439
  if r4
397
440
  s3 << r4
@@ -403,18 +446,18 @@ module Fig
403
446
  s1 << r3
404
447
  if r3
405
448
  if has_terminal?('"', false, index)
406
- r5 = instantiate_node(SyntaxNode,input, index...(index + 1))
449
+ r9 = instantiate_node(SyntaxNode,input, index...(index + 1))
407
450
  @index += 1
408
451
  else
409
452
  terminal_parse_failure('"')
410
- r5 = nil
453
+ r9 = nil
411
454
  end
412
- s1 << r5
455
+ s1 << r9
413
456
  end
414
457
  end
415
458
  if s1.last
416
459
  r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
417
- r1.extend(AssetUrl0)
460
+ r1.extend(AssetLocation1)
418
461
  else
419
462
  @index = i1
420
463
  r1 = nil
@@ -422,75 +465,112 @@ module Fig
422
465
  if r1
423
466
  r0 = r1
424
467
  else
425
- i6, s6 = index, []
468
+ i10, s10 = index, []
426
469
  if has_terminal?("'", false, index)
427
- r7 = instantiate_node(SyntaxNode,input, index...(index + 1))
470
+ r11 = instantiate_node(SyntaxNode,input, index...(index + 1))
428
471
  @index += 1
429
472
  else
430
473
  terminal_parse_failure("'")
431
- r7 = nil
474
+ r11 = nil
432
475
  end
433
- s6 << r7
434
- if r7
435
- s8, i8 = [], index
476
+ s10 << r11
477
+ if r11
478
+ s12, i12 = [], index
436
479
  loop do
437
- if has_terminal?('\G[^\']', true, index)
438
- r9 = true
480
+ i13 = index
481
+ if has_terminal?('\G[^\'\\\\]', true, index)
482
+ r14 = true
439
483
  @index += 1
440
484
  else
441
- r9 = nil
485
+ r14 = nil
442
486
  end
443
- if r9
444
- s8 << r9
487
+ if r14
488
+ r13 = r14
489
+ else
490
+ i15, s15 = index, []
491
+ if has_terminal?('\\', false, index)
492
+ r16 = instantiate_node(SyntaxNode,input, index...(index + 1))
493
+ @index += 1
494
+ else
495
+ terminal_parse_failure('\\')
496
+ r16 = nil
497
+ end
498
+ s15 << r16
499
+ if r16
500
+ if index < input_length
501
+ r17 = instantiate_node(SyntaxNode,input, index...(index + 1))
502
+ @index += 1
503
+ else
504
+ terminal_parse_failure("any character")
505
+ r17 = nil
506
+ end
507
+ s15 << r17
508
+ end
509
+ if s15.last
510
+ r15 = instantiate_node(SyntaxNode,input, i15...index, s15)
511
+ r15.extend(AssetLocation2)
512
+ else
513
+ @index = i15
514
+ r15 = nil
515
+ end
516
+ if r15
517
+ r13 = r15
518
+ else
519
+ @index = i13
520
+ r13 = nil
521
+ end
522
+ end
523
+ if r13
524
+ s12 << r13
445
525
  else
446
526
  break
447
527
  end
448
528
  end
449
- r8 = instantiate_node(SyntaxNode,input, i8...index, s8)
450
- s6 << r8
451
- if r8
529
+ r12 = instantiate_node(SyntaxNode,input, i12...index, s12)
530
+ s10 << r12
531
+ if r12
452
532
  if has_terminal?("'", false, index)
453
- r10 = instantiate_node(SyntaxNode,input, index...(index + 1))
533
+ r18 = instantiate_node(SyntaxNode,input, index...(index + 1))
454
534
  @index += 1
455
535
  else
456
536
  terminal_parse_failure("'")
457
- r10 = nil
537
+ r18 = nil
458
538
  end
459
- s6 << r10
539
+ s10 << r18
460
540
  end
461
541
  end
462
- if s6.last
463
- r6 = instantiate_node(SyntaxNode,input, i6...index, s6)
464
- r6.extend(AssetUrl1)
542
+ if s10.last
543
+ r10 = instantiate_node(SyntaxNode,input, i10...index, s10)
544
+ r10.extend(AssetLocation3)
465
545
  else
466
- @index = i6
467
- r6 = nil
546
+ @index = i10
547
+ r10 = nil
468
548
  end
469
- if r6
470
- r0 = r6
549
+ if r10
550
+ r0 = r10
471
551
  else
472
- s11, i11 = [], index
552
+ s19, i19 = [], index
473
553
  loop do
474
- if has_terminal?('\G[\\S]', true, index)
475
- r12 = true
554
+ if has_terminal?('\G[^\\s#]', true, index)
555
+ r20 = true
476
556
  @index += 1
477
557
  else
478
- r12 = nil
558
+ r20 = nil
479
559
  end
480
- if r12
481
- s11 << r12
560
+ if r20
561
+ s19 << r20
482
562
  else
483
563
  break
484
564
  end
485
565
  end
486
- if s11.empty?
487
- @index = i11
488
- r11 = nil
566
+ if s19.empty?
567
+ @index = i19
568
+ r19 = nil
489
569
  else
490
- r11 = instantiate_node(SyntaxNode,input, i11...index, s11)
570
+ r19 = instantiate_node(SyntaxNode,input, i19...index, s19)
491
571
  end
492
- if r11
493
- r0 = r11
572
+ if r19
573
+ r0 = r19
494
574
  else
495
575
  @index = i0
496
576
  r0 = nil
@@ -498,7 +578,7 @@ module Fig
498
578
  end
499
579
  end
500
580
 
501
- node_cache[:asset_url][start_index] = r0
581
+ node_cache[:asset_location][start_index] = r0
502
582
 
503
583
  r0
504
584
  end
@@ -1039,12 +1119,123 @@ module Fig
1039
1119
  r0
1040
1120
  end
1041
1121
 
1122
+ def _nt_environment_variable_name
1123
+ start_index = index
1124
+ if node_cache[:environment_variable_name].has_key?(index)
1125
+ cached = node_cache[:environment_variable_name][index]
1126
+ if cached
1127
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1128
+ @index = cached.interval.end
1129
+ end
1130
+ return cached
1131
+ end
1132
+
1133
+ s0, i0 = [], index
1134
+ loop do
1135
+ if has_terminal?('\G[a-zA-Z0-9_]', true, index)
1136
+ r1 = true
1137
+ @index += 1
1138
+ else
1139
+ r1 = nil
1140
+ end
1141
+ if r1
1142
+ s0 << r1
1143
+ else
1144
+ break
1145
+ end
1146
+ end
1147
+ if s0.empty?
1148
+ @index = i0
1149
+ r0 = nil
1150
+ else
1151
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
1152
+ end
1153
+
1154
+ node_cache[:environment_variable_name][start_index] = r0
1155
+
1156
+ r0
1157
+ end
1158
+
1159
+ module Set0
1160
+ def statement_start
1161
+ elements[0]
1162
+ end
1163
+
1164
+ def environment_variable_name_value
1165
+ elements[2]
1166
+ end
1167
+ end
1168
+
1169
+ module Set1
1170
+ def to_config_statement(build_state)
1171
+ return build_state.new_environment_variable_statement(
1172
+ Statement::Set, statement_start, environment_variable_name_value
1173
+ )
1174
+ end
1175
+ end
1176
+
1177
+ def _nt_set
1178
+ start_index = index
1179
+ if node_cache[:set].has_key?(index)
1180
+ cached = node_cache[:set][index]
1181
+ if cached
1182
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1183
+ @index = cached.interval.end
1184
+ end
1185
+ return cached
1186
+ end
1187
+
1188
+ i0, s0 = index, []
1189
+ if has_terminal?('set', false, index)
1190
+ r1 = instantiate_node(SyntaxNode,input, index...(index + 3))
1191
+ @index += 3
1192
+ else
1193
+ terminal_parse_failure('set')
1194
+ r1 = nil
1195
+ end
1196
+ s0 << r1
1197
+ if r1
1198
+ s2, i2 = [], index
1199
+ loop do
1200
+ r3 = _nt_ws_or_comment
1201
+ if r3
1202
+ s2 << r3
1203
+ else
1204
+ break
1205
+ end
1206
+ end
1207
+ if s2.empty?
1208
+ @index = i2
1209
+ r2 = nil
1210
+ else
1211
+ r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
1212
+ end
1213
+ s0 << r2
1214
+ if r2
1215
+ r4 = _nt_environment_variable_name_value
1216
+ s0 << r4
1217
+ end
1218
+ end
1219
+ if s0.last
1220
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
1221
+ r0.extend(Set0)
1222
+ r0.extend(Set1)
1223
+ else
1224
+ @index = i0
1225
+ r0 = nil
1226
+ end
1227
+
1228
+ node_cache[:set][start_index] = r0
1229
+
1230
+ r0
1231
+ end
1232
+
1042
1233
  module Path0
1043
1234
  def statement_start
1044
1235
  elements[0]
1045
1236
  end
1046
1237
 
1047
- def name_value
1238
+ def environment_variable_name_value
1048
1239
  elements[2]
1049
1240
  end
1050
1241
  end
@@ -1052,7 +1243,7 @@ module Fig
1052
1243
  module Path1
1053
1244
  def to_config_statement(build_state)
1054
1245
  return build_state.new_environment_variable_statement(
1055
- Statement::Path, statement_start, name_value
1246
+ Statement::Path, statement_start, environment_variable_name_value
1056
1247
  )
1057
1248
  end
1058
1249
  end
@@ -1124,26 +1315,7 @@ module Fig
1124
1315
  end
1125
1316
  s0 << r5
1126
1317
  if r5
1127
- s7, i7 = [], index
1128
- loop do
1129
- if has_terminal?('\G[\\S]', true, index)
1130
- r8 = true
1131
- @index += 1
1132
- else
1133
- r8 = nil
1134
- end
1135
- if r8
1136
- s7 << r8
1137
- else
1138
- break
1139
- end
1140
- end
1141
- if s7.empty?
1142
- @index = i7
1143
- r7 = nil
1144
- else
1145
- r7 = instantiate_node(SyntaxNode,input, i7...index, s7)
1146
- end
1318
+ r7 = _nt_environment_variable_name_value
1147
1319
  s0 << r7
1148
1320
  end
1149
1321
  end
@@ -1161,10 +1333,22 @@ module Fig
1161
1333
  r0
1162
1334
  end
1163
1335
 
1164
- def _nt_environment_variable_name
1336
+ module EnvironmentVariableNameValue0
1337
+ end
1338
+
1339
+ module EnvironmentVariableNameValue1
1340
+ end
1341
+
1342
+ module EnvironmentVariableNameValue2
1343
+ end
1344
+
1345
+ module EnvironmentVariableNameValue3
1346
+ end
1347
+
1348
+ def _nt_environment_variable_name_value
1165
1349
  start_index = index
1166
- if node_cache[:environment_variable_name].has_key?(index)
1167
- cached = node_cache[:environment_variable_name][index]
1350
+ if node_cache[:environment_variable_name_value].has_key?(index)
1351
+ cached = node_cache[:environment_variable_name_value][index]
1168
1352
  if cached
1169
1353
  cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1170
1354
  @index = cached.interval.end
@@ -1172,121 +1356,241 @@ module Fig
1172
1356
  return cached
1173
1357
  end
1174
1358
 
1175
- s0, i0 = [], index
1359
+ i0 = index
1360
+ i1, s1 = index, []
1361
+ s2, i2 = [], index
1176
1362
  loop do
1177
- if has_terminal?('\G[a-zA-Z0-9_]', true, index)
1178
- r1 = true
1363
+ if has_terminal?('\G[^\\s#\\\\"]', true, index)
1364
+ r3 = true
1179
1365
  @index += 1
1180
1366
  else
1181
- r1 = nil
1367
+ r3 = nil
1182
1368
  end
1183
- if r1
1184
- s0 << r1
1369
+ if r3
1370
+ s2 << r3
1185
1371
  else
1186
1372
  break
1187
1373
  end
1188
1374
  end
1189
- if s0.empty?
1190
- @index = i0
1191
- r0 = nil
1192
- else
1193
- r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
1194
- end
1195
-
1196
- node_cache[:environment_variable_name][start_index] = r0
1197
-
1198
- r0
1199
- end
1200
-
1201
- module Set0
1202
- def statement_start
1203
- elements[0]
1204
- end
1205
-
1206
- def name_value
1207
- elements[2]
1208
- end
1209
- end
1210
-
1211
- module Set1
1212
- def to_config_statement(build_state)
1213
- return build_state.new_environment_variable_statement(
1214
- Statement::Set, statement_start, name_value
1215
- )
1216
- end
1217
- end
1218
-
1219
- def _nt_set
1220
- start_index = index
1221
- if node_cache[:set].has_key?(index)
1222
- cached = node_cache[:set][index]
1223
- if cached
1224
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1225
- @index = cached.interval.end
1375
+ r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
1376
+ s1 << r2
1377
+ if r2
1378
+ if has_terminal?('"', false, index)
1379
+ r4 = instantiate_node(SyntaxNode,input, index...(index + 1))
1380
+ @index += 1
1381
+ else
1382
+ terminal_parse_failure('"')
1383
+ r4 = nil
1384
+ end
1385
+ s1 << r4
1386
+ if r4
1387
+ s5, i5 = [], index
1388
+ loop do
1389
+ i6 = index
1390
+ if has_terminal?('\G[^"\\\\]', true, index)
1391
+ r7 = true
1392
+ @index += 1
1393
+ else
1394
+ r7 = nil
1395
+ end
1396
+ if r7
1397
+ r6 = r7
1398
+ else
1399
+ i8, s8 = index, []
1400
+ if has_terminal?('\\', false, index)
1401
+ r9 = instantiate_node(SyntaxNode,input, index...(index + 1))
1402
+ @index += 1
1403
+ else
1404
+ terminal_parse_failure('\\')
1405
+ r9 = nil
1406
+ end
1407
+ s8 << r9
1408
+ if r9
1409
+ if index < input_length
1410
+ r10 = instantiate_node(SyntaxNode,input, index...(index + 1))
1411
+ @index += 1
1412
+ else
1413
+ terminal_parse_failure("any character")
1414
+ r10 = nil
1415
+ end
1416
+ s8 << r10
1417
+ end
1418
+ if s8.last
1419
+ r8 = instantiate_node(SyntaxNode,input, i8...index, s8)
1420
+ r8.extend(EnvironmentVariableNameValue0)
1421
+ else
1422
+ @index = i8
1423
+ r8 = nil
1424
+ end
1425
+ if r8
1426
+ r6 = r8
1427
+ else
1428
+ @index = i6
1429
+ r6 = nil
1430
+ end
1431
+ end
1432
+ if r6
1433
+ s5 << r6
1434
+ else
1435
+ break
1436
+ end
1437
+ end
1438
+ r5 = instantiate_node(SyntaxNode,input, i5...index, s5)
1439
+ s1 << r5
1440
+ if r5
1441
+ if has_terminal?('"', false, index)
1442
+ r11 = instantiate_node(SyntaxNode,input, index...(index + 1))
1443
+ @index += 1
1444
+ else
1445
+ terminal_parse_failure('"')
1446
+ r11 = nil
1447
+ end
1448
+ s1 << r11
1449
+ end
1226
1450
  end
1227
- return cached
1228
1451
  end
1229
-
1230
- i0, s0 = index, []
1231
- if has_terminal?('set', false, index)
1232
- r1 = instantiate_node(SyntaxNode,input, index...(index + 3))
1233
- @index += 3
1452
+ if s1.last
1453
+ r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
1454
+ r1.extend(EnvironmentVariableNameValue1)
1234
1455
  else
1235
- terminal_parse_failure('set')
1456
+ @index = i1
1236
1457
  r1 = nil
1237
1458
  end
1238
- s0 << r1
1239
1459
  if r1
1240
- s2, i2 = [], index
1460
+ r0 = r1
1461
+ else
1462
+ i12, s12 = index, []
1463
+ s13, i13 = [], index
1241
1464
  loop do
1242
- r3 = _nt_ws_or_comment
1243
- if r3
1244
- s2 << r3
1465
+ if has_terminal?('\G[^\\s#\\\\\']', true, index)
1466
+ r14 = true
1467
+ @index += 1
1468
+ else
1469
+ r14 = nil
1470
+ end
1471
+ if r14
1472
+ s13 << r14
1245
1473
  else
1246
1474
  break
1247
1475
  end
1248
1476
  end
1249
- if s2.empty?
1250
- @index = i2
1251
- r2 = nil
1477
+ r13 = instantiate_node(SyntaxNode,input, i13...index, s13)
1478
+ s12 << r13
1479
+ if r13
1480
+ if has_terminal?("'", false, index)
1481
+ r15 = instantiate_node(SyntaxNode,input, index...(index + 1))
1482
+ @index += 1
1483
+ else
1484
+ terminal_parse_failure("'")
1485
+ r15 = nil
1486
+ end
1487
+ s12 << r15
1488
+ if r15
1489
+ s16, i16 = [], index
1490
+ loop do
1491
+ i17 = index
1492
+ if has_terminal?('\G[^\'\\\\]', true, index)
1493
+ r18 = true
1494
+ @index += 1
1495
+ else
1496
+ r18 = nil
1497
+ end
1498
+ if r18
1499
+ r17 = r18
1500
+ else
1501
+ i19, s19 = index, []
1502
+ if has_terminal?('\\', false, index)
1503
+ r20 = instantiate_node(SyntaxNode,input, index...(index + 1))
1504
+ @index += 1
1505
+ else
1506
+ terminal_parse_failure('\\')
1507
+ r20 = nil
1508
+ end
1509
+ s19 << r20
1510
+ if r20
1511
+ if index < input_length
1512
+ r21 = instantiate_node(SyntaxNode,input, index...(index + 1))
1513
+ @index += 1
1514
+ else
1515
+ terminal_parse_failure("any character")
1516
+ r21 = nil
1517
+ end
1518
+ s19 << r21
1519
+ end
1520
+ if s19.last
1521
+ r19 = instantiate_node(SyntaxNode,input, i19...index, s19)
1522
+ r19.extend(EnvironmentVariableNameValue2)
1523
+ else
1524
+ @index = i19
1525
+ r19 = nil
1526
+ end
1527
+ if r19
1528
+ r17 = r19
1529
+ else
1530
+ @index = i17
1531
+ r17 = nil
1532
+ end
1533
+ end
1534
+ if r17
1535
+ s16 << r17
1536
+ else
1537
+ break
1538
+ end
1539
+ end
1540
+ r16 = instantiate_node(SyntaxNode,input, i16...index, s16)
1541
+ s12 << r16
1542
+ if r16
1543
+ if has_terminal?("'", false, index)
1544
+ r22 = instantiate_node(SyntaxNode,input, index...(index + 1))
1545
+ @index += 1
1546
+ else
1547
+ terminal_parse_failure("'")
1548
+ r22 = nil
1549
+ end
1550
+ s12 << r22
1551
+ end
1552
+ end
1553
+ end
1554
+ if s12.last
1555
+ r12 = instantiate_node(SyntaxNode,input, i12...index, s12)
1556
+ r12.extend(EnvironmentVariableNameValue3)
1252
1557
  else
1253
- r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
1558
+ @index = i12
1559
+ r12 = nil
1254
1560
  end
1255
- s0 << r2
1256
- if r2
1257
- s4, i4 = [], index
1561
+ if r12
1562
+ r0 = r12
1563
+ else
1564
+ s23, i23 = [], index
1258
1565
  loop do
1259
- if has_terminal?('\G[\\S]', true, index)
1260
- r5 = true
1566
+ if has_terminal?('\G[^\\s#]', true, index)
1567
+ r24 = true
1261
1568
  @index += 1
1262
1569
  else
1263
- r5 = nil
1570
+ r24 = nil
1264
1571
  end
1265
- if r5
1266
- s4 << r5
1572
+ if r24
1573
+ s23 << r24
1267
1574
  else
1268
1575
  break
1269
1576
  end
1270
1577
  end
1271
- if s4.empty?
1272
- @index = i4
1273
- r4 = nil
1578
+ if s23.empty?
1579
+ @index = i23
1580
+ r23 = nil
1274
1581
  else
1275
- r4 = instantiate_node(SyntaxNode,input, i4...index, s4)
1582
+ r23 = instantiate_node(SyntaxNode,input, i23...index, s23)
1583
+ end
1584
+ if r23
1585
+ r0 = r23
1586
+ else
1587
+ @index = i0
1588
+ r0 = nil
1276
1589
  end
1277
- s0 << r4
1278
1590
  end
1279
1591
  end
1280
- if s0.last
1281
- r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
1282
- r0.extend(Set0)
1283
- r0.extend(Set1)
1284
- else
1285
- @index = i0
1286
- r0 = nil
1287
- end
1288
1592
 
1289
- node_cache[:set][start_index] = r0
1593
+ node_cache[:environment_variable_name_value][start_index] = r0
1290
1594
 
1291
1595
  r0
1292
1596
  end
@@ -1296,14 +1600,16 @@ module Fig
1296
1600
  elements[0]
1297
1601
  end
1298
1602
 
1299
- def string
1603
+ def command_line
1300
1604
  elements[2]
1301
1605
  end
1302
1606
  end
1303
1607
 
1304
1608
  module Command1
1305
1609
  def to_config_statement(build_state)
1306
- return build_state.new_command_statement(statement_start, string)
1610
+ return build_state.new_command_statement(
1611
+ statement_start, command_line
1612
+ )
1307
1613
  end
1308
1614
  end
1309
1615
 
@@ -1345,7 +1651,7 @@ module Fig
1345
1651
  end
1346
1652
  s0 << r2
1347
1653
  if r2
1348
- r4 = _nt_string
1654
+ r4 = _nt_command_line
1349
1655
  s0 << r4
1350
1656
  end
1351
1657
  end
@@ -1363,17 +1669,17 @@ module Fig
1363
1669
  r0
1364
1670
  end
1365
1671
 
1366
- module String0
1672
+ module CommandLine0
1367
1673
  def value
1368
1674
  elements[1]
1369
1675
  end
1370
1676
 
1371
1677
  end
1372
1678
 
1373
- def _nt_string
1679
+ def _nt_command_line
1374
1680
  start_index = index
1375
- if node_cache[:string].has_key?(index)
1376
- cached = node_cache[:string][index]
1681
+ if node_cache[:command_line].has_key?(index)
1682
+ cached = node_cache[:command_line][index]
1377
1683
  if cached
1378
1684
  cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1379
1685
  @index = cached.interval.end
@@ -1420,13 +1726,13 @@ module Fig
1420
1726
  end
1421
1727
  if s0.last
1422
1728
  r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
1423
- r0.extend(String0)
1729
+ r0.extend(CommandLine0)
1424
1730
  else
1425
1731
  @index = i0
1426
1732
  r0 = nil
1427
1733
  end
1428
1734
 
1429
- node_cache[:string][start_index] = r0
1735
+ node_cache[:command_line][start_index] = r0
1430
1736
 
1431
1737
  r0
1432
1738
  end
@@ -1444,7 +1750,7 @@ module Fig
1444
1750
 
1445
1751
  s0, i0 = [], index
1446
1752
  loop do
1447
- if has_terminal?('\G[\\S]', true, index)
1753
+ if has_terminal?('\G[^\\s#]', true, index)
1448
1754
  r1 = true
1449
1755
  @index += 1
1450
1756
  else