From 469235afb3d95cb6190d73ae154785e8be44eb0d Mon Sep 17 00:00:00 2001 From: Emil Lerch Date: Tue, 1 Sep 2026 10:07:02 -0700 Subject: [PATCH] handle full srf spec --- .pre-commit-config.yaml | 3 + grammar.js | 66 +- queries/highlights.scm | 1 + src/grammar.json | 157 ++- src/node-types.json | 12 +- src/parser.c | 2110 +++++++++++++++++-------------- src/scanner.c | 255 ++++ test/corpus/basics.txt | 14 - test/corpus/compact_format.txt | 201 +++ test/corpus/errors.txt | 58 + test/corpus/length_prefixed.txt | 155 +++ test/corpus/long_format.txt | 302 +++++ 12 files changed, 2303 insertions(+), 1031 deletions(-) create mode 100644 src/scanner.c create mode 100644 test/corpus/compact_format.txt create mode 100644 test/corpus/errors.txt create mode 100644 test/corpus/length_prefixed.txt create mode 100644 test/corpus/long_format.txt diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 38eed5d..fc9cbda 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -6,6 +6,9 @@ repos: hooks: - id: trailing-whitespace - id: end-of-file-fixer + # tree-sitter generate emits these two without a trailing newline, so + # the fixer and the generate hook below would undo each other forever. + exclude: ^src/(grammar|node-types)\.json$ - id: check-yaml - id: check-added-large-files - repo: local diff --git a/grammar.js b/grammar.js index 3b6bd56..7d4f579 100644 --- a/grammar.js +++ b/grammar.js @@ -2,6 +2,11 @@ * @file SRF (Simple Record Format) grammar for tree-sitter * @author Emil Lerch * @license MIT + * + * SRF's field delimiter depends on the format directive: ',' in compact format + * (the default) and '\n' after `#!long`. A numeric type hint additionally means + * "this value is exactly N bytes", newlines included. Neither is expressible + * here, so those tokens come from the external scanner in src/scanner.c. */ /// @@ -12,17 +17,34 @@ module.exports = grammar({ extras: _ => [], + externals: $ => [ + $._long_marker, + $._compact_marker, + $._length_hint, + $.value, + // Never produced by the scanner. Only valid while tree-sitter is in error + // recovery, which tells the scanner to keep its hands off. + $._error_sentinel, + ], + rules: { document: $ => repeat($._line), - _line: $ => choice( - $.magic, - $.directive, - $.comment, - $.field, - $.blank_line, + // Leading whitespace is insignificant on every kind of line: the reference + // parser trims the start of each line before deciding what it is. + _line: $ => seq( + optional($._ws), + choice( + $.magic, + $.directive, + $.comment, + $._field_line, + $.blank_line, + ), ), + _ws: _ => /[ \t]+/, + magic: $ => seq( '#!srfv1', optional($.inline_comment), @@ -42,8 +64,11 @@ module.exports = grammar({ $.directive_unknown, ), - directive_long: $ => seq('#!long', optional($.inline_comment), '\n'), - directive_compact: $ => seq('#!compact', optional($.inline_comment), '\n'), + // The format directives are scanned externally so that the scanner learns + // which delimiter applies to the rest of the document. If both appear, the + // last one wins, matching the reference parser. + directive_long: $ => seq($._long_marker, optional($.inline_comment), '\n'), + directive_compact: $ => seq($._compact_marker, optional($.inline_comment), '\n'), directive_requireeof: $ => seq('#!requireeof', optional($.inline_comment), '\n'), directive_eof: $ => seq('#!eof', optional($.inline_comment), '\n'), directive_expires: $ => seq( @@ -77,6 +102,16 @@ module.exports = grammar({ blank_line: _ => token(/[ \t]*\n/), + // A comma only ever separates fields in compact format: in long format the + // scanner has already swallowed it as part of the value, so the repetition + // below is unreachable there. Requiring a field after every comma is what + // makes a trailing separator (`key::value,`) an error, as the spec demands. + _field_line: $ => seq( + $.field, + repeat(seq(',', $.field)), + '\n', + ), + field: $ => choice( $.typed_field, $.untyped_field, @@ -85,30 +120,31 @@ module.exports = grammar({ typed_field: $ => seq( $.key, ':', + optional($._ws), $.type_hint, + optional($._ws), ':', optional($.value), - /[,\n]/, ), untyped_field: $ => seq( $.key, '::', optional($.value), - /[,\n]/, ), - key: _ => /[^#\n:, \t][^:,]*/, + // Everything up to the first colon, so commas are fair game. A key may not + // start with one, which keeps a stray trailing comma in compact format from + // being absorbed into the next key. + key: _ => /[^#\n:, \t][^:\n]*/, - type_hint: _ => choice( + type_hint: $ => choice( 'string', 'num', 'bool', 'null', 'binary', - /[0-9]+/, + $._length_hint, ), - - value: _ => /[^\n,]+/, }, }); diff --git a/queries/highlights.scm b/queries/highlights.scm index e52ab69..aca8b15 100644 --- a/queries/highlights.scm +++ b/queries/highlights.scm @@ -22,3 +22,4 @@ ":" @punctuation.delimiter "::" @punctuation.delimiter +"," @punctuation.delimiter diff --git a/src/grammar.json b/src/grammar.json index 73f7f06..cfe92bb 100644 --- a/src/grammar.json +++ b/src/grammar.json @@ -10,30 +10,51 @@ } }, "_line": { - "type": "CHOICE", + "type": "SEQ", "members": [ { - "type": "SYMBOL", - "name": "magic" + "type": "CHOICE", + "members": [ + { + "type": "SYMBOL", + "name": "_ws" + }, + { + "type": "BLANK" + } + ] }, { - "type": "SYMBOL", - "name": "directive" - }, - { - "type": "SYMBOL", - "name": "comment" - }, - { - "type": "SYMBOL", - "name": "field" - }, - { - "type": "SYMBOL", - "name": "blank_line" + "type": "CHOICE", + "members": [ + { + "type": "SYMBOL", + "name": "magic" + }, + { + "type": "SYMBOL", + "name": "directive" + }, + { + "type": "SYMBOL", + "name": "comment" + }, + { + "type": "SYMBOL", + "name": "_field_line" + }, + { + "type": "SYMBOL", + "name": "blank_line" + } + ] } ] }, + "_ws": { + "type": "PATTERN", + "value": "[ \\t]+" + }, "magic": { "type": "SEQ", "members": [ @@ -104,8 +125,8 @@ "type": "SEQ", "members": [ { - "type": "STRING", - "value": "#!long" + "type": "SYMBOL", + "name": "_long_marker" }, { "type": "CHOICE", @@ -129,8 +150,8 @@ "type": "SEQ", "members": [ { - "type": "STRING", - "value": "#!compact" + "type": "SYMBOL", + "name": "_compact_marker" }, { "type": "CHOICE", @@ -385,6 +406,35 @@ "value": "[ \\t]*\\n" } }, + "_field_line": { + "type": "SEQ", + "members": [ + { + "type": "SYMBOL", + "name": "field" + }, + { + "type": "REPEAT", + "content": { + "type": "SEQ", + "members": [ + { + "type": "STRING", + "value": "," + }, + { + "type": "SYMBOL", + "name": "field" + } + ] + } + }, + { + "type": "STRING", + "value": "\n" + } + ] + }, "field": { "type": "CHOICE", "members": [ @@ -409,10 +459,34 @@ "type": "STRING", "value": ":" }, + { + "type": "CHOICE", + "members": [ + { + "type": "SYMBOL", + "name": "_ws" + }, + { + "type": "BLANK" + } + ] + }, { "type": "SYMBOL", "name": "type_hint" }, + { + "type": "CHOICE", + "members": [ + { + "type": "SYMBOL", + "name": "_ws" + }, + { + "type": "BLANK" + } + ] + }, { "type": "STRING", "value": ":" @@ -428,10 +502,6 @@ "type": "BLANK" } ] - }, - { - "type": "PATTERN", - "value": "[,\\n]" } ] }, @@ -457,16 +527,12 @@ "type": "BLANK" } ] - }, - { - "type": "PATTERN", - "value": "[,\\n]" } ] }, "key": { "type": "PATTERN", - "value": "[^#\\n:, \\t][^:,]*" + "value": "[^#\\n:, \\t][^:\\n]*" }, "type_hint": { "type": "CHOICE", @@ -492,20 +558,37 @@ "value": "binary" }, { - "type": "PATTERN", - "value": "[0-9]+" + "type": "SYMBOL", + "name": "_length_hint" } ] - }, - "value": { - "type": "PATTERN", - "value": "[^\\n,]+" } }, "extras": [], "conflicts": [], "precedences": [], - "externals": [], + "externals": [ + { + "type": "SYMBOL", + "name": "_long_marker" + }, + { + "type": "SYMBOL", + "name": "_compact_marker" + }, + { + "type": "SYMBOL", + "name": "_length_hint" + }, + { + "type": "SYMBOL", + "name": "value" + }, + { + "type": "SYMBOL", + "name": "_error_sentinel" + } + ], "inline": [], "supertypes": [], "reserved": {} diff --git a/src/node-types.json b/src/node-types.json index a844e49..cb97737 100644 --- a/src/node-types.json +++ b/src/node-types.json @@ -302,10 +302,6 @@ "type": "\n", "named": false }, - { - "type": "#!compact", - "named": false - }, { "type": "#!created=", "named": false @@ -318,10 +314,6 @@ "type": "#!expires=", "named": false }, - { - "type": "#!long", - "named": false - }, { "type": "#!modified=", "named": false @@ -334,6 +326,10 @@ "type": "#!srfv1", "named": false }, + { + "type": ",", + "named": false + }, { "type": ":", "named": false diff --git a/src/parser.c b/src/parser.c index 1a375cc..625c72f 100644 --- a/src/parser.c +++ b/src/parser.c @@ -7,73 +7,76 @@ #endif #define LANGUAGE_VERSION 15 -#define STATE_COUNT 60 -#define LARGE_STATE_COUNT 4 -#define SYMBOL_COUNT 46 +#define STATE_COUNT 73 +#define LARGE_STATE_COUNT 5 +#define SYMBOL_COUNT 50 #define ALIAS_COUNT 0 -#define TOKEN_COUNT 29 -#define EXTERNAL_TOKEN_COUNT 0 +#define TOKEN_COUNT 31 +#define EXTERNAL_TOKEN_COUNT 5 #define FIELD_COUNT 1 -#define MAX_ALIAS_SEQUENCE_LENGTH 6 +#define MAX_ALIAS_SEQUENCE_LENGTH 7 #define MAX_RESERVED_WORD_SET_SIZE 0 #define PRODUCTION_ID_COUNT 2 #define SUPERTYPE_COUNT 0 enum ts_symbol_identifiers { - anon_sym_POUND_BANGsrfv1 = 1, - anon_sym_LF = 2, - sym_inline_comment = 3, - anon_sym_POUND_BANGlong = 4, - anon_sym_POUND_BANGcompact = 5, - anon_sym_POUND_BANGrequireeof = 6, - anon_sym_POUND_BANGeof = 7, - anon_sym_POUND_BANGexpires_EQ = 8, - anon_sym_POUND_BANGcreated_EQ = 9, - anon_sym_POUND_BANGmodified_EQ = 10, - aux_sym_directive_unknown_token1 = 11, - aux_sym_directive_unknown_token2 = 12, - anon_sym_EQ = 13, - aux_sym_directive_unknown_token3 = 14, - sym_timestamp = 15, - sym_comment = 16, - sym_blank_line = 17, + sym__ws = 1, + anon_sym_POUND_BANGsrfv1 = 2, + anon_sym_LF = 3, + sym_inline_comment = 4, + anon_sym_POUND_BANGrequireeof = 5, + anon_sym_POUND_BANGeof = 6, + anon_sym_POUND_BANGexpires_EQ = 7, + anon_sym_POUND_BANGcreated_EQ = 8, + anon_sym_POUND_BANGmodified_EQ = 9, + aux_sym_directive_unknown_token1 = 10, + aux_sym_directive_unknown_token2 = 11, + anon_sym_EQ = 12, + aux_sym_directive_unknown_token3 = 13, + sym_timestamp = 14, + sym_comment = 15, + sym_blank_line = 16, + anon_sym_COMMA = 17, anon_sym_COLON = 18, - aux_sym_typed_field_token1 = 19, - anon_sym_COLON_COLON = 20, - sym_key = 21, - anon_sym_string = 22, - anon_sym_num = 23, - anon_sym_bool = 24, - anon_sym_null = 25, - anon_sym_binary = 26, - aux_sym_type_hint_token1 = 27, - sym_value = 28, - sym_document = 29, - sym__line = 30, - sym_magic = 31, - sym_directive = 32, - sym_directive_long = 33, - sym_directive_compact = 34, - sym_directive_requireeof = 35, - sym_directive_eof = 36, - sym_directive_expires = 37, - sym_directive_created = 38, - sym_directive_modified = 39, - sym_directive_unknown = 40, - sym_field = 41, - sym_typed_field = 42, - sym_untyped_field = 43, - sym_type_hint = 44, - aux_sym_document_repeat1 = 45, + anon_sym_COLON_COLON = 19, + sym_key = 20, + anon_sym_string = 21, + anon_sym_num = 22, + anon_sym_bool = 23, + anon_sym_null = 24, + anon_sym_binary = 25, + sym__long_marker = 26, + sym__compact_marker = 27, + sym__length_hint = 28, + sym_value = 29, + sym__error_sentinel = 30, + sym_document = 31, + sym__line = 32, + sym_magic = 33, + sym_directive = 34, + sym_directive_long = 35, + sym_directive_compact = 36, + sym_directive_requireeof = 37, + sym_directive_eof = 38, + sym_directive_expires = 39, + sym_directive_created = 40, + sym_directive_modified = 41, + sym_directive_unknown = 42, + sym__field_line = 43, + sym_field = 44, + sym_typed_field = 45, + sym_untyped_field = 46, + sym_type_hint = 47, + aux_sym_document_repeat1 = 48, + aux_sym__field_line_repeat1 = 49, }; static const char * const ts_symbol_names[] = { [ts_builtin_sym_end] = "end", + [sym__ws] = "_ws", [anon_sym_POUND_BANGsrfv1] = "#!srfv1", [anon_sym_LF] = "\n", [sym_inline_comment] = "inline_comment", - [anon_sym_POUND_BANGlong] = "#!long", - [anon_sym_POUND_BANGcompact] = "#!compact", [anon_sym_POUND_BANGrequireeof] = "#!requireeof", [anon_sym_POUND_BANGeof] = "#!eof", [anon_sym_POUND_BANGexpires_EQ] = "#!expires=", @@ -86,8 +89,8 @@ static const char * const ts_symbol_names[] = { [sym_timestamp] = "timestamp", [sym_comment] = "comment", [sym_blank_line] = "blank_line", + [anon_sym_COMMA] = ",", [anon_sym_COLON] = ":", - [aux_sym_typed_field_token1] = "typed_field_token1", [anon_sym_COLON_COLON] = "::", [sym_key] = "key", [anon_sym_string] = "string", @@ -95,8 +98,11 @@ static const char * const ts_symbol_names[] = { [anon_sym_bool] = "bool", [anon_sym_null] = "null", [anon_sym_binary] = "binary", - [aux_sym_type_hint_token1] = "type_hint_token1", + [sym__long_marker] = "_long_marker", + [sym__compact_marker] = "_compact_marker", + [sym__length_hint] = "_length_hint", [sym_value] = "value", + [sym__error_sentinel] = "_error_sentinel", [sym_document] = "document", [sym__line] = "_line", [sym_magic] = "magic", @@ -109,20 +115,21 @@ static const char * const ts_symbol_names[] = { [sym_directive_created] = "directive_created", [sym_directive_modified] = "directive_modified", [sym_directive_unknown] = "directive_unknown", + [sym__field_line] = "_field_line", [sym_field] = "field", [sym_typed_field] = "typed_field", [sym_untyped_field] = "untyped_field", [sym_type_hint] = "type_hint", [aux_sym_document_repeat1] = "document_repeat1", + [aux_sym__field_line_repeat1] = "_field_line_repeat1", }; static const TSSymbol ts_symbol_map[] = { [ts_builtin_sym_end] = ts_builtin_sym_end, + [sym__ws] = sym__ws, [anon_sym_POUND_BANGsrfv1] = anon_sym_POUND_BANGsrfv1, [anon_sym_LF] = anon_sym_LF, [sym_inline_comment] = sym_inline_comment, - [anon_sym_POUND_BANGlong] = anon_sym_POUND_BANGlong, - [anon_sym_POUND_BANGcompact] = anon_sym_POUND_BANGcompact, [anon_sym_POUND_BANGrequireeof] = anon_sym_POUND_BANGrequireeof, [anon_sym_POUND_BANGeof] = anon_sym_POUND_BANGeof, [anon_sym_POUND_BANGexpires_EQ] = anon_sym_POUND_BANGexpires_EQ, @@ -135,8 +142,8 @@ static const TSSymbol ts_symbol_map[] = { [sym_timestamp] = sym_timestamp, [sym_comment] = sym_comment, [sym_blank_line] = sym_blank_line, + [anon_sym_COMMA] = anon_sym_COMMA, [anon_sym_COLON] = anon_sym_COLON, - [aux_sym_typed_field_token1] = aux_sym_typed_field_token1, [anon_sym_COLON_COLON] = anon_sym_COLON_COLON, [sym_key] = sym_key, [anon_sym_string] = anon_sym_string, @@ -144,8 +151,11 @@ static const TSSymbol ts_symbol_map[] = { [anon_sym_bool] = anon_sym_bool, [anon_sym_null] = anon_sym_null, [anon_sym_binary] = anon_sym_binary, - [aux_sym_type_hint_token1] = aux_sym_type_hint_token1, + [sym__long_marker] = sym__long_marker, + [sym__compact_marker] = sym__compact_marker, + [sym__length_hint] = sym__length_hint, [sym_value] = sym_value, + [sym__error_sentinel] = sym__error_sentinel, [sym_document] = sym_document, [sym__line] = sym__line, [sym_magic] = sym_magic, @@ -158,11 +168,13 @@ static const TSSymbol ts_symbol_map[] = { [sym_directive_created] = sym_directive_created, [sym_directive_modified] = sym_directive_modified, [sym_directive_unknown] = sym_directive_unknown, + [sym__field_line] = sym__field_line, [sym_field] = sym_field, [sym_typed_field] = sym_typed_field, [sym_untyped_field] = sym_untyped_field, [sym_type_hint] = sym_type_hint, [aux_sym_document_repeat1] = aux_sym_document_repeat1, + [aux_sym__field_line_repeat1] = aux_sym__field_line_repeat1, }; static const TSSymbolMetadata ts_symbol_metadata[] = { @@ -170,6 +182,10 @@ static const TSSymbolMetadata ts_symbol_metadata[] = { .visible = false, .named = true, }, + [sym__ws] = { + .visible = false, + .named = true, + }, [anon_sym_POUND_BANGsrfv1] = { .visible = true, .named = false, @@ -182,14 +198,6 @@ static const TSSymbolMetadata ts_symbol_metadata[] = { .visible = true, .named = true, }, - [anon_sym_POUND_BANGlong] = { - .visible = true, - .named = false, - }, - [anon_sym_POUND_BANGcompact] = { - .visible = true, - .named = false, - }, [anon_sym_POUND_BANGrequireeof] = { .visible = true, .named = false, @@ -238,12 +246,12 @@ static const TSSymbolMetadata ts_symbol_metadata[] = { .visible = true, .named = true, }, - [anon_sym_COLON] = { + [anon_sym_COMMA] = { .visible = true, .named = false, }, - [aux_sym_typed_field_token1] = { - .visible = false, + [anon_sym_COLON] = { + .visible = true, .named = false, }, [anon_sym_COLON_COLON] = { @@ -274,14 +282,26 @@ static const TSSymbolMetadata ts_symbol_metadata[] = { .visible = true, .named = false, }, - [aux_sym_type_hint_token1] = { + [sym__long_marker] = { .visible = false, - .named = false, + .named = true, + }, + [sym__compact_marker] = { + .visible = false, + .named = true, + }, + [sym__length_hint] = { + .visible = false, + .named = true, }, [sym_value] = { .visible = true, .named = true, }, + [sym__error_sentinel] = { + .visible = false, + .named = true, + }, [sym_document] = { .visible = true, .named = true, @@ -330,6 +350,10 @@ static const TSSymbolMetadata ts_symbol_metadata[] = { .visible = true, .named = true, }, + [sym__field_line] = { + .visible = false, + .named = true, + }, [sym_field] = { .visible = true, .named = true, @@ -350,6 +374,10 @@ static const TSSymbolMetadata ts_symbol_metadata[] = { .visible = false, .named = false, }, + [aux_sym__field_line_repeat1] = { + .visible = false, + .named = false, + }, }; enum ts_field_identifiers { @@ -439,6 +467,19 @@ static const TSStateId ts_primary_state_ids[STATE_COUNT] = { [57] = 57, [58] = 58, [59] = 59, + [60] = 60, + [61] = 61, + [62] = 62, + [63] = 63, + [64] = 64, + [65] = 65, + [66] = 66, + [67] = 67, + [68] = 68, + [69] = 69, + [70] = 70, + [71] = 71, + [72] = 72, }; static bool ts_lex(TSLexer *lexer, TSStateId state) { @@ -446,536 +487,488 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) { eof = lexer->eof(lexer); switch (state) { case 0: - if (eof) ADVANCE(69); + if (eof) ADVANCE(58); ADVANCE_MAP( - '\n', 71, - '#', 2, - ',', 105, - '-', 100, - ':', 104, - '=', 97, - 'b', 83, - 'n', 94, - 's', 93, - '\t', 4, - ' ', 4, + '\n', 62, + '#', 3, + ',', 91, + ':', 93, + '=', 86, + 'b', 72, + 'n', 83, + 's', 82, + '\t', 59, + ' ', 59, ); - if (('0' <= lookahead && lookahead <= '9')) ADVANCE(99); + if (lookahead == '-' || + ('0' <= lookahead && lookahead <= '9')) ADVANCE(88); if (('A' <= lookahead && lookahead <= 'Z') || - ('a' <= lookahead && lookahead <= 'z')) ADVANCE(96); + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(85); END_STATE(); case 1: - if (lookahead == '\n') ADVANCE(71); - if (lookahead == '=') ADVANCE(97); - if (lookahead == 'b') ADVANCE(32); - if (lookahead == 'n') ADVANCE(62); - if (lookahead == 's') ADVANCE(61); - if (lookahead == '\t' || - lookahead == ' ') ADVANCE(6); - if (('0' <= lookahead && lookahead <= '9')) ADVANCE(118); + ADVANCE_MAP( + '\n', 62, + ',', 91, + ':', 92, + '=', 86, + 'b', 27, + 'n', 53, + 's', 51, + '\t', 60, + ' ', 60, + ); END_STATE(); case 2: - if (lookahead == '\n') ADVANCE(101); - if (lookahead == '!') ADVANCE(80); - if (lookahead != 0) ADVANCE(3); + if (lookahead == '\n') ADVANCE(62); + if (lookahead == '\t' || + lookahead == ' ') ADVANCE(5); + if (('A' <= lookahead && lookahead <= 'Z') || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(85); END_STATE(); case 3: - if (lookahead == '\n') ADVANCE(101); - if (lookahead != 0) ADVANCE(3); + if (lookahead == '\n') ADVANCE(89); + if (lookahead == '!') ADVANCE(69); + if (lookahead != 0) ADVANCE(4); END_STATE(); case 4: - if (lookahead == '\n') ADVANCE(102); - if (lookahead == '#') ADVANCE(72); - if (lookahead == '\t' || - lookahead == ' ') ADVANCE(4); + if (lookahead == '\n') ADVANCE(89); + if (lookahead != 0) ADVANCE(4); END_STATE(); case 5: - if (lookahead == '\n') ADVANCE(102); + if (lookahead == '#') ADVANCE(63); if (lookahead == '\t' || lookahead == ' ') ADVANCE(5); END_STATE(); case 6: - if (lookahead == '#') ADVANCE(72); - if (lookahead == '\t' || - lookahead == ' ') ADVANCE(6); + if (lookahead == '1') ADVANCE(61); END_STATE(); case 7: - if (lookahead == '1') ADVANCE(70); + if (lookahead == '=') ADVANCE(67); END_STATE(); case 8: - if (lookahead == '=') ADVANCE(78); + if (lookahead == '=') ADVANCE(66); END_STATE(); case 9: - if (lookahead == '=') ADVANCE(77); + if (lookahead == '=') ADVANCE(68); END_STATE(); case 10: - if (lookahead == '=') ADVANCE(79); + if (lookahead == 'a') ADVANCE(52); END_STATE(); case 11: - if (lookahead == 'a') ADVANCE(60); + if (lookahead == 'a') ADVANCE(44); END_STATE(); case 12: - if (lookahead == 'a') ADVANCE(14); + if (lookahead == 'd') ADVANCE(7); END_STATE(); case 13: - if (lookahead == 'a') ADVANCE(53); + if (lookahead == 'd') ADVANCE(29); END_STATE(); case 14: - if (lookahead == 'c') ADVANCE(59); + if (lookahead == 'd') ADVANCE(9); END_STATE(); case 15: - if (lookahead == 'd') ADVANCE(8); + if (lookahead == 'e') ADVANCE(43); END_STATE(); case 16: - if (lookahead == 'd') ADVANCE(33); + if (lookahead == 'e') ADVANCE(10); END_STATE(); case 17: - if (lookahead == 'd') ADVANCE(10); + if (lookahead == 'e') ADVANCE(50); END_STATE(); case 18: - if (lookahead == 'e') ADVANCE(52); + if (lookahead == 'e') ADVANCE(41); END_STATE(); case 19: - if (lookahead == 'e') ADVANCE(11); + if (lookahead == 'e') ADVANCE(12); END_STATE(); case 20: - if (lookahead == 'e') ADVANCE(58); + if (lookahead == 'e') ADVANCE(14); END_STATE(); case 21: - if (lookahead == 'e') ADVANCE(15); + if (lookahead == 'e') ADVANCE(18); END_STATE(); case 22: - if (lookahead == 'e') ADVANCE(49); + if (lookahead == 'f') ADVANCE(65); END_STATE(); case 23: - if (lookahead == 'e') ADVANCE(17); + if (lookahead == 'f') ADVANCE(55); END_STATE(); case 24: - if (lookahead == 'e') ADVANCE(22); - END_STATE(); - case 25: - if (lookahead == 'f') ADVANCE(76); - END_STATE(); - case 26: if (lookahead == 'f') ADVANCE(64); END_STATE(); + case 25: + if (lookahead == 'f') ADVANCE(30); + END_STATE(); + case 26: + if (lookahead == 'g') ADVANCE(96); + END_STATE(); case 27: - if (lookahead == 'f') ADVANCE(75); + if (lookahead == 'i') ADVANCE(37); + if (lookahead == 'o') ADVANCE(40); END_STATE(); case 28: - if (lookahead == 'f') ADVANCE(34); + if (lookahead == 'i') ADVANCE(36); END_STATE(); case 29: - if (lookahead == 'g') ADVANCE(73); + if (lookahead == 'i') ADVANCE(25); END_STATE(); case 30: - if (lookahead == 'g') ADVANCE(108); + if (lookahead == 'i') ADVANCE(20); END_STATE(); case 31: - if (lookahead == 'i') ADVANCE(55); + if (lookahead == 'i') ADVANCE(47); END_STATE(); case 32: - if (lookahead == 'i') ADVANCE(43); - if (lookahead == 'o') ADVANCE(48); + if (lookahead == 'i') ADVANCE(49); END_STATE(); case 33: - if (lookahead == 'i') ADVANCE(28); + if (lookahead == 'l') ADVANCE(100); END_STATE(); case 34: - if (lookahead == 'i') ADVANCE(23); + if (lookahead == 'l') ADVANCE(102); END_STATE(); case 35: - if (lookahead == 'i') ADVANCE(42); + if (lookahead == 'l') ADVANCE(34); + if (lookahead == 'm') ADVANCE(98); END_STATE(); case 36: - if (lookahead == 'i') ADVANCE(57); + if (lookahead == 'n') ADVANCE(26); END_STATE(); case 37: - if (lookahead == 'l') ADVANCE(112); + if (lookahead == 'n') ADVANCE(11); END_STATE(); case 38: - if (lookahead == 'l') ADVANCE(114); + if (lookahead == 'o') ADVANCE(22); + if (lookahead == 'x') ADVANCE(42); END_STATE(); case 39: - if (lookahead == 'l') ADVANCE(38); - if (lookahead == 'm') ADVANCE(110); + if (lookahead == 'o') ADVANCE(13); END_STATE(); case 40: - if (lookahead == 'm') ADVANCE(51); + if (lookahead == 'o') ADVANCE(33); END_STATE(); case 41: - if (lookahead == 'n') ADVANCE(29); + if (lookahead == 'o') ADVANCE(24); END_STATE(); case 42: - if (lookahead == 'n') ADVANCE(30); - END_STATE(); - case 43: - if (lookahead == 'n') ADVANCE(13); - END_STATE(); - case 44: - if (lookahead == 'o') ADVANCE(40); - if (lookahead == 'r') ADVANCE(19); - END_STATE(); - case 45: - if (lookahead == 'o') ADVANCE(25); - if (lookahead == 'x') ADVANCE(50); - END_STATE(); - case 46: - if (lookahead == 'o') ADVANCE(41); - END_STATE(); - case 47: - if (lookahead == 'o') ADVANCE(16); - END_STATE(); - case 48: - if (lookahead == 'o') ADVANCE(37); - END_STATE(); - case 49: - if (lookahead == 'o') ADVANCE(27); - END_STATE(); - case 50: if (lookahead == 'p') ADVANCE(31); END_STATE(); + case 43: + if (lookahead == 'q') ADVANCE(54); + END_STATE(); + case 44: + if (lookahead == 'r') ADVANCE(56); + END_STATE(); + case 45: + if (lookahead == 'r') ADVANCE(16); + END_STATE(); + case 46: + if (lookahead == 'r') ADVANCE(23); + END_STATE(); + case 47: + if (lookahead == 'r') ADVANCE(17); + END_STATE(); + case 48: + if (lookahead == 'r') ADVANCE(28); + END_STATE(); + case 49: + if (lookahead == 'r') ADVANCE(21); + END_STATE(); + case 50: + if (lookahead == 's') ADVANCE(8); + END_STATE(); case 51: - if (lookahead == 'p') ADVANCE(12); + if (lookahead == 't') ADVANCE(48); END_STATE(); case 52: - if (lookahead == 'q') ADVANCE(63); + if (lookahead == 't') ADVANCE(19); END_STATE(); case 53: - if (lookahead == 'r') ADVANCE(65); + if (lookahead == 'u') ADVANCE(35); END_STATE(); case 54: - if (lookahead == 'r') ADVANCE(26); + if (lookahead == 'u') ADVANCE(32); END_STATE(); case 55: - if (lookahead == 'r') ADVANCE(20); + if (lookahead == 'v') ADVANCE(6); END_STATE(); case 56: - if (lookahead == 'r') ADVANCE(35); + if (lookahead == 'y') ADVANCE(104); END_STATE(); case 57: - if (lookahead == 'r') ADVANCE(24); + if (eof) ADVANCE(58); + if (lookahead == '\n') ADVANCE(90); + if (lookahead == '#') ADVANCE(3); + if (lookahead == '\t' || + lookahead == ' ') ADVANCE(59); + if (lookahead != 0 && + lookahead != ',' && + lookahead != ':') ADVANCE(95); END_STATE(); case 58: - if (lookahead == 's') ADVANCE(9); - END_STATE(); - case 59: - if (lookahead == 't') ADVANCE(74); - END_STATE(); - case 60: - if (lookahead == 't') ADVANCE(21); - END_STATE(); - case 61: - if (lookahead == 't') ADVANCE(56); - END_STATE(); - case 62: - if (lookahead == 'u') ADVANCE(39); - END_STATE(); - case 63: - if (lookahead == 'u') ADVANCE(36); - END_STATE(); - case 64: - if (lookahead == 'v') ADVANCE(7); - END_STATE(); - case 65: - if (lookahead == 'y') ADVANCE(116); - END_STATE(); - case 66: - if (lookahead == '\n' || - lookahead == ',') ADVANCE(105); - if (lookahead != 0) ADVANCE(119); - END_STATE(); - case 67: - if (lookahead == '-' || - ('0' <= lookahead && lookahead <= '9')) ADVANCE(100); - if (('A' <= lookahead && lookahead <= 'Z') || - ('a' <= lookahead && lookahead <= 'z')) ADVANCE(96); - END_STATE(); - case 68: - if (eof) ADVANCE(69); - if (lookahead == '\n') ADVANCE(102); - if (lookahead == '#') ADVANCE(2); - if (lookahead == ':') ADVANCE(103); - if (lookahead == '\t' || - lookahead == ' ') ADVANCE(5); - if (lookahead != 0 && - lookahead != ',') ADVANCE(107); - END_STATE(); - case 69: ACCEPT_TOKEN(ts_builtin_sym_end); END_STATE(); - case 70: + case 59: + ACCEPT_TOKEN(sym__ws); + if (lookahead == '\n') ADVANCE(90); + if (lookahead == '\t' || + lookahead == ' ') ADVANCE(59); + END_STATE(); + case 60: + ACCEPT_TOKEN(sym__ws); + if (lookahead == '\t' || + lookahead == ' ') ADVANCE(60); + END_STATE(); + case 61: ACCEPT_TOKEN(anon_sym_POUND_BANGsrfv1); END_STATE(); - case 71: + case 62: ACCEPT_TOKEN(anon_sym_LF); END_STATE(); - case 72: + case 63: ACCEPT_TOKEN(sym_inline_comment); if (lookahead != 0 && - lookahead != '\n') ADVANCE(72); + lookahead != '\n') ADVANCE(63); END_STATE(); - case 73: - ACCEPT_TOKEN(anon_sym_POUND_BANGlong); - END_STATE(); - case 74: - ACCEPT_TOKEN(anon_sym_POUND_BANGcompact); - END_STATE(); - case 75: + case 64: ACCEPT_TOKEN(anon_sym_POUND_BANGrequireeof); END_STATE(); - case 76: + case 65: ACCEPT_TOKEN(anon_sym_POUND_BANGeof); END_STATE(); - case 77: + case 66: ACCEPT_TOKEN(anon_sym_POUND_BANGexpires_EQ); END_STATE(); - case 78: + case 67: ACCEPT_TOKEN(anon_sym_POUND_BANGcreated_EQ); END_STATE(); - case 79: + case 68: ACCEPT_TOKEN(anon_sym_POUND_BANGmodified_EQ); END_STATE(); - case 80: + case 69: ACCEPT_TOKEN(aux_sym_directive_unknown_token1); - if (lookahead == 'c') ADVANCE(44); - if (lookahead == 'e') ADVANCE(45); - if (lookahead == 'l') ADVANCE(46); - if (lookahead == 'm') ADVANCE(47); - if (lookahead == 'r') ADVANCE(18); - if (lookahead == 's') ADVANCE(54); + if (lookahead == 'c') ADVANCE(45); + if (lookahead == 'e') ADVANCE(38); + if (lookahead == 'm') ADVANCE(39); + if (lookahead == 'r') ADVANCE(15); + if (lookahead == 's') ADVANCE(46); + END_STATE(); + case 70: + ACCEPT_TOKEN(aux_sym_directive_unknown_token2); + if (lookahead == 'a') ADVANCE(81); + if (('0' <= lookahead && lookahead <= '9') || + ('A' <= lookahead && lookahead <= 'Z') || + lookahead == '_' || + ('b' <= lookahead && lookahead <= 'z')) ADVANCE(85); + END_STATE(); + case 71: + ACCEPT_TOKEN(aux_sym_directive_unknown_token2); + if (lookahead == 'g') ADVANCE(97); + if (('0' <= lookahead && lookahead <= '9') || + ('A' <= lookahead && lookahead <= 'Z') || + lookahead == '_' || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(85); + END_STATE(); + case 72: + ACCEPT_TOKEN(aux_sym_directive_unknown_token2); + if (lookahead == 'i') ADVANCE(77); + if (lookahead == 'o') ADVANCE(79); + if (('0' <= lookahead && lookahead <= '9') || + ('A' <= lookahead && lookahead <= 'Z') || + lookahead == '_' || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(85); + END_STATE(); + case 73: + ACCEPT_TOKEN(aux_sym_directive_unknown_token2); + if (lookahead == 'i') ADVANCE(78); + if (('0' <= lookahead && lookahead <= '9') || + ('A' <= lookahead && lookahead <= 'Z') || + lookahead == '_' || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(85); + END_STATE(); + case 74: + ACCEPT_TOKEN(aux_sym_directive_unknown_token2); + if (lookahead == 'l') ADVANCE(101); + if (('0' <= lookahead && lookahead <= '9') || + ('A' <= lookahead && lookahead <= 'Z') || + lookahead == '_' || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(85); + END_STATE(); + case 75: + ACCEPT_TOKEN(aux_sym_directive_unknown_token2); + if (lookahead == 'l') ADVANCE(103); + if (('0' <= lookahead && lookahead <= '9') || + ('A' <= lookahead && lookahead <= 'Z') || + lookahead == '_' || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(85); + END_STATE(); + case 76: + ACCEPT_TOKEN(aux_sym_directive_unknown_token2); + if (lookahead == 'l') ADVANCE(75); + if (lookahead == 'm') ADVANCE(99); + if (('0' <= lookahead && lookahead <= '9') || + ('A' <= lookahead && lookahead <= 'Z') || + lookahead == '_' || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(85); + END_STATE(); + case 77: + ACCEPT_TOKEN(aux_sym_directive_unknown_token2); + if (lookahead == 'n') ADVANCE(70); + if (('0' <= lookahead && lookahead <= '9') || + ('A' <= lookahead && lookahead <= 'Z') || + lookahead == '_' || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(85); + END_STATE(); + case 78: + ACCEPT_TOKEN(aux_sym_directive_unknown_token2); + if (lookahead == 'n') ADVANCE(71); + if (('0' <= lookahead && lookahead <= '9') || + ('A' <= lookahead && lookahead <= 'Z') || + lookahead == '_' || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(85); + END_STATE(); + case 79: + ACCEPT_TOKEN(aux_sym_directive_unknown_token2); + if (lookahead == 'o') ADVANCE(74); + if (('0' <= lookahead && lookahead <= '9') || + ('A' <= lookahead && lookahead <= 'Z') || + lookahead == '_' || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(85); + END_STATE(); + case 80: + ACCEPT_TOKEN(aux_sym_directive_unknown_token2); + if (lookahead == 'r') ADVANCE(73); + if (('0' <= lookahead && lookahead <= '9') || + ('A' <= lookahead && lookahead <= 'Z') || + lookahead == '_' || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(85); END_STATE(); case 81: - ACCEPT_TOKEN(aux_sym_directive_unknown_token2); - if (lookahead == 'a') ADVANCE(92); - if (('0' <= lookahead && lookahead <= '9') || - ('A' <= lookahead && lookahead <= 'Z') || - lookahead == '_' || - ('b' <= lookahead && lookahead <= 'z')) ADVANCE(96); - END_STATE(); - case 82: - ACCEPT_TOKEN(aux_sym_directive_unknown_token2); - if (lookahead == 'g') ADVANCE(109); - if (('0' <= lookahead && lookahead <= '9') || - ('A' <= lookahead && lookahead <= 'Z') || - lookahead == '_' || - ('a' <= lookahead && lookahead <= 'z')) ADVANCE(96); - END_STATE(); - case 83: - ACCEPT_TOKEN(aux_sym_directive_unknown_token2); - if (lookahead == 'i') ADVANCE(88); - if (lookahead == 'o') ADVANCE(90); - if (('0' <= lookahead && lookahead <= '9') || - ('A' <= lookahead && lookahead <= 'Z') || - lookahead == '_' || - ('a' <= lookahead && lookahead <= 'z')) ADVANCE(96); - END_STATE(); - case 84: - ACCEPT_TOKEN(aux_sym_directive_unknown_token2); - if (lookahead == 'i') ADVANCE(89); - if (('0' <= lookahead && lookahead <= '9') || - ('A' <= lookahead && lookahead <= 'Z') || - lookahead == '_' || - ('a' <= lookahead && lookahead <= 'z')) ADVANCE(96); - END_STATE(); - case 85: - ACCEPT_TOKEN(aux_sym_directive_unknown_token2); - if (lookahead == 'l') ADVANCE(113); - if (('0' <= lookahead && lookahead <= '9') || - ('A' <= lookahead && lookahead <= 'Z') || - lookahead == '_' || - ('a' <= lookahead && lookahead <= 'z')) ADVANCE(96); - END_STATE(); - case 86: - ACCEPT_TOKEN(aux_sym_directive_unknown_token2); - if (lookahead == 'l') ADVANCE(115); - if (('0' <= lookahead && lookahead <= '9') || - ('A' <= lookahead && lookahead <= 'Z') || - lookahead == '_' || - ('a' <= lookahead && lookahead <= 'z')) ADVANCE(96); - END_STATE(); - case 87: - ACCEPT_TOKEN(aux_sym_directive_unknown_token2); - if (lookahead == 'l') ADVANCE(86); - if (lookahead == 'm') ADVANCE(111); - if (('0' <= lookahead && lookahead <= '9') || - ('A' <= lookahead && lookahead <= 'Z') || - lookahead == '_' || - ('a' <= lookahead && lookahead <= 'z')) ADVANCE(96); - END_STATE(); - case 88: - ACCEPT_TOKEN(aux_sym_directive_unknown_token2); - if (lookahead == 'n') ADVANCE(81); - if (('0' <= lookahead && lookahead <= '9') || - ('A' <= lookahead && lookahead <= 'Z') || - lookahead == '_' || - ('a' <= lookahead && lookahead <= 'z')) ADVANCE(96); - END_STATE(); - case 89: - ACCEPT_TOKEN(aux_sym_directive_unknown_token2); - if (lookahead == 'n') ADVANCE(82); - if (('0' <= lookahead && lookahead <= '9') || - ('A' <= lookahead && lookahead <= 'Z') || - lookahead == '_' || - ('a' <= lookahead && lookahead <= 'z')) ADVANCE(96); - END_STATE(); - case 90: - ACCEPT_TOKEN(aux_sym_directive_unknown_token2); - if (lookahead == 'o') ADVANCE(85); - if (('0' <= lookahead && lookahead <= '9') || - ('A' <= lookahead && lookahead <= 'Z') || - lookahead == '_' || - ('a' <= lookahead && lookahead <= 'z')) ADVANCE(96); - END_STATE(); - case 91: ACCEPT_TOKEN(aux_sym_directive_unknown_token2); if (lookahead == 'r') ADVANCE(84); if (('0' <= lookahead && lookahead <= '9') || ('A' <= lookahead && lookahead <= 'Z') || lookahead == '_' || - ('a' <= lookahead && lookahead <= 'z')) ADVANCE(96); + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(85); END_STATE(); - case 92: + case 82: ACCEPT_TOKEN(aux_sym_directive_unknown_token2); - if (lookahead == 'r') ADVANCE(95); + if (lookahead == 't') ADVANCE(80); if (('0' <= lookahead && lookahead <= '9') || ('A' <= lookahead && lookahead <= 'Z') || lookahead == '_' || - ('a' <= lookahead && lookahead <= 'z')) ADVANCE(96); + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(85); END_STATE(); - case 93: + case 83: ACCEPT_TOKEN(aux_sym_directive_unknown_token2); - if (lookahead == 't') ADVANCE(91); + if (lookahead == 'u') ADVANCE(76); if (('0' <= lookahead && lookahead <= '9') || ('A' <= lookahead && lookahead <= 'Z') || lookahead == '_' || - ('a' <= lookahead && lookahead <= 'z')) ADVANCE(96); + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(85); END_STATE(); - case 94: + case 84: ACCEPT_TOKEN(aux_sym_directive_unknown_token2); - if (lookahead == 'u') ADVANCE(87); + if (lookahead == 'y') ADVANCE(105); if (('0' <= lookahead && lookahead <= '9') || ('A' <= lookahead && lookahead <= 'Z') || lookahead == '_' || - ('a' <= lookahead && lookahead <= 'z')) ADVANCE(96); + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(85); END_STATE(); - case 95: - ACCEPT_TOKEN(aux_sym_directive_unknown_token2); - if (lookahead == 'y') ADVANCE(117); - if (('0' <= lookahead && lookahead <= '9') || - ('A' <= lookahead && lookahead <= 'Z') || - lookahead == '_' || - ('a' <= lookahead && lookahead <= 'z')) ADVANCE(96); - END_STATE(); - case 96: + case 85: ACCEPT_TOKEN(aux_sym_directive_unknown_token2); if (('0' <= lookahead && lookahead <= '9') || ('A' <= lookahead && lookahead <= 'Z') || lookahead == '_' || - ('a' <= lookahead && lookahead <= 'z')) ADVANCE(96); + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(85); END_STATE(); - case 97: + case 86: ACCEPT_TOKEN(anon_sym_EQ); END_STATE(); - case 98: + case 87: ACCEPT_TOKEN(aux_sym_directive_unknown_token3); if (lookahead != 0 && - lookahead != '\n') ADVANCE(98); + lookahead != '\n') ADVANCE(87); END_STATE(); - case 99: - ACCEPT_TOKEN(sym_timestamp); - if (lookahead == '-') ADVANCE(100); - if (('0' <= lookahead && lookahead <= '9')) ADVANCE(99); - END_STATE(); - case 100: + case 88: ACCEPT_TOKEN(sym_timestamp); if (lookahead == '-' || - ('0' <= lookahead && lookahead <= '9')) ADVANCE(100); + ('0' <= lookahead && lookahead <= '9')) ADVANCE(88); END_STATE(); - case 101: + case 89: ACCEPT_TOKEN(sym_comment); END_STATE(); - case 102: + case 90: ACCEPT_TOKEN(sym_blank_line); END_STATE(); - case 103: + case 91: + ACCEPT_TOKEN(anon_sym_COMMA); + END_STATE(); + case 92: ACCEPT_TOKEN(anon_sym_COLON); END_STATE(); - case 104: + case 93: ACCEPT_TOKEN(anon_sym_COLON); - if (lookahead == ':') ADVANCE(106); + if (lookahead == ':') ADVANCE(94); END_STATE(); - case 105: - ACCEPT_TOKEN(aux_sym_typed_field_token1); - END_STATE(); - case 106: + case 94: ACCEPT_TOKEN(anon_sym_COLON_COLON); END_STATE(); - case 107: + case 95: ACCEPT_TOKEN(sym_key); - if (lookahead != 0 && - lookahead != ',' && - lookahead != ':') ADVANCE(107); - END_STATE(); - case 108: - ACCEPT_TOKEN(anon_sym_string); - END_STATE(); - case 109: - ACCEPT_TOKEN(anon_sym_string); - if (('0' <= lookahead && lookahead <= '9') || - ('A' <= lookahead && lookahead <= 'Z') || - lookahead == '_' || - ('a' <= lookahead && lookahead <= 'z')) ADVANCE(96); - END_STATE(); - case 110: - ACCEPT_TOKEN(anon_sym_num); - END_STATE(); - case 111: - ACCEPT_TOKEN(anon_sym_num); - if (('0' <= lookahead && lookahead <= '9') || - ('A' <= lookahead && lookahead <= 'Z') || - lookahead == '_' || - ('a' <= lookahead && lookahead <= 'z')) ADVANCE(96); - END_STATE(); - case 112: - ACCEPT_TOKEN(anon_sym_bool); - END_STATE(); - case 113: - ACCEPT_TOKEN(anon_sym_bool); - if (('0' <= lookahead && lookahead <= '9') || - ('A' <= lookahead && lookahead <= 'Z') || - lookahead == '_' || - ('a' <= lookahead && lookahead <= 'z')) ADVANCE(96); - END_STATE(); - case 114: - ACCEPT_TOKEN(anon_sym_null); - END_STATE(); - case 115: - ACCEPT_TOKEN(anon_sym_null); - if (('0' <= lookahead && lookahead <= '9') || - ('A' <= lookahead && lookahead <= 'Z') || - lookahead == '_' || - ('a' <= lookahead && lookahead <= 'z')) ADVANCE(96); - END_STATE(); - case 116: - ACCEPT_TOKEN(anon_sym_binary); - END_STATE(); - case 117: - ACCEPT_TOKEN(anon_sym_binary); - if (('0' <= lookahead && lookahead <= '9') || - ('A' <= lookahead && lookahead <= 'Z') || - lookahead == '_' || - ('a' <= lookahead && lookahead <= 'z')) ADVANCE(96); - END_STATE(); - case 118: - ACCEPT_TOKEN(aux_sym_type_hint_token1); - if (('0' <= lookahead && lookahead <= '9')) ADVANCE(118); - END_STATE(); - case 119: - ACCEPT_TOKEN(sym_value); if (lookahead != 0 && lookahead != '\n' && - lookahead != ',') ADVANCE(119); + lookahead != ':') ADVANCE(95); + END_STATE(); + case 96: + ACCEPT_TOKEN(anon_sym_string); + END_STATE(); + case 97: + ACCEPT_TOKEN(anon_sym_string); + if (('0' <= lookahead && lookahead <= '9') || + ('A' <= lookahead && lookahead <= 'Z') || + lookahead == '_' || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(85); + END_STATE(); + case 98: + ACCEPT_TOKEN(anon_sym_num); + END_STATE(); + case 99: + ACCEPT_TOKEN(anon_sym_num); + if (('0' <= lookahead && lookahead <= '9') || + ('A' <= lookahead && lookahead <= 'Z') || + lookahead == '_' || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(85); + END_STATE(); + case 100: + ACCEPT_TOKEN(anon_sym_bool); + END_STATE(); + case 101: + ACCEPT_TOKEN(anon_sym_bool); + if (('0' <= lookahead && lookahead <= '9') || + ('A' <= lookahead && lookahead <= 'Z') || + lookahead == '_' || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(85); + END_STATE(); + case 102: + ACCEPT_TOKEN(anon_sym_null); + END_STATE(); + case 103: + ACCEPT_TOKEN(anon_sym_null); + if (('0' <= lookahead && lookahead <= '9') || + ('A' <= lookahead && lookahead <= 'Z') || + lookahead == '_' || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(85); + END_STATE(); + case 104: + ACCEPT_TOKEN(anon_sym_binary); + END_STATE(); + case 105: + ACCEPT_TOKEN(anon_sym_binary); + if (('0' <= lookahead && lookahead <= '9') || + ('A' <= lookahead && lookahead <= 'Z') || + lookahead == '_' || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(85); END_STATE(); default: return false; @@ -983,76 +976,87 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) { } static const TSLexerMode ts_lex_modes[STATE_COUNT] = { - [0] = {.lex_state = 0}, - [1] = {.lex_state = 68}, - [2] = {.lex_state = 68}, - [3] = {.lex_state = 68}, - [4] = {.lex_state = 68}, - [5] = {.lex_state = 68}, - [6] = {.lex_state = 68}, - [7] = {.lex_state = 68}, - [8] = {.lex_state = 68}, - [9] = {.lex_state = 68}, - [10] = {.lex_state = 68}, - [11] = {.lex_state = 68}, - [12] = {.lex_state = 68}, - [13] = {.lex_state = 68}, - [14] = {.lex_state = 68}, - [15] = {.lex_state = 68}, - [16] = {.lex_state = 68}, - [17] = {.lex_state = 68}, - [18] = {.lex_state = 68}, - [19] = {.lex_state = 68}, - [20] = {.lex_state = 68}, - [21] = {.lex_state = 68}, - [22] = {.lex_state = 68}, - [23] = {.lex_state = 68}, - [24] = {.lex_state = 68}, - [25] = {.lex_state = 68}, - [26] = {.lex_state = 68}, - [27] = {.lex_state = 68}, - [28] = {.lex_state = 1}, - [29] = {.lex_state = 1}, - [30] = {.lex_state = 0}, - [31] = {.lex_state = 66}, - [32] = {.lex_state = 1}, + [0] = {.lex_state = 0, .external_lex_state = 1}, + [1] = {.lex_state = 57, .external_lex_state = 2}, + [2] = {.lex_state = 57, .external_lex_state = 2}, + [3] = {.lex_state = 57, .external_lex_state = 2}, + [4] = {.lex_state = 57, .external_lex_state = 2}, + [5] = {.lex_state = 57, .external_lex_state = 2}, + [6] = {.lex_state = 57, .external_lex_state = 2}, + [7] = {.lex_state = 57, .external_lex_state = 2}, + [8] = {.lex_state = 57, .external_lex_state = 2}, + [9] = {.lex_state = 57, .external_lex_state = 2}, + [10] = {.lex_state = 57, .external_lex_state = 2}, + [11] = {.lex_state = 57, .external_lex_state = 2}, + [12] = {.lex_state = 57, .external_lex_state = 2}, + [13] = {.lex_state = 57, .external_lex_state = 2}, + [14] = {.lex_state = 57, .external_lex_state = 2}, + [15] = {.lex_state = 57, .external_lex_state = 2}, + [16] = {.lex_state = 57, .external_lex_state = 2}, + [17] = {.lex_state = 57, .external_lex_state = 2}, + [18] = {.lex_state = 57, .external_lex_state = 2}, + [19] = {.lex_state = 57, .external_lex_state = 2}, + [20] = {.lex_state = 57, .external_lex_state = 2}, + [21] = {.lex_state = 57, .external_lex_state = 2}, + [22] = {.lex_state = 57, .external_lex_state = 2}, + [23] = {.lex_state = 57, .external_lex_state = 2}, + [24] = {.lex_state = 57, .external_lex_state = 2}, + [25] = {.lex_state = 57, .external_lex_state = 2}, + [26] = {.lex_state = 57, .external_lex_state = 2}, + [27] = {.lex_state = 1, .external_lex_state = 3}, + [28] = {.lex_state = 1, .external_lex_state = 3}, + [29] = {.lex_state = 57}, + [30] = {.lex_state = 1}, + [31] = {.lex_state = 1, .external_lex_state = 4}, + [32] = {.lex_state = 1, .external_lex_state = 4}, [33] = {.lex_state = 1}, [34] = {.lex_state = 1}, - [35] = {.lex_state = 1}, - [36] = {.lex_state = 1}, - [37] = {.lex_state = 1}, + [35] = {.lex_state = 1, .external_lex_state = 4}, + [36] = {.lex_state = 1, .external_lex_state = 4}, + [37] = {.lex_state = 2}, [38] = {.lex_state = 1}, - [39] = {.lex_state = 66}, - [40] = {.lex_state = 1}, - [41] = {.lex_state = 0}, - [42] = {.lex_state = 1}, + [39] = {.lex_state = 2}, + [40] = {.lex_state = 0}, + [41] = {.lex_state = 1}, + [42] = {.lex_state = 2}, [43] = {.lex_state = 1}, [44] = {.lex_state = 1}, [45] = {.lex_state = 1}, - [46] = {.lex_state = 67}, - [47] = {.lex_state = 1}, + [46] = {.lex_state = 2}, + [47] = {.lex_state = 2}, [48] = {.lex_state = 1}, - [49] = {.lex_state = 67}, - [50] = {.lex_state = 66}, - [51] = {.lex_state = 98}, - [52] = {.lex_state = 67}, - [53] = {.lex_state = 1}, + [49] = {.lex_state = 1}, + [50] = {.lex_state = 2}, + [51] = {.lex_state = 1}, + [52] = {.lex_state = 1}, + [53] = {.lex_state = 2}, [54] = {.lex_state = 1}, - [55] = {.lex_state = 68}, - [56] = {.lex_state = 68}, + [55] = {.lex_state = 2}, + [56] = {.lex_state = 1}, [57] = {.lex_state = 1}, - [58] = {.lex_state = 67}, - [59] = {.lex_state = 66}, + [58] = {.lex_state = 0}, + [59] = {.lex_state = 1}, + [60] = {.lex_state = 1}, + [61] = {.lex_state = 87}, + [62] = {.lex_state = 1}, + [63] = {.lex_state = 0}, + [64] = {.lex_state = 0}, + [65] = {.lex_state = 0}, + [66] = {.lex_state = 1}, + [67] = {.lex_state = 0}, + [68] = {.lex_state = 2}, + [69] = {.lex_state = 1}, + [70] = {.lex_state = 0}, + [71] = {.lex_state = 1}, + [72] = {.lex_state = 1}, }; static const uint16_t ts_parse_table[LARGE_STATE_COUNT][SYMBOL_COUNT] = { [STATE(0)] = { [ts_builtin_sym_end] = ACTIONS(1), + [sym__ws] = ACTIONS(1), [anon_sym_POUND_BANGsrfv1] = ACTIONS(1), [anon_sym_LF] = ACTIONS(1), - [sym_inline_comment] = ACTIONS(1), - [anon_sym_POUND_BANGlong] = ACTIONS(1), - [anon_sym_POUND_BANGcompact] = ACTIONS(1), [anon_sym_POUND_BANGrequireeof] = ACTIONS(1), [anon_sym_POUND_BANGeof] = ACTIONS(1), [anon_sym_POUND_BANGexpires_EQ] = ACTIONS(1), @@ -1064,118 +1068,157 @@ static const uint16_t ts_parse_table[LARGE_STATE_COUNT][SYMBOL_COUNT] = { [sym_timestamp] = ACTIONS(1), [sym_comment] = ACTIONS(1), [sym_blank_line] = ACTIONS(1), + [anon_sym_COMMA] = ACTIONS(1), [anon_sym_COLON] = ACTIONS(1), - [aux_sym_typed_field_token1] = ACTIONS(1), [anon_sym_COLON_COLON] = ACTIONS(1), [anon_sym_string] = ACTIONS(1), [anon_sym_num] = ACTIONS(1), [anon_sym_bool] = ACTIONS(1), [anon_sym_null] = ACTIONS(1), [anon_sym_binary] = ACTIONS(1), - [aux_sym_type_hint_token1] = ACTIONS(1), + [sym__long_marker] = ACTIONS(1), + [sym__compact_marker] = ACTIONS(1), + [sym__length_hint] = ACTIONS(1), + [sym_value] = ACTIONS(1), + [sym__error_sentinel] = ACTIONS(1), }, [STATE(1)] = { - [sym_document] = STATE(41), + [sym_document] = STATE(63), + [sym__line] = STATE(2), + [sym_magic] = STATE(2), + [sym_directive] = STATE(2), + [sym_directive_long] = STATE(7), + [sym_directive_compact] = STATE(7), + [sym_directive_requireeof] = STATE(7), + [sym_directive_eof] = STATE(7), + [sym_directive_expires] = STATE(7), + [sym_directive_created] = STATE(7), + [sym_directive_modified] = STATE(7), + [sym_directive_unknown] = STATE(7), + [sym__field_line] = STATE(2), + [sym_field] = STATE(30), + [sym_typed_field] = STATE(49), + [sym_untyped_field] = STATE(49), + [aux_sym_document_repeat1] = STATE(2), + [ts_builtin_sym_end] = ACTIONS(3), + [sym__ws] = ACTIONS(5), + [anon_sym_POUND_BANGsrfv1] = ACTIONS(7), + [anon_sym_POUND_BANGrequireeof] = ACTIONS(9), + [anon_sym_POUND_BANGeof] = ACTIONS(11), + [anon_sym_POUND_BANGexpires_EQ] = ACTIONS(13), + [anon_sym_POUND_BANGcreated_EQ] = ACTIONS(15), + [anon_sym_POUND_BANGmodified_EQ] = ACTIONS(17), + [aux_sym_directive_unknown_token1] = ACTIONS(19), + [sym_comment] = ACTIONS(21), + [sym_blank_line] = ACTIONS(21), + [sym_key] = ACTIONS(23), + [sym__long_marker] = ACTIONS(25), + [sym__compact_marker] = ACTIONS(27), + }, + [STATE(2)] = { [sym__line] = STATE(3), [sym_magic] = STATE(3), [sym_directive] = STATE(3), - [sym_directive_long] = STATE(5), - [sym_directive_compact] = STATE(5), - [sym_directive_requireeof] = STATE(5), - [sym_directive_eof] = STATE(5), - [sym_directive_expires] = STATE(5), - [sym_directive_created] = STATE(5), - [sym_directive_modified] = STATE(5), - [sym_directive_unknown] = STATE(5), - [sym_field] = STATE(3), - [sym_typed_field] = STATE(9), - [sym_untyped_field] = STATE(9), + [sym_directive_long] = STATE(7), + [sym_directive_compact] = STATE(7), + [sym_directive_requireeof] = STATE(7), + [sym_directive_eof] = STATE(7), + [sym_directive_expires] = STATE(7), + [sym_directive_created] = STATE(7), + [sym_directive_modified] = STATE(7), + [sym_directive_unknown] = STATE(7), + [sym__field_line] = STATE(3), + [sym_field] = STATE(30), + [sym_typed_field] = STATE(49), + [sym_untyped_field] = STATE(49), [aux_sym_document_repeat1] = STATE(3), - [ts_builtin_sym_end] = ACTIONS(3), - [anon_sym_POUND_BANGsrfv1] = ACTIONS(5), - [anon_sym_POUND_BANGlong] = ACTIONS(7), - [anon_sym_POUND_BANGcompact] = ACTIONS(9), - [anon_sym_POUND_BANGrequireeof] = ACTIONS(11), - [anon_sym_POUND_BANGeof] = ACTIONS(13), - [anon_sym_POUND_BANGexpires_EQ] = ACTIONS(15), - [anon_sym_POUND_BANGcreated_EQ] = ACTIONS(17), - [anon_sym_POUND_BANGmodified_EQ] = ACTIONS(19), - [aux_sym_directive_unknown_token1] = ACTIONS(21), - [sym_comment] = ACTIONS(23), - [sym_blank_line] = ACTIONS(23), - [sym_key] = ACTIONS(25), - }, - [STATE(2)] = { - [sym__line] = STATE(2), - [sym_magic] = STATE(2), - [sym_directive] = STATE(2), - [sym_directive_long] = STATE(5), - [sym_directive_compact] = STATE(5), - [sym_directive_requireeof] = STATE(5), - [sym_directive_eof] = STATE(5), - [sym_directive_expires] = STATE(5), - [sym_directive_created] = STATE(5), - [sym_directive_modified] = STATE(5), - [sym_directive_unknown] = STATE(5), - [sym_field] = STATE(2), - [sym_typed_field] = STATE(9), - [sym_untyped_field] = STATE(9), - [aux_sym_document_repeat1] = STATE(2), - [ts_builtin_sym_end] = ACTIONS(27), - [anon_sym_POUND_BANGsrfv1] = ACTIONS(29), - [anon_sym_POUND_BANGlong] = ACTIONS(32), - [anon_sym_POUND_BANGcompact] = ACTIONS(35), - [anon_sym_POUND_BANGrequireeof] = ACTIONS(38), - [anon_sym_POUND_BANGeof] = ACTIONS(41), - [anon_sym_POUND_BANGexpires_EQ] = ACTIONS(44), - [anon_sym_POUND_BANGcreated_EQ] = ACTIONS(47), - [anon_sym_POUND_BANGmodified_EQ] = ACTIONS(50), - [aux_sym_directive_unknown_token1] = ACTIONS(53), - [sym_comment] = ACTIONS(56), - [sym_blank_line] = ACTIONS(56), - [sym_key] = ACTIONS(59), + [ts_builtin_sym_end] = ACTIONS(29), + [sym__ws] = ACTIONS(5), + [anon_sym_POUND_BANGsrfv1] = ACTIONS(7), + [anon_sym_POUND_BANGrequireeof] = ACTIONS(9), + [anon_sym_POUND_BANGeof] = ACTIONS(11), + [anon_sym_POUND_BANGexpires_EQ] = ACTIONS(13), + [anon_sym_POUND_BANGcreated_EQ] = ACTIONS(15), + [anon_sym_POUND_BANGmodified_EQ] = ACTIONS(17), + [aux_sym_directive_unknown_token1] = ACTIONS(19), + [sym_comment] = ACTIONS(31), + [sym_blank_line] = ACTIONS(31), + [sym_key] = ACTIONS(23), + [sym__long_marker] = ACTIONS(25), + [sym__compact_marker] = ACTIONS(27), }, [STATE(3)] = { - [sym__line] = STATE(2), - [sym_magic] = STATE(2), - [sym_directive] = STATE(2), - [sym_directive_long] = STATE(5), - [sym_directive_compact] = STATE(5), - [sym_directive_requireeof] = STATE(5), - [sym_directive_eof] = STATE(5), - [sym_directive_expires] = STATE(5), - [sym_directive_created] = STATE(5), - [sym_directive_modified] = STATE(5), - [sym_directive_unknown] = STATE(5), - [sym_field] = STATE(2), - [sym_typed_field] = STATE(9), - [sym_untyped_field] = STATE(9), - [aux_sym_document_repeat1] = STATE(2), - [ts_builtin_sym_end] = ACTIONS(62), - [anon_sym_POUND_BANGsrfv1] = ACTIONS(5), - [anon_sym_POUND_BANGlong] = ACTIONS(7), - [anon_sym_POUND_BANGcompact] = ACTIONS(9), - [anon_sym_POUND_BANGrequireeof] = ACTIONS(11), - [anon_sym_POUND_BANGeof] = ACTIONS(13), - [anon_sym_POUND_BANGexpires_EQ] = ACTIONS(15), - [anon_sym_POUND_BANGcreated_EQ] = ACTIONS(17), - [anon_sym_POUND_BANGmodified_EQ] = ACTIONS(19), - [aux_sym_directive_unknown_token1] = ACTIONS(21), - [sym_comment] = ACTIONS(64), - [sym_blank_line] = ACTIONS(64), - [sym_key] = ACTIONS(25), + [sym__line] = STATE(3), + [sym_magic] = STATE(3), + [sym_directive] = STATE(3), + [sym_directive_long] = STATE(7), + [sym_directive_compact] = STATE(7), + [sym_directive_requireeof] = STATE(7), + [sym_directive_eof] = STATE(7), + [sym_directive_expires] = STATE(7), + [sym_directive_created] = STATE(7), + [sym_directive_modified] = STATE(7), + [sym_directive_unknown] = STATE(7), + [sym__field_line] = STATE(3), + [sym_field] = STATE(30), + [sym_typed_field] = STATE(49), + [sym_untyped_field] = STATE(49), + [aux_sym_document_repeat1] = STATE(3), + [ts_builtin_sym_end] = ACTIONS(33), + [sym__ws] = ACTIONS(35), + [anon_sym_POUND_BANGsrfv1] = ACTIONS(38), + [anon_sym_POUND_BANGrequireeof] = ACTIONS(41), + [anon_sym_POUND_BANGeof] = ACTIONS(44), + [anon_sym_POUND_BANGexpires_EQ] = ACTIONS(47), + [anon_sym_POUND_BANGcreated_EQ] = ACTIONS(50), + [anon_sym_POUND_BANGmodified_EQ] = ACTIONS(53), + [aux_sym_directive_unknown_token1] = ACTIONS(56), + [sym_comment] = ACTIONS(59), + [sym_blank_line] = ACTIONS(59), + [sym_key] = ACTIONS(62), + [sym__long_marker] = ACTIONS(65), + [sym__compact_marker] = ACTIONS(68), + }, + [STATE(4)] = { + [sym_magic] = STATE(11), + [sym_directive] = STATE(11), + [sym_directive_long] = STATE(7), + [sym_directive_compact] = STATE(7), + [sym_directive_requireeof] = STATE(7), + [sym_directive_eof] = STATE(7), + [sym_directive_expires] = STATE(7), + [sym_directive_created] = STATE(7), + [sym_directive_modified] = STATE(7), + [sym_directive_unknown] = STATE(7), + [sym__field_line] = STATE(11), + [sym_field] = STATE(30), + [sym_typed_field] = STATE(49), + [sym_untyped_field] = STATE(49), + [anon_sym_POUND_BANGsrfv1] = ACTIONS(7), + [anon_sym_POUND_BANGrequireeof] = ACTIONS(9), + [anon_sym_POUND_BANGeof] = ACTIONS(11), + [anon_sym_POUND_BANGexpires_EQ] = ACTIONS(13), + [anon_sym_POUND_BANGcreated_EQ] = ACTIONS(15), + [anon_sym_POUND_BANGmodified_EQ] = ACTIONS(17), + [aux_sym_directive_unknown_token1] = ACTIONS(19), + [sym_comment] = ACTIONS(71), + [sym_blank_line] = ACTIONS(71), + [sym_key] = ACTIONS(23), + [sym__long_marker] = ACTIONS(25), + [sym__compact_marker] = ACTIONS(27), }, }; static const uint16_t ts_small_parse_table[] = { [0] = 2, - ACTIONS(68), 1, + ACTIONS(75), 2, + sym__ws, aux_sym_directive_unknown_token1, - ACTIONS(66), 12, + ACTIONS(73), 12, + sym__long_marker, + sym__compact_marker, ts_builtin_sym_end, anon_sym_POUND_BANGsrfv1, - anon_sym_POUND_BANGlong, - anon_sym_POUND_BANGcompact, anon_sym_POUND_BANGrequireeof, anon_sym_POUND_BANGeof, anon_sym_POUND_BANGexpires_EQ, @@ -1184,14 +1227,15 @@ static const uint16_t ts_small_parse_table[] = { sym_comment, sym_blank_line, sym_key, - [18] = 2, - ACTIONS(72), 1, + [19] = 2, + ACTIONS(79), 2, + sym__ws, aux_sym_directive_unknown_token1, - ACTIONS(70), 12, + ACTIONS(77), 12, + sym__long_marker, + sym__compact_marker, ts_builtin_sym_end, anon_sym_POUND_BANGsrfv1, - anon_sym_POUND_BANGlong, - anon_sym_POUND_BANGcompact, anon_sym_POUND_BANGrequireeof, anon_sym_POUND_BANGeof, anon_sym_POUND_BANGexpires_EQ, @@ -1200,14 +1244,15 @@ static const uint16_t ts_small_parse_table[] = { sym_comment, sym_blank_line, sym_key, - [36] = 2, - ACTIONS(76), 1, + [38] = 2, + ACTIONS(83), 2, + sym__ws, aux_sym_directive_unknown_token1, - ACTIONS(74), 12, + ACTIONS(81), 12, + sym__long_marker, + sym__compact_marker, ts_builtin_sym_end, anon_sym_POUND_BANGsrfv1, - anon_sym_POUND_BANGlong, - anon_sym_POUND_BANGcompact, anon_sym_POUND_BANGrequireeof, anon_sym_POUND_BANGeof, anon_sym_POUND_BANGexpires_EQ, @@ -1216,14 +1261,15 @@ static const uint16_t ts_small_parse_table[] = { sym_comment, sym_blank_line, sym_key, - [54] = 2, - ACTIONS(80), 1, + [57] = 2, + ACTIONS(87), 2, + sym__ws, aux_sym_directive_unknown_token1, - ACTIONS(78), 12, + ACTIONS(85), 12, + sym__long_marker, + sym__compact_marker, ts_builtin_sym_end, anon_sym_POUND_BANGsrfv1, - anon_sym_POUND_BANGlong, - anon_sym_POUND_BANGcompact, anon_sym_POUND_BANGrequireeof, anon_sym_POUND_BANGeof, anon_sym_POUND_BANGexpires_EQ, @@ -1232,14 +1278,15 @@ static const uint16_t ts_small_parse_table[] = { sym_comment, sym_blank_line, sym_key, - [72] = 2, - ACTIONS(84), 1, + [76] = 2, + ACTIONS(91), 2, + sym__ws, aux_sym_directive_unknown_token1, - ACTIONS(82), 12, + ACTIONS(89), 12, + sym__long_marker, + sym__compact_marker, ts_builtin_sym_end, anon_sym_POUND_BANGsrfv1, - anon_sym_POUND_BANGlong, - anon_sym_POUND_BANGcompact, anon_sym_POUND_BANGrequireeof, anon_sym_POUND_BANGeof, anon_sym_POUND_BANGexpires_EQ, @@ -1248,14 +1295,15 @@ static const uint16_t ts_small_parse_table[] = { sym_comment, sym_blank_line, sym_key, - [90] = 2, - ACTIONS(88), 1, + [95] = 2, + ACTIONS(95), 2, + sym__ws, aux_sym_directive_unknown_token1, - ACTIONS(86), 12, + ACTIONS(93), 12, + sym__long_marker, + sym__compact_marker, ts_builtin_sym_end, anon_sym_POUND_BANGsrfv1, - anon_sym_POUND_BANGlong, - anon_sym_POUND_BANGcompact, anon_sym_POUND_BANGrequireeof, anon_sym_POUND_BANGeof, anon_sym_POUND_BANGexpires_EQ, @@ -1264,14 +1312,15 @@ static const uint16_t ts_small_parse_table[] = { sym_comment, sym_blank_line, sym_key, - [108] = 2, - ACTIONS(92), 1, + [114] = 2, + ACTIONS(99), 2, + sym__ws, aux_sym_directive_unknown_token1, - ACTIONS(90), 12, + ACTIONS(97), 12, + sym__long_marker, + sym__compact_marker, ts_builtin_sym_end, anon_sym_POUND_BANGsrfv1, - anon_sym_POUND_BANGlong, - anon_sym_POUND_BANGcompact, anon_sym_POUND_BANGrequireeof, anon_sym_POUND_BANGeof, anon_sym_POUND_BANGexpires_EQ, @@ -1280,14 +1329,15 @@ static const uint16_t ts_small_parse_table[] = { sym_comment, sym_blank_line, sym_key, - [126] = 2, - ACTIONS(96), 1, + [133] = 2, + ACTIONS(103), 2, + sym__ws, aux_sym_directive_unknown_token1, - ACTIONS(94), 12, + ACTIONS(101), 12, + sym__long_marker, + sym__compact_marker, ts_builtin_sym_end, anon_sym_POUND_BANGsrfv1, - anon_sym_POUND_BANGlong, - anon_sym_POUND_BANGcompact, anon_sym_POUND_BANGrequireeof, anon_sym_POUND_BANGeof, anon_sym_POUND_BANGexpires_EQ, @@ -1296,14 +1346,15 @@ static const uint16_t ts_small_parse_table[] = { sym_comment, sym_blank_line, sym_key, - [144] = 2, - ACTIONS(100), 1, + [152] = 2, + ACTIONS(107), 2, + sym__ws, aux_sym_directive_unknown_token1, - ACTIONS(98), 12, + ACTIONS(105), 12, + sym__long_marker, + sym__compact_marker, ts_builtin_sym_end, anon_sym_POUND_BANGsrfv1, - anon_sym_POUND_BANGlong, - anon_sym_POUND_BANGcompact, anon_sym_POUND_BANGrequireeof, anon_sym_POUND_BANGeof, anon_sym_POUND_BANGexpires_EQ, @@ -1312,14 +1363,15 @@ static const uint16_t ts_small_parse_table[] = { sym_comment, sym_blank_line, sym_key, - [162] = 2, - ACTIONS(104), 1, + [171] = 2, + ACTIONS(111), 2, + sym__ws, aux_sym_directive_unknown_token1, - ACTIONS(102), 12, + ACTIONS(109), 12, + sym__long_marker, + sym__compact_marker, ts_builtin_sym_end, anon_sym_POUND_BANGsrfv1, - anon_sym_POUND_BANGlong, - anon_sym_POUND_BANGcompact, anon_sym_POUND_BANGrequireeof, anon_sym_POUND_BANGeof, anon_sym_POUND_BANGexpires_EQ, @@ -1328,14 +1380,15 @@ static const uint16_t ts_small_parse_table[] = { sym_comment, sym_blank_line, sym_key, - [180] = 2, - ACTIONS(108), 1, + [190] = 2, + ACTIONS(115), 2, + sym__ws, aux_sym_directive_unknown_token1, - ACTIONS(106), 12, + ACTIONS(113), 12, + sym__long_marker, + sym__compact_marker, ts_builtin_sym_end, anon_sym_POUND_BANGsrfv1, - anon_sym_POUND_BANGlong, - anon_sym_POUND_BANGcompact, anon_sym_POUND_BANGrequireeof, anon_sym_POUND_BANGeof, anon_sym_POUND_BANGexpires_EQ, @@ -1344,14 +1397,15 @@ static const uint16_t ts_small_parse_table[] = { sym_comment, sym_blank_line, sym_key, - [198] = 2, - ACTIONS(112), 1, + [209] = 2, + ACTIONS(119), 2, + sym__ws, aux_sym_directive_unknown_token1, - ACTIONS(110), 12, + ACTIONS(117), 12, + sym__long_marker, + sym__compact_marker, ts_builtin_sym_end, anon_sym_POUND_BANGsrfv1, - anon_sym_POUND_BANGlong, - anon_sym_POUND_BANGcompact, anon_sym_POUND_BANGrequireeof, anon_sym_POUND_BANGeof, anon_sym_POUND_BANGexpires_EQ, @@ -1360,14 +1414,15 @@ static const uint16_t ts_small_parse_table[] = { sym_comment, sym_blank_line, sym_key, - [216] = 2, - ACTIONS(116), 1, + [228] = 2, + ACTIONS(123), 2, + sym__ws, aux_sym_directive_unknown_token1, - ACTIONS(114), 12, + ACTIONS(121), 12, + sym__long_marker, + sym__compact_marker, ts_builtin_sym_end, anon_sym_POUND_BANGsrfv1, - anon_sym_POUND_BANGlong, - anon_sym_POUND_BANGcompact, anon_sym_POUND_BANGrequireeof, anon_sym_POUND_BANGeof, anon_sym_POUND_BANGexpires_EQ, @@ -1376,14 +1431,15 @@ static const uint16_t ts_small_parse_table[] = { sym_comment, sym_blank_line, sym_key, - [234] = 2, - ACTIONS(120), 1, + [247] = 2, + ACTIONS(127), 2, + sym__ws, aux_sym_directive_unknown_token1, - ACTIONS(118), 12, + ACTIONS(125), 12, + sym__long_marker, + sym__compact_marker, ts_builtin_sym_end, anon_sym_POUND_BANGsrfv1, - anon_sym_POUND_BANGlong, - anon_sym_POUND_BANGcompact, anon_sym_POUND_BANGrequireeof, anon_sym_POUND_BANGeof, anon_sym_POUND_BANGexpires_EQ, @@ -1392,14 +1448,15 @@ static const uint16_t ts_small_parse_table[] = { sym_comment, sym_blank_line, sym_key, - [252] = 2, - ACTIONS(124), 1, + [266] = 2, + ACTIONS(131), 2, + sym__ws, aux_sym_directive_unknown_token1, - ACTIONS(122), 12, + ACTIONS(129), 12, + sym__long_marker, + sym__compact_marker, ts_builtin_sym_end, anon_sym_POUND_BANGsrfv1, - anon_sym_POUND_BANGlong, - anon_sym_POUND_BANGcompact, anon_sym_POUND_BANGrequireeof, anon_sym_POUND_BANGeof, anon_sym_POUND_BANGexpires_EQ, @@ -1408,14 +1465,15 @@ static const uint16_t ts_small_parse_table[] = { sym_comment, sym_blank_line, sym_key, - [270] = 2, - ACTIONS(128), 1, + [285] = 2, + ACTIONS(135), 2, + sym__ws, aux_sym_directive_unknown_token1, - ACTIONS(126), 12, + ACTIONS(133), 12, + sym__long_marker, + sym__compact_marker, ts_builtin_sym_end, anon_sym_POUND_BANGsrfv1, - anon_sym_POUND_BANGlong, - anon_sym_POUND_BANGcompact, anon_sym_POUND_BANGrequireeof, anon_sym_POUND_BANGeof, anon_sym_POUND_BANGexpires_EQ, @@ -1424,14 +1482,15 @@ static const uint16_t ts_small_parse_table[] = { sym_comment, sym_blank_line, sym_key, - [288] = 2, - ACTIONS(132), 1, + [304] = 2, + ACTIONS(139), 2, + sym__ws, aux_sym_directive_unknown_token1, - ACTIONS(130), 12, + ACTIONS(137), 12, + sym__long_marker, + sym__compact_marker, ts_builtin_sym_end, anon_sym_POUND_BANGsrfv1, - anon_sym_POUND_BANGlong, - anon_sym_POUND_BANGcompact, anon_sym_POUND_BANGrequireeof, anon_sym_POUND_BANGeof, anon_sym_POUND_BANGexpires_EQ, @@ -1440,30 +1499,15 @@ static const uint16_t ts_small_parse_table[] = { sym_comment, sym_blank_line, sym_key, - [306] = 2, - ACTIONS(136), 1, + [323] = 2, + ACTIONS(143), 2, + sym__ws, aux_sym_directive_unknown_token1, - ACTIONS(134), 12, + ACTIONS(141), 12, + sym__long_marker, + sym__compact_marker, ts_builtin_sym_end, anon_sym_POUND_BANGsrfv1, - anon_sym_POUND_BANGlong, - anon_sym_POUND_BANGcompact, - anon_sym_POUND_BANGrequireeof, - anon_sym_POUND_BANGeof, - anon_sym_POUND_BANGexpires_EQ, - anon_sym_POUND_BANGcreated_EQ, - anon_sym_POUND_BANGmodified_EQ, - sym_comment, - sym_blank_line, - sym_key, - [324] = 2, - ACTIONS(140), 1, - aux_sym_directive_unknown_token1, - ACTIONS(138), 12, - ts_builtin_sym_end, - anon_sym_POUND_BANGsrfv1, - anon_sym_POUND_BANGlong, - anon_sym_POUND_BANGcompact, anon_sym_POUND_BANGrequireeof, anon_sym_POUND_BANGeof, anon_sym_POUND_BANGexpires_EQ, @@ -1473,13 +1517,14 @@ static const uint16_t ts_small_parse_table[] = { sym_blank_line, sym_key, [342] = 2, - ACTIONS(144), 1, + ACTIONS(147), 2, + sym__ws, aux_sym_directive_unknown_token1, - ACTIONS(142), 12, + ACTIONS(145), 12, + sym__long_marker, + sym__compact_marker, ts_builtin_sym_end, anon_sym_POUND_BANGsrfv1, - anon_sym_POUND_BANGlong, - anon_sym_POUND_BANGcompact, anon_sym_POUND_BANGrequireeof, anon_sym_POUND_BANGeof, anon_sym_POUND_BANGexpires_EQ, @@ -1488,14 +1533,15 @@ static const uint16_t ts_small_parse_table[] = { sym_comment, sym_blank_line, sym_key, - [360] = 2, - ACTIONS(148), 1, + [361] = 2, + ACTIONS(151), 2, + sym__ws, aux_sym_directive_unknown_token1, - ACTIONS(146), 12, + ACTIONS(149), 12, + sym__long_marker, + sym__compact_marker, ts_builtin_sym_end, anon_sym_POUND_BANGsrfv1, - anon_sym_POUND_BANGlong, - anon_sym_POUND_BANGcompact, anon_sym_POUND_BANGrequireeof, anon_sym_POUND_BANGeof, anon_sym_POUND_BANGexpires_EQ, @@ -1504,14 +1550,15 @@ static const uint16_t ts_small_parse_table[] = { sym_comment, sym_blank_line, sym_key, - [378] = 2, - ACTIONS(152), 1, + [380] = 2, + ACTIONS(155), 2, + sym__ws, aux_sym_directive_unknown_token1, - ACTIONS(150), 12, + ACTIONS(153), 12, + sym__long_marker, + sym__compact_marker, ts_builtin_sym_end, anon_sym_POUND_BANGsrfv1, - anon_sym_POUND_BANGlong, - anon_sym_POUND_BANGcompact, anon_sym_POUND_BANGrequireeof, anon_sym_POUND_BANGeof, anon_sym_POUND_BANGexpires_EQ, @@ -1520,14 +1567,15 @@ static const uint16_t ts_small_parse_table[] = { sym_comment, sym_blank_line, sym_key, - [396] = 2, - ACTIONS(156), 1, + [399] = 2, + ACTIONS(159), 2, + sym__ws, aux_sym_directive_unknown_token1, - ACTIONS(154), 12, + ACTIONS(157), 12, + sym__long_marker, + sym__compact_marker, ts_builtin_sym_end, anon_sym_POUND_BANGsrfv1, - anon_sym_POUND_BANGlong, - anon_sym_POUND_BANGcompact, anon_sym_POUND_BANGrequireeof, anon_sym_POUND_BANGeof, anon_sym_POUND_BANGexpires_EQ, @@ -1536,336 +1584,475 @@ static const uint16_t ts_small_parse_table[] = { sym_comment, sym_blank_line, sym_key, - [414] = 2, - ACTIONS(160), 1, - aux_sym_directive_unknown_token1, - ACTIONS(158), 12, - ts_builtin_sym_end, - anon_sym_POUND_BANGsrfv1, - anon_sym_POUND_BANGlong, - anon_sym_POUND_BANGcompact, - anon_sym_POUND_BANGrequireeof, - anon_sym_POUND_BANGeof, - anon_sym_POUND_BANGexpires_EQ, - anon_sym_POUND_BANGcreated_EQ, - anon_sym_POUND_BANGmodified_EQ, - sym_comment, - sym_blank_line, - sym_key, - [432] = 2, - STATE(55), 1, + [418] = 3, + ACTIONS(161), 1, + sym__ws, + STATE(43), 1, sym_type_hint, - ACTIONS(162), 6, + ACTIONS(163), 6, + sym__length_hint, anon_sym_string, anon_sym_num, anon_sym_bool, anon_sym_null, anon_sym_binary, - aux_sym_type_hint_token1, - [444] = 2, - ACTIONS(164), 1, + [433] = 2, + STATE(51), 1, + sym_type_hint, + ACTIONS(163), 6, + sym__length_hint, + anon_sym_string, + anon_sym_num, + anon_sym_bool, + anon_sym_null, + anon_sym_binary, + [445] = 3, + ACTIONS(23), 1, + sym_key, + STATE(45), 1, + sym_field, + STATE(49), 2, + sym_typed_field, + sym_untyped_field, + [456] = 3, + ACTIONS(165), 1, anon_sym_LF, - ACTIONS(166), 1, - sym_inline_comment, - [451] = 2, - ACTIONS(168), 1, - anon_sym_COLON, - ACTIONS(170), 1, - anon_sym_COLON_COLON, - [458] = 2, - ACTIONS(172), 1, - aux_sym_typed_field_token1, - ACTIONS(174), 1, + ACTIONS(167), 1, + anon_sym_COMMA, + STATE(33), 1, + aux_sym__field_line_repeat1, + [466] = 2, + ACTIONS(171), 1, sym_value, - [465] = 2, - ACTIONS(176), 1, + ACTIONS(169), 2, anon_sym_LF, - ACTIONS(178), 1, - sym_inline_comment, - [472] = 2, - ACTIONS(180), 1, + anon_sym_COMMA, + [474] = 2, + ACTIONS(175), 1, + sym_value, + ACTIONS(173), 2, anon_sym_LF, - ACTIONS(182), 1, - sym_inline_comment, - [479] = 2, - ACTIONS(184), 1, + anon_sym_COMMA, + [482] = 3, + ACTIONS(167), 1, + anon_sym_COMMA, + ACTIONS(177), 1, anon_sym_LF, + STATE(34), 1, + aux_sym__field_line_repeat1, + [492] = 3, + ACTIONS(179), 1, + anon_sym_LF, + ACTIONS(181), 1, + anon_sym_COMMA, + STATE(34), 1, + aux_sym__field_line_repeat1, + [502] = 2, ACTIONS(186), 1, - sym_inline_comment, - [486] = 2, - ACTIONS(188), 1, + sym_value, + ACTIONS(184), 2, anon_sym_LF, + anon_sym_COMMA, + [510] = 2, ACTIONS(190), 1, - sym_inline_comment, - [493] = 2, + sym_value, + ACTIONS(188), 2, + anon_sym_LF, + anon_sym_COMMA, + [518] = 2, ACTIONS(192), 1, anon_sym_LF, ACTIONS(194), 1, sym_inline_comment, - [500] = 2, - ACTIONS(196), 1, + [525] = 1, + ACTIONS(196), 2, anon_sym_LF, + anon_sym_COMMA, + [530] = 2, ACTIONS(198), 1, - sym_inline_comment, - [507] = 2, - ACTIONS(200), 1, anon_sym_LF, - ACTIONS(202), 1, + ACTIONS(200), 1, sym_inline_comment, - [514] = 2, + [537] = 2, + ACTIONS(202), 1, + anon_sym_COLON, ACTIONS(204), 1, - aux_sym_typed_field_token1, - ACTIONS(206), 1, - sym_value, - [521] = 2, + anon_sym_COLON_COLON, + [544] = 1, + ACTIONS(206), 2, + sym__ws, + anon_sym_COLON, + [549] = 2, ACTIONS(208), 1, anon_sym_LF, ACTIONS(210), 1, - anon_sym_EQ, - [528] = 1, + sym_inline_comment, + [556] = 2, ACTIONS(212), 1, - ts_builtin_sym_end, - [532] = 1, + sym__ws, ACTIONS(214), 1, + anon_sym_COLON, + [563] = 1, + ACTIONS(216), 2, anon_sym_LF, - [536] = 1, - ACTIONS(216), 1, + anon_sym_COMMA, + [568] = 1, + ACTIONS(179), 2, anon_sym_LF, - [540] = 1, + anon_sym_COMMA, + [573] = 2, ACTIONS(218), 1, anon_sym_LF, - [544] = 1, ACTIONS(220), 1, - anon_sym_LF, - [548] = 1, + sym_inline_comment, + [580] = 2, ACTIONS(222), 1, - sym_timestamp, - [552] = 1, - ACTIONS(224), 1, anon_sym_LF, - [556] = 1, + ACTIONS(224), 1, + sym_inline_comment, + [587] = 2, ACTIONS(226), 1, anon_sym_LF, - [560] = 1, ACTIONS(228), 1, - sym_timestamp, - [564] = 1, - ACTIONS(230), 1, - aux_sym_typed_field_token1, - [568] = 1, + anon_sym_EQ, + [594] = 1, + ACTIONS(230), 2, + anon_sym_LF, + anon_sym_COMMA, + [599] = 2, ACTIONS(232), 1, - aux_sym_directive_unknown_token3, - [572] = 1, + anon_sym_LF, ACTIONS(234), 1, - sym_timestamp, - [576] = 1, + sym_inline_comment, + [606] = 2, ACTIONS(236), 1, - anon_sym_LF, - [580] = 1, + sym__ws, ACTIONS(238), 1, + anon_sym_COLON, + [613] = 1, + ACTIONS(188), 2, anon_sym_LF, - [584] = 1, + anon_sym_COMMA, + [618] = 2, ACTIONS(240), 1, - anon_sym_COLON, - [588] = 1, + anon_sym_LF, ACTIONS(242), 1, - anon_sym_COLON, - [592] = 1, + sym_inline_comment, + [625] = 1, + ACTIONS(173), 2, + anon_sym_LF, + anon_sym_COMMA, + [630] = 2, ACTIONS(244), 1, anon_sym_LF, - [596] = 1, ACTIONS(246), 1, - aux_sym_directive_unknown_token2, - [600] = 1, + sym_inline_comment, + [637] = 1, ACTIONS(248), 1, - aux_sym_typed_field_token1, + anon_sym_LF, + [641] = 1, + ACTIONS(250), 1, + anon_sym_LF, + [645] = 1, + ACTIONS(252), 1, + sym_timestamp, + [649] = 1, + ACTIONS(254), 1, + anon_sym_LF, + [653] = 1, + ACTIONS(256), 1, + anon_sym_LF, + [657] = 1, + ACTIONS(258), 1, + aux_sym_directive_unknown_token3, + [661] = 1, + ACTIONS(260), 1, + anon_sym_LF, + [665] = 1, + ACTIONS(262), 1, + ts_builtin_sym_end, + [669] = 1, + ACTIONS(238), 1, + anon_sym_COLON, + [673] = 1, + ACTIONS(264), 1, + sym_timestamp, + [677] = 1, + ACTIONS(266), 1, + anon_sym_LF, + [681] = 1, + ACTIONS(268), 1, + anon_sym_COLON, + [685] = 1, + ACTIONS(270), 1, + aux_sym_directive_unknown_token2, + [689] = 1, + ACTIONS(272), 1, + anon_sym_LF, + [693] = 1, + ACTIONS(274), 1, + sym_timestamp, + [697] = 1, + ACTIONS(276), 1, + anon_sym_LF, + [701] = 1, + ACTIONS(278), 1, + anon_sym_LF, }; static const uint32_t ts_small_parse_table_map[] = { - [SMALL_STATE(4)] = 0, - [SMALL_STATE(5)] = 18, - [SMALL_STATE(6)] = 36, - [SMALL_STATE(7)] = 54, - [SMALL_STATE(8)] = 72, - [SMALL_STATE(9)] = 90, - [SMALL_STATE(10)] = 108, - [SMALL_STATE(11)] = 126, - [SMALL_STATE(12)] = 144, - [SMALL_STATE(13)] = 162, - [SMALL_STATE(14)] = 180, - [SMALL_STATE(15)] = 198, - [SMALL_STATE(16)] = 216, - [SMALL_STATE(17)] = 234, - [SMALL_STATE(18)] = 252, - [SMALL_STATE(19)] = 270, - [SMALL_STATE(20)] = 288, - [SMALL_STATE(21)] = 306, - [SMALL_STATE(22)] = 324, + [SMALL_STATE(5)] = 0, + [SMALL_STATE(6)] = 19, + [SMALL_STATE(7)] = 38, + [SMALL_STATE(8)] = 57, + [SMALL_STATE(9)] = 76, + [SMALL_STATE(10)] = 95, + [SMALL_STATE(11)] = 114, + [SMALL_STATE(12)] = 133, + [SMALL_STATE(13)] = 152, + [SMALL_STATE(14)] = 171, + [SMALL_STATE(15)] = 190, + [SMALL_STATE(16)] = 209, + [SMALL_STATE(17)] = 228, + [SMALL_STATE(18)] = 247, + [SMALL_STATE(19)] = 266, + [SMALL_STATE(20)] = 285, + [SMALL_STATE(21)] = 304, + [SMALL_STATE(22)] = 323, [SMALL_STATE(23)] = 342, - [SMALL_STATE(24)] = 360, - [SMALL_STATE(25)] = 378, - [SMALL_STATE(26)] = 396, - [SMALL_STATE(27)] = 414, - [SMALL_STATE(28)] = 432, - [SMALL_STATE(29)] = 444, - [SMALL_STATE(30)] = 451, - [SMALL_STATE(31)] = 458, - [SMALL_STATE(32)] = 465, - [SMALL_STATE(33)] = 472, - [SMALL_STATE(34)] = 479, - [SMALL_STATE(35)] = 486, - [SMALL_STATE(36)] = 493, - [SMALL_STATE(37)] = 500, - [SMALL_STATE(38)] = 507, - [SMALL_STATE(39)] = 514, - [SMALL_STATE(40)] = 521, - [SMALL_STATE(41)] = 528, - [SMALL_STATE(42)] = 532, - [SMALL_STATE(43)] = 536, - [SMALL_STATE(44)] = 540, - [SMALL_STATE(45)] = 544, - [SMALL_STATE(46)] = 548, - [SMALL_STATE(47)] = 552, - [SMALL_STATE(48)] = 556, - [SMALL_STATE(49)] = 560, - [SMALL_STATE(50)] = 564, - [SMALL_STATE(51)] = 568, - [SMALL_STATE(52)] = 572, - [SMALL_STATE(53)] = 576, - [SMALL_STATE(54)] = 580, - [SMALL_STATE(55)] = 584, - [SMALL_STATE(56)] = 588, - [SMALL_STATE(57)] = 592, - [SMALL_STATE(58)] = 596, - [SMALL_STATE(59)] = 600, + [SMALL_STATE(24)] = 361, + [SMALL_STATE(25)] = 380, + [SMALL_STATE(26)] = 399, + [SMALL_STATE(27)] = 418, + [SMALL_STATE(28)] = 433, + [SMALL_STATE(29)] = 445, + [SMALL_STATE(30)] = 456, + [SMALL_STATE(31)] = 466, + [SMALL_STATE(32)] = 474, + [SMALL_STATE(33)] = 482, + [SMALL_STATE(34)] = 492, + [SMALL_STATE(35)] = 502, + [SMALL_STATE(36)] = 510, + [SMALL_STATE(37)] = 518, + [SMALL_STATE(38)] = 525, + [SMALL_STATE(39)] = 530, + [SMALL_STATE(40)] = 537, + [SMALL_STATE(41)] = 544, + [SMALL_STATE(42)] = 549, + [SMALL_STATE(43)] = 556, + [SMALL_STATE(44)] = 563, + [SMALL_STATE(45)] = 568, + [SMALL_STATE(46)] = 573, + [SMALL_STATE(47)] = 580, + [SMALL_STATE(48)] = 587, + [SMALL_STATE(49)] = 594, + [SMALL_STATE(50)] = 599, + [SMALL_STATE(51)] = 606, + [SMALL_STATE(52)] = 613, + [SMALL_STATE(53)] = 618, + [SMALL_STATE(54)] = 625, + [SMALL_STATE(55)] = 630, + [SMALL_STATE(56)] = 637, + [SMALL_STATE(57)] = 641, + [SMALL_STATE(58)] = 645, + [SMALL_STATE(59)] = 649, + [SMALL_STATE(60)] = 653, + [SMALL_STATE(61)] = 657, + [SMALL_STATE(62)] = 661, + [SMALL_STATE(63)] = 665, + [SMALL_STATE(64)] = 669, + [SMALL_STATE(65)] = 673, + [SMALL_STATE(66)] = 677, + [SMALL_STATE(67)] = 681, + [SMALL_STATE(68)] = 685, + [SMALL_STATE(69)] = 689, + [SMALL_STATE(70)] = 693, + [SMALL_STATE(71)] = 697, + [SMALL_STATE(72)] = 701, }; static const TSParseActionEntry ts_parse_actions[] = { [0] = {.entry = {.count = 0, .reusable = false}}, [1] = {.entry = {.count = 1, .reusable = false}}, RECOVER(), [3] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_document, 0, 0, 0), - [5] = {.entry = {.count = 1, .reusable = true}}, SHIFT(32), - [7] = {.entry = {.count = 1, .reusable = true}}, SHIFT(34), - [9] = {.entry = {.count = 1, .reusable = true}}, SHIFT(35), - [11] = {.entry = {.count = 1, .reusable = true}}, SHIFT(33), - [13] = {.entry = {.count = 1, .reusable = true}}, SHIFT(36), - [15] = {.entry = {.count = 1, .reusable = true}}, SHIFT(46), - [17] = {.entry = {.count = 1, .reusable = true}}, SHIFT(49), - [19] = {.entry = {.count = 1, .reusable = true}}, SHIFT(52), - [21] = {.entry = {.count = 1, .reusable = false}}, SHIFT(58), - [23] = {.entry = {.count = 1, .reusable = true}}, SHIFT(3), - [25] = {.entry = {.count = 1, .reusable = true}}, SHIFT(30), - [27] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_document_repeat1, 2, 0, 0), - [29] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_document_repeat1, 2, 0, 0), SHIFT_REPEAT(32), - [32] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_document_repeat1, 2, 0, 0), SHIFT_REPEAT(34), - [35] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_document_repeat1, 2, 0, 0), SHIFT_REPEAT(35), - [38] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_document_repeat1, 2, 0, 0), SHIFT_REPEAT(33), - [41] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_document_repeat1, 2, 0, 0), SHIFT_REPEAT(36), - [44] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_document_repeat1, 2, 0, 0), SHIFT_REPEAT(46), - [47] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_document_repeat1, 2, 0, 0), SHIFT_REPEAT(49), - [50] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_document_repeat1, 2, 0, 0), SHIFT_REPEAT(52), - [53] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_document_repeat1, 2, 0, 0), SHIFT_REPEAT(58), - [56] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_document_repeat1, 2, 0, 0), SHIFT_REPEAT(2), - [59] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_document_repeat1, 2, 0, 0), SHIFT_REPEAT(30), - [62] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_document, 1, 0, 0), - [64] = {.entry = {.count = 1, .reusable = true}}, SHIFT(2), - [66] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_magic, 2, 0, 0), - [68] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_magic, 2, 0, 0), - [70] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_directive, 1, 0, 0), - [72] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_directive, 1, 0, 0), - [74] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_directive_compact, 2, 0, 0), - [76] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_directive_compact, 2, 0, 0), - [78] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_directive_requireeof, 2, 0, 0), - [80] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_directive_requireeof, 2, 0, 0), - [82] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_directive_eof, 2, 0, 0), - [84] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_directive_eof, 2, 0, 0), - [86] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_field, 1, 0, 0), - [88] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_field, 1, 0, 0), - [90] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_magic, 3, 0, 0), - [92] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_magic, 3, 0, 0), - [94] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_directive_long, 2, 0, 0), - [96] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_directive_long, 2, 0, 0), - [98] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_directive_long, 3, 0, 0), - [100] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_directive_long, 3, 0, 0), - [102] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_directive_compact, 3, 0, 0), - [104] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_directive_compact, 3, 0, 0), - [106] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_directive_requireeof, 3, 0, 0), - [108] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_directive_requireeof, 3, 0, 0), - [110] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_directive_eof, 3, 0, 0), - [112] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_directive_eof, 3, 0, 0), - [114] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_directive_expires, 3, 0, 1), - [116] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_directive_expires, 3, 0, 1), - [118] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_directive_created, 3, 0, 1), - [120] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_directive_created, 3, 0, 1), - [122] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_directive_modified, 3, 0, 1), - [124] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_directive_modified, 3, 0, 1), - [126] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_directive_unknown, 3, 0, 0), - [128] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_directive_unknown, 3, 0, 0), - [130] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_untyped_field, 3, 0, 0), - [132] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_untyped_field, 3, 0, 0), - [134] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_directive_expires, 4, 0, 1), - [136] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_directive_expires, 4, 0, 1), - [138] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_directive_created, 4, 0, 1), - [140] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_directive_created, 4, 0, 1), - [142] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_directive_modified, 4, 0, 1), - [144] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_directive_modified, 4, 0, 1), - [146] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_untyped_field, 4, 0, 0), - [148] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_untyped_field, 4, 0, 0), - [150] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_directive_unknown, 5, 0, 0), - [152] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_directive_unknown, 5, 0, 0), - [154] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_typed_field, 5, 0, 0), - [156] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_typed_field, 5, 0, 0), - [158] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_typed_field, 6, 0, 0), - [160] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_typed_field, 6, 0, 0), - [162] = {.entry = {.count = 1, .reusable = true}}, SHIFT(56), - [164] = {.entry = {.count = 1, .reusable = true}}, SHIFT(18), - [166] = {.entry = {.count = 1, .reusable = true}}, SHIFT(47), - [168] = {.entry = {.count = 1, .reusable = false}}, SHIFT(28), - [170] = {.entry = {.count = 1, .reusable = true}}, SHIFT(31), - [172] = {.entry = {.count = 1, .reusable = true}}, SHIFT(20), - [174] = {.entry = {.count = 1, .reusable = true}}, SHIFT(50), - [176] = {.entry = {.count = 1, .reusable = true}}, SHIFT(4), - [178] = {.entry = {.count = 1, .reusable = true}}, SHIFT(42), - [180] = {.entry = {.count = 1, .reusable = true}}, SHIFT(7), - [182] = {.entry = {.count = 1, .reusable = true}}, SHIFT(57), - [184] = {.entry = {.count = 1, .reusable = true}}, SHIFT(11), - [186] = {.entry = {.count = 1, .reusable = true}}, SHIFT(44), - [188] = {.entry = {.count = 1, .reusable = true}}, SHIFT(6), - [190] = {.entry = {.count = 1, .reusable = true}}, SHIFT(48), + [5] = {.entry = {.count = 1, .reusable = false}}, SHIFT(4), + [7] = {.entry = {.count = 1, .reusable = true}}, SHIFT(39), + [9] = {.entry = {.count = 1, .reusable = true}}, SHIFT(53), + [11] = {.entry = {.count = 1, .reusable = true}}, SHIFT(55), + [13] = {.entry = {.count = 1, .reusable = true}}, SHIFT(70), + [15] = {.entry = {.count = 1, .reusable = true}}, SHIFT(58), + [17] = {.entry = {.count = 1, .reusable = true}}, SHIFT(65), + [19] = {.entry = {.count = 1, .reusable = false}}, SHIFT(68), + [21] = {.entry = {.count = 1, .reusable = true}}, SHIFT(2), + [23] = {.entry = {.count = 1, .reusable = true}}, SHIFT(40), + [25] = {.entry = {.count = 1, .reusable = true}}, SHIFT(37), + [27] = {.entry = {.count = 1, .reusable = true}}, SHIFT(50), + [29] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_document, 1, 0, 0), + [31] = {.entry = {.count = 1, .reusable = true}}, SHIFT(3), + [33] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_document_repeat1, 2, 0, 0), + [35] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_document_repeat1, 2, 0, 0), SHIFT_REPEAT(4), + [38] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_document_repeat1, 2, 0, 0), SHIFT_REPEAT(39), + [41] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_document_repeat1, 2, 0, 0), SHIFT_REPEAT(53), + [44] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_document_repeat1, 2, 0, 0), SHIFT_REPEAT(55), + [47] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_document_repeat1, 2, 0, 0), SHIFT_REPEAT(70), + [50] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_document_repeat1, 2, 0, 0), SHIFT_REPEAT(58), + [53] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_document_repeat1, 2, 0, 0), SHIFT_REPEAT(65), + [56] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_document_repeat1, 2, 0, 0), SHIFT_REPEAT(68), + [59] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_document_repeat1, 2, 0, 0), SHIFT_REPEAT(3), + [62] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_document_repeat1, 2, 0, 0), SHIFT_REPEAT(40), + [65] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_document_repeat1, 2, 0, 0), SHIFT_REPEAT(37), + [68] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_document_repeat1, 2, 0, 0), SHIFT_REPEAT(50), + [71] = {.entry = {.count = 1, .reusable = true}}, SHIFT(11), + [73] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_directive_compact, 3, 0, 0), + [75] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_directive_compact, 3, 0, 0), + [77] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_directive_compact, 2, 0, 0), + [79] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_directive_compact, 2, 0, 0), + [81] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_directive, 1, 0, 0), + [83] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_directive, 1, 0, 0), + [85] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_directive_long, 2, 0, 0), + [87] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_directive_long, 2, 0, 0), + [89] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_magic, 2, 0, 0), + [91] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_magic, 2, 0, 0), + [93] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_directive_requireeof, 2, 0, 0), + [95] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_directive_requireeof, 2, 0, 0), + [97] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__line, 2, 0, 0), + [99] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym__line, 2, 0, 0), + [101] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__field_line, 2, 0, 0), + [103] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym__field_line, 2, 0, 0), + [105] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_directive_eof, 2, 0, 0), + [107] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_directive_eof, 2, 0, 0), + [109] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_directive_long, 3, 0, 0), + [111] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_directive_long, 3, 0, 0), + [113] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_magic, 3, 0, 0), + [115] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_magic, 3, 0, 0), + [117] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_directive_requireeof, 3, 0, 0), + [119] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_directive_requireeof, 3, 0, 0), + [121] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_directive_eof, 3, 0, 0), + [123] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_directive_eof, 3, 0, 0), + [125] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_directive_expires, 3, 0, 1), + [127] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_directive_expires, 3, 0, 1), + [129] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_directive_created, 3, 0, 1), + [131] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_directive_created, 3, 0, 1), + [133] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_directive_modified, 3, 0, 1), + [135] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_directive_modified, 3, 0, 1), + [137] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_directive_unknown, 3, 0, 0), + [139] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_directive_unknown, 3, 0, 0), + [141] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__field_line, 3, 0, 0), + [143] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym__field_line, 3, 0, 0), + [145] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_directive_created, 4, 0, 1), + [147] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_directive_created, 4, 0, 1), + [149] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_directive_expires, 4, 0, 1), + [151] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_directive_expires, 4, 0, 1), + [153] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_directive_modified, 4, 0, 1), + [155] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_directive_modified, 4, 0, 1), + [157] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_directive_unknown, 5, 0, 0), + [159] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_directive_unknown, 5, 0, 0), + [161] = {.entry = {.count = 1, .reusable = true}}, SHIFT(28), + [163] = {.entry = {.count = 1, .reusable = true}}, SHIFT(41), + [165] = {.entry = {.count = 1, .reusable = true}}, SHIFT(12), + [167] = {.entry = {.count = 1, .reusable = true}}, SHIFT(29), + [169] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_untyped_field, 2, 0, 0), + [171] = {.entry = {.count = 1, .reusable = true}}, SHIFT(44), + [173] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_typed_field, 6, 0, 0), + [175] = {.entry = {.count = 1, .reusable = true}}, SHIFT(38), + [177] = {.entry = {.count = 1, .reusable = true}}, SHIFT(22), + [179] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym__field_line_repeat1, 2, 0, 0), + [181] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym__field_line_repeat1, 2, 0, 0), SHIFT_REPEAT(29), + [184] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_typed_field, 4, 0, 0), + [186] = {.entry = {.count = 1, .reusable = true}}, SHIFT(52), + [188] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_typed_field, 5, 0, 0), + [190] = {.entry = {.count = 1, .reusable = true}}, SHIFT(54), [192] = {.entry = {.count = 1, .reusable = true}}, SHIFT(8), - [194] = {.entry = {.count = 1, .reusable = true}}, SHIFT(53), - [196] = {.entry = {.count = 1, .reusable = true}}, SHIFT(17), - [198] = {.entry = {.count = 1, .reusable = true}}, SHIFT(45), - [200] = {.entry = {.count = 1, .reusable = true}}, SHIFT(16), - [202] = {.entry = {.count = 1, .reusable = true}}, SHIFT(43), - [204] = {.entry = {.count = 1, .reusable = true}}, SHIFT(26), - [206] = {.entry = {.count = 1, .reusable = true}}, SHIFT(59), - [208] = {.entry = {.count = 1, .reusable = true}}, SHIFT(19), - [210] = {.entry = {.count = 1, .reusable = true}}, SHIFT(51), - [212] = {.entry = {.count = 1, .reusable = true}}, ACCEPT_INPUT(), - [214] = {.entry = {.count = 1, .reusable = true}}, SHIFT(10), - [216] = {.entry = {.count = 1, .reusable = true}}, SHIFT(21), - [218] = {.entry = {.count = 1, .reusable = true}}, SHIFT(12), - [220] = {.entry = {.count = 1, .reusable = true}}, SHIFT(22), - [222] = {.entry = {.count = 1, .reusable = true}}, SHIFT(38), - [224] = {.entry = {.count = 1, .reusable = true}}, SHIFT(23), - [226] = {.entry = {.count = 1, .reusable = true}}, SHIFT(13), - [228] = {.entry = {.count = 1, .reusable = true}}, SHIFT(37), - [230] = {.entry = {.count = 1, .reusable = true}}, SHIFT(24), - [232] = {.entry = {.count = 1, .reusable = true}}, SHIFT(54), - [234] = {.entry = {.count = 1, .reusable = true}}, SHIFT(29), - [236] = {.entry = {.count = 1, .reusable = true}}, SHIFT(15), - [238] = {.entry = {.count = 1, .reusable = true}}, SHIFT(25), - [240] = {.entry = {.count = 1, .reusable = true}}, SHIFT(39), - [242] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_type_hint, 1, 0, 0), - [244] = {.entry = {.count = 1, .reusable = true}}, SHIFT(14), - [246] = {.entry = {.count = 1, .reusable = true}}, SHIFT(40), - [248] = {.entry = {.count = 1, .reusable = true}}, SHIFT(27), + [194] = {.entry = {.count = 1, .reusable = true}}, SHIFT(66), + [196] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_typed_field, 7, 0, 0), + [198] = {.entry = {.count = 1, .reusable = true}}, SHIFT(9), + [200] = {.entry = {.count = 1, .reusable = true}}, SHIFT(69), + [202] = {.entry = {.count = 1, .reusable = false}}, SHIFT(27), + [204] = {.entry = {.count = 1, .reusable = true}}, SHIFT(31), + [206] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_type_hint, 1, 0, 0), + [208] = {.entry = {.count = 1, .reusable = true}}, SHIFT(18), + [210] = {.entry = {.count = 1, .reusable = true}}, SHIFT(71), + [212] = {.entry = {.count = 1, .reusable = true}}, SHIFT(64), + [214] = {.entry = {.count = 1, .reusable = true}}, SHIFT(35), + [216] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_untyped_field, 3, 0, 0), + [218] = {.entry = {.count = 1, .reusable = true}}, SHIFT(19), + [220] = {.entry = {.count = 1, .reusable = true}}, SHIFT(57), + [222] = {.entry = {.count = 1, .reusable = true}}, SHIFT(20), + [224] = {.entry = {.count = 1, .reusable = true}}, SHIFT(59), + [226] = {.entry = {.count = 1, .reusable = true}}, SHIFT(21), + [228] = {.entry = {.count = 1, .reusable = true}}, SHIFT(61), + [230] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_field, 1, 0, 0), + [232] = {.entry = {.count = 1, .reusable = true}}, SHIFT(6), + [234] = {.entry = {.count = 1, .reusable = true}}, SHIFT(56), + [236] = {.entry = {.count = 1, .reusable = true}}, SHIFT(67), + [238] = {.entry = {.count = 1, .reusable = true}}, SHIFT(36), + [240] = {.entry = {.count = 1, .reusable = true}}, SHIFT(10), + [242] = {.entry = {.count = 1, .reusable = true}}, SHIFT(72), + [244] = {.entry = {.count = 1, .reusable = true}}, SHIFT(13), + [246] = {.entry = {.count = 1, .reusable = true}}, SHIFT(60), + [248] = {.entry = {.count = 1, .reusable = true}}, SHIFT(5), + [250] = {.entry = {.count = 1, .reusable = true}}, SHIFT(23), + [252] = {.entry = {.count = 1, .reusable = true}}, SHIFT(46), + [254] = {.entry = {.count = 1, .reusable = true}}, SHIFT(25), + [256] = {.entry = {.count = 1, .reusable = true}}, SHIFT(17), + [258] = {.entry = {.count = 1, .reusable = true}}, SHIFT(62), + [260] = {.entry = {.count = 1, .reusable = true}}, SHIFT(26), + [262] = {.entry = {.count = 1, .reusable = true}}, ACCEPT_INPUT(), + [264] = {.entry = {.count = 1, .reusable = true}}, SHIFT(47), + [266] = {.entry = {.count = 1, .reusable = true}}, SHIFT(14), + [268] = {.entry = {.count = 1, .reusable = true}}, SHIFT(32), + [270] = {.entry = {.count = 1, .reusable = true}}, SHIFT(48), + [272] = {.entry = {.count = 1, .reusable = true}}, SHIFT(15), + [274] = {.entry = {.count = 1, .reusable = true}}, SHIFT(42), + [276] = {.entry = {.count = 1, .reusable = true}}, SHIFT(24), + [278] = {.entry = {.count = 1, .reusable = true}}, SHIFT(16), +}; + +enum ts_external_scanner_symbol_identifiers { + ts_external_token__long_marker = 0, + ts_external_token__compact_marker = 1, + ts_external_token__length_hint = 2, + ts_external_token_value = 3, + ts_external_token__error_sentinel = 4, +}; + +static const TSSymbol ts_external_scanner_symbol_map[EXTERNAL_TOKEN_COUNT] = { + [ts_external_token__long_marker] = sym__long_marker, + [ts_external_token__compact_marker] = sym__compact_marker, + [ts_external_token__length_hint] = sym__length_hint, + [ts_external_token_value] = sym_value, + [ts_external_token__error_sentinel] = sym__error_sentinel, +}; + +static const bool ts_external_scanner_states[5][EXTERNAL_TOKEN_COUNT] = { + [1] = { + [ts_external_token__long_marker] = true, + [ts_external_token__compact_marker] = true, + [ts_external_token__length_hint] = true, + [ts_external_token_value] = true, + [ts_external_token__error_sentinel] = true, + }, + [2] = { + [ts_external_token__long_marker] = true, + [ts_external_token__compact_marker] = true, + }, + [3] = { + [ts_external_token__length_hint] = true, + }, + [4] = { + [ts_external_token_value] = true, + }, }; #ifdef __cplusplus extern "C" { #endif +void *tree_sitter_srf_external_scanner_create(void); +void tree_sitter_srf_external_scanner_destroy(void *); +bool tree_sitter_srf_external_scanner_scan(void *, TSLexer *, const bool *); +unsigned tree_sitter_srf_external_scanner_serialize(void *, char *); +void tree_sitter_srf_external_scanner_deserialize(void *, const char *, unsigned); + #ifdef TREE_SITTER_HIDE_SYMBOLS #define TS_PUBLIC #elif defined(_WIN32) @@ -1901,6 +2088,15 @@ TS_PUBLIC const TSLanguage *tree_sitter_srf(void) { .alias_sequences = &ts_alias_sequences[0][0], .lex_modes = (const void*)ts_lex_modes, .lex_fn = ts_lex, + .external_scanner = { + &ts_external_scanner_states[0][0], + ts_external_scanner_symbol_map, + tree_sitter_srf_external_scanner_create, + tree_sitter_srf_external_scanner_destroy, + tree_sitter_srf_external_scanner_scan, + tree_sitter_srf_external_scanner_serialize, + tree_sitter_srf_external_scanner_deserialize, + }, .primary_state_ids = ts_primary_state_ids, .name = "srf", .max_reserved_word_set_size = 0, diff --git a/src/scanner.c b/src/scanner.c new file mode 100644 index 0000000..0b5ebe7 --- /dev/null +++ b/src/scanner.c @@ -0,0 +1,255 @@ +/** + * @file External scanner for the SRF grammar + * @author Emil Lerch + * @license MIT + * + * SRF's field delimiter is not fixed by the syntax: it is ',' in compact + * format (the default) and '\n' after a `#!long` directive. On top of that, a + * numeric type hint (`key:7:foo`) means "the value is exactly 7 bytes", + * newlines included. Neither is expressible in a context-free grammar, so the + * mode-sensitive tokens live here and everything else stays in grammar.js. + * + * Tokens produced: + * LONG_MARKER `#!long` - flips the scanner into long mode + * COMPACT_MARKER `#!compact` - flips the scanner back into compact mode + * LENGTH_HINT digits in the type hint slot; records the byte count + * VALUE a field value, delimited by mode or by a pending length + * + * ERROR_SENTINEL is never returned. It is only valid during error recovery + * (when tree-sitter marks every token valid), which is our cue to bail out + * without touching scanner state. + */ + +#include "tree_sitter/alloc.h" +#include "tree_sitter/parser.h" + +enum TokenType { + LONG_MARKER, + COMPACT_MARKER, + LENGTH_HINT, + VALUE, + ERROR_SENTINEL, +}; + +/// Reject absurd length hints rather than letting a typo scan its way through +/// the rest of the buffer. 16MiB is far past any sane single SRF value. +#define MAX_VALUE_LENGTH (16u * 1024u * 1024u) + +typedef struct { + /// false means compact format, which is the SRF default. + bool long_mode; + /// Set by LENGTH_HINT, consumed by the next VALUE. + bool has_length; + uint32_t length; +} Scanner; + +/// Number of UTF-8 bytes the given codepoint occupies. Length hints count +/// bytes, but `lexer->lookahead` hands us decoded codepoints. +static inline uint32_t utf8_length(int32_t codepoint) { + if (codepoint < 0x80) return 1; + if (codepoint < 0x800) return 2; + if (codepoint < 0x10000) return 3; + return 4; +} + +static inline bool at_directive_boundary(TSLexer *lexer) { + return lexer->eof(lexer) || lexer->lookahead == '\n' || + lexer->lookahead == ' ' || lexer->lookahead == '\t'; +} + +/// Consumes the remaining characters of a directive keyword, which must be +/// followed by end of directive so that `#!longhand` is not mistaken for +/// `#!long`. Advances the lexer as it goes, so a false return leaves the lexer +/// mid-keyword; only ever call it on a path that returns false all the way out. +static bool match_keyword_tail(TSLexer *lexer, const char *tail) { + for (const char *c = tail; *c != '\0'; c++) { + if (lexer->lookahead != (int32_t)*c) return false; + lexer->advance(lexer, false); + } + return at_directive_boundary(lexer); +} + +/// `#!long` or `#!compact`. Both are usually valid at the same position and +/// the scanner cannot rewind, so this matches the shared `#!` prefix once and +/// then branches on the character that distinguishes them. +static bool scan_format_marker(Scanner *scanner, TSLexer *lexer, + const bool *valid_symbols) { + if (lexer->lookahead != '#') return false; + lexer->advance(lexer, false); + if (lexer->lookahead != '!') return false; + lexer->advance(lexer, false); + + if (valid_symbols[LONG_MARKER] && lexer->lookahead == 'l') { + lexer->advance(lexer, false); + if (!match_keyword_tail(lexer, "ong")) return false; + scanner->long_mode = true; + lexer->result_symbol = LONG_MARKER; + return true; + } + + if (valid_symbols[COMPACT_MARKER] && lexer->lookahead == 'c') { + lexer->advance(lexer, false); + if (!match_keyword_tail(lexer, "ompact")) return false; + scanner->long_mode = false; + lexer->result_symbol = COMPACT_MARKER; + return true; + } + + return false; +} + +/// A run of digits in the type hint slot, e.g. the `7` of `key:7:value`. +/// The token ends at the last digit; the optional whitespace and the ':' that +/// follow are matched by the grammar, so we only look past them to confirm we +/// really are in a type hint slot. +static bool scan_length_hint(Scanner *scanner, TSLexer *lexer) { + if (lexer->lookahead < '0' || lexer->lookahead > '9') return false; + + uint32_t length = 0; + while (lexer->lookahead >= '0' && lexer->lookahead <= '9') { + length = length * 10 + (uint32_t)(lexer->lookahead - '0'); + if (length > MAX_VALUE_LENGTH) return false; + lexer->advance(lexer, false); + } + lexer->mark_end(lexer); + + while (lexer->lookahead == ' ' || lexer->lookahead == '\t') { + lexer->advance(lexer, false); + } + if (lexer->lookahead != ':') return false; + + // `key:0:` is an empty value, which is the same thing as no value at all, so + // leave the pending length unset and let the delimited scan decline. This + // also keeps the invariant below intact: a pending length always produces a + // value token, so it always gets cleared. + if (length > 0) { + scanner->has_length = true; + scanner->length = length; + } + lexer->result_symbol = LENGTH_HINT; + return true; +} + +/// Exactly `scanner->length` bytes, newlines and all. Stops rather than +/// straddling a codepoint boundary when the length is wrong; the field +/// terminator the grammar then demands will be missing, which surfaces the bad +/// length as an error instead of silently eating the file. +/// +/// Note this is stricter than the reference parser in long format, where a +/// length shorter than the rest of the line leaves trailing bytes that the +/// parser skips along with the rest of the line. Here those bytes have nowhere +/// to go, so `key:5:hello world` is flagged. Compact format rejects it in the +/// reference parser too, and either way the length is wrong. +static bool scan_length_prefixed_value(Scanner *scanner, TSLexer *lexer) { + uint32_t remaining = scanner->length; + bool consumed = false; + + while (remaining > 0 && !lexer->eof(lexer)) { + uint32_t width = utf8_length(lexer->lookahead); + if (width > remaining) break; + remaining -= width; + lexer->advance(lexer, false); + consumed = true; + } + + // Only reachable at EOF, i.e. a truncated file. Nothing follows, so leaving + // the pending length set cannot mislead a later token. + if (!consumed) return false; + + scanner->has_length = false; + scanner->length = 0; + lexer->result_symbol = VALUE; + return true; +} + +/// Everything up to the delimiter for the current mode: end of line in long +/// mode, end of line or a comma in compact mode. +static bool scan_delimited_value(const Scanner *scanner, TSLexer *lexer) { + bool consumed = false; + + while (!lexer->eof(lexer) && lexer->lookahead != '\n') { + if (!scanner->long_mode && lexer->lookahead == ',') break; + lexer->advance(lexer, false); + consumed = true; + } + + if (!consumed) return false; + lexer->result_symbol = VALUE; + return true; +} + +void *tree_sitter_srf_external_scanner_create(void) { + return ts_calloc(1, sizeof(Scanner)); +} + +void tree_sitter_srf_external_scanner_destroy(void *payload) { + ts_free(payload); +} + +unsigned tree_sitter_srf_external_scanner_serialize(void *payload, char *buffer) { + Scanner *scanner = (Scanner *)payload; + buffer[0] = (char)scanner->long_mode; + buffer[1] = (char)scanner->has_length; + buffer[2] = (char)(scanner->length & 0xff); + buffer[3] = (char)((scanner->length >> 8) & 0xff); + buffer[4] = (char)((scanner->length >> 16) & 0xff); + buffer[5] = (char)((scanner->length >> 24) & 0xff); + return 6; +} + +void tree_sitter_srf_external_scanner_deserialize(void *payload, const char *buffer, + unsigned length) { + Scanner *scanner = (Scanner *)payload; + + // Called with length 0 to reset the scanner to its initial state, which for + // SRF is compact format with no pending length. + scanner->long_mode = false; + scanner->has_length = false; + scanner->length = 0; + if (length < 6) return; + + scanner->long_mode = buffer[0] != 0; + scanner->has_length = buffer[1] != 0; + scanner->length = (uint32_t)(unsigned char)buffer[2] | + ((uint32_t)(unsigned char)buffer[3] << 8) | + ((uint32_t)(unsigned char)buffer[4] << 16) | + ((uint32_t)(unsigned char)buffer[5] << 24); +} + +bool tree_sitter_srf_external_scanner_scan(void *payload, TSLexer *lexer, + const bool *valid_symbols) { + Scanner *scanner = (Scanner *)payload; + + // Error recovery marks every symbol valid. Producing tokens (and flipping + // format mode) off the back of that would be guesswork, so leave it to the + // internal lexer's recovery. + if (valid_symbols[ERROR_SENTINEL]) return false; + + // Scanner state only survives when we return true, because tree-sitter + // serialises after a produced token and not after a declined one. So state is + // never cleared on a bail-out path; instead a pending length is guaranteed to + // be consumed by the very next token (see scan_length_hint). + + // Whitespace is never skipped here: `_ws` handles indentation in the + // grammar, and leading whitespace inside a value is significant. + if (lexer->lookahead == '#' && + (valid_symbols[LONG_MARKER] || valid_symbols[COMPACT_MARKER])) { + // A direct return rather than a fall-through: scan_format_marker advances + // past `#!` before it can fail, so the lexer is no longer at the token + // start and a value scan from here would produce garbage. Returning false + // resets the lexer to the token start, letting the internal lexer have a go + // at `#!created=`, a misspelled marker, a comment, and so on. + return scan_format_marker(scanner, lexer, valid_symbols); + } + + if (valid_symbols[LENGTH_HINT] && scan_length_hint(scanner, lexer)) { + return true; + } + + if (valid_symbols[VALUE]) { + if (scanner->has_length) return scan_length_prefixed_value(scanner, lexer); + return scan_delimited_value(scanner, lexer); + } + + return false; +} diff --git a/test/corpus/basics.txt b/test/corpus/basics.txt index 6c52e48..eb46df8 100644 --- a/test/corpus/basics.txt +++ b/test/corpus/basics.txt @@ -1,7 +1,6 @@ ================== Basic long format ================== - #!srfv1 #!long name::alice @@ -10,7 +9,6 @@ age:num:30 --- (document - (blank_line) (magic) (directive (directive_long)) @@ -27,14 +25,12 @@ age:num:30 ================== Basic compact format ================== - #!srfv1 name::alice,age:num:30 --- (document - (blank_line) (magic) (field (untyped_field @@ -49,7 +45,6 @@ name::alice,age:num:30 ================== Directives ================== - #!srfv1 #!requireeof #!long @@ -63,7 +58,6 @@ name::alice --- (document - (blank_line) (magic) (directive (directive_requireeof)) @@ -89,7 +83,6 @@ name::alice ================== Comments ================== - #!srfv1 # This is a comment name::alice @@ -97,7 +90,6 @@ name::alice --- (document - (blank_line) (magic) (comment) (field @@ -108,7 +100,6 @@ name::alice ================== All type hints ================== - #!srfv1 name:string:alice age:num:30 @@ -120,7 +111,6 @@ bio:12:hello world! --- (document - (blank_line) (magic) (field (typed_field @@ -155,7 +145,6 @@ bio:12:hello world! ================== Inline comments on directives ================== - #!srfv1 # version header #!long # use long format name::alice @@ -163,7 +152,6 @@ name::alice --- (document - (blank_line) (magic (inline_comment)) (directive @@ -177,7 +165,6 @@ name::alice ================== Multiple records long format ================== - #!srfv1 #!long name::alice @@ -189,7 +176,6 @@ age:num:25 --- (document - (blank_line) (magic) (directive (directive_long)) diff --git a/test/corpus/compact_format.txt b/test/corpus/compact_format.txt new file mode 100644 index 0000000..27cb274 --- /dev/null +++ b/test/corpus/compact_format.txt @@ -0,0 +1,201 @@ +================== +Commas delimit fields by default +================== +#!srfv1 +name::alice,age:num:30 +name::bob,age:num:25 + +--- + +(document + (magic) + (field + (untyped_field + (key) + (value))) + (field + (typed_field + (key) + (type_hint) + (value))) + (field + (untyped_field + (key) + (value))) + (field + (typed_field + (key) + (type_hint) + (value)))) + +================== +Explicit compact directive +================== +#!srfv1 +#!compact +name::alice,age:num:30 + +--- + +(document + (magic) + (directive + (directive_compact)) + (field + (untyped_field + (key) + (value))) + (field + (typed_field + (key) + (type_hint) + (value)))) + +================== +Last format directive wins +================== +#!srfv1 +#!long +#!compact +name::alice,age:num:30 + +--- + +(document + (magic) + (directive + (directive_long)) + (directive + (directive_compact)) + (field + (untyped_field + (key) + (value))) + (field + (typed_field + (key) + (type_hint) + (value)))) + +================== +Directives sharing a prefix with the format markers +================== +#!srfv1 +#!created=1772500000 +#!longhand=1 +#!compaction=1 +name::alice,age:num:30 + +--- + +(document + (magic) + (directive + (directive_created + value: (timestamp))) + (directive + (directive_unknown)) + (directive + (directive_unknown)) + (field + (untyped_field + (key) + (value))) + (field + (typed_field + (key) + (type_hint) + (value)))) + +================== +A format marker inside an inline comment is not a directive +================== +#!srfv1 +#!long # compact format is optional #!compact +name::alice, bob + +--- + +(document + (magic) + (directive + (directive_long + (inline_comment))) + (field + (untyped_field + (key) + (value)))) + +================== +A format marker in a value is not a directive +================== +#!srfv1 +k::#!long,j::#!compact +name::alice,age:num:30 + +--- + +(document + (magic) + (field + (untyped_field + (key) + (value))) + (field + (untyped_field + (key) + (value))) + (field + (untyped_field + (key) + (value))) + (field + (typed_field + (key) + (type_hint) + (value)))) + +================== +Compact format from the SRF README +================== +#!srfv1 # mandatory comment with format and version. Parser instructions start with #! +key::string value must have a length between colons or end with a comma,this is a number:num:5 ,null value:null:,array::array's don't exist. Use json or toml or something,data with newlines must have a length:7:foo +bar,boolean value:bool:false +key::this is the second record + +--- + +(document + (magic + (inline_comment)) + (field + (untyped_field + (key) + (value))) + (field + (typed_field + (key) + (type_hint) + (value))) + (field + (typed_field + (key) + (type_hint))) + (field + (untyped_field + (key) + (value))) + (field + (typed_field + (key) + (type_hint) + (value))) + (field + (typed_field + (key) + (type_hint) + (value))) + (field + (untyped_field + (key) + (value)))) diff --git a/test/corpus/errors.txt b/test/corpus/errors.txt new file mode 100644 index 0000000..0e14497 --- /dev/null +++ b/test/corpus/errors.txt @@ -0,0 +1,58 @@ +================== +Line with no colon +:error +================== +#!srfv1 +#!long +garbage +name::alice + +--- + +================== +Empty key +:error +================== +#!srfv1 +#!long +::value + +--- + +================== +Length hint beyond the sanity limit +:error +================== +#!srfv1 +#!long +k:99999999999:v + +--- + +================== +Length hint splitting a multi-byte character +:error +================== +#!srfv1 +#!long +yen:1:¥ + +--- + +================== +Unterminated final line +:error +================== +#!srfv1 +#!long +name::alice +--- + +================== +Trailing field separator in compact format +:error +================== +#!srfv1 +name::alice, + +--- diff --git a/test/corpus/length_prefixed.txt b/test/corpus/length_prefixed.txt new file mode 100644 index 0000000..e93a65c --- /dev/null +++ b/test/corpus/length_prefixed.txt @@ -0,0 +1,155 @@ +================== +Length-prefixed value spanning lines +================== +#!srfv1 +#!long +data with newlines must have a length:7:foo +bar +name::alice + +--- + +(document + (magic) + (directive + (directive_long)) + (field + (typed_field + (key) + (type_hint) + (value))) + (field + (untyped_field + (key) + (value)))) + +================== +Length-prefixed value from the SRF type table +================== +#!srfv1 +#!long +bio:12:hello +world! + +--- + +(document + (magic) + (directive + (directive_long)) + (field + (typed_field + (key) + (type_hint) + (value)))) + +================== +Length-prefixed value containing commas in compact format +================== +#!srfv1 +k:5:a,b,c,next::x + +--- + +(document + (magic) + (field + (typed_field + (key) + (type_hint) + (value))) + (field + (untyped_field + (key) + (value)))) + +================== +Length counts bytes, not characters +================== +#!srfv1 +#!long +yen:3:¥5 +next::ok + +--- + +(document + (magic) + (directive + (directive_long)) + (field + (typed_field + (key) + (type_hint) + (value))) + (field + (untyped_field + (key) + (value)))) + +================== +Length-prefixed value containing field syntax +================== +#!srfv1 +#!long +raw:14:k::not a field +name::alice + +--- + +(document + (magic) + (directive + (directive_long)) + (field + (typed_field + (key) + (type_hint) + (value))) + (field + (untyped_field + (key) + (value)))) + +================== +Zero length is an empty value +================== +#!srfv1 +#!long +empty:0: +name::alice + +--- + +(document + (magic) + (directive + (directive_long)) + (field + (typed_field + (key) + (type_hint))) + (field + (untyped_field + (key) + (value)))) + +================== +Whitespace around a length hint +================== +#!srfv1 +#!long +padded: 7 :foo +bar + +--- + +(document + (magic) + (directive + (directive_long)) + (field + (typed_field + (key) + (type_hint) + (value)))) diff --git a/test/corpus/long_format.txt b/test/corpus/long_format.txt new file mode 100644 index 0000000..8fc9cf6 --- /dev/null +++ b/test/corpus/long_format.txt @@ -0,0 +1,302 @@ +================== +Value containing commas +================== +#!srfv1 +#!long +name::alice, bob and carol +cost:num:$1,000,000,000.42 + +--- + +(document + (magic) + (directive + (directive_long)) + (field + (untyped_field + (key) + (value))) + (field + (typed_field + (key) + (type_hint) + (value)))) + +================== +Key containing a comma +================== +#!srfv1 +#!long +last, first::alice + +--- + +(document + (magic) + (directive + (directive_long)) + (field + (untyped_field + (key) + (value)))) + +================== +Non-ASCII values +================== +#!srfv1 +#!long +tokyo dinner:num:¥15,000 +airbus:num:€410,000,000 + +--- + +(document + (magic) + (directive + (directive_long)) + (field + (typed_field + (key) + (type_hint) + (value))) + (field + (typed_field + (key) + (type_hint) + (value)))) + +================== +Leading whitespace is insignificant +================== +#!srfv1 + #!long + name::alice, bob + # indented comment +age:num:30 + +--- + +(document + (magic) + (directive + (directive_long)) + (field + (untyped_field + (key) + (value))) + (comment) + (field + (typed_field + (key) + (type_hint) + (value)))) + +================== +Whitespace around the type hint +================== +#!srfv1 +#!long +n: num : 5 +m:num:6 + +--- + +(document + (magic) + (directive + (directive_long)) + (field + (typed_field + (key) + (type_hint) + (value))) + (field + (typed_field + (key) + (type_hint) + (value)))) + +================== +Empty values +================== +#!srfv1 +#!long +missing:null: +also missing:: +name::alice + +--- + +(document + (magic) + (directive + (directive_long)) + (field + (typed_field + (key) + (type_hint))) + (field + (untyped_field + (key))) + (field + (untyped_field + (key) + (value)))) + +================== +Values that look like other syntax +================== +#!srfv1 +#!long +url::https://x.example/a?b=1,c=2 +note::alice # not an inline comment +shrug::, + +--- + +(document + (magic) + (directive + (directive_long)) + (field + (untyped_field + (key) + (value))) + (field + (untyped_field + (key) + (value))) + (field + (untyped_field + (key) + (value)))) + +================== +Records separated by blank lines +================== +#!srfv1 +#!long +name::alice, of the alices +age:num:30 + +name::bob, of the bobs +age:num:25 + +--- + +(document + (magic) + (directive + (directive_long)) + (field + (untyped_field + (key) + (value))) + (field + (typed_field + (key) + (type_hint) + (value))) + (blank_line) + (field + (untyped_field + (key) + (value))) + (field + (typed_field + (key) + (type_hint) + (value)))) + +================== +Long format from the SRF README +================== +#!srfv1 # mandatory comment with format and version. Parser instructions start with #! +#!requireeof # Set this if you want parsing to fail when #!eof not present on last line +#!long # Mandatory to use multiline records, compact format is optional #!compact +# A comment +# empty lines ignored + +key::string value, with any data except a \n. an optional string length between the colons +this is a number:num: 5 +null value:null: +array::array's don't exist. Use json or toml or something +data with newlines must have a length:7:foo +bar +boolean value:bool:false + + # Empty line separates records, but comments don't count as empty +key::this is the second record +this is a number:num:42 +null value:null: +array::array's still don't exist +data with newlines must have a length::single line +#!eof # eof marker, useful to make sure your file wasn't cut in half. Only considered if requireeof set at top + +--- + +(document + (magic + (inline_comment)) + (directive + (directive_requireeof + (inline_comment))) + (directive + (directive_long + (inline_comment))) + (comment) + (comment) + (blank_line) + (field + (untyped_field + (key) + (value))) + (field + (typed_field + (key) + (type_hint) + (value))) + (field + (typed_field + (key) + (type_hint))) + (field + (untyped_field + (key) + (value))) + (field + (typed_field + (key) + (type_hint) + (value))) + (field + (typed_field + (key) + (type_hint) + (value))) + (blank_line) + (comment) + (field + (untyped_field + (key) + (value))) + (field + (typed_field + (key) + (type_hint) + (value))) + (field + (typed_field + (key) + (type_hint))) + (field + (untyped_field + (key) + (value))) + (field + (untyped_field + (key) + (value))) + (directive + (directive_eof + (inline_comment))))