prettier 1.2.3 → 1.2.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -31,17 +31,10 @@ function isSingleQuotable(node) {
31
31
 
32
32
  const quotePattern = new RegExp("\\\\([\\s\\S])|(['\"])", "g");
33
33
 
34
- function normalizeQuotes(content, enclosingQuote, originalQuote) {
35
- const replaceOther = originalQuote === '"';
36
- const otherQuote = enclosingQuote === '"' ? "'" : '"';
37
-
34
+ function normalizeQuotes(content, enclosingQuote) {
38
35
  // Escape and unescape single and double quotes as needed to be able to
39
36
  // enclose `content` with `enclosingQuote`.
40
37
  return content.replace(quotePattern, (match, escaped, quote) => {
41
- if (replaceOther && escaped === otherQuote) {
42
- return escaped;
43
- }
44
-
45
38
  if (quote === enclosingQuote) {
46
39
  return `\\${quote}`;
47
40
  }
@@ -97,12 +90,34 @@ function printDynaSymbol(path, opts, print) {
97
90
  return concat([":", quote].concat(path.map(print, "body")).concat(quote));
98
91
  }
99
92
 
93
+ function printStringConcat(path, opts, print) {
94
+ const [leftDoc, rightDoc] = path.map(print, "body");
95
+
96
+ return group(concat([leftDoc, " \\", indent(concat([hardline, rightDoc]))]));
97
+ }
98
+
100
99
  // Prints out an interpolated variable in the string by converting it into an
101
100
  // embedded expression.
102
101
  function printStringDVar(path, opts, print) {
103
102
  return concat(["#{", path.call(print, "body", 0), "}"]);
104
103
  }
105
104
 
105
+ function printStringEmbExpr(path, opts, print) {
106
+ const parts = path.call(print, "body", 0);
107
+
108
+ // If the interpolated expression is inside of a heredoc or an xstring
109
+ // literal (a string that gets sent to the command line) then we don't want
110
+ // to automatically indent, as this can lead to some very odd looking
111
+ // expressions
112
+ if (["heredoc", "xstring_literal"].includes(path.getParentNode().type)) {
113
+ return concat(["#{", parts, "}"]);
114
+ }
115
+
116
+ return group(
117
+ concat(["#{", indent(concat([softline, parts])), concat([softline, "}"])])
118
+ );
119
+ }
120
+
106
121
  // Prints out a literal string. This function does its best to respect the
107
122
  // wishes of the user with regards to single versus double quotes, but if the
108
123
  // string contains any escape expressions then it will just keep the original
@@ -131,10 +146,7 @@ function printStringLiteral(path, { rubySingleQuote }, print) {
131
146
  }
132
147
 
133
148
  // In this case, the part of the string is just regular string content
134
- return join(
135
- literalline,
136
- normalizeQuotes(part.body, quote, node.quote).split("\n")
137
- );
149
+ return join(literalline, normalizeQuotes(part.body, quote).split("\n"));
138
150
  });
139
151
 
140
152
  return concat([quote].concat(parts).concat(getClosingQuote(quote)));
@@ -155,30 +167,9 @@ function printXStringLiteral(path, opts, print) {
155
167
  module.exports = {
156
168
  "@CHAR": printChar,
157
169
  dyna_symbol: printDynaSymbol,
158
- string_concat: (path, opts, print) =>
159
- group(
160
- concat([
161
- path.call(print, "body", 0),
162
- " \\",
163
- indent(concat([hardline, path.call(print, "body", 1)]))
164
- ])
165
- ),
170
+ string_concat: printStringConcat,
166
171
  string_dvar: printStringDVar,
167
- string_embexpr: (path, opts, print) => {
168
- const parts = path.call(print, "body", 0);
169
-
170
- // If the interpolated expression is inside of a heredoc or an xstring
171
- // literal (a string that gets sent to the command line) then we don't want
172
- // to automatically indent, as this can lead to some very odd looking
173
- // expressions
174
- if (["heredoc", "xstring_literal"].includes(path.getParentNode().type)) {
175
- return concat(["#{", parts, "}"]);
176
- }
177
-
178
- return group(
179
- concat(["#{", indent(concat([softline, parts])), concat([softline, "}"])])
180
- );
181
- },
172
+ string_embexpr: printStringEmbExpr,
182
173
  string_literal: printStringLiteral,
183
174
  symbol_literal: printSymbolLiteral,
184
175
  xstring_literal: printXStringLiteral
@@ -4,6 +4,7 @@ const path = require("path");
4
4
  // In order to properly parse ruby code, we need to tell the ruby process to
5
5
  // parse using UTF-8. Unfortunately, the way that you accomplish this looks
6
6
  // differently depending on your platform.
7
+ /* istanbul ignore next */
7
8
  const LANG = (() => {
8
9
  const { env, platform } = process;
9
10
  const envValue = env.LC_ALL || env.LC_CTYPE || env.LANG;
@@ -42,7 +43,7 @@ function parse(text, _parsers, _opts) {
42
43
  {
43
44
  env: Object.assign({}, process.env, { LANG }),
44
45
  input: text,
45
- maxBuffer: 10 * 1024 * 1024 // 10MB
46
+ maxBuffer: 15 * 1024 * 1024 // 15MB
46
47
  }
47
48
  );
48
49
 
@@ -93,8 +93,8 @@ class Prettier::Parser < Ripper
93
93
  node = {
94
94
  type: :"@#{event}",
95
95
  body: value,
96
- start: lineno,
97
- end: lineno,
96
+ sl: lineno,
97
+ el: lineno,
98
98
  sc: char_pos,
99
99
  ec: ec
100
100
  }
@@ -118,8 +118,8 @@ class Prettier::Parser < Ripper
118
118
  @comments << {
119
119
  type: :@comment,
120
120
  value: value[1..-1].chomp.force_encoding('UTF-8'),
121
- start: lineno,
122
- end: lineno,
121
+ sl: lineno,
122
+ el: lineno,
123
123
  sc: char_pos,
124
124
  ec: char_pos + value.length - 1
125
125
  }
@@ -138,8 +138,8 @@ class Prettier::Parser < Ripper
138
138
  {
139
139
  type: :ignored_nl,
140
140
  body: nil,
141
- start: lineno,
142
- end: lineno,
141
+ sl: lineno,
142
+ el: lineno,
143
143
  sc: char_pos,
144
144
  ec: char_pos
145
145
  }
@@ -191,7 +191,7 @@ class Prettier::Parser < Ripper
191
191
  find_scanner_event(:@kw, 'BEGIN').merge!(
192
192
  type: :BEGIN,
193
193
  body: [beging, stmts],
194
- end: ending[:end],
194
+ el: ending[:el],
195
195
  ec: ending[:ec]
196
196
  )
197
197
  end
@@ -215,7 +215,7 @@ class Prettier::Parser < Ripper
215
215
  find_scanner_event(:@kw, 'END').merge!(
216
216
  type: :END,
217
217
  body: [beging, stmts],
218
- end: ending[:end],
218
+ el: ending[:el],
219
219
  ec: ending[:ec]
220
220
  )
221
221
  end
@@ -234,9 +234,9 @@ class Prettier::Parser < Ripper
234
234
  {
235
235
  type: :alias,
236
236
  body: [left, right],
237
- start: beging[:start],
237
+ sl: beging[:sl],
238
238
  sc: beging[:sc],
239
- end: ending[:end],
239
+ el: ending[:el],
240
240
  ec: ending[:ec]
241
241
  }
242
242
  end
@@ -262,9 +262,9 @@ class Prettier::Parser < Ripper
262
262
  {
263
263
  type: :aref,
264
264
  body: [collection, index],
265
- start: collection[:start],
265
+ sl: collection[:sl],
266
266
  sc: collection[:sc],
267
- end: ending[:end],
267
+ el: ending[:el],
268
268
  ec: ending[:ec]
269
269
  }
270
270
  end
@@ -278,9 +278,9 @@ class Prettier::Parser < Ripper
278
278
  {
279
279
  type: :aref_field,
280
280
  body: [collection, index],
281
- start: collection[:start],
281
+ sl: collection[:sl],
282
282
  sc: collection[:sc],
283
- end: ending[:end],
283
+ el: ending[:el],
284
284
  ec: ending[:ec]
285
285
  }
286
286
  end
@@ -292,9 +292,9 @@ class Prettier::Parser < Ripper
292
292
  {
293
293
  type: :args,
294
294
  body: [],
295
- start: lineno,
295
+ sl: lineno,
296
296
  sc: char_pos,
297
- end: lineno,
297
+ el: lineno,
298
298
  ec: char_pos
299
299
  }
300
300
  end
@@ -307,7 +307,7 @@ class Prettier::Parser < Ripper
307
307
  if args[:body].empty?
308
308
  arg.merge(type: :args, body: [arg])
309
309
  else
310
- args.merge!(body: args[:body] << arg, end: arg[:end], ec: arg[:ec])
310
+ args.merge!(body: args[:body] << arg, el: arg[:el], ec: arg[:ec])
311
311
  end
312
312
  end
313
313
 
@@ -320,7 +320,7 @@ class Prettier::Parser < Ripper
320
320
  args.merge(
321
321
  type: :args_add_block,
322
322
  body: [args, block],
323
- end: ending[:end],
323
+ el: ending[:el],
324
324
  ec: ending[:ec]
325
325
  )
326
326
  end
@@ -335,9 +335,9 @@ class Prettier::Parser < Ripper
335
335
  {
336
336
  type: :args_add_star,
337
337
  body: [args, part],
338
- start: beging[:start],
338
+ sl: beging[:sl],
339
339
  sc: beging[:sc],
340
- end: ending[:end],
340
+ el: ending[:el],
341
341
  ec: ending[:ec]
342
342
  }
343
343
  end
@@ -357,14 +357,14 @@ class Prettier::Parser < Ripper
357
357
  # If the arguments exceed the ending of the parentheses, then we know we
358
358
  # have a heredoc in the arguments, and we need to use the bounds of the
359
359
  # arguments to determine how large the arg_paren is.
360
- ending = (args && args[:end] > rparen[:end]) ? args : rparen
360
+ ending = (args && args[:el] > rparen[:el]) ? args : rparen
361
361
 
362
362
  {
363
363
  type: :arg_paren,
364
364
  body: [args],
365
- start: beging[:start],
365
+ sl: beging[:sl],
366
366
  sc: beging[:sc],
367
- end: ending[:end],
367
+ el: ending[:el],
368
368
  ec: ending[:ec]
369
369
  }
370
370
  end
@@ -381,9 +381,9 @@ class Prettier::Parser < Ripper
381
381
  {
382
382
  type: :array,
383
383
  body: [contents],
384
- start: beging[:start],
384
+ sl: beging[:sl],
385
385
  sc: beging[:sc],
386
- end: ending[:end],
386
+ el: ending[:el],
387
387
  ec: ending[:ec]
388
388
  }
389
389
  else
@@ -393,7 +393,7 @@ class Prettier::Parser < Ripper
393
393
  ending.merge!(
394
394
  type: :array,
395
395
  body: [contents],
396
- start: contents[:start],
396
+ sl: contents[:sl],
397
397
  sc: contents[:sc]
398
398
  )
399
399
  end
@@ -407,9 +407,9 @@ class Prettier::Parser < Ripper
407
407
  {
408
408
  type: :aryptn,
409
409
  body: [const, preargs, splatarg, postargs],
410
- start: pieces[0][:start],
410
+ sl: pieces[0][:sl],
411
411
  sc: pieces[0][:sc],
412
- end: pieces[-1][:end],
412
+ el: pieces[-1][:el],
413
413
  ec: pieces[-1][:ec]
414
414
  }
415
415
  end
@@ -421,7 +421,7 @@ class Prettier::Parser < Ripper
421
421
  left.merge(
422
422
  type: :assign,
423
423
  body: [left, right],
424
- end: right[:end],
424
+ el: right[:el],
425
425
  ec: right[:ec]
426
426
  )
427
427
  end
@@ -433,9 +433,9 @@ class Prettier::Parser < Ripper
433
433
  {
434
434
  type: :assoc_new,
435
435
  body: [key, value],
436
- start: key[:start],
436
+ sl: key[:sl],
437
437
  sc: key[:sc],
438
- end: value[:end],
438
+ el: value[:el],
439
439
  ec: value[:ec]
440
440
  }
441
441
  end
@@ -446,7 +446,7 @@ class Prettier::Parser < Ripper
446
446
  find_scanner_event(:@op, '**').merge!(
447
447
  type: :assoc_splat,
448
448
  body: [contents],
449
- end: contents[:end],
449
+ el: contents[:el],
450
450
  ec: contents[:ec]
451
451
  )
452
452
  end
@@ -459,9 +459,9 @@ class Prettier::Parser < Ripper
459
459
  {
460
460
  type: :assoclist_from_args,
461
461
  body: assocs,
462
- start: assocs[0][:start],
462
+ sl: assocs[0][:sl],
463
463
  sc: assocs[0][:sc],
464
- end: assocs[-1][:end],
464
+ el: assocs[-1][:el],
465
465
  ec: assocs[-1][:ec]
466
466
  }
467
467
  end
@@ -474,9 +474,9 @@ class Prettier::Parser < Ripper
474
474
  {
475
475
  type: :bare_assoc_hash,
476
476
  body: assoc_news,
477
- start: assoc_news[0][:start],
477
+ sl: assoc_news[0][:sl],
478
478
  sc: assoc_news[0][:sc],
479
- end: assoc_news[-1][:end],
479
+ el: assoc_news[-1][:el],
480
480
  ec: assoc_news[-1][:ec]
481
481
  }
482
482
  end
@@ -497,7 +497,7 @@ class Prettier::Parser < Ripper
497
497
  beging.merge!(
498
498
  type: :begin,
499
499
  body: [bodystmt],
500
- end: bodystmt[:end],
500
+ el: bodystmt[:el],
501
501
  ec: bodystmt[:ec]
502
502
  )
503
503
  end
@@ -508,9 +508,9 @@ class Prettier::Parser < Ripper
508
508
  {
509
509
  type: :binary,
510
510
  body: [left, oper, right],
511
- start: left[:start],
511
+ sl: left[:sl],
512
512
  sc: left[:sc],
513
- end: right[:end],
513
+ el: right[:el],
514
514
  ec: right[:ec]
515
515
  }
516
516
  end
@@ -530,9 +530,9 @@ class Prettier::Parser < Ripper
530
530
  {
531
531
  type: :block_var,
532
532
  body: [params, locals],
533
- start: beging[:start],
533
+ sl: beging[:sl],
534
534
  sc: beging[:sc],
535
- end: ending[:end],
535
+ el: ending[:el],
536
536
  ec: ending[:ec]
537
537
  }
538
538
  end
@@ -543,7 +543,7 @@ class Prettier::Parser < Ripper
543
543
  find_scanner_event(:@op, '&').merge!(
544
544
  type: :blockarg,
545
545
  body: [ident],
546
- end: ident[:end],
546
+ el: ident[:el],
547
547
  ec: ident[:ec]
548
548
  )
549
549
  end
@@ -574,9 +574,9 @@ class Prettier::Parser < Ripper
574
574
  BodyStmt.new(
575
575
  type: :bodystmt,
576
576
  body: [stmts, rescued, ensured, elsed],
577
- start: lineno,
577
+ sl: lineno,
578
578
  sc: char_pos,
579
- end: lineno,
579
+ el: lineno,
580
580
  ec: char_pos
581
581
  )
582
582
  end
@@ -594,9 +594,9 @@ class Prettier::Parser < Ripper
594
594
  {
595
595
  type: :brace_block,
596
596
  body: [block_var, stmts],
597
- start: beging[:start],
597
+ sl: beging[:sl],
598
598
  sc: beging[:sc],
599
- end: ending[:end],
599
+ el: ending[:el],
600
600
  ec: ending[:ec]
601
601
  }
602
602
  end
@@ -617,7 +617,7 @@ class Prettier::Parser < Ripper
617
617
  beging.merge!(
618
618
  type: :break,
619
619
  body: [args_add_block],
620
- end: args_add_block[:end],
620
+ el: args_add_block[:el],
621
621
  ec: args_add_block[:ec]
622
622
  )
623
623
  end
@@ -651,9 +651,9 @@ class Prettier::Parser < Ripper
651
651
  {
652
652
  type: :call,
653
653
  body: [receiver, oper, sending],
654
- start: receiver[:start],
654
+ sl: receiver[:sl],
655
655
  sc: receiver[:sc],
656
- end: ending[:end],
656
+ el: ending[:el],
657
657
  ec: ending[:ec]
658
658
  }
659
659
  end
@@ -672,7 +672,7 @@ class Prettier::Parser < Ripper
672
672
 
673
673
  beging.merge!(
674
674
  body: [switch, consequent],
675
- end: consequent[:end],
675
+ el: consequent[:el],
676
676
  ec: consequent[:ec]
677
677
  )
678
678
  end
@@ -714,9 +714,9 @@ class Prettier::Parser < Ripper
714
714
  {
715
715
  type: :class,
716
716
  body: [const, superclass, bodystmt],
717
- start: beging[:start],
717
+ sl: beging[:sl],
718
718
  sc: beging[:sc],
719
- end: ending[:end],
719
+ el: ending[:el],
720
720
  ec: ending[:ec]
721
721
  }
722
722
  end
@@ -728,9 +728,9 @@ class Prettier::Parser < Ripper
728
728
  {
729
729
  type: :command,
730
730
  body: [ident, args],
731
- start: ident[:start],
731
+ sl: ident[:sl],
732
732
  sc: ident[:sc],
733
- end: args[:end],
733
+ el: args[:el],
734
734
  ec: args[:ec]
735
735
  }
736
736
  end
@@ -750,9 +750,9 @@ class Prettier::Parser < Ripper
750
750
  {
751
751
  type: :command_call,
752
752
  body: [receiver, oper, ident, args],
753
- start: receiver[:start],
753
+ sl: receiver[:sl],
754
754
  sc: receiver[:sc],
755
- end: ending[:end],
755
+ el: ending[:el],
756
756
  ec: ending[:ec]
757
757
  }
758
758
  end
@@ -767,9 +767,9 @@ class Prettier::Parser < Ripper
767
767
  {
768
768
  type: :const_path_field,
769
769
  body: [left, const],
770
- start: left[:start],
770
+ sl: left[:sl],
771
771
  sc: left[:sc],
772
- end: const[:end],
772
+ el: const[:el],
773
773
  ec: const[:ec]
774
774
  }
775
775
  end
@@ -784,9 +784,9 @@ class Prettier::Parser < Ripper
784
784
  {
785
785
  type: :const_path_ref,
786
786
  body: [left, const],
787
- start: left[:start],
787
+ sl: left[:sl],
788
788
  sc: left[:sc],
789
- end: const[:end],
789
+ el: const[:el],
790
790
  ec: const[:ec]
791
791
  }
792
792
  end
@@ -837,9 +837,9 @@ class Prettier::Parser < Ripper
837
837
  {
838
838
  type: :defsl,
839
839
  body: [ident, params, bodystmt],
840
- start: beging[:start],
840
+ sl: beging[:sl],
841
841
  sc: beging[:sc],
842
- end: bodystmt[:end],
842
+ el: bodystmt[:el],
843
843
  ec: bodystmt[:ec]
844
844
  }
845
845
  )
@@ -857,9 +857,9 @@ class Prettier::Parser < Ripper
857
857
  {
858
858
  type: :def,
859
859
  body: [ident, params, bodystmt],
860
- start: beging[:start],
860
+ sl: beging[:sl],
861
861
  sc: beging[:sc],
862
- end: ending[:end],
862
+ el: ending[:el],
863
863
  ec: ending[:ec]
864
864
  }
865
865
  end
@@ -897,9 +897,9 @@ class Prettier::Parser < Ripper
897
897
  {
898
898
  type: :defs,
899
899
  body: [target, oper, ident, params, bodystmt],
900
- start: beging[:start],
900
+ sl: beging[:sl],
901
901
  sc: beging[:sc],
902
- end: ending[:end],
902
+ el: ending[:el],
903
903
  ec: ending[:ec]
904
904
  }
905
905
  end
@@ -917,7 +917,7 @@ class Prettier::Parser < Ripper
917
917
  beging.merge!(
918
918
  type: :defined,
919
919
  body: [value],
920
- end: ending[:end],
920
+ el: ending[:el],
921
921
  ec: ending[:ec]
922
922
  )
923
923
  end
@@ -935,9 +935,9 @@ class Prettier::Parser < Ripper
935
935
  {
936
936
  type: :do_block,
937
937
  body: [block_var, bodystmt],
938
- start: beging[:start],
938
+ sl: beging[:sl],
939
939
  sc: beging[:sc],
940
- end: ending[:end],
940
+ el: ending[:el],
941
941
  ec: ending[:ec]
942
942
  }
943
943
  end
@@ -954,9 +954,9 @@ class Prettier::Parser < Ripper
954
954
  {
955
955
  type: :dot2,
956
956
  body: [left, right],
957
- start: beging[:start],
957
+ sl: beging[:sl],
958
958
  sc: beging[:sc],
959
- end: ending[:end],
959
+ el: ending[:el],
960
960
  ec: ending[:ec]
961
961
  }
962
962
  end
@@ -973,9 +973,9 @@ class Prettier::Parser < Ripper
973
973
  {
974
974
  type: :dot3,
975
975
  body: [left, right],
976
- start: beging[:start],
976
+ sl: beging[:sl],
977
977
  sc: beging[:sc],
978
- end: ending[:end],
978
+ el: ending[:el],
979
979
  ec: ending[:ec]
980
980
  }
981
981
  end
@@ -1008,7 +1008,7 @@ class Prettier::Parser < Ripper
1008
1008
  type: :dyna_symbol,
1009
1009
  quote: beging[:body][1],
1010
1010
  body: string[:body],
1011
- end: ending[:end],
1011
+ el: ending[:el],
1012
1012
  ec: ending[:ec]
1013
1013
  )
1014
1014
  else
@@ -1019,9 +1019,9 @@ class Prettier::Parser < Ripper
1019
1019
  string.merge!(
1020
1020
  type: :dyna_symbol,
1021
1021
  quote: ending[:body][0],
1022
- start: beging[:start],
1022
+ sl: beging[:sl],
1023
1023
  sc: beging[:sc],
1024
- end: ending[:end],
1024
+ el: ending[:el],
1025
1025
  ec: ending[:ec]
1026
1026
  )
1027
1027
  end
@@ -1052,9 +1052,9 @@ class Prettier::Parser < Ripper
1052
1052
  {
1053
1053
  type: :else,
1054
1054
  body: [stmts],
1055
- start: beging[:start],
1055
+ sl: beging[:sl],
1056
1056
  sc: beging[:sc],
1057
- end: ending[:end],
1057
+ el: ending[:el],
1058
1058
  ec: ending[:ec]
1059
1059
  }
1060
1060
  end
@@ -1072,9 +1072,9 @@ class Prettier::Parser < Ripper
1072
1072
  {
1073
1073
  type: :elsif,
1074
1074
  body: [predicate, stmts, consequent],
1075
- start: beging[:start],
1075
+ sl: beging[:sl],
1076
1076
  sc: beging[:sc],
1077
- end: ending[:end],
1077
+ el: ending[:el],
1078
1078
  ec: ending[:ec]
1079
1079
  }
1080
1080
  end
@@ -1085,7 +1085,7 @@ class Prettier::Parser < Ripper
1085
1085
  # and add to it as we get content. It always starts with this scanner
1086
1086
  # event, so here we'll initialize the current embdoc.
1087
1087
  def on_embdoc_beg(value)
1088
- @embdoc = { type: :@embdoc, value: value, start: lineno, sc: char_pos }
1088
+ @embdoc = { type: :@embdoc, value: value, sl: lineno, sc: char_pos }
1089
1089
  end
1090
1090
 
1091
1091
  # This is a scanner event that gets hit when we're inside an embdoc and
@@ -1104,7 +1104,7 @@ class Prettier::Parser < Ripper
1104
1104
  @comments <<
1105
1105
  @embdoc.merge!(
1106
1106
  value: @embdoc[:value] << value.chomp,
1107
- end: lineno,
1107
+ el: lineno,
1108
1108
  ec: char_pos + value.length - 1
1109
1109
  )
1110
1110
 
@@ -1129,9 +1129,9 @@ class Prettier::Parser < Ripper
1129
1129
  {
1130
1130
  type: :ensure,
1131
1131
  body: [beging, stmts],
1132
- start: beging[:start],
1132
+ sl: beging[:sl],
1133
1133
  sc: beging[:sc],
1134
- end: ending[:end],
1134
+ el: ending[:el],
1135
1135
  ec: ending[:ec]
1136
1136
  }
1137
1137
  end
@@ -1160,9 +1160,9 @@ class Prettier::Parser < Ripper
1160
1160
  {
1161
1161
  type: :field,
1162
1162
  body: [left, oper, right],
1163
- start: left[:start],
1163
+ sl: left[:sl],
1164
1164
  sc: left[:sc],
1165
- end: right[:end],
1165
+ el: right[:el],
1166
1166
  ec: right[:ec]
1167
1167
  }
1168
1168
  end
@@ -1176,9 +1176,9 @@ class Prettier::Parser < Ripper
1176
1176
  {
1177
1177
  type: :fndptn,
1178
1178
  body: [const, presplat, args, postsplat],
1179
- start: beging[:start],
1179
+ sl: beging[:sl],
1180
1180
  sc: beging[:sc],
1181
- end: ending[:end],
1181
+ el: ending[:el],
1182
1182
  ec: ending[:ec]
1183
1183
  }
1184
1184
  end
@@ -1196,9 +1196,9 @@ class Prettier::Parser < Ripper
1196
1196
  {
1197
1197
  type: :for,
1198
1198
  body: [ident, enumerable, stmts],
1199
- start: beging[:start],
1199
+ sl: beging[:sl],
1200
1200
  sc: beging[:sc],
1201
- end: ending[:end],
1201
+ el: ending[:el],
1202
1202
  ec: ending[:ec]
1203
1203
  }
1204
1204
  end
@@ -1219,9 +1219,9 @@ class Prettier::Parser < Ripper
1219
1219
  {
1220
1220
  type: :hash,
1221
1221
  body: [assoclist_from_args],
1222
- start: beging[:start],
1222
+ sl: beging[:sl],
1223
1223
  sc: beging[:sc],
1224
- end: ending[:end],
1224
+ el: ending[:el],
1225
1225
  ec: ending[:ec]
1226
1226
  }
1227
1227
  end
@@ -1234,8 +1234,8 @@ class Prettier::Parser < Ripper
1234
1234
  # printer through our embed function.
1235
1235
  def on_heredoc_beg(beging)
1236
1236
  location = {
1237
- start: lineno,
1238
- end: lineno,
1237
+ sl: lineno,
1238
+ el: lineno,
1239
1239
  sc: char_pos,
1240
1240
  ec: char_pos + beging.length + 1
1241
1241
  }
@@ -1259,7 +1259,7 @@ class Prettier::Parser < Ripper
1259
1259
 
1260
1260
  # This is a scanner event that represents the end of the heredoc.
1261
1261
  def on_heredoc_end(ending)
1262
- @heredocs[-1].merge!(ending: ending.chomp, end: lineno, ec: char_pos)
1262
+ @heredocs[-1].merge!(ending: ending.chomp, el: lineno, ec: char_pos)
1263
1263
  end
1264
1264
 
1265
1265
  # hshptn is a parser event that represents matching against a hash pattern
@@ -1270,9 +1270,9 @@ class Prettier::Parser < Ripper
1270
1270
  {
1271
1271
  type: :hshptn,
1272
1272
  body: [const, kw, kwrest],
1273
- start: pieces[0][:start],
1273
+ sl: pieces[0][:sl],
1274
1274
  sc: pieces[0][:sc],
1275
- end: pieces[-1][:end],
1275
+ el: pieces[-1][:el],
1276
1276
  ec: pieces[-1][:ec]
1277
1277
  }
1278
1278
  end
@@ -1289,9 +1289,9 @@ class Prettier::Parser < Ripper
1289
1289
  {
1290
1290
  type: :if,
1291
1291
  body: [predicate, stmts, consequent],
1292
- start: beging[:start],
1292
+ sl: beging[:sl],
1293
1293
  sc: beging[:sc],
1294
- end: ending[:end],
1294
+ el: ending[:el],
1295
1295
  ec: ending[:ec]
1296
1296
  }
1297
1297
  end
@@ -1303,7 +1303,7 @@ class Prettier::Parser < Ripper
1303
1303
  predicate.merge(
1304
1304
  type: :ifop,
1305
1305
  body: [predicate, truthy, falsy],
1306
- end: falsy[:end],
1306
+ el: falsy[:el],
1307
1307
  ec: falsy[:ec]
1308
1308
  )
1309
1309
  end
@@ -1317,9 +1317,9 @@ class Prettier::Parser < Ripper
1317
1317
  {
1318
1318
  type: :if_mod,
1319
1319
  body: [predicate, statement],
1320
- start: statement[:start],
1320
+ sl: statement[:sl],
1321
1321
  sc: statement[:sc],
1322
- end: predicate[:end],
1322
+ el: predicate[:el],
1323
1323
  ec: predicate[:ec]
1324
1324
  }
1325
1325
  end
@@ -1339,7 +1339,7 @@ class Prettier::Parser < Ripper
1339
1339
  beging.merge!(
1340
1340
  type: :in,
1341
1341
  body: [pattern, stmts, consequent],
1342
- end: ending[:end],
1342
+ el: ending[:el],
1343
1343
  ec: ending[:ec]
1344
1344
  )
1345
1345
  end
@@ -1353,7 +1353,7 @@ class Prettier::Parser < Ripper
1353
1353
  oper.merge!(
1354
1354
  type: :kwrest_param,
1355
1355
  body: [ident],
1356
- end: ident[:end],
1356
+ el: ident[:el],
1357
1357
  ec: ident[:ec]
1358
1358
  )
1359
1359
  end
@@ -1381,9 +1381,9 @@ class Prettier::Parser < Ripper
1381
1381
  {
1382
1382
  type: :lambda,
1383
1383
  body: [params, stmts],
1384
- start: beging[:start],
1384
+ sl: beging[:sl],
1385
1385
  sc: beging[:sc],
1386
- end: closing[:end],
1386
+ el: closing[:el],
1387
1387
  ec: closing[:ec]
1388
1388
  }
1389
1389
  end
@@ -1411,9 +1411,9 @@ class Prettier::Parser < Ripper
1411
1411
  {
1412
1412
  type: :massign,
1413
1413
  body: [left, right],
1414
- start: left[:start],
1414
+ sl: left[:sl],
1415
1415
  sc: left[:sc],
1416
- end: right[:end],
1416
+ el: right[:el],
1417
1417
  ec: right[:ec]
1418
1418
  }
1419
1419
  end
@@ -1433,9 +1433,9 @@ class Prettier::Parser < Ripper
1433
1433
  {
1434
1434
  type: :method_add_arg,
1435
1435
  body: [fcall, arg_paren],
1436
- start: fcall[:start],
1436
+ sl: fcall[:sl],
1437
1437
  sc: fcall[:sc],
1438
- end: arg_paren[:end],
1438
+ el: arg_paren[:el],
1439
1439
  ec: arg_paren[:ec]
1440
1440
  }
1441
1441
  end
@@ -1447,9 +1447,9 @@ class Prettier::Parser < Ripper
1447
1447
  {
1448
1448
  type: :method_add_block,
1449
1449
  body: [method_add_arg, block],
1450
- start: method_add_arg[:start],
1450
+ sl: method_add_arg[:sl],
1451
1451
  sc: method_add_arg[:sc],
1452
- end: block[:end],
1452
+ el: block[:el],
1453
1453
  ec: block[:ec]
1454
1454
  }
1455
1455
  end
@@ -1461,9 +1461,9 @@ class Prettier::Parser < Ripper
1461
1461
  {
1462
1462
  type: :mlhs,
1463
1463
  body: [],
1464
- start: lineno,
1464
+ sl: lineno,
1465
1465
  sc: char_pos,
1466
- end: lineno,
1466
+ el: lineno,
1467
1467
  ec: char_pos
1468
1468
  }
1469
1469
  end
@@ -1475,7 +1475,7 @@ class Prettier::Parser < Ripper
1475
1475
  if mlhs[:body].empty?
1476
1476
  part.merge(type: :mlhs, body: [part])
1477
1477
  else
1478
- mlhs.merge!(body: mlhs[:body] << part, end: part[:end], ec: part[:ec])
1478
+ mlhs.merge!(body: mlhs[:body] << part, el: part[:el], ec: part[:ec])
1479
1479
  end
1480
1480
  end
1481
1481
 
@@ -1488,7 +1488,7 @@ class Prettier::Parser < Ripper
1488
1488
  mlhs_add_star.merge(
1489
1489
  type: :mlhs_add_post,
1490
1490
  body: [mlhs_add_star, mlhs],
1491
- end: mlhs[:end],
1491
+ el: mlhs[:el],
1492
1492
  ec: mlhs[:ec]
1493
1493
  )
1494
1494
  end
@@ -1504,9 +1504,9 @@ class Prettier::Parser < Ripper
1504
1504
  {
1505
1505
  type: :mlhs_add_star,
1506
1506
  body: [mlhs, part],
1507
- start: beging[:start],
1507
+ sl: beging[:sl],
1508
1508
  sc: beging[:sc],
1509
- end: ending[:end],
1509
+ el: ending[:el],
1510
1510
  ec: ending[:ec]
1511
1511
  }
1512
1512
  end
@@ -1526,9 +1526,9 @@ class Prettier::Parser < Ripper
1526
1526
  {
1527
1527
  type: :mlhs_paren,
1528
1528
  body: [contents],
1529
- start: beging[:start],
1529
+ sl: beging[:sl],
1530
1530
  sc: beging[:sc],
1531
- end: ending[:end],
1531
+ el: ending[:el],
1532
1532
  ec: ending[:ec]
1533
1533
  }
1534
1534
  end
@@ -1545,9 +1545,9 @@ class Prettier::Parser < Ripper
1545
1545
  {
1546
1546
  type: :module,
1547
1547
  body: [const, bodystmt],
1548
- start: beging[:start],
1548
+ sl: beging[:sl],
1549
1549
  sc: beging[:sc],
1550
- end: ending[:end],
1550
+ el: ending[:el],
1551
1551
  ec: ending[:ec]
1552
1552
  }
1553
1553
  end
@@ -1560,9 +1560,9 @@ class Prettier::Parser < Ripper
1560
1560
  {
1561
1561
  type: :mrhs,
1562
1562
  body: [],
1563
- start: lineno,
1563
+ sl: lineno,
1564
1564
  sc: char_pos,
1565
- end: lineno,
1565
+ el: lineno,
1566
1566
  ec: char_pos
1567
1567
  }
1568
1568
  end
@@ -1573,7 +1573,7 @@ class Prettier::Parser < Ripper
1573
1573
  if mrhs[:body].empty?
1574
1574
  part.merge(type: :mrhs, body: [part])
1575
1575
  else
1576
- mrhs.merge!(body: mrhs[:body] << part, end: part[:end], ec: part[:ec])
1576
+ mrhs.merge!(body: mrhs[:body] << part, el: part[:el], ec: part[:ec])
1577
1577
  end
1578
1578
  end
1579
1579
 
@@ -1587,9 +1587,9 @@ class Prettier::Parser < Ripper
1587
1587
  {
1588
1588
  type: :mrhs_add_star,
1589
1589
  body: [mrhs, part],
1590
- start: beging[:start],
1590
+ sl: beging[:sl],
1591
1591
  sc: beging[:sc],
1592
- end: ending[:end],
1592
+ el: ending[:el],
1593
1593
  ec: ending[:ec]
1594
1594
  }
1595
1595
  end
@@ -1613,7 +1613,7 @@ class Prettier::Parser < Ripper
1613
1613
  find_scanner_event(:@kw, 'next').merge!(
1614
1614
  type: :next,
1615
1615
  body: [args_add_block],
1616
- end: args_add_block[:end],
1616
+ el: args_add_block[:el],
1617
1617
  ec: args_add_block[:ec]
1618
1618
  )
1619
1619
  end
@@ -1626,7 +1626,7 @@ class Prettier::Parser < Ripper
1626
1626
  left.merge(
1627
1627
  type: :opassign,
1628
1628
  body: [left, oper, right],
1629
- end: right[:end],
1629
+ el: right[:el],
1630
1630
  ec: right[:ec]
1631
1631
  )
1632
1632
  end
@@ -1641,13 +1641,13 @@ class Prettier::Parser < Ripper
1641
1641
  location =
1642
1642
  if flattened.any?
1643
1643
  {
1644
- start: flattened[0][:start],
1644
+ sl: flattened[0][:sl],
1645
1645
  sc: flattened[0][:sc],
1646
- end: flattened[-1][:end],
1646
+ el: flattened[-1][:el],
1647
1647
  ec: flattened[-1][:ec]
1648
1648
  }
1649
1649
  else
1650
- { start: lineno, sc: char_pos, end: lineno, ec: char_pos }
1650
+ { sl: lineno, sc: char_pos, el: lineno, ec: char_pos }
1651
1651
  end
1652
1652
 
1653
1653
  location.merge!(type: :params, body: types)
@@ -1657,12 +1657,17 @@ class Prettier::Parser < Ripper
1657
1657
  # anywhere in a Ruby program. It accepts as arguments the contents, which
1658
1658
  # can be either params or statements.
1659
1659
  def on_paren(contents)
1660
+ beging = find_scanner_event(:@lparen)
1660
1661
  ending = find_scanner_event(:@rparen)
1661
1662
 
1662
- find_scanner_event(:@lparen).merge!(
1663
+ if contents && contents[:type] == :params
1664
+ contents.merge!(sc: beging[:ec], ec: ending[:sc])
1665
+ end
1666
+
1667
+ beging.merge!(
1663
1668
  type: :paren,
1664
1669
  body: [contents],
1665
- end: ending[:end],
1670
+ el: ending[:el],
1666
1671
  ec: ending[:ec]
1667
1672
  )
1668
1673
  end
@@ -1672,7 +1677,7 @@ class Prettier::Parser < Ripper
1672
1677
  # source string. We'll also attach on the __END__ content if there was
1673
1678
  # some found at the end of the source string.
1674
1679
  def on_program(stmts)
1675
- range = { start: 1, end: lines.length, sc: 0, ec: source.length }
1680
+ range = { sl: 1, el: lines.length, sc: 0, ec: source.length }
1676
1681
 
1677
1682
  stmts[:body] << @__end__ if @__end__
1678
1683
  stmts.bind(0, source.length)
@@ -1694,7 +1699,7 @@ class Prettier::Parser < Ripper
1694
1699
  def on_qsymbols_add(qsymbols, tstring_content)
1695
1700
  qsymbols.merge!(
1696
1701
  body: qsymbols[:body] << tstring_content,
1697
- end: tstring_content[:end],
1702
+ el: tstring_content[:el],
1698
1703
  ec: tstring_content[:ec]
1699
1704
  )
1700
1705
  end
@@ -1713,7 +1718,7 @@ class Prettier::Parser < Ripper
1713
1718
  def on_qwords_add(qwords, tstring_content)
1714
1719
  qwords.merge!(
1715
1720
  body: qwords[:body] << tstring_content,
1716
- end: tstring_content[:end],
1721
+ el: tstring_content[:el],
1717
1722
  ec: tstring_content[:ec]
1718
1723
  )
1719
1724
  end
@@ -1739,7 +1744,7 @@ class Prettier::Parser < Ripper
1739
1744
  def on_regexp_add(regexp, piece)
1740
1745
  regexp.merge!(
1741
1746
  body: regexp[:body] << piece,
1742
- end: regexp[:end],
1747
+ el: regexp[:el],
1743
1748
  ec: regexp[:ec]
1744
1749
  )
1745
1750
  end
@@ -1752,7 +1757,7 @@ class Prettier::Parser < Ripper
1752
1757
  regexp.merge!(
1753
1758
  type: :regexp_literal,
1754
1759
  ending: ending[:body],
1755
- end: ending[:end],
1760
+ el: ending[:el],
1756
1761
  ec: ending[:ec]
1757
1762
  )
1758
1763
  end
@@ -1791,7 +1796,7 @@ class Prettier::Parser < Ripper
1791
1796
  beging.merge!(
1792
1797
  type: :rescue,
1793
1798
  body: [exceptions, variable, stmts, consequent],
1794
- end: lineno,
1799
+ el: lineno,
1795
1800
  ec: char_pos
1796
1801
  )
1797
1802
  )
@@ -1806,9 +1811,9 @@ class Prettier::Parser < Ripper
1806
1811
  {
1807
1812
  type: :rescue_mod,
1808
1813
  body: [statement, rescued],
1809
- start: statement[:start],
1814
+ sl: statement[:sl],
1810
1815
  sc: statement[:sc],
1811
- end: rescued[:end],
1816
+ el: rescued[:el],
1812
1817
  ec: rescued[:ec]
1813
1818
  }
1814
1819
  end
@@ -1824,7 +1829,7 @@ class Prettier::Parser < Ripper
1824
1829
  oper.merge!(
1825
1830
  type: :rest_param,
1826
1831
  body: [ident],
1827
- end: ident[:end],
1832
+ el: ident[:el],
1828
1833
  ec: ident[:ec]
1829
1834
  )
1830
1835
  end
@@ -1842,7 +1847,7 @@ class Prettier::Parser < Ripper
1842
1847
  find_scanner_event(:@kw, 'return').merge!(
1843
1848
  type: :return,
1844
1849
  body: [args_add_block],
1845
- end: args_add_block[:end],
1850
+ el: args_add_block[:el],
1846
1851
  ec: args_add_block[:ec]
1847
1852
  )
1848
1853
  end
@@ -1874,9 +1879,9 @@ class Prettier::Parser < Ripper
1874
1879
  {
1875
1880
  type: :sclass,
1876
1881
  body: [target, bodystmt],
1877
- start: beging[:start],
1882
+ sl: beging[:sl],
1878
1883
  sc: beging[:sc],
1879
- end: ending[:end],
1884
+ el: ending[:el],
1880
1885
  ec: ending[:ec]
1881
1886
  }
1882
1887
  end
@@ -1903,9 +1908,9 @@ class Prettier::Parser < Ripper
1903
1908
 
1904
1909
  def <<(statement)
1905
1910
  if self[:body].any?
1906
- merge!(statement.slice(:end, :ec))
1911
+ merge!(statement.slice(:el, :ec))
1907
1912
  else
1908
- merge!(statement.slice(:start, :end, :sc, :ec))
1913
+ merge!(statement.slice(:sl, :el, :sc, :ec))
1909
1914
  end
1910
1915
 
1911
1916
  self[:body] << statement
@@ -1920,8 +1925,8 @@ class Prettier::Parser < Ripper
1920
1925
  Stmts.new(
1921
1926
  type: :stmts,
1922
1927
  body: [],
1923
- start: lineno,
1924
- end: lineno,
1928
+ sl: lineno,
1929
+ el: lineno,
1925
1930
  sc: char_pos,
1926
1931
  ec: char_pos
1927
1932
  )
@@ -1945,9 +1950,9 @@ class Prettier::Parser < Ripper
1945
1950
  {
1946
1951
  type: :string_concat,
1947
1952
  body: [left, right],
1948
- start: left[:start],
1953
+ sl: left[:sl],
1949
1954
  sc: left[:sc],
1950
- end: right[:end],
1955
+ el: right[:el],
1951
1956
  ec: right[:ec]
1952
1957
  }
1953
1958
  end
@@ -1961,8 +1966,8 @@ class Prettier::Parser < Ripper
1961
1966
  {
1962
1967
  type: :string,
1963
1968
  body: [],
1964
- start: lineno,
1965
- end: lineno,
1969
+ sl: lineno,
1970
+ el: lineno,
1966
1971
  sc: char_pos,
1967
1972
  ec: char_pos
1968
1973
  }
@@ -1973,11 +1978,7 @@ class Prettier::Parser < Ripper
1973
1978
  # It accepts as arguments the parent string node as well as the additional
1974
1979
  # piece of the string.
1975
1980
  def on_string_add(string, piece)
1976
- string.merge!(
1977
- body: string[:body] << piece,
1978
- end: piece[:end],
1979
- ec: piece[:ec]
1980
- )
1981
+ string.merge!(body: string[:body] << piece, el: piece[:el], ec: piece[:ec])
1981
1982
  end
1982
1983
 
1983
1984
  # string_dvar is a parser event that represents a very special kind of
@@ -1989,7 +1990,7 @@ class Prettier::Parser < Ripper
1989
1990
  find_scanner_event(:@embvar).merge!(
1990
1991
  type: :string_dvar,
1991
1992
  body: [var_ref],
1992
- end: var_ref[:end],
1993
+ el: var_ref[:el],
1993
1994
  ec: var_ref[:ec]
1994
1995
  )
1995
1996
  end
@@ -2007,9 +2008,9 @@ class Prettier::Parser < Ripper
2007
2008
  {
2008
2009
  type: :string_embexpr,
2009
2010
  body: [stmts],
2010
- start: beging[:start],
2011
+ sl: beging[:sl],
2011
2012
  sc: beging[:sc],
2012
- end: ending[:end],
2013
+ el: ending[:el],
2013
2014
  ec: ending[:ec]
2014
2015
  }
2015
2016
  end
@@ -2029,9 +2030,9 @@ class Prettier::Parser < Ripper
2029
2030
  type: :string_literal,
2030
2031
  body: string[:body],
2031
2032
  quote: beging[:body],
2032
- start: beging[:start],
2033
+ sl: beging[:sl],
2033
2034
  sc: beging[:sc],
2034
- end: ending[:end],
2035
+ el: ending[:el],
2035
2036
  ec: ending[:ec]
2036
2037
  }
2037
2038
  end
@@ -2045,7 +2046,7 @@ class Prettier::Parser < Ripper
2045
2046
  find_scanner_event(:@kw, 'super').merge!(
2046
2047
  type: :super,
2047
2048
  body: [contents],
2048
- end: contents[:end],
2049
+ el: contents[:el],
2049
2050
  ec: contents[:ec]
2050
2051
  )
2051
2052
  end
@@ -2096,7 +2097,7 @@ class Prettier::Parser < Ripper
2096
2097
  def on_symbols_add(symbols, word_add)
2097
2098
  symbols.merge!(
2098
2099
  body: symbols[:body] << word_add,
2099
- end: word_add[:end],
2100
+ el: word_add[:el],
2100
2101
  ec: word_add[:ec]
2101
2102
  )
2102
2103
  end
@@ -2125,7 +2126,7 @@ class Prettier::Parser < Ripper
2125
2126
  const.merge(
2126
2127
  type: :top_const_field,
2127
2128
  body: [const],
2128
- start: beging[:start],
2129
+ sl: beging[:sl],
2129
2130
  sc: beging[:sc]
2130
2131
  )
2131
2132
  end
@@ -2141,7 +2142,7 @@ class Prettier::Parser < Ripper
2141
2142
  const.merge(
2142
2143
  type: :top_const_ref,
2143
2144
  body: [const],
2144
- start: beging[:start],
2145
+ sl: beging[:sl],
2145
2146
  sc: beging[:sc]
2146
2147
  )
2147
2148
  end
@@ -2161,7 +2162,7 @@ class Prettier::Parser < Ripper
2161
2162
  type: :unary,
2162
2163
  oper: oper,
2163
2164
  body: [value],
2164
- end: ending[:end],
2165
+ el: ending[:el],
2165
2166
  ec: ending[:ec],
2166
2167
  paren: paren
2167
2168
  )
@@ -2181,7 +2182,7 @@ class Prettier::Parser < Ripper
2181
2182
  type: :unary,
2182
2183
  oper: oper[0],
2183
2184
  body: [value],
2184
- end: value[:end],
2185
+ el: value[:el],
2185
2186
  ec: value[:ec]
2186
2187
  )
2187
2188
  end
@@ -2197,7 +2198,7 @@ class Prettier::Parser < Ripper
2197
2198
  find_scanner_event(:@kw, 'undef').merge!(
2198
2199
  type: :undef,
2199
2200
  body: symbol_literals,
2200
- end: last[:end],
2201
+ el: last[:el],
2201
2202
  ec: last[:ec]
2202
2203
  )
2203
2204
  end
@@ -2215,9 +2216,9 @@ class Prettier::Parser < Ripper
2215
2216
  {
2216
2217
  type: :unless,
2217
2218
  body: [predicate, stmts, consequent],
2218
- start: beging[:start],
2219
+ sl: beging[:sl],
2219
2220
  sc: beging[:sc],
2220
- end: ending[:end],
2221
+ el: ending[:el],
2221
2222
  ec: ending[:ec]
2222
2223
  }
2223
2224
  end
@@ -2231,9 +2232,9 @@ class Prettier::Parser < Ripper
2231
2232
  {
2232
2233
  type: :unless_mod,
2233
2234
  body: [predicate, statement],
2234
- start: statement[:start],
2235
+ sl: statement[:sl],
2235
2236
  sc: statement[:sc],
2236
- end: predicate[:end],
2237
+ el: predicate[:el],
2237
2238
  ec: predicate[:ec]
2238
2239
  }
2239
2240
  end
@@ -2257,9 +2258,9 @@ class Prettier::Parser < Ripper
2257
2258
  {
2258
2259
  type: :until,
2259
2260
  body: [predicate, stmts],
2260
- start: beging[:start],
2261
+ sl: beging[:sl],
2261
2262
  sc: beging[:sc],
2262
- end: ending[:end],
2263
+ el: ending[:el],
2263
2264
  ec: ending[:ec]
2264
2265
  }
2265
2266
  end
@@ -2273,9 +2274,9 @@ class Prettier::Parser < Ripper
2273
2274
  {
2274
2275
  type: :until_mod,
2275
2276
  body: [predicate, statement],
2276
- start: statement[:start],
2277
+ sl: statement[:sl],
2277
2278
  sc: statement[:sc],
2278
- end: predicate[:end],
2279
+ el: predicate[:el],
2279
2280
  ec: predicate[:ec]
2280
2281
  }
2281
2282
  end
@@ -2293,9 +2294,9 @@ class Prettier::Parser < Ripper
2293
2294
  {
2294
2295
  type: :var_alias,
2295
2296
  body: [left, right],
2296
- start: beging[:start],
2297
+ sl: beging[:sl],
2297
2298
  sc: beging[:sc],
2298
- end: ending[:end],
2299
+ el: ending[:el],
2299
2300
  ec: ending[:ec]
2300
2301
  }
2301
2302
  end
@@ -2348,7 +2349,7 @@ class Prettier::Parser < Ripper
2348
2349
  # block of code. It often will have comments attached to it, so it requires
2349
2350
  # some special handling.
2350
2351
  def on_void_stmt
2351
- { type: :void_stmt, start: lineno, end: lineno, sc: char_pos, ec: char_pos }
2352
+ { type: :void_stmt, sl: lineno, el: lineno, sc: char_pos, ec: char_pos }
2352
2353
  end
2353
2354
 
2354
2355
  # when is a parser event that represents another clause in a case chain.
@@ -2364,9 +2365,9 @@ class Prettier::Parser < Ripper
2364
2365
  {
2365
2366
  type: :when,
2366
2367
  body: [predicate, stmts, consequent],
2367
- start: beging[:start],
2368
+ sl: beging[:sl],
2368
2369
  sc: beging[:sc],
2369
- end: ending[:end],
2370
+ el: ending[:el],
2370
2371
  ec: ending[:ec]
2371
2372
  }
2372
2373
  end
@@ -2390,9 +2391,9 @@ class Prettier::Parser < Ripper
2390
2391
  {
2391
2392
  type: :while,
2392
2393
  body: [predicate, stmts],
2393
- start: beging[:start],
2394
+ sl: beging[:sl],
2394
2395
  sc: beging[:sc],
2395
- end: ending[:end],
2396
+ el: ending[:el],
2396
2397
  ec: ending[:ec]
2397
2398
  }
2398
2399
  end
@@ -2406,9 +2407,9 @@ class Prettier::Parser < Ripper
2406
2407
  {
2407
2408
  type: :while_mod,
2408
2409
  body: [predicate, statement],
2409
- start: statement[:start],
2410
+ sl: statement[:sl],
2410
2411
  sc: statement[:sc],
2411
- end: predicate[:end],
2412
+ el: predicate[:el],
2412
2413
  ec: predicate[:ec]
2413
2414
  }
2414
2415
  end
@@ -2439,7 +2440,7 @@ class Prettier::Parser < Ripper
2439
2440
  # location information from the first piece.
2440
2441
  piece.merge(type: :word, body: [piece])
2441
2442
  else
2442
- word.merge!(body: word[:body] << piece, end: piece[:end], ec: piece[:ec])
2443
+ word.merge!(body: word[:body] << piece, el: piece[:el], ec: piece[:ec])
2443
2444
  end
2444
2445
  end
2445
2446
 
@@ -2458,7 +2459,7 @@ class Prettier::Parser < Ripper
2458
2459
  def on_words_add(words, word_add)
2459
2460
  words.merge!(
2460
2461
  body: words[:body] << word_add,
2461
- end: word_add[:end],
2462
+ el: word_add[:el],
2462
2463
  ec: word_add[:ec]
2463
2464
  )
2464
2465
  end
@@ -2492,7 +2493,7 @@ class Prettier::Parser < Ripper
2492
2493
  def on_xstring_add(xstring, piece)
2493
2494
  xstring.merge!(
2494
2495
  body: xstring[:body] << piece,
2495
- end: piece[:end],
2496
+ el: piece[:el],
2496
2497
  ec: piece[:ec]
2497
2498
  )
2498
2499
  end
@@ -2518,7 +2519,7 @@ class Prettier::Parser < Ripper
2518
2519
  heredoc.merge!(body: xstring[:body])
2519
2520
  else
2520
2521
  ending = find_scanner_event(:@tstring_end)
2521
- xstring.merge!(type: :xstring_literal, end: ending[:end], ec: ending[:ec])
2522
+ xstring.merge!(type: :xstring_literal, el: ending[:el], ec: ending[:ec])
2522
2523
  end
2523
2524
  end
2524
2525
 
@@ -2529,7 +2530,7 @@ class Prettier::Parser < Ripper
2529
2530
  find_scanner_event(:@kw, 'yield').merge!(
2530
2531
  type: :yield,
2531
2532
  body: [args_add_block],
2532
- end: args_add_block[:end],
2533
+ el: args_add_block[:el],
2533
2534
  ec: args_add_block[:ec]
2534
2535
  )
2535
2536
  end