@konomanoasa/tree-sitter-diagnostic-sh 0.4.0 → 0.5.0

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.
package/Cargo.toml CHANGED
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "konomanoasa-tree-sitter-diagnostic-sh"
3
- version = "0.4.0"
3
+ version = "0.5.0"
4
4
  edition = "2024"
5
5
  description = "Tree-sitter grammar for diagnostics of POSIX sh."
6
6
  readme = "README.md"
@@ -10,6 +10,7 @@ build = "bindings/rust/build.rs"
10
10
  links = "tree-sitter-diagnostic-sh"
11
11
  include = [
12
12
  "/LICENSE",
13
+ "/PARSING_POLICY.md",
13
14
  "/README.md",
14
15
  "/bindings/rust/*.rs",
15
16
  "/src/*.c",
@@ -0,0 +1,11 @@
1
+ # Parsing Policy
2
+
3
+ The parser checks the syntax of source as written. It parses the following
4
+ commands but does not apply their effects to parsing.
5
+
6
+ | Command | Effects not applied |
7
+ | ------------------ | ----------------------------------------------------------------- |
8
+ | `.` | Loading another file or applying changes made by its execution. |
9
+ | `alias`, `unalias` | Alias substitution or changes to alias definitions. |
10
+ | `eval` | Reparsing code constructed from its arguments. |
11
+ | `set` | Changing parsing conditions in response to shell option settings. |
package/README.md CHANGED
@@ -23,6 +23,10 @@ npm run build
23
23
  npm test
24
24
  ```
25
25
 
26
+ ## Parsing Policy
27
+
28
+ [Parsing Policy](PARSING_POLICY.md)
29
+
26
30
  ## Specification
27
31
 
28
32
  [POSIX.1-2024 Shell Command Language](https://pubs.opengroup.org/onlinepubs/9799919799.2024edition/utilities/V3_chap02.html)
package/package.json CHANGED
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "name": "@konomanoasa/tree-sitter-diagnostic-sh",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "type": "module",
5
5
  "description": "Tree-sitter grammar for diagnostics of POSIX sh.",
6
6
  "license": "MIT",
7
7
  "repository": "git+https://github.com/konomanoasa/tree-sitter-diagnostic-sh.git",
8
8
  "files": [
9
9
  "Cargo.toml",
10
+ "PARSING_POLICY.md",
10
11
  "bindings/rust/*.rs",
11
12
  "grammar.js",
12
13
  "src/*.c",
package/src/parser.c CHANGED
@@ -15390,7 +15390,7 @@ TS_PUBLIC const TSLanguage *tree_sitter_diagnostic_sh(void) {
15390
15390
  .max_reserved_word_set_size = 0,
15391
15391
  .metadata = {
15392
15392
  .major_version = 0,
15393
- .minor_version = 4,
15393
+ .minor_version = 5,
15394
15394
  .patch_version = 0,
15395
15395
  },
15396
15396
  };
package/src/scanner.c CHANGED
@@ -146,6 +146,7 @@ struct Change {
146
146
  struct Capture {
147
147
  struct Change *changes;
148
148
  size_t count, capacity;
149
+ size_t depth, verbatim;
149
150
  bool quoted, failed, newlines_only;
150
151
  struct Unit newline;
151
152
  size_t uncertain;
@@ -191,6 +192,7 @@ struct Plan {
191
192
  struct Owner *owners;
192
193
  size_t owner_count, owner_capacity;
193
194
  size_t depth;
195
+ size_t source_end;
194
196
  bool failed;
195
197
  };
196
198
 
@@ -229,7 +231,7 @@ struct Parser {
229
231
  struct Input input;
230
232
  struct Plan *plan;
231
233
  struct Token token;
232
- bool ready, opaque, quoted_delimiter;
234
+ bool ready, opaque;
233
235
  size_t owner, consumed, consumed_start;
234
236
  struct Document *documents;
235
237
  size_t document_count, document_capacity;
@@ -859,7 +861,6 @@ finish:
859
861
  return result;
860
862
  }
861
863
 
862
- // Holes invalidate the outer stack.
863
864
  static enum ArithmeticValidation
864
865
  arithmetic_check_structure(const int32_t *source, size_t length) {
865
866
  struct ArithmeticGroup {
@@ -1566,16 +1567,34 @@ static bool capturing_delimiter(const struct Input *input) {
1566
1567
  return false;
1567
1568
  }
1568
1569
 
1569
- static void capture_change(
1570
- struct Input *input,
1571
- struct Unit unit,
1572
- int32_t value,
1573
- bool quoted
1574
- ) {
1570
+ static void capture_quote(struct Input *input) {
1571
+ for (
1572
+ struct Capture *capture = input->capture; capture; capture = capture->parent
1573
+ )
1574
+ if (!capture->newlines_only && !capture->depth) capture->quoted = true;
1575
+ }
1576
+
1577
+ static void
1578
+ capture_substitution(struct Input *input, bool entering, bool verbatim) {
1575
1579
  for (
1576
1580
  struct Capture *capture = input->capture; capture; capture = capture->parent
1577
1581
  ) {
1578
- if (capture->newlines_only) continue;
1582
+ if (entering) {
1583
+ capture->depth++;
1584
+ if (verbatim) capture->verbatim++;
1585
+ } else {
1586
+ capture->depth--;
1587
+ if (verbatim) capture->verbatim--;
1588
+ }
1589
+ }
1590
+ }
1591
+
1592
+ static void
1593
+ capture_change(struct Input *input, struct Unit unit, int32_t value) {
1594
+ for (
1595
+ struct Capture *capture = input->capture; capture; capture = capture->parent
1596
+ ) {
1597
+ if (capture->newlines_only || capture->verbatim) continue;
1579
1598
  struct Change *grown = diagnostic_grow(
1580
1599
  capture->changes,
1581
1600
  &capture->capacity,
@@ -1589,7 +1608,6 @@ static void capture_change(
1589
1608
  capture->changes = grown;
1590
1609
  capture->changes[capture->count++] =
1591
1610
  (struct Change){unit.start, unit.end, value};
1592
- capture->quoted |= quoted;
1593
1611
  }
1594
1612
  }
1595
1613
 
@@ -1629,8 +1647,7 @@ static struct Unit pop(struct Input *input) {
1629
1647
  (
1630
1648
  struct Unit
1631
1649
  ){0, input->units[input->position].start, input->units[position - 1].end},
1632
- -1,
1633
- false
1650
+ -1
1634
1651
  );
1635
1652
  input->position = position;
1636
1653
  return read_raw(input);
@@ -1639,7 +1656,7 @@ static struct Unit pop(struct Input *input) {
1639
1656
  static struct Unit escaped_unit(struct Input *input, struct Unit slash) {
1640
1657
  struct Unit escaped = input->units[input->position++];
1641
1658
  escaped.start = slash.start;
1642
- capture_change(input, escaped, escaped.value, true);
1659
+ capture_quote(input);
1643
1660
  return escaped;
1644
1661
  }
1645
1662
 
@@ -1929,7 +1946,6 @@ child_parser(const struct Parser *parent, struct Input input) {
1929
1946
  ){.input = input,
1930
1947
  .plan = parent->plan,
1931
1948
  .opaque = parent->opaque,
1932
- .quoted_delimiter = parent->quoted_delimiter,
1933
1949
  .owner = parent->owner,
1934
1950
  .backquote_end = parent->backquote_end};
1935
1951
  }
@@ -1976,12 +1992,9 @@ static void quoted(struct Parser *parser, struct Text *text, int32_t quote) {
1976
1992
  offset(input)
1977
1993
  );
1978
1994
  int32_t parent_closer = parser->closer;
1979
- bool quoted_delimiter = parser->quoted_delimiter;
1980
1995
  parser->closer = quote;
1981
- if (!literal && capturing_delimiter(input)) parser->quoted_delimiter = true;
1982
- struct Unit opening = pop(input);
1983
- bool preserve = literal && parser->quoted_delimiter;
1984
- if (!preserve) capture_change(input, opening, -1, true);
1996
+ pop(input);
1997
+ capture_quote(input);
1985
1998
  while (!parser->plan->failed) {
1986
1999
  int32_t c = peek_quoted(input, literal);
1987
2000
  if (c < 0) {
@@ -1993,8 +2006,7 @@ static void quoted(struct Parser *parser, struct Text *text, int32_t quote) {
1993
2006
  break;
1994
2007
  }
1995
2008
  if (c == quote) {
1996
- struct Unit closing = pop_quoted(input, literal);
1997
- if (!preserve) capture_change(input, closing, -1, true);
2009
+ pop_quoted(input, literal);
1998
2010
  break;
1999
2011
  }
2000
2012
  if (!literal && (c == '$' || c == '`')) {
@@ -2007,7 +2019,6 @@ static void quoted(struct Parser *parser, struct Text *text, int32_t quote) {
2007
2019
  text_push(parser, text, unit);
2008
2020
  }
2009
2021
  parser->closer = parent_closer;
2010
- parser->quoted_delimiter = quoted_delimiter;
2011
2022
  owner_end(parser, owner, consumed_offset(input));
2012
2023
  unnest(parser);
2013
2024
  }
@@ -2120,10 +2131,11 @@ static void parameter_escape(
2120
2131
  ) {
2121
2132
  struct Input *input = &parser->input;
2122
2133
  struct Unit slash = pop(input);
2134
+ int32_t next = raw(input, input->position);
2135
+ if (next < 0 && input->end == parser->plan->source_end) return;
2123
2136
  size_t owner = double_quoted
2124
2137
  ? 0
2125
2138
  : owner_begin(parser, BEGIN_ESCAPED_CHARACTER, slash.start);
2126
- int32_t next = raw(input, input->position);
2127
2139
  if (next < 0) {
2128
2140
  if (!double_quoted && fault->kind == TOKEN_TYPE_COUNT)
2129
2141
  *fault = (struct Fault){INCOMPLETE_ESCAPE, slash.start, slash.end, owner};
@@ -2312,7 +2324,7 @@ dollar_quote_escape(struct Parser *parser, struct Unit *unit) {
2312
2324
  else if (c == 'c') fault = control_escape(parser, unit, &end);
2313
2325
  else if (!known && !undecodable(c)) fault = UNSPECIFIED_DOLLAR_QUOTE_ESCAPE;
2314
2326
  unit->end = input->units[input->position - 1].end;
2315
- capture_change(input, *unit, unit->value, true);
2327
+ capture_change(input, *unit, unit->value);
2316
2328
  }
2317
2329
  if (undecidable_delimiter_fault(fault)) capture_uncertain(input, unit->start);
2318
2330
  if (!end) end = unit->end;
@@ -2322,13 +2334,12 @@ dollar_quote_escape(struct Parser *parser, struct Unit *unit) {
2322
2334
 
2323
2335
  static void dollar_quote(struct Parser *parser, struct Text *text) {
2324
2336
  struct Input *input = &parser->input;
2325
- struct Unit opening = pop(input);
2326
- capture_change(input, opening, -1, true);
2337
+ pop(input);
2338
+ capture_quote(input);
2327
2339
  bool closed = false;
2328
2340
  while (!parser->plan->failed && input->position < input->count) {
2329
2341
  struct Unit unit = read_raw(input);
2330
2342
  if (unit.value == '\'') {
2331
- capture_change(input, unit, -1, true);
2332
2343
  closed = true;
2333
2344
  break;
2334
2345
  }
@@ -2361,8 +2372,7 @@ static struct Unit backquote_next(struct BackquoteInput *reader) {
2361
2372
  }
2362
2373
  if (unit.value == '\\') {
2363
2374
  if (raw(input, input->position) == '\n') {
2364
- unit.end = input->units[input->position++].end;
2365
- capture_change(input, unit, -1, false);
2375
+ input->position++;
2366
2376
  continue;
2367
2377
  }
2368
2378
  reader->literal_next = true;
@@ -2393,7 +2403,6 @@ static size_t backquote_body(
2393
2403
  if (expansion_escape(next) || (double_quoted && next == '"')) {
2394
2404
  decoded.start = unit.start;
2395
2405
  unit = decoded;
2396
- capture_change(input, unit, unit.value, true);
2397
2406
  } else {
2398
2407
  text_push(parser, content, unit);
2399
2408
  if (next >= 0) text_push(parser, content, decoded);
@@ -2412,6 +2421,8 @@ static void backquote_contents(
2412
2421
  ) {
2413
2422
  struct Input *input = &parser->input;
2414
2423
  struct Unit opening = pop(input);
2424
+ size_t begin = input->position;
2425
+ capture_substitution(input, true, true);
2415
2426
  struct Text content = {0};
2416
2427
  size_t end = input->end;
2417
2428
  size_t closed = backquote_body(parser, double_quoted, &content, &end);
@@ -2425,6 +2436,17 @@ static void backquote_contents(
2425
2436
  );
2426
2437
  ts_free(rejected.bits);
2427
2438
  ts_free(content.units);
2439
+ capture_substitution(input, false, true);
2440
+ if (capturing_delimiter(input)) {
2441
+ for (size_t i = begin; i + 1 < input->position; i++) {
2442
+ if (input->units[i].value != '\\') continue;
2443
+ struct Unit slash = input->units[i++];
2444
+ if (input->units[i].value == '\n') {
2445
+ slash.end = input->units[i].end;
2446
+ capture_change(input, slash, -1);
2447
+ }
2448
+ }
2449
+ }
2428
2450
  text_push(parser, text, (struct Unit){-1, opening.start, offset(input)});
2429
2451
  }
2430
2452
 
@@ -2438,7 +2460,7 @@ backquote(struct Parser *parser, struct Text *text, bool double_quoted) {
2438
2460
  unnest(parser);
2439
2461
  }
2440
2462
 
2441
- // Cache rejected `$((` probes to avoid exponential work during nested fallback.
2463
+ // Caching rejected `$((` probes prevents exponential fallback.
2442
2464
  static bool rejected_arithmetic(const struct Input *input, size_t at) {
2443
2465
  const uint8_t *bits = input->rejected->bits;
2444
2466
  return bits && (bits[at / 8] >> (at % 8)) & 1;
@@ -2511,7 +2533,7 @@ arithmetic_valid(struct Plan *plan, const struct Text *content, bool open) {
2511
2533
  for (size_t i = 0; i < content->count; i++)
2512
2534
  values[i] = content->units[i].value;
2513
2535
  size_t length = content->count;
2514
- // An EOF continuation is an unconstrained suffix, like an expansion hole.
2536
+ // An EOF continuation acts as an expansion hole.
2515
2537
  if (open) values[length++] = -1;
2516
2538
  enum ArithmeticValidation validation = validate_arithmetic(values, length);
2517
2539
  ts_free(values);
@@ -2529,8 +2551,7 @@ replay_capture(struct Parser *parser, const struct Capture *capture) {
2529
2551
  capture_change(
2530
2552
  &parser->input,
2531
2553
  (struct Unit){0, change.start, change.end},
2532
- change.value,
2533
- capture->quoted
2554
+ change.value
2534
2555
  );
2535
2556
  }
2536
2557
  }
@@ -2540,7 +2561,8 @@ static bool arithmetic(struct Parser *parser) {
2540
2561
  if (rejected_arithmetic(&parser->input, at)) return false;
2541
2562
  struct Parser probe = child_parser(parser, parser->input);
2542
2563
  struct Capture capture = {
2543
- .newlines_only = !capturing_delimiter(&parser->input)
2564
+ .newlines_only = !capturing_delimiter(&parser->input),
2565
+ .depth = 1
2544
2566
  };
2545
2567
  if (parser->input.capture) probe.input.capture = &capture;
2546
2568
  struct Plan *plan = parser->plan;
@@ -2623,6 +2645,8 @@ static void expansion_contents(
2623
2645
  int32_t c = peek(input);
2624
2646
  bool double_quoted = context != UNQUOTED;
2625
2647
  size_t owner = 0;
2648
+ bool nested = c == '{' || c == '(';
2649
+ if (nested) capture_substitution(input, true, false);
2626
2650
  if (c == '{') {
2627
2651
  owner = owner_begin(parser, BEGIN_PARAMETER_EXPANSION, dollar.start);
2628
2652
  parameter(parser, double_quoted);
@@ -2635,7 +2659,7 @@ static void expansion_contents(
2635
2659
  }
2636
2660
  } else if (c == '\'' && !double_quoted) {
2637
2661
  owner = owner_begin(parser, BEGIN_DOLLAR_SINGLE_QUOTED, dollar.start);
2638
- capture_change(input, dollar, -1, true);
2662
+ capture_change(input, dollar, -1);
2639
2663
  dollar_quote(parser, text);
2640
2664
  owner_end(parser, owner, consumed_offset(input));
2641
2665
  return;
@@ -2643,6 +2667,7 @@ static void expansion_contents(
2643
2667
  dollar_literal(parser, text, dollar, context);
2644
2668
  return;
2645
2669
  }
2670
+ if (nested) capture_substitution(input, false, false);
2646
2671
  owner_end(parser, owner, consumed_offset(input));
2647
2672
  text_push(parser, text, (struct Unit){-1, dollar.start, offset(input)});
2648
2673
  }
@@ -2660,10 +2685,16 @@ static void expansion(
2660
2685
  static void escaped_character(struct Parser *parser, struct Token *token) {
2661
2686
  struct Input *input = &parser->input;
2662
2687
  struct Unit slash = pop(input);
2688
+ if (
2689
+ raw(input, input->position) < 0 &&
2690
+ (parser->backquote_end || input->end == parser->plan->source_end)
2691
+ ) {
2692
+ text_push(parser, &token->text, slash);
2693
+ return;
2694
+ }
2663
2695
  size_t owner = owner_begin(parser, BEGIN_ESCAPED_CHARACTER, slash.start);
2664
2696
  if (raw(input, input->position) >= 0)
2665
2697
  text_push(parser, &token->text, escaped_unit(input, slash));
2666
- else if (parser->backquote_end) text_push(parser, &token->text, slash);
2667
2698
  else
2668
2699
  issue(
2669
2700
  parser,
@@ -2889,7 +2920,35 @@ static size_t unit_after(
2889
2920
  return low;
2890
2921
  }
2891
2922
 
2892
- // Changes nest or are disjoint; later changes take precedence.
2923
+ static void remove_delimiter_quotes(struct Text *text) {
2924
+ int32_t quote = 0;
2925
+ size_t output = 0;
2926
+ for (size_t i = 0; i < text->count; i++) {
2927
+ struct Unit unit = text->units[i];
2928
+ if (quote == '\'') {
2929
+ if (unit.value == '\'') quote = 0;
2930
+ else text->units[output++] = unit;
2931
+ continue;
2932
+ }
2933
+ if (unit.value == '"') {
2934
+ quote = quote ? 0 : '"';
2935
+ continue;
2936
+ }
2937
+ if (!quote && unit.value == '\'') {
2938
+ quote = '\'';
2939
+ continue;
2940
+ }
2941
+ if (unit.value == '\\' && i + 1 < text->count) {
2942
+ int32_t next = text->units[i + 1].value;
2943
+ if (!quote || expansion_escape(next) || next == '"')
2944
+ unit = text->units[++i];
2945
+ }
2946
+ text->units[output++] = unit;
2947
+ }
2948
+ text->count = output;
2949
+ }
2950
+
2951
+ // Changes must nest or be disjoint.
2893
2952
  static struct Text captured_delimiter(
2894
2953
  struct Parser *parser,
2895
2954
  const struct Capture *capture,
@@ -2917,14 +2976,18 @@ static struct Text captured_delimiter(
2917
2976
  if (!slot) encode(parser, &bytes, units[j]);
2918
2977
  else if (slot != removed) {
2919
2978
  struct Change change = capture->changes[slot - 1];
2920
- encode(
2921
- parser,
2922
- &bytes,
2923
- (struct Unit){change.value, change.start, change.end}
2924
- );
2979
+ struct Unit unit = {change.value, change.start, change.end};
2980
+ if (change.value == '\'' || change.value == -'\'' - 2) {
2981
+ const char *escaped_quote = "'\\''";
2982
+ for (size_t i = 0; escaped_quote[i]; i++) {
2983
+ unit.value = escaped_quote[i];
2984
+ text_push(parser, &bytes, unit);
2985
+ }
2986
+ } else encode(parser, &bytes, unit);
2925
2987
  }
2926
2988
  }
2927
2989
  ts_free(slots);
2990
+ if (capture->quoted) remove_delimiter_quotes(&bytes);
2928
2991
  return bytes;
2929
2992
  }
2930
2993
 
@@ -2964,7 +3027,7 @@ static void here_document_line(
2964
3027
  int32_t next = raw(input, input->position);
2965
3028
  if (next == '\n') {
2966
3029
  unit.end = input->units[input->position++].end;
2967
- capture_change(input, unit, -1, false);
3030
+ capture_change(input, unit, -1);
2968
3031
  continue;
2969
3032
  }
2970
3033
  text_push(parser, line, unit);
@@ -2991,9 +3054,11 @@ static bool here_document_end_line(
2991
3054
  bytes->count = 0;
2992
3055
  for (size_t i = *first; i < line->count && line->units[i].value != '\n'; i++)
2993
3056
  encode(parser, bytes, line->units[i]);
3057
+ bool newline = line->count && line->units[line->count - 1].value == '\n';
3058
+ bool source_eof = parser->input.position == parser->input.count &&
3059
+ parser->input.end == parser->plan->source_end;
2994
3060
  bool found = bytes->count == here->delimiter.count &&
2995
- line->count &&
2996
- line->units[line->count - 1].value == '\n';
3061
+ (newline || (bytes->count && source_eof));
2997
3062
  for (size_t i = 0; found && i < bytes->count; i++)
2998
3063
  found &= bytes->units[i].value == here->delimiter.units[i].value;
2999
3064
  return found;
@@ -3042,8 +3107,13 @@ static bool here_document(
3042
3107
  here_document_lines(parser, here, &body, &at_line_start, &boundary);
3043
3108
  if (!here->quoted) here_body(parser, body, boundary);
3044
3109
  ts_free(body.units);
3110
+ bool accepted_eof = input->end == parser->plan->source_end;
3045
3111
  // An unstarted body's gap must not belong to an outer body.
3046
- if (!found && !backquote_cut(parser, UNDEFINED_BACKQUOTE_HERE_DOCUMENT))
3112
+ if (
3113
+ !found &&
3114
+ !accepted_eof &&
3115
+ !backquote_cut(parser, UNDEFINED_BACKQUOTE_HERE_DOCUMENT)
3116
+ )
3047
3117
  report(
3048
3118
  parser,
3049
3119
  (struct Fault){HERE_DOCUMENT_ENDING_GAP, input->end, input->end, owner},
@@ -3319,13 +3389,8 @@ static bool redirect_operand(struct Parser *parser, enum Lexeme kind) {
3319
3389
  bool here = kind == HERE || kind == HERE_STRIP;
3320
3390
  struct Capture capture = {.parent = parser->input.capture};
3321
3391
  size_t begin = parser->input.position;
3322
- bool quoted_delimiter = parser->quoted_delimiter;
3323
- if (here) {
3324
- parser->input.capture = &capture;
3325
- parser->quoted_delimiter = false;
3326
- }
3392
+ if (here) parser->input.capture = &capture;
3327
3393
  const struct Token *target = look(parser);
3328
- parser->quoted_delimiter = quoted_delimiter;
3329
3394
  parser->input.capture = capture.parent;
3330
3395
  parser->plan->failed |= capture.failed;
3331
3396
  bool word = target->kind == WORD;
@@ -4212,7 +4277,6 @@ static bool later_child(const struct Plan *plan, size_t a, size_t b) {
4212
4277
  return a > b;
4213
4278
  }
4214
4279
 
4215
- // Ordered sibling ranges allow early termination.
4216
4280
  static size_t place_unowned(
4217
4281
  const struct Plan *plan,
4218
4282
  const struct PublicChild *children,
@@ -4330,7 +4394,6 @@ static bool replaces_issue(
4330
4394
  return candidate->recovery.complete && !current->recovery.complete;
4331
4395
  }
4332
4396
 
4333
- // A completed recovery leaves its boundary available to independent faults.
4334
4397
  static bool covered(
4335
4398
  const struct Plan *plan,
4336
4399
  const struct Issue *candidate,
@@ -4547,7 +4610,7 @@ static void decode_faults(struct Parser *parser, const struct Text *source) {
4547
4610
  static bool prepare(struct Scanner *scanner, TSLexer *lexer) {
4548
4611
  struct Text source = {0};
4549
4612
  bool success = read_source(lexer, &source);
4550
- struct Plan plan = {.failed = !success};
4613
+ struct Plan plan = {.source_end = source.count, .failed = !success};
4551
4614
  struct Rejected rejected = {0};
4552
4615
  struct Parser parser = {
4553
4616
  .input = {source.units, source.count, 0, source.count, NULL, &rejected},