From 21b5fad6f0785adce5d4f841ef3f09491b7cfcd7 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Mon, 11 Jun 2018 16:56:33 -0700 Subject: [PATCH] Add raw text elements and doctypes Co-Authored-By: Ashi Krishnan --- corpus/main.txt | 47 ++ grammar.js | 25 +- src/grammar.json | 87 +++ src/parser.c | 1422 +++++++++++++++++++++++++++++++--------------- src/scanner.cc | 36 +- src/tag.h | 4 + 6 files changed, 1156 insertions(+), 465 deletions(-) diff --git a/corpus/main.txt b/corpus/main.txt index be9be4f..3099359 100644 --- a/corpus/main.txt +++ b/corpus/main.txt @@ -87,3 +87,50 @@ Comments (start_tag) (comment) (end_tag))) + +================================== +Raw text elements +================================== + + + + + +--- + +(fragment + (raw_element + (start_tag) + (end_tag)) + (raw_element + (start_tag) + (end_tag)) + (text)) + +================================== +All-caps doctype +================================== + +--- + +(fragment + (doctype)) + +================================== +Lowercase doctype +================================== + +--- + +(fragment + (doctype)) diff --git a/grammar.js b/grammar.js index 536ce49..f73d13c 100644 --- a/grammar.js +++ b/grammar.js @@ -8,21 +8,32 @@ module.exports = grammar({ externals: $ => [ $._open_start_tag, + $._open_raw_start_tag, $._close_start_tag, $._self_close_start_tag, $.end_tag, $._implicit_end_tag, $._erroneous_end_tag, + $._raw_text, $.comment, ], rules: { fragment: $ => repeat($._node), + doctype: $ => seq( + ']+/, + '>' + ), + _node: $ => choice( + $.doctype, $.text, $._erroneous_end_tag, - $.element + $.element, + $.raw_element ), element: $ => choice( @@ -34,12 +45,24 @@ module.exports = grammar({ $.self_closing_tag ), + raw_element: $ => seq( + alias($._raw_start_tag, $.start_tag), + optional($._raw_text), + $.end_tag + ), + start_tag: $ => seq( $._open_start_tag, repeat($.attribute), $._close_start_tag ), + _raw_start_tag: $ => seq( + $._open_raw_start_tag, + repeat($.attribute), + $._close_start_tag + ), + self_closing_tag: $ => seq( $._open_start_tag, repeat($.attribute), diff --git a/src/grammar.json b/src/grammar.json index 542482d..f0cfbca 100644 --- a/src/grammar.json +++ b/src/grammar.json @@ -8,9 +8,34 @@ "name": "_node" } }, + "doctype": { + "type": "SEQ", + "members": [ + { + "type": "STRING", + "value": "]+" + }, + { + "type": "STRING", + "value": ">" + } + ] + }, "_node": { "type": "CHOICE", "members": [ + { + "type": "SYMBOL", + "name": "doctype" + }, { "type": "SYMBOL", "name": "text" @@ -22,6 +47,10 @@ { "type": "SYMBOL", "name": "element" + }, + { + "type": "SYMBOL", + "name": "raw_element" } ] }, @@ -63,6 +92,36 @@ } ] }, + "raw_element": { + "type": "SEQ", + "members": [ + { + "type": "ALIAS", + "content": { + "type": "SYMBOL", + "name": "_raw_start_tag" + }, + "named": true, + "value": "start_tag" + }, + { + "type": "CHOICE", + "members": [ + { + "type": "SYMBOL", + "name": "_raw_text" + }, + { + "type": "BLANK" + } + ] + }, + { + "type": "SYMBOL", + "name": "end_tag" + } + ] + }, "start_tag": { "type": "SEQ", "members": [ @@ -83,6 +142,26 @@ } ] }, + "_raw_start_tag": { + "type": "SEQ", + "members": [ + { + "type": "SYMBOL", + "name": "_open_raw_start_tag" + }, + { + "type": "REPEAT", + "content": { + "type": "SYMBOL", + "name": "attribute" + } + }, + { + "type": "SYMBOL", + "name": "_close_start_tag" + } + ] + }, "self_closing_tag": { "type": "SEQ", "members": [ @@ -236,6 +315,10 @@ "type": "SYMBOL", "name": "_open_start_tag" }, + { + "type": "SYMBOL", + "name": "_open_raw_start_tag" + }, { "type": "SYMBOL", "name": "_close_start_tag" @@ -256,6 +339,10 @@ "type": "SYMBOL", "name": "_erroneous_end_tag" }, + { + "type": "SYMBOL", + "name": "_raw_text" + }, { "type": "SYMBOL", "name": "comment" diff --git a/src/parser.c b/src/parser.c index 73efc11..82900a1 100644 --- a/src/parser.c +++ b/src/parser.c @@ -6,50 +6,66 @@ #endif #define LANGUAGE_VERSION 8 -#define STATE_COUNT 36 -#define SYMBOL_COUNT 25 -#define ALIAS_COUNT 1 -#define TOKEN_COUNT 16 -#define EXTERNAL_TOKEN_COUNT 7 +#define STATE_COUNT 68 +#define SYMBOL_COUNT 34 +#define ALIAS_COUNT 2 +#define TOKEN_COUNT 22 +#define EXTERNAL_TOKEN_COUNT 9 #define MAX_ALIAS_SEQUENCE_LENGTH 3 enum { sym__open_start_tag = 1, - sym__close_start_tag = 2, - sym__self_close_start_tag = 3, - sym_end_tag = 4, - sym__implicit_end_tag = 5, - sym__erroneous_end_tag = 6, - sym_comment = 7, - anon_sym_EQ = 8, - sym_attribute_name = 9, - sym_attribute_value = 10, - anon_sym_SQUOTE = 11, - aux_sym_SLASH_LBRACK_CARET_SQUOTE_RBRACK_PLUS_SLASH = 12, - anon_sym_DQUOTE = 13, - aux_sym_SLASH_LBRACK_CARET_DQUOTE_RBRACK_PLUS_SLASH = 14, - sym_text = 15, - sym_fragment = 16, - sym__node = 17, - sym_element = 18, - sym_start_tag = 19, - sym_self_closing_tag = 20, - sym_attribute = 21, - sym_quoted_attribute_value = 22, - aux_sym_fragment_repeat1 = 23, - aux_sym_start_tag_repeat1 = 24, - alias_sym_attribute_value = 25, + sym__open_raw_start_tag = 2, + sym__close_start_tag = 3, + sym__self_close_start_tag = 4, + sym_end_tag = 5, + sym__implicit_end_tag = 6, + sym__erroneous_end_tag = 7, + sym__raw_text = 8, + sym_comment = 9, + anon_sym_LT_BANG = 10, + aux_sym_SLASH_LBRACKDd_RBRACK_LBRACKOo_RBRACK_LBRACKCc_RBRACK_LBRACKTt_RBRACK_LBRACKYy_RBRACK_LBRACKPp_RBRACK_LBRACKEe_RBRACK_SLASH = 11, + aux_sym_SLASH_LBRACK_CARET_GT_RBRACK_PLUS_SLASH = 12, + anon_sym_GT = 13, + anon_sym_EQ = 14, + sym_attribute_name = 15, + sym_attribute_value = 16, + anon_sym_SQUOTE = 17, + aux_sym_SLASH_LBRACK_CARET_SQUOTE_RBRACK_PLUS_SLASH = 18, + anon_sym_DQUOTE = 19, + aux_sym_SLASH_LBRACK_CARET_DQUOTE_RBRACK_PLUS_SLASH = 20, + sym_text = 21, + sym_fragment = 22, + sym_doctype = 23, + sym__node = 24, + sym_element = 25, + sym_raw_element = 26, + sym_start_tag = 27, + sym__raw_start_tag = 28, + sym_self_closing_tag = 29, + sym_attribute = 30, + sym_quoted_attribute_value = 31, + aux_sym_fragment_repeat1 = 32, + aux_sym_start_tag_repeat1 = 33, + alias_sym_attribute_value = 34, + alias_sym_start_tag = 35, }; static const char *ts_symbol_names[] = { [sym__open_start_tag] = "_open_start_tag", + [sym__open_raw_start_tag] = "_open_raw_start_tag", [sym__close_start_tag] = "_close_start_tag", [sym__self_close_start_tag] = "_self_close_start_tag", [sym_end_tag] = "end_tag", [sym__implicit_end_tag] = "_implicit_end_tag", [sym__erroneous_end_tag] = "_erroneous_end_tag", + [sym__raw_text] = "_raw_text", [sym_comment] = "comment", [ts_builtin_sym_end] = "END", + [anon_sym_LT_BANG] = "]+/", + [anon_sym_GT] = ">", [anon_sym_EQ] = "=", [sym_attribute_name] = "attribute_name", [sym_attribute_value] = "attribute_value", @@ -59,15 +75,19 @@ static const char *ts_symbol_names[] = { [aux_sym_SLASH_LBRACK_CARET_DQUOTE_RBRACK_PLUS_SLASH] = "/[^\"]+/", [sym_text] = "text", [sym_fragment] = "fragment", + [sym_doctype] = "doctype", [sym__node] = "_node", [sym_element] = "element", + [sym_raw_element] = "raw_element", [sym_start_tag] = "start_tag", + [sym__raw_start_tag] = "_raw_start_tag", [sym_self_closing_tag] = "self_closing_tag", [sym_attribute] = "attribute", [sym_quoted_attribute_value] = "quoted_attribute_value", [aux_sym_fragment_repeat1] = "fragment_repeat1", [aux_sym_start_tag_repeat1] = "start_tag_repeat1", [alias_sym_attribute_value] = "attribute_value", + [alias_sym_start_tag] = "start_tag", }; static const TSSymbolMetadata ts_symbol_metadata[] = { @@ -75,6 +95,10 @@ static const TSSymbolMetadata ts_symbol_metadata[] = { .visible = false, .named = true, }, + [sym__open_raw_start_tag] = { + .visible = false, + .named = true, + }, [sym__close_start_tag] = { .visible = false, .named = true, @@ -95,6 +119,10 @@ static const TSSymbolMetadata ts_symbol_metadata[] = { .visible = false, .named = true, }, + [sym__raw_text] = { + .visible = false, + .named = true, + }, [sym_comment] = { .visible = true, .named = true, @@ -103,6 +131,22 @@ static const TSSymbolMetadata ts_symbol_metadata[] = { .visible = false, .named = true, }, + [anon_sym_LT_BANG] = { + .visible = true, + .named = false, + }, + [aux_sym_SLASH_LBRACKDd_RBRACK_LBRACKOo_RBRACK_LBRACKCc_RBRACK_LBRACKTt_RBRACK_LBRACKYy_RBRACK_LBRACKPp_RBRACK_LBRACKEe_RBRACK_SLASH] = { + .visible = false, + .named = false, + }, + [aux_sym_SLASH_LBRACK_CARET_GT_RBRACK_PLUS_SLASH] = { + .visible = false, + .named = false, + }, + [anon_sym_GT] = { + .visible = true, + .named = false, + }, [anon_sym_EQ] = { .visible = true, .named = false, @@ -139,6 +183,10 @@ static const TSSymbolMetadata ts_symbol_metadata[] = { .visible = true, .named = true, }, + [sym_doctype] = { + .visible = true, + .named = true, + }, [sym__node] = { .visible = false, .named = true, @@ -147,10 +195,18 @@ static const TSSymbolMetadata ts_symbol_metadata[] = { .visible = true, .named = true, }, + [sym_raw_element] = { + .visible = true, + .named = true, + }, [sym_start_tag] = { .visible = true, .named = true, }, + [sym__raw_start_tag] = { + .visible = false, + .named = true, + }, [sym_self_closing_tag] = { .visible = true, .named = true, @@ -175,10 +231,17 @@ static const TSSymbolMetadata ts_symbol_metadata[] = { .visible = true, .named = true, }, + [alias_sym_start_tag] = { + .visible = true, + .named = true, + }, }; -static TSSymbol ts_alias_sequences[2][MAX_ALIAS_SEQUENCE_LENGTH] = { +static TSSymbol ts_alias_sequences[3][MAX_ALIAS_SEQUENCE_LENGTH] = { [1] = { + [0] = alias_sym_start_tag, + }, + [2] = { [1] = alias_sym_attribute_value, }, }; @@ -193,17 +256,20 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) { ADVANCE(2); if (lookahead == '\'') ADVANCE(3); - if (lookahead == '/') + if (lookahead == '<') ADVANCE(4); if (lookahead == '=') - ADVANCE(5); + ADVANCE(6); + if (lookahead == '>') + ADVANCE(7); + if (lookahead == 'D' || + lookahead == 'd') + ADVANCE(8); if (lookahead == '\t' || lookahead == '\n' || lookahead == '\r' || lookahead == ' ') SKIP(0); - if ((lookahead < '<' || lookahead > '>')) - ADVANCE(6); END_STATE(); case 1: ACCEPT_TOKEN(ts_builtin_sym_end); @@ -215,6 +281,185 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) { ACCEPT_TOKEN(anon_sym_SQUOTE); END_STATE(); case 4: + if (lookahead == '!') + ADVANCE(5); + END_STATE(); + case 5: + ACCEPT_TOKEN(anon_sym_LT_BANG); + END_STATE(); + case 6: + ACCEPT_TOKEN(anon_sym_EQ); + END_STATE(); + case 7: + ACCEPT_TOKEN(anon_sym_GT); + END_STATE(); + case 8: + if (lookahead == 'O' || + lookahead == 'o') + ADVANCE(9); + END_STATE(); + case 9: + if (lookahead == 'C' || + lookahead == 'c') + ADVANCE(10); + END_STATE(); + case 10: + if (lookahead == 'T' || + lookahead == 't') + ADVANCE(11); + END_STATE(); + case 11: + if (lookahead == 'Y' || + lookahead == 'y') + ADVANCE(12); + END_STATE(); + case 12: + if (lookahead == 'P' || + lookahead == 'p') + ADVANCE(13); + END_STATE(); + case 13: + if (lookahead == 'E' || + lookahead == 'e') + ADVANCE(14); + END_STATE(); + case 14: + ACCEPT_TOKEN(aux_sym_SLASH_LBRACKDd_RBRACK_LBRACKOo_RBRACK_LBRACKCc_RBRACK_LBRACKTt_RBRACK_LBRACKYy_RBRACK_LBRACKPp_RBRACK_LBRACKEe_RBRACK_SLASH); + END_STATE(); + case 15: + if (lookahead == 0) + ADVANCE(1); + if (lookahead == '<') + ADVANCE(4); + if (lookahead == '\t' || + lookahead == '\n' || + lookahead == '\r' || + lookahead == ' ') + ADVANCE(16); + if (lookahead != '>') + ADVANCE(17); + END_STATE(); + case 16: + ACCEPT_TOKEN(sym_text); + if (lookahead == '\t' || + lookahead == '\n' || + lookahead == '\r' || + lookahead == ' ') + ADVANCE(16); + if (lookahead != 0 && + lookahead != '<' && + lookahead != '>') + ADVANCE(17); + END_STATE(); + case 17: + ACCEPT_TOKEN(sym_text); + if (lookahead != 0 && + lookahead != '<' && + lookahead != '>') + ADVANCE(17); + END_STATE(); + case 18: + if (lookahead == '\t' || + lookahead == '\n' || + lookahead == '\r' || + lookahead == ' ') + SKIP(18); + if (lookahead != 0 && + lookahead != '\"' && + lookahead != '\'' && + lookahead != '/' && + (lookahead < '<' || lookahead > '>')) + ADVANCE(19); + END_STATE(); + case 19: + ACCEPT_TOKEN(sym_attribute_name); + if (lookahead != 0 && + lookahead != '\t' && + lookahead != '\n' && + lookahead != '\r' && + lookahead != ' ' && + lookahead != '\"' && + lookahead != '\'' && + lookahead != '/' && + (lookahead < '<' || lookahead > '>')) + ADVANCE(19); + END_STATE(); + case 20: + if (lookahead == 'D' || + lookahead == 'd') + ADVANCE(8); + if (lookahead == '\t' || + lookahead == '\n' || + lookahead == '\r' || + lookahead == ' ') + SKIP(20); + END_STATE(); + case 21: + if (lookahead == 0) + ADVANCE(1); + if (lookahead == '\t' || + lookahead == '\n' || + lookahead == '\r' || + lookahead == ' ') + SKIP(21); + END_STATE(); + case 22: + if (lookahead == '=') + ADVANCE(6); + if (lookahead == '\t' || + lookahead == '\n' || + lookahead == '\r' || + lookahead == ' ') + SKIP(22); + if (lookahead != 0 && + lookahead != '\"' && + lookahead != '\'' && + lookahead != '/' && + (lookahead < '<' || lookahead > '>')) + ADVANCE(19); + END_STATE(); + case 23: + if (lookahead == '\t' || + lookahead == '\n' || + lookahead == '\r' || + lookahead == ' ') + ADVANCE(24); + if (lookahead != 0 && + lookahead != '>') + ADVANCE(25); + END_STATE(); + case 24: + ACCEPT_TOKEN(aux_sym_SLASH_LBRACK_CARET_GT_RBRACK_PLUS_SLASH); + if (lookahead == '\t' || + lookahead == '\n' || + lookahead == '\r' || + lookahead == ' ') + ADVANCE(24); + if (lookahead != 0 && + lookahead != '>') + ADVANCE(25); + END_STATE(); + case 25: + ACCEPT_TOKEN(aux_sym_SLASH_LBRACK_CARET_GT_RBRACK_PLUS_SLASH); + if (lookahead != 0 && + lookahead != '>') + ADVANCE(25); + END_STATE(); + case 26: + if (lookahead == '\"') + ADVANCE(2); + if (lookahead == '\'') + ADVANCE(3); + if (lookahead == '\t' || + lookahead == '\n' || + lookahead == '\r' || + lookahead == ' ') + SKIP(26); + if (lookahead != 0 && + (lookahead < '<' || lookahead > '>')) + ADVANCE(27); + END_STATE(); + case 27: ACCEPT_TOKEN(sym_attribute_value); if (lookahead != 0 && lookahead != '\t' && @@ -224,193 +469,90 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) { lookahead != '\"' && lookahead != '\'' && (lookahead < '<' || lookahead > '>')) - ADVANCE(4); + ADVANCE(27); END_STATE(); - case 5: - ACCEPT_TOKEN(anon_sym_EQ); - END_STATE(); - case 6: - ACCEPT_TOKEN(sym_attribute_name); - if (lookahead == '/') - ADVANCE(4); - if (lookahead != 0 && - lookahead != '\t' && - lookahead != '\n' && - lookahead != '\r' && - lookahead != ' ' && - lookahead != '\"' && - lookahead != '\'' && - (lookahead < '<' || lookahead > '>')) - ADVANCE(6); - END_STATE(); - case 7: - if (lookahead == 0) - ADVANCE(1); + case 28: + if (lookahead == '>') + ADVANCE(7); if (lookahead == '\t' || lookahead == '\n' || lookahead == '\r' || lookahead == ' ') - ADVANCE(8); - if (lookahead != '<' && - lookahead != '>') - ADVANCE(9); + SKIP(28); END_STATE(); - case 8: - ACCEPT_TOKEN(sym_text); - if (lookahead == '\t' || - lookahead == '\n' || - lookahead == '\r' || - lookahead == ' ') - ADVANCE(8); - if (lookahead != 0 && - lookahead != '<' && - lookahead != '>') - ADVANCE(9); - END_STATE(); - case 9: - ACCEPT_TOKEN(sym_text); - if (lookahead != 0 && - lookahead != '<' && - lookahead != '>') - ADVANCE(9); - END_STATE(); - case 10: - if (lookahead == '\t' || - lookahead == '\n' || - lookahead == '\r' || - lookahead == ' ') - SKIP(10); - if (lookahead != 0 && - lookahead != '\"' && - lookahead != '\'' && - lookahead != '/' && - (lookahead < '<' || lookahead > '>')) - ADVANCE(11); - END_STATE(); - case 11: - ACCEPT_TOKEN(sym_attribute_name); - if (lookahead != 0 && - lookahead != '\t' && - lookahead != '\n' && - lookahead != '\r' && - lookahead != ' ' && - lookahead != '\"' && - lookahead != '\'' && - lookahead != '/' && - (lookahead < '<' || lookahead > '>')) - ADVANCE(11); - END_STATE(); - case 12: - if (lookahead == 0) - ADVANCE(1); - if (lookahead == '\t' || - lookahead == '\n' || - lookahead == '\r' || - lookahead == ' ') - SKIP(12); - END_STATE(); - case 13: - if (lookahead == '=') - ADVANCE(5); - if (lookahead == '\t' || - lookahead == '\n' || - lookahead == '\r' || - lookahead == ' ') - SKIP(13); - if (lookahead != 0 && - lookahead != '\"' && - lookahead != '\'' && - lookahead != '/' && - (lookahead < '<' || lookahead > '>')) - ADVANCE(11); - END_STATE(); - case 14: - if (lookahead == '\"') - ADVANCE(2); + case 29: if (lookahead == '\'') ADVANCE(3); if (lookahead == '\t' || lookahead == '\n' || lookahead == '\r' || lookahead == ' ') - SKIP(14); - if (lookahead != 0 && - (lookahead < '<' || lookahead > '>')) - ADVANCE(4); - END_STATE(); - case 15: - if (lookahead == '\'') - ADVANCE(3); - if (lookahead == '\t' || - lookahead == '\n' || - lookahead == '\r' || - lookahead == ' ') - ADVANCE(16); + ADVANCE(30); if (lookahead != 0) - ADVANCE(17); + ADVANCE(31); END_STATE(); - case 16: + case 30: ACCEPT_TOKEN(aux_sym_SLASH_LBRACK_CARET_SQUOTE_RBRACK_PLUS_SLASH); if (lookahead == '\t' || lookahead == '\n' || lookahead == '\r' || lookahead == ' ') - ADVANCE(16); + ADVANCE(30); if (lookahead != 0 && lookahead != '\'') - ADVANCE(17); + ADVANCE(31); END_STATE(); - case 17: + case 31: ACCEPT_TOKEN(aux_sym_SLASH_LBRACK_CARET_SQUOTE_RBRACK_PLUS_SLASH); if (lookahead != 0 && lookahead != '\'') - ADVANCE(17); + ADVANCE(31); END_STATE(); - case 18: + case 32: if (lookahead == '\"') ADVANCE(2); if (lookahead == '\t' || lookahead == '\n' || lookahead == '\r' || lookahead == ' ') - ADVANCE(19); + ADVANCE(33); if (lookahead != 0) - ADVANCE(20); + ADVANCE(34); END_STATE(); - case 19: + case 33: ACCEPT_TOKEN(aux_sym_SLASH_LBRACK_CARET_DQUOTE_RBRACK_PLUS_SLASH); if (lookahead == '\t' || lookahead == '\n' || lookahead == '\r' || lookahead == ' ') - ADVANCE(19); + ADVANCE(33); if (lookahead != 0 && lookahead != '\"') - ADVANCE(20); + ADVANCE(34); END_STATE(); - case 20: + case 34: ACCEPT_TOKEN(aux_sym_SLASH_LBRACK_CARET_DQUOTE_RBRACK_PLUS_SLASH); if (lookahead != 0 && lookahead != '\"') - ADVANCE(20); + ADVANCE(34); END_STATE(); - case 21: + case 35: if (lookahead == '\'') ADVANCE(3); if (lookahead == '\t' || lookahead == '\n' || lookahead == '\r' || lookahead == ' ') - SKIP(21); + SKIP(35); END_STATE(); - case 22: + case 36: if (lookahead == '\"') ADVANCE(2); if (lookahead == '\t' || lookahead == '\n' || lookahead == '\r' || lookahead == ' ') - SKIP(22); + SKIP(36); END_STATE(); default: return false; @@ -419,75 +561,114 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) { static TSLexMode ts_lex_modes[STATE_COUNT] = { [0] = {.lex_state = 0, .external_lex_state = 1}, - [1] = {.lex_state = 7, .external_lex_state = 2}, - [2] = {.lex_state = 10, .external_lex_state = 3}, - [3] = {.lex_state = 12, .external_lex_state = 4}, - [4] = {.lex_state = 7, .external_lex_state = 5}, - [5] = {.lex_state = 7, .external_lex_state = 2}, - [6] = {.lex_state = 7, .external_lex_state = 2}, - [7] = {.lex_state = 7, .external_lex_state = 5}, - [8] = {.lex_state = 7, .external_lex_state = 2}, - [9] = {.lex_state = 13, .external_lex_state = 3}, - [10] = {.lex_state = 10, .external_lex_state = 3}, - [11] = {.lex_state = 10, .external_lex_state = 3}, - [12] = {.lex_state = 7, .external_lex_state = 2}, - [13] = {.lex_state = 7, .external_lex_state = 5}, - [14] = {.lex_state = 7, .external_lex_state = 5}, - [15] = {.lex_state = 7, .external_lex_state = 5}, - [16] = {.lex_state = 7, .external_lex_state = 2}, - [17] = {.lex_state = 14, .external_lex_state = 4}, - [18] = {.lex_state = 7, .external_lex_state = 5}, - [19] = {.lex_state = 7, .external_lex_state = 2}, - [20] = {.lex_state = 10, .external_lex_state = 3}, - [21] = {.lex_state = 7, .external_lex_state = 5}, - [22] = {.lex_state = 10, .external_lex_state = 3}, - [23] = {.lex_state = 7, .external_lex_state = 5}, - [24] = {.lex_state = 7, .external_lex_state = 5}, - [25] = {.lex_state = 7, .external_lex_state = 2}, - [26] = {.lex_state = 7, .external_lex_state = 5}, - [27] = {.lex_state = 10, .external_lex_state = 3}, - [28] = {.lex_state = 15, .external_lex_state = 4}, - [29] = {.lex_state = 18, .external_lex_state = 4}, - [30] = {.lex_state = 7, .external_lex_state = 5}, - [31] = {.lex_state = 7, .external_lex_state = 5}, - [32] = {.lex_state = 10, .external_lex_state = 3}, - [33] = {.lex_state = 21, .external_lex_state = 4}, - [34] = {.lex_state = 22, .external_lex_state = 4}, - [35] = {.lex_state = 10, .external_lex_state = 3}, + [1] = {.lex_state = 15, .external_lex_state = 2}, + [2] = {.lex_state = 18, .external_lex_state = 3}, + [3] = {.lex_state = 18, .external_lex_state = 4}, + [4] = {.lex_state = 20, .external_lex_state = 5}, + [5] = {.lex_state = 21, .external_lex_state = 5}, + [6] = {.lex_state = 15, .external_lex_state = 2}, + [7] = {.lex_state = 15, .external_lex_state = 6}, + [8] = {.lex_state = 21, .external_lex_state = 7}, + [9] = {.lex_state = 15, .external_lex_state = 2}, + [10] = {.lex_state = 15, .external_lex_state = 2}, + [11] = {.lex_state = 15, .external_lex_state = 6}, + [12] = {.lex_state = 15, .external_lex_state = 2}, + [13] = {.lex_state = 22, .external_lex_state = 3}, + [14] = {.lex_state = 18, .external_lex_state = 3}, + [15] = {.lex_state = 21, .external_lex_state = 7}, + [16] = {.lex_state = 22, .external_lex_state = 4}, + [17] = {.lex_state = 18, .external_lex_state = 4}, + [18] = {.lex_state = 23, .external_lex_state = 5}, + [19] = {.lex_state = 18, .external_lex_state = 3}, + [20] = {.lex_state = 15, .external_lex_state = 2}, + [21] = {.lex_state = 20, .external_lex_state = 5}, + [22] = {.lex_state = 15, .external_lex_state = 6}, + [23] = {.lex_state = 15, .external_lex_state = 6}, + [24] = {.lex_state = 21, .external_lex_state = 7}, + [25] = {.lex_state = 15, .external_lex_state = 6}, + [26] = {.lex_state = 15, .external_lex_state = 6}, + [27] = {.lex_state = 15, .external_lex_state = 2}, + [28] = {.lex_state = 21, .external_lex_state = 8}, + [29] = {.lex_state = 15, .external_lex_state = 2}, + [30] = {.lex_state = 26, .external_lex_state = 5}, + [31] = {.lex_state = 15, .external_lex_state = 6}, + [32] = {.lex_state = 15, .external_lex_state = 2}, + [33] = {.lex_state = 18, .external_lex_state = 3}, + [34] = {.lex_state = 26, .external_lex_state = 5}, + [35] = {.lex_state = 21, .external_lex_state = 7}, + [36] = {.lex_state = 18, .external_lex_state = 4}, + [37] = {.lex_state = 28, .external_lex_state = 5}, + [38] = {.lex_state = 15, .external_lex_state = 6}, + [39] = {.lex_state = 18, .external_lex_state = 3}, + [40] = {.lex_state = 23, .external_lex_state = 5}, + [41] = {.lex_state = 15, .external_lex_state = 6}, + [42] = {.lex_state = 15, .external_lex_state = 6}, + [43] = {.lex_state = 15, .external_lex_state = 6}, + [44] = {.lex_state = 21, .external_lex_state = 8}, + [45] = {.lex_state = 15, .external_lex_state = 2}, + [46] = {.lex_state = 15, .external_lex_state = 6}, + [47] = {.lex_state = 15, .external_lex_state = 2}, + [48] = {.lex_state = 18, .external_lex_state = 3}, + [49] = {.lex_state = 29, .external_lex_state = 5}, + [50] = {.lex_state = 32, .external_lex_state = 5}, + [51] = {.lex_state = 18, .external_lex_state = 4}, + [52] = {.lex_state = 29, .external_lex_state = 5}, + [53] = {.lex_state = 32, .external_lex_state = 5}, + [54] = {.lex_state = 15, .external_lex_state = 2}, + [55] = {.lex_state = 15, .external_lex_state = 6}, + [56] = {.lex_state = 28, .external_lex_state = 5}, + [57] = {.lex_state = 15, .external_lex_state = 6}, + [58] = {.lex_state = 15, .external_lex_state = 6}, + [59] = {.lex_state = 18, .external_lex_state = 3}, + [60] = {.lex_state = 35, .external_lex_state = 5}, + [61] = {.lex_state = 36, .external_lex_state = 5}, + [62] = {.lex_state = 18, .external_lex_state = 4}, + [63] = {.lex_state = 35, .external_lex_state = 5}, + [64] = {.lex_state = 36, .external_lex_state = 5}, + [65] = {.lex_state = 15, .external_lex_state = 6}, + [66] = {.lex_state = 18, .external_lex_state = 3}, + [67] = {.lex_state = 18, .external_lex_state = 4}, }; enum { ts_external_token__open_start_tag, + ts_external_token__open_raw_start_tag, ts_external_token__close_start_tag, ts_external_token__self_close_start_tag, ts_external_token_end_tag, ts_external_token__implicit_end_tag, ts_external_token__erroneous_end_tag, + ts_external_token__raw_text, ts_external_token_comment, }; static TSSymbol ts_external_scanner_symbol_map[EXTERNAL_TOKEN_COUNT] = { [ts_external_token__open_start_tag] = sym__open_start_tag, + [ts_external_token__open_raw_start_tag] = sym__open_raw_start_tag, [ts_external_token__close_start_tag] = sym__close_start_tag, [ts_external_token__self_close_start_tag] = sym__self_close_start_tag, [ts_external_token_end_tag] = sym_end_tag, [ts_external_token__implicit_end_tag] = sym__implicit_end_tag, [ts_external_token__erroneous_end_tag] = sym__erroneous_end_tag, + [ts_external_token__raw_text] = sym__raw_text, [ts_external_token_comment] = sym_comment, }; -static bool ts_external_scanner_states[6][EXTERNAL_TOKEN_COUNT] = { +static bool ts_external_scanner_states[9][EXTERNAL_TOKEN_COUNT] = { [1] = { [ts_external_token__open_start_tag] = true, + [ts_external_token__open_raw_start_tag] = true, [ts_external_token__close_start_tag] = true, [ts_external_token__self_close_start_tag] = true, [ts_external_token_end_tag] = true, [ts_external_token__implicit_end_tag] = true, [ts_external_token__erroneous_end_tag] = true, + [ts_external_token__raw_text] = true, [ts_external_token_comment] = true, }, [2] = { [ts_external_token__open_start_tag] = true, + [ts_external_token__open_raw_start_tag] = true, [ts_external_token__erroneous_end_tag] = true, [ts_external_token_comment] = true, }, @@ -497,374 +678,693 @@ static bool ts_external_scanner_states[6][EXTERNAL_TOKEN_COUNT] = { [ts_external_token_comment] = true, }, [4] = { + [ts_external_token__close_start_tag] = true, [ts_external_token_comment] = true, }, [5] = { + [ts_external_token_comment] = true, + }, + [6] = { [ts_external_token__open_start_tag] = true, + [ts_external_token__open_raw_start_tag] = true, [ts_external_token_end_tag] = true, [ts_external_token__implicit_end_tag] = true, [ts_external_token__erroneous_end_tag] = true, [ts_external_token_comment] = true, }, + [7] = { + [ts_external_token_end_tag] = true, + [ts_external_token__raw_text] = true, + [ts_external_token_comment] = true, + }, + [8] = { + [ts_external_token_end_tag] = true, + [ts_external_token_comment] = true, + }, }; static uint16_t ts_parse_table[STATE_COUNT][SYMBOL_COUNT] = { [0] = { [sym__open_start_tag] = ACTIONS(1), + [sym__open_raw_start_tag] = ACTIONS(1), [sym__close_start_tag] = ACTIONS(1), [sym__self_close_start_tag] = ACTIONS(1), [sym_end_tag] = ACTIONS(1), [sym__implicit_end_tag] = ACTIONS(1), [sym__erroneous_end_tag] = ACTIONS(1), + [sym__raw_text] = ACTIONS(1), [sym_comment] = ACTIONS(1), [ts_builtin_sym_end] = ACTIONS(1), + [anon_sym_LT_BANG] = ACTIONS(1), + [aux_sym_SLASH_LBRACKDd_RBRACK_LBRACKOo_RBRACK_LBRACKCc_RBRACK_LBRACKTt_RBRACK_LBRACKYy_RBRACK_LBRACKPp_RBRACK_LBRACKEe_RBRACK_SLASH] = ACTIONS(1), + [anon_sym_GT] = ACTIONS(1), [anon_sym_EQ] = ACTIONS(1), - [sym_attribute_name] = ACTIONS(3), - [sym_attribute_value] = ACTIONS(3), [anon_sym_SQUOTE] = ACTIONS(1), [anon_sym_DQUOTE] = ACTIONS(1), }, [1] = { - [sym_fragment] = STATE(3), + [sym_fragment] = STATE(5), + [sym_doctype] = STATE(6), [sym__node] = STATE(6), [sym_element] = STATE(6), - [sym_start_tag] = STATE(4), - [sym_self_closing_tag] = STATE(5), - [aux_sym_fragment_repeat1] = STATE(6), - [sym__open_start_tag] = ACTIONS(5), + [sym_raw_element] = STATE(6), + [sym_start_tag] = STATE(7), + [sym__raw_start_tag] = STATE(8), + [sym_self_closing_tag] = STATE(9), + [aux_sym_fragment_repeat1] = STATE(10), + [sym__open_start_tag] = ACTIONS(3), + [sym__open_raw_start_tag] = ACTIONS(5), [sym__erroneous_end_tag] = ACTIONS(7), [sym_comment] = ACTIONS(9), [ts_builtin_sym_end] = ACTIONS(11), + [anon_sym_LT_BANG] = ACTIONS(13), [sym_text] = ACTIONS(7), }, [2] = { - [sym_attribute] = STATE(10), - [aux_sym_start_tag_repeat1] = STATE(10), - [sym__close_start_tag] = ACTIONS(13), - [sym__self_close_start_tag] = ACTIONS(15), + [sym_attribute] = STATE(14), + [aux_sym_start_tag_repeat1] = STATE(14), + [sym__close_start_tag] = ACTIONS(15), + [sym__self_close_start_tag] = ACTIONS(17), [sym_comment] = ACTIONS(9), - [sym_attribute_name] = ACTIONS(17), + [sym_attribute_name] = ACTIONS(19), }, [3] = { + [sym_attribute] = STATE(17), + [aux_sym_start_tag_repeat1] = STATE(17), + [sym__close_start_tag] = ACTIONS(21), [sym_comment] = ACTIONS(9), - [ts_builtin_sym_end] = ACTIONS(19), + [sym_attribute_name] = ACTIONS(23), }, [4] = { - [sym__node] = STATE(15), - [sym_element] = STATE(15), - [sym_start_tag] = STATE(13), - [sym_self_closing_tag] = STATE(14), - [aux_sym_fragment_repeat1] = STATE(15), - [sym__open_start_tag] = ACTIONS(21), - [sym_end_tag] = ACTIONS(23), - [sym__implicit_end_tag] = ACTIONS(23), - [sym__erroneous_end_tag] = ACTIONS(25), [sym_comment] = ACTIONS(9), - [sym_text] = ACTIONS(25), + [aux_sym_SLASH_LBRACKDd_RBRACK_LBRACKOo_RBRACK_LBRACKCc_RBRACK_LBRACKTt_RBRACK_LBRACKYy_RBRACK_LBRACKPp_RBRACK_LBRACKEe_RBRACK_SLASH] = ACTIONS(25), }, [5] = { - [sym__open_start_tag] = ACTIONS(27), - [sym__erroneous_end_tag] = ACTIONS(27), [sym_comment] = ACTIONS(9), [ts_builtin_sym_end] = ACTIONS(27), - [sym_text] = ACTIONS(27), }, [6] = { - [sym__node] = STATE(16), - [sym_element] = STATE(16), - [sym_start_tag] = STATE(4), - [sym_self_closing_tag] = STATE(5), - [aux_sym_fragment_repeat1] = STATE(16), - [sym__open_start_tag] = ACTIONS(5), + [sym__open_start_tag] = ACTIONS(29), + [sym__open_raw_start_tag] = ACTIONS(29), [sym__erroneous_end_tag] = ACTIONS(29), [sym_comment] = ACTIONS(9), - [ts_builtin_sym_end] = ACTIONS(31), + [ts_builtin_sym_end] = ACTIONS(29), + [anon_sym_LT_BANG] = ACTIONS(31), [sym_text] = ACTIONS(29), }, [7] = { - [sym__open_start_tag] = ACTIONS(33), - [sym_end_tag] = ACTIONS(33), - [sym__implicit_end_tag] = ACTIONS(33), - [sym__erroneous_end_tag] = ACTIONS(33), - [sym_comment] = ACTIONS(9), - [sym_text] = ACTIONS(33), - }, - [8] = { - [sym__open_start_tag] = ACTIONS(35), - [sym__erroneous_end_tag] = ACTIONS(35), - [sym_comment] = ACTIONS(9), - [ts_builtin_sym_end] = ACTIONS(35), - [sym_text] = ACTIONS(35), - }, - [9] = { - [sym__close_start_tag] = ACTIONS(37), - [sym__self_close_start_tag] = ACTIONS(37), - [sym_comment] = ACTIONS(9), - [anon_sym_EQ] = ACTIONS(39), - [sym_attribute_name] = ACTIONS(37), - }, - [10] = { - [sym_attribute] = STATE(20), - [aux_sym_start_tag_repeat1] = STATE(20), - [sym__close_start_tag] = ACTIONS(41), - [sym__self_close_start_tag] = ACTIONS(43), - [sym_comment] = ACTIONS(9), - [sym_attribute_name] = ACTIONS(17), - }, - [11] = { - [sym_attribute] = STATE(22), - [aux_sym_start_tag_repeat1] = STATE(22), - [sym__close_start_tag] = ACTIONS(13), - [sym__self_close_start_tag] = ACTIONS(45), - [sym_comment] = ACTIONS(9), - [sym_attribute_name] = ACTIONS(17), - }, - [12] = { - [sym__open_start_tag] = ACTIONS(47), - [sym__erroneous_end_tag] = ACTIONS(47), - [sym_comment] = ACTIONS(9), - [ts_builtin_sym_end] = ACTIONS(47), - [sym_text] = ACTIONS(47), - }, - [13] = { - [sym__node] = STATE(24), - [sym_element] = STATE(24), - [sym_start_tag] = STATE(13), - [sym_self_closing_tag] = STATE(14), - [aux_sym_fragment_repeat1] = STATE(24), - [sym__open_start_tag] = ACTIONS(21), - [sym_end_tag] = ACTIONS(49), - [sym__implicit_end_tag] = ACTIONS(49), - [sym__erroneous_end_tag] = ACTIONS(51), - [sym_comment] = ACTIONS(9), - [sym_text] = ACTIONS(51), - }, - [14] = { - [sym__open_start_tag] = ACTIONS(27), - [sym_end_tag] = ACTIONS(27), - [sym__implicit_end_tag] = ACTIONS(27), - [sym__erroneous_end_tag] = ACTIONS(27), - [sym_comment] = ACTIONS(9), - [sym_text] = ACTIONS(27), - }, - [15] = { - [sym__node] = STATE(26), - [sym_element] = STATE(26), - [sym_start_tag] = STATE(13), - [sym_self_closing_tag] = STATE(14), + [sym_doctype] = STATE(22), + [sym__node] = STATE(22), + [sym_element] = STATE(22), + [sym_raw_element] = STATE(22), + [sym_start_tag] = STATE(23), + [sym__raw_start_tag] = STATE(24), + [sym_self_closing_tag] = STATE(25), [aux_sym_fragment_repeat1] = STATE(26), - [sym__open_start_tag] = ACTIONS(21), - [sym_end_tag] = ACTIONS(53), - [sym__implicit_end_tag] = ACTIONS(53), - [sym__erroneous_end_tag] = ACTIONS(55), - [sym_comment] = ACTIONS(9), - [sym_text] = ACTIONS(55), - }, - [16] = { - [sym__node] = STATE(16), - [sym_element] = STATE(16), - [sym_start_tag] = STATE(4), - [sym_self_closing_tag] = STATE(5), - [aux_sym_fragment_repeat1] = STATE(16), - [sym__open_start_tag] = ACTIONS(57), - [sym__erroneous_end_tag] = ACTIONS(60), - [sym_comment] = ACTIONS(9), - [ts_builtin_sym_end] = ACTIONS(63), - [sym_text] = ACTIONS(60), - }, - [17] = { - [sym_quoted_attribute_value] = STATE(27), - [sym_comment] = ACTIONS(9), - [sym_attribute_value] = ACTIONS(65), - [anon_sym_SQUOTE] = ACTIONS(67), - [anon_sym_DQUOTE] = ACTIONS(69), - }, - [18] = { - [sym__open_start_tag] = ACTIONS(71), - [sym_end_tag] = ACTIONS(71), - [sym__implicit_end_tag] = ACTIONS(71), - [sym__erroneous_end_tag] = ACTIONS(71), - [sym_comment] = ACTIONS(9), - [sym_text] = ACTIONS(71), - }, - [19] = { - [sym__open_start_tag] = ACTIONS(73), - [sym__erroneous_end_tag] = ACTIONS(73), - [sym_comment] = ACTIONS(9), - [ts_builtin_sym_end] = ACTIONS(73), - [sym_text] = ACTIONS(73), - }, - [20] = { - [sym_attribute] = STATE(20), - [aux_sym_start_tag_repeat1] = STATE(20), - [sym__close_start_tag] = ACTIONS(75), - [sym__self_close_start_tag] = ACTIONS(75), - [sym_comment] = ACTIONS(9), - [sym_attribute_name] = ACTIONS(77), - }, - [21] = { - [sym__open_start_tag] = ACTIONS(35), + [sym__open_start_tag] = ACTIONS(33), + [sym__open_raw_start_tag] = ACTIONS(5), [sym_end_tag] = ACTIONS(35), [sym__implicit_end_tag] = ACTIONS(35), - [sym__erroneous_end_tag] = ACTIONS(35), + [sym__erroneous_end_tag] = ACTIONS(37), [sym_comment] = ACTIONS(9), - [sym_text] = ACTIONS(35), + [anon_sym_LT_BANG] = ACTIONS(39), + [sym_text] = ACTIONS(37), }, - [22] = { - [sym_attribute] = STATE(20), - [aux_sym_start_tag_repeat1] = STATE(20), - [sym__close_start_tag] = ACTIONS(41), - [sym__self_close_start_tag] = ACTIONS(80), + [8] = { + [sym_end_tag] = ACTIONS(41), + [sym__raw_text] = ACTIONS(43), [sym_comment] = ACTIONS(9), - [sym_attribute_name] = ACTIONS(17), }, - [23] = { - [sym__open_start_tag] = ACTIONS(47), - [sym_end_tag] = ACTIONS(47), - [sym__implicit_end_tag] = ACTIONS(47), - [sym__erroneous_end_tag] = ACTIONS(47), + [9] = { + [sym__open_start_tag] = ACTIONS(45), + [sym__open_raw_start_tag] = ACTIONS(45), + [sym__erroneous_end_tag] = ACTIONS(45), [sym_comment] = ACTIONS(9), - [sym_text] = ACTIONS(47), + [ts_builtin_sym_end] = ACTIONS(45), + [anon_sym_LT_BANG] = ACTIONS(47), + [sym_text] = ACTIONS(45), }, - [24] = { - [sym__node] = STATE(26), - [sym_element] = STATE(26), - [sym_start_tag] = STATE(13), - [sym_self_closing_tag] = STATE(14), - [aux_sym_fragment_repeat1] = STATE(26), - [sym__open_start_tag] = ACTIONS(21), - [sym_end_tag] = ACTIONS(82), - [sym__implicit_end_tag] = ACTIONS(82), + [10] = { + [sym_doctype] = STATE(6), + [sym__node] = STATE(6), + [sym_element] = STATE(6), + [sym_raw_element] = STATE(6), + [sym_start_tag] = STATE(7), + [sym__raw_start_tag] = STATE(8), + [sym_self_closing_tag] = STATE(9), + [aux_sym_fragment_repeat1] = STATE(29), + [sym__open_start_tag] = ACTIONS(3), + [sym__open_raw_start_tag] = ACTIONS(5), + [sym__erroneous_end_tag] = ACTIONS(7), + [sym_comment] = ACTIONS(9), + [ts_builtin_sym_end] = ACTIONS(49), + [anon_sym_LT_BANG] = ACTIONS(13), + [sym_text] = ACTIONS(7), + }, + [11] = { + [sym__open_start_tag] = ACTIONS(51), + [sym__open_raw_start_tag] = ACTIONS(51), + [sym_end_tag] = ACTIONS(51), + [sym__implicit_end_tag] = ACTIONS(51), + [sym__erroneous_end_tag] = ACTIONS(51), + [sym_comment] = ACTIONS(9), + [anon_sym_LT_BANG] = ACTIONS(53), + [sym_text] = ACTIONS(51), + }, + [12] = { + [sym__open_start_tag] = ACTIONS(55), + [sym__open_raw_start_tag] = ACTIONS(55), [sym__erroneous_end_tag] = ACTIONS(55), [sym_comment] = ACTIONS(9), + [ts_builtin_sym_end] = ACTIONS(55), + [anon_sym_LT_BANG] = ACTIONS(57), [sym_text] = ACTIONS(55), }, - [25] = { - [sym__open_start_tag] = ACTIONS(84), - [sym__erroneous_end_tag] = ACTIONS(84), + [13] = { + [sym__close_start_tag] = ACTIONS(59), + [sym__self_close_start_tag] = ACTIONS(59), [sym_comment] = ACTIONS(9), - [ts_builtin_sym_end] = ACTIONS(84), - [sym_text] = ACTIONS(84), + [anon_sym_EQ] = ACTIONS(61), + [sym_attribute_name] = ACTIONS(59), + }, + [14] = { + [sym_attribute] = STATE(33), + [aux_sym_start_tag_repeat1] = STATE(33), + [sym__close_start_tag] = ACTIONS(63), + [sym__self_close_start_tag] = ACTIONS(65), + [sym_comment] = ACTIONS(9), + [sym_attribute_name] = ACTIONS(19), + }, + [15] = { + [sym_end_tag] = ACTIONS(67), + [sym__raw_text] = ACTIONS(67), + [sym_comment] = ACTIONS(9), + }, + [16] = { + [sym__close_start_tag] = ACTIONS(59), + [sym_comment] = ACTIONS(9), + [anon_sym_EQ] = ACTIONS(69), + [sym_attribute_name] = ACTIONS(59), + }, + [17] = { + [sym_attribute] = STATE(36), + [aux_sym_start_tag_repeat1] = STATE(36), + [sym__close_start_tag] = ACTIONS(71), + [sym_comment] = ACTIONS(9), + [sym_attribute_name] = ACTIONS(23), + }, + [18] = { + [sym_comment] = ACTIONS(9), + [aux_sym_SLASH_LBRACK_CARET_GT_RBRACK_PLUS_SLASH] = ACTIONS(73), + }, + [19] = { + [sym_attribute] = STATE(39), + [aux_sym_start_tag_repeat1] = STATE(39), + [sym__close_start_tag] = ACTIONS(15), + [sym__self_close_start_tag] = ACTIONS(75), + [sym_comment] = ACTIONS(9), + [sym_attribute_name] = ACTIONS(19), + }, + [20] = { + [sym__open_start_tag] = ACTIONS(77), + [sym__open_raw_start_tag] = ACTIONS(77), + [sym__erroneous_end_tag] = ACTIONS(77), + [sym_comment] = ACTIONS(9), + [ts_builtin_sym_end] = ACTIONS(77), + [anon_sym_LT_BANG] = ACTIONS(79), + [sym_text] = ACTIONS(77), + }, + [21] = { + [sym_comment] = ACTIONS(9), + [aux_sym_SLASH_LBRACKDd_RBRACK_LBRACKOo_RBRACK_LBRACKCc_RBRACK_LBRACKTt_RBRACK_LBRACKYy_RBRACK_LBRACKPp_RBRACK_LBRACKEe_RBRACK_SLASH] = ACTIONS(81), + }, + [22] = { + [sym__open_start_tag] = ACTIONS(29), + [sym__open_raw_start_tag] = ACTIONS(29), + [sym_end_tag] = ACTIONS(29), + [sym__implicit_end_tag] = ACTIONS(29), + [sym__erroneous_end_tag] = ACTIONS(29), + [sym_comment] = ACTIONS(9), + [anon_sym_LT_BANG] = ACTIONS(31), + [sym_text] = ACTIONS(29), + }, + [23] = { + [sym_doctype] = STATE(22), + [sym__node] = STATE(22), + [sym_element] = STATE(22), + [sym_raw_element] = STATE(22), + [sym_start_tag] = STATE(23), + [sym__raw_start_tag] = STATE(24), + [sym_self_closing_tag] = STATE(25), + [aux_sym_fragment_repeat1] = STATE(42), + [sym__open_start_tag] = ACTIONS(33), + [sym__open_raw_start_tag] = ACTIONS(5), + [sym_end_tag] = ACTIONS(83), + [sym__implicit_end_tag] = ACTIONS(83), + [sym__erroneous_end_tag] = ACTIONS(37), + [sym_comment] = ACTIONS(9), + [anon_sym_LT_BANG] = ACTIONS(39), + [sym_text] = ACTIONS(37), + }, + [24] = { + [sym_end_tag] = ACTIONS(85), + [sym__raw_text] = ACTIONS(87), + [sym_comment] = ACTIONS(9), + }, + [25] = { + [sym__open_start_tag] = ACTIONS(45), + [sym__open_raw_start_tag] = ACTIONS(45), + [sym_end_tag] = ACTIONS(45), + [sym__implicit_end_tag] = ACTIONS(45), + [sym__erroneous_end_tag] = ACTIONS(45), + [sym_comment] = ACTIONS(9), + [anon_sym_LT_BANG] = ACTIONS(47), + [sym_text] = ACTIONS(45), }, [26] = { - [sym__node] = STATE(26), - [sym_element] = STATE(26), - [sym_start_tag] = STATE(13), - [sym_self_closing_tag] = STATE(14), - [aux_sym_fragment_repeat1] = STATE(26), - [sym__open_start_tag] = ACTIONS(86), - [sym_end_tag] = ACTIONS(63), - [sym__implicit_end_tag] = ACTIONS(63), - [sym__erroneous_end_tag] = ACTIONS(89), + [sym_doctype] = STATE(22), + [sym__node] = STATE(22), + [sym_element] = STATE(22), + [sym_raw_element] = STATE(22), + [sym_start_tag] = STATE(23), + [sym__raw_start_tag] = STATE(24), + [sym_self_closing_tag] = STATE(25), + [aux_sym_fragment_repeat1] = STATE(46), + [sym__open_start_tag] = ACTIONS(33), + [sym__open_raw_start_tag] = ACTIONS(5), + [sym_end_tag] = ACTIONS(89), + [sym__implicit_end_tag] = ACTIONS(89), + [sym__erroneous_end_tag] = ACTIONS(37), [sym_comment] = ACTIONS(9), - [sym_text] = ACTIONS(89), + [anon_sym_LT_BANG] = ACTIONS(39), + [sym_text] = ACTIONS(37), }, [27] = { - [sym__close_start_tag] = ACTIONS(92), - [sym__self_close_start_tag] = ACTIONS(92), + [sym__open_start_tag] = ACTIONS(91), + [sym__open_raw_start_tag] = ACTIONS(91), + [sym__erroneous_end_tag] = ACTIONS(91), [sym_comment] = ACTIONS(9), - [sym_attribute_name] = ACTIONS(92), + [ts_builtin_sym_end] = ACTIONS(91), + [anon_sym_LT_BANG] = ACTIONS(93), + [sym_text] = ACTIONS(91), }, [28] = { + [sym_end_tag] = ACTIONS(95), [sym_comment] = ACTIONS(9), - [anon_sym_SQUOTE] = ACTIONS(94), - [aux_sym_SLASH_LBRACK_CARET_SQUOTE_RBRACK_PLUS_SLASH] = ACTIONS(96), }, [29] = { + [sym_doctype] = STATE(6), + [sym__node] = STATE(6), + [sym_element] = STATE(6), + [sym_raw_element] = STATE(6), + [sym_start_tag] = STATE(7), + [sym__raw_start_tag] = STATE(8), + [sym_self_closing_tag] = STATE(9), + [aux_sym_fragment_repeat1] = STATE(29), + [sym__open_start_tag] = ACTIONS(97), + [sym__open_raw_start_tag] = ACTIONS(100), + [sym__erroneous_end_tag] = ACTIONS(103), [sym_comment] = ACTIONS(9), - [anon_sym_DQUOTE] = ACTIONS(94), - [aux_sym_SLASH_LBRACK_CARET_DQUOTE_RBRACK_PLUS_SLASH] = ACTIONS(98), + [ts_builtin_sym_end] = ACTIONS(106), + [anon_sym_LT_BANG] = ACTIONS(108), + [sym_text] = ACTIONS(103), }, [30] = { - [sym__open_start_tag] = ACTIONS(73), - [sym_end_tag] = ACTIONS(73), - [sym__implicit_end_tag] = ACTIONS(73), - [sym__erroneous_end_tag] = ACTIONS(73), + [sym_quoted_attribute_value] = STATE(48), [sym_comment] = ACTIONS(9), - [sym_text] = ACTIONS(73), + [sym_attribute_value] = ACTIONS(111), + [anon_sym_SQUOTE] = ACTIONS(113), + [anon_sym_DQUOTE] = ACTIONS(115), }, [31] = { - [sym__open_start_tag] = ACTIONS(84), - [sym_end_tag] = ACTIONS(84), - [sym__implicit_end_tag] = ACTIONS(84), - [sym__erroneous_end_tag] = ACTIONS(84), + [sym__open_start_tag] = ACTIONS(117), + [sym__open_raw_start_tag] = ACTIONS(117), + [sym_end_tag] = ACTIONS(117), + [sym__implicit_end_tag] = ACTIONS(117), + [sym__erroneous_end_tag] = ACTIONS(117), [sym_comment] = ACTIONS(9), - [sym_text] = ACTIONS(84), + [anon_sym_LT_BANG] = ACTIONS(119), + [sym_text] = ACTIONS(117), }, [32] = { - [sym__close_start_tag] = ACTIONS(100), - [sym__self_close_start_tag] = ACTIONS(100), + [sym__open_start_tag] = ACTIONS(121), + [sym__open_raw_start_tag] = ACTIONS(121), + [sym__erroneous_end_tag] = ACTIONS(121), [sym_comment] = ACTIONS(9), - [sym_attribute_name] = ACTIONS(100), + [ts_builtin_sym_end] = ACTIONS(121), + [anon_sym_LT_BANG] = ACTIONS(123), + [sym_text] = ACTIONS(121), }, [33] = { + [sym_attribute] = STATE(33), + [aux_sym_start_tag_repeat1] = STATE(33), + [sym__close_start_tag] = ACTIONS(125), + [sym__self_close_start_tag] = ACTIONS(125), [sym_comment] = ACTIONS(9), - [anon_sym_SQUOTE] = ACTIONS(102), + [sym_attribute_name] = ACTIONS(127), }, [34] = { + [sym_quoted_attribute_value] = STATE(51), [sym_comment] = ACTIONS(9), - [anon_sym_DQUOTE] = ACTIONS(102), + [sym_attribute_value] = ACTIONS(130), + [anon_sym_SQUOTE] = ACTIONS(132), + [anon_sym_DQUOTE] = ACTIONS(134), }, [35] = { - [sym__close_start_tag] = ACTIONS(104), - [sym__self_close_start_tag] = ACTIONS(104), + [sym_end_tag] = ACTIONS(136), + [sym__raw_text] = ACTIONS(136), [sym_comment] = ACTIONS(9), - [sym_attribute_name] = ACTIONS(104), + }, + [36] = { + [sym_attribute] = STATE(36), + [aux_sym_start_tag_repeat1] = STATE(36), + [sym__close_start_tag] = ACTIONS(125), + [sym_comment] = ACTIONS(9), + [sym_attribute_name] = ACTIONS(138), + }, + [37] = { + [sym_comment] = ACTIONS(9), + [anon_sym_GT] = ACTIONS(141), + }, + [38] = { + [sym__open_start_tag] = ACTIONS(55), + [sym__open_raw_start_tag] = ACTIONS(55), + [sym_end_tag] = ACTIONS(55), + [sym__implicit_end_tag] = ACTIONS(55), + [sym__erroneous_end_tag] = ACTIONS(55), + [sym_comment] = ACTIONS(9), + [anon_sym_LT_BANG] = ACTIONS(57), + [sym_text] = ACTIONS(55), + }, + [39] = { + [sym_attribute] = STATE(33), + [aux_sym_start_tag_repeat1] = STATE(33), + [sym__close_start_tag] = ACTIONS(63), + [sym__self_close_start_tag] = ACTIONS(143), + [sym_comment] = ACTIONS(9), + [sym_attribute_name] = ACTIONS(19), + }, + [40] = { + [sym_comment] = ACTIONS(9), + [aux_sym_SLASH_LBRACK_CARET_GT_RBRACK_PLUS_SLASH] = ACTIONS(145), + }, + [41] = { + [sym__open_start_tag] = ACTIONS(77), + [sym__open_raw_start_tag] = ACTIONS(77), + [sym_end_tag] = ACTIONS(77), + [sym__implicit_end_tag] = ACTIONS(77), + [sym__erroneous_end_tag] = ACTIONS(77), + [sym_comment] = ACTIONS(9), + [anon_sym_LT_BANG] = ACTIONS(79), + [sym_text] = ACTIONS(77), + }, + [42] = { + [sym_doctype] = STATE(22), + [sym__node] = STATE(22), + [sym_element] = STATE(22), + [sym_raw_element] = STATE(22), + [sym_start_tag] = STATE(23), + [sym__raw_start_tag] = STATE(24), + [sym_self_closing_tag] = STATE(25), + [aux_sym_fragment_repeat1] = STATE(46), + [sym__open_start_tag] = ACTIONS(33), + [sym__open_raw_start_tag] = ACTIONS(5), + [sym_end_tag] = ACTIONS(147), + [sym__implicit_end_tag] = ACTIONS(147), + [sym__erroneous_end_tag] = ACTIONS(37), + [sym_comment] = ACTIONS(9), + [anon_sym_LT_BANG] = ACTIONS(39), + [sym_text] = ACTIONS(37), + }, + [43] = { + [sym__open_start_tag] = ACTIONS(91), + [sym__open_raw_start_tag] = ACTIONS(91), + [sym_end_tag] = ACTIONS(91), + [sym__implicit_end_tag] = ACTIONS(91), + [sym__erroneous_end_tag] = ACTIONS(91), + [sym_comment] = ACTIONS(9), + [anon_sym_LT_BANG] = ACTIONS(93), + [sym_text] = ACTIONS(91), + }, + [44] = { + [sym_end_tag] = ACTIONS(149), + [sym_comment] = ACTIONS(9), + }, + [45] = { + [sym__open_start_tag] = ACTIONS(151), + [sym__open_raw_start_tag] = ACTIONS(151), + [sym__erroneous_end_tag] = ACTIONS(151), + [sym_comment] = ACTIONS(9), + [ts_builtin_sym_end] = ACTIONS(151), + [anon_sym_LT_BANG] = ACTIONS(153), + [sym_text] = ACTIONS(151), + }, + [46] = { + [sym_doctype] = STATE(22), + [sym__node] = STATE(22), + [sym_element] = STATE(22), + [sym_raw_element] = STATE(22), + [sym_start_tag] = STATE(23), + [sym__raw_start_tag] = STATE(24), + [sym_self_closing_tag] = STATE(25), + [aux_sym_fragment_repeat1] = STATE(46), + [sym__open_start_tag] = ACTIONS(155), + [sym__open_raw_start_tag] = ACTIONS(100), + [sym_end_tag] = ACTIONS(106), + [sym__implicit_end_tag] = ACTIONS(106), + [sym__erroneous_end_tag] = ACTIONS(158), + [sym_comment] = ACTIONS(9), + [anon_sym_LT_BANG] = ACTIONS(161), + [sym_text] = ACTIONS(158), + }, + [47] = { + [sym__open_start_tag] = ACTIONS(164), + [sym__open_raw_start_tag] = ACTIONS(164), + [sym__erroneous_end_tag] = ACTIONS(164), + [sym_comment] = ACTIONS(9), + [ts_builtin_sym_end] = ACTIONS(164), + [anon_sym_LT_BANG] = ACTIONS(166), + [sym_text] = ACTIONS(164), + }, + [48] = { + [sym__close_start_tag] = ACTIONS(168), + [sym__self_close_start_tag] = ACTIONS(168), + [sym_comment] = ACTIONS(9), + [sym_attribute_name] = ACTIONS(168), + }, + [49] = { + [sym_comment] = ACTIONS(9), + [anon_sym_SQUOTE] = ACTIONS(170), + [aux_sym_SLASH_LBRACK_CARET_SQUOTE_RBRACK_PLUS_SLASH] = ACTIONS(172), + }, + [50] = { + [sym_comment] = ACTIONS(9), + [anon_sym_DQUOTE] = ACTIONS(170), + [aux_sym_SLASH_LBRACK_CARET_DQUOTE_RBRACK_PLUS_SLASH] = ACTIONS(174), + }, + [51] = { + [sym__close_start_tag] = ACTIONS(168), + [sym_comment] = ACTIONS(9), + [sym_attribute_name] = ACTIONS(168), + }, + [52] = { + [sym_comment] = ACTIONS(9), + [anon_sym_SQUOTE] = ACTIONS(176), + [aux_sym_SLASH_LBRACK_CARET_SQUOTE_RBRACK_PLUS_SLASH] = ACTIONS(178), + }, + [53] = { + [sym_comment] = ACTIONS(9), + [anon_sym_DQUOTE] = ACTIONS(176), + [aux_sym_SLASH_LBRACK_CARET_DQUOTE_RBRACK_PLUS_SLASH] = ACTIONS(180), + }, + [54] = { + [sym__open_start_tag] = ACTIONS(182), + [sym__open_raw_start_tag] = ACTIONS(182), + [sym__erroneous_end_tag] = ACTIONS(182), + [sym_comment] = ACTIONS(9), + [ts_builtin_sym_end] = ACTIONS(182), + [anon_sym_LT_BANG] = ACTIONS(184), + [sym_text] = ACTIONS(182), + }, + [55] = { + [sym__open_start_tag] = ACTIONS(121), + [sym__open_raw_start_tag] = ACTIONS(121), + [sym_end_tag] = ACTIONS(121), + [sym__implicit_end_tag] = ACTIONS(121), + [sym__erroneous_end_tag] = ACTIONS(121), + [sym_comment] = ACTIONS(9), + [anon_sym_LT_BANG] = ACTIONS(123), + [sym_text] = ACTIONS(121), + }, + [56] = { + [sym_comment] = ACTIONS(9), + [anon_sym_GT] = ACTIONS(186), + }, + [57] = { + [sym__open_start_tag] = ACTIONS(151), + [sym__open_raw_start_tag] = ACTIONS(151), + [sym_end_tag] = ACTIONS(151), + [sym__implicit_end_tag] = ACTIONS(151), + [sym__erroneous_end_tag] = ACTIONS(151), + [sym_comment] = ACTIONS(9), + [anon_sym_LT_BANG] = ACTIONS(153), + [sym_text] = ACTIONS(151), + }, + [58] = { + [sym__open_start_tag] = ACTIONS(164), + [sym__open_raw_start_tag] = ACTIONS(164), + [sym_end_tag] = ACTIONS(164), + [sym__implicit_end_tag] = ACTIONS(164), + [sym__erroneous_end_tag] = ACTIONS(164), + [sym_comment] = ACTIONS(9), + [anon_sym_LT_BANG] = ACTIONS(166), + [sym_text] = ACTIONS(164), + }, + [59] = { + [sym__close_start_tag] = ACTIONS(188), + [sym__self_close_start_tag] = ACTIONS(188), + [sym_comment] = ACTIONS(9), + [sym_attribute_name] = ACTIONS(188), + }, + [60] = { + [sym_comment] = ACTIONS(9), + [anon_sym_SQUOTE] = ACTIONS(190), + }, + [61] = { + [sym_comment] = ACTIONS(9), + [anon_sym_DQUOTE] = ACTIONS(190), + }, + [62] = { + [sym__close_start_tag] = ACTIONS(188), + [sym_comment] = ACTIONS(9), + [sym_attribute_name] = ACTIONS(188), + }, + [63] = { + [sym_comment] = ACTIONS(9), + [anon_sym_SQUOTE] = ACTIONS(192), + }, + [64] = { + [sym_comment] = ACTIONS(9), + [anon_sym_DQUOTE] = ACTIONS(192), + }, + [65] = { + [sym__open_start_tag] = ACTIONS(182), + [sym__open_raw_start_tag] = ACTIONS(182), + [sym_end_tag] = ACTIONS(182), + [sym__implicit_end_tag] = ACTIONS(182), + [sym__erroneous_end_tag] = ACTIONS(182), + [sym_comment] = ACTIONS(9), + [anon_sym_LT_BANG] = ACTIONS(184), + [sym_text] = ACTIONS(182), + }, + [66] = { + [sym__close_start_tag] = ACTIONS(194), + [sym__self_close_start_tag] = ACTIONS(194), + [sym_comment] = ACTIONS(9), + [sym_attribute_name] = ACTIONS(194), + }, + [67] = { + [sym__close_start_tag] = ACTIONS(194), + [sym_comment] = ACTIONS(9), + [sym_attribute_name] = ACTIONS(194), }, }; static TSParseActionEntry ts_parse_actions[] = { [0] = {.count = 0, .reusable = false}, [1] = {.count = 1, .reusable = true}, RECOVER(), - [3] = {.count = 1, .reusable = false}, RECOVER(), - [5] = {.count = 1, .reusable = true}, SHIFT(2), + [3] = {.count = 1, .reusable = true}, SHIFT(2), + [5] = {.count = 1, .reusable = true}, SHIFT(3), [7] = {.count = 1, .reusable = true}, SHIFT(6), [9] = {.count = 1, .reusable = true}, SHIFT_EXTRA(), [11] = {.count = 1, .reusable = true}, REDUCE(sym_fragment, 0), - [13] = {.count = 1, .reusable = true}, SHIFT(7), - [15] = {.count = 1, .reusable = true}, SHIFT(8), - [17] = {.count = 1, .reusable = true}, SHIFT(9), - [19] = {.count = 1, .reusable = true}, ACCEPT_INPUT(), - [21] = {.count = 1, .reusable = true}, SHIFT(11), - [23] = {.count = 1, .reusable = true}, SHIFT(12), - [25] = {.count = 1, .reusable = true}, SHIFT(15), - [27] = {.count = 1, .reusable = true}, REDUCE(sym_element, 1), - [29] = {.count = 1, .reusable = true}, SHIFT(16), - [31] = {.count = 1, .reusable = true}, REDUCE(sym_fragment, 1), - [33] = {.count = 1, .reusable = true}, REDUCE(sym_start_tag, 2), - [35] = {.count = 1, .reusable = true}, REDUCE(sym_self_closing_tag, 2), - [37] = {.count = 1, .reusable = true}, REDUCE(sym_attribute, 1), - [39] = {.count = 1, .reusable = true}, SHIFT(17), - [41] = {.count = 1, .reusable = true}, SHIFT(18), - [43] = {.count = 1, .reusable = true}, SHIFT(19), - [45] = {.count = 1, .reusable = true}, SHIFT(21), - [47] = {.count = 1, .reusable = true}, REDUCE(sym_element, 2), - [49] = {.count = 1, .reusable = true}, SHIFT(23), - [51] = {.count = 1, .reusable = true}, SHIFT(24), - [53] = {.count = 1, .reusable = true}, SHIFT(25), - [55] = {.count = 1, .reusable = true}, SHIFT(26), - [57] = {.count = 2, .reusable = true}, REDUCE(aux_sym_fragment_repeat1, 2), SHIFT_REPEAT(2), - [60] = {.count = 2, .reusable = true}, REDUCE(aux_sym_fragment_repeat1, 2), SHIFT_REPEAT(16), - [63] = {.count = 1, .reusable = true}, REDUCE(aux_sym_fragment_repeat1, 2), - [65] = {.count = 1, .reusable = true}, SHIFT(27), - [67] = {.count = 1, .reusable = true}, SHIFT(28), - [69] = {.count = 1, .reusable = true}, SHIFT(29), - [71] = {.count = 1, .reusable = true}, REDUCE(sym_start_tag, 3), - [73] = {.count = 1, .reusable = true}, REDUCE(sym_self_closing_tag, 3), - [75] = {.count = 1, .reusable = true}, REDUCE(aux_sym_start_tag_repeat1, 2), - [77] = {.count = 2, .reusable = true}, REDUCE(aux_sym_start_tag_repeat1, 2), SHIFT_REPEAT(9), - [80] = {.count = 1, .reusable = true}, SHIFT(30), - [82] = {.count = 1, .reusable = true}, SHIFT(31), - [84] = {.count = 1, .reusable = true}, REDUCE(sym_element, 3), - [86] = {.count = 2, .reusable = true}, REDUCE(aux_sym_fragment_repeat1, 2), SHIFT_REPEAT(11), - [89] = {.count = 2, .reusable = true}, REDUCE(aux_sym_fragment_repeat1, 2), SHIFT_REPEAT(26), - [92] = {.count = 1, .reusable = true}, REDUCE(sym_attribute, 3), - [94] = {.count = 1, .reusable = false}, SHIFT(32), - [96] = {.count = 1, .reusable = true}, SHIFT(33), - [98] = {.count = 1, .reusable = true}, SHIFT(34), - [100] = {.count = 1, .reusable = true}, REDUCE(sym_quoted_attribute_value, 2), - [102] = {.count = 1, .reusable = true}, SHIFT(35), - [104] = {.count = 1, .reusable = true}, REDUCE(sym_quoted_attribute_value, 3, .alias_sequence_id = 1), + [13] = {.count = 1, .reusable = false}, SHIFT(4), + [15] = {.count = 1, .reusable = true}, SHIFT(11), + [17] = {.count = 1, .reusable = true}, SHIFT(12), + [19] = {.count = 1, .reusable = true}, SHIFT(13), + [21] = {.count = 1, .reusable = true}, SHIFT(15), + [23] = {.count = 1, .reusable = true}, SHIFT(16), + [25] = {.count = 1, .reusable = true}, SHIFT(18), + [27] = {.count = 1, .reusable = true}, ACCEPT_INPUT(), + [29] = {.count = 1, .reusable = true}, REDUCE(aux_sym_fragment_repeat1, 1), + [31] = {.count = 1, .reusable = false}, REDUCE(aux_sym_fragment_repeat1, 1), + [33] = {.count = 1, .reusable = true}, SHIFT(19), + [35] = {.count = 1, .reusable = true}, SHIFT(20), + [37] = {.count = 1, .reusable = true}, SHIFT(22), + [39] = {.count = 1, .reusable = false}, SHIFT(21), + [41] = {.count = 1, .reusable = true}, SHIFT(27), + [43] = {.count = 1, .reusable = true}, SHIFT(28), + [45] = {.count = 1, .reusable = true}, REDUCE(sym_element, 1), + [47] = {.count = 1, .reusable = false}, REDUCE(sym_element, 1), + [49] = {.count = 1, .reusable = true}, REDUCE(sym_fragment, 1), + [51] = {.count = 1, .reusable = true}, REDUCE(sym_start_tag, 2), + [53] = {.count = 1, .reusable = false}, REDUCE(sym_start_tag, 2), + [55] = {.count = 1, .reusable = true}, REDUCE(sym_self_closing_tag, 2), + [57] = {.count = 1, .reusable = false}, REDUCE(sym_self_closing_tag, 2), + [59] = {.count = 1, .reusable = true}, REDUCE(sym_attribute, 1), + [61] = {.count = 1, .reusable = true}, SHIFT(30), + [63] = {.count = 1, .reusable = true}, SHIFT(31), + [65] = {.count = 1, .reusable = true}, SHIFT(32), + [67] = {.count = 1, .reusable = true}, REDUCE(sym__raw_start_tag, 2), + [69] = {.count = 1, .reusable = true}, SHIFT(34), + [71] = {.count = 1, .reusable = true}, SHIFT(35), + [73] = {.count = 1, .reusable = true}, SHIFT(37), + [75] = {.count = 1, .reusable = true}, SHIFT(38), + [77] = {.count = 1, .reusable = true}, REDUCE(sym_element, 2), + [79] = {.count = 1, .reusable = false}, REDUCE(sym_element, 2), + [81] = {.count = 1, .reusable = true}, SHIFT(40), + [83] = {.count = 1, .reusable = true}, SHIFT(41), + [85] = {.count = 1, .reusable = true}, SHIFT(43), + [87] = {.count = 1, .reusable = true}, SHIFT(44), + [89] = {.count = 1, .reusable = true}, SHIFT(45), + [91] = {.count = 1, .reusable = true}, REDUCE(sym_raw_element, 2, .alias_sequence_id = 1), + [93] = {.count = 1, .reusable = false}, REDUCE(sym_raw_element, 2, .alias_sequence_id = 1), + [95] = {.count = 1, .reusable = true}, SHIFT(47), + [97] = {.count = 2, .reusable = true}, REDUCE(aux_sym_fragment_repeat1, 2), SHIFT_REPEAT(2), + [100] = {.count = 2, .reusable = true}, REDUCE(aux_sym_fragment_repeat1, 2), SHIFT_REPEAT(3), + [103] = {.count = 2, .reusable = true}, REDUCE(aux_sym_fragment_repeat1, 2), SHIFT_REPEAT(6), + [106] = {.count = 1, .reusable = true}, REDUCE(aux_sym_fragment_repeat1, 2), + [108] = {.count = 2, .reusable = false}, REDUCE(aux_sym_fragment_repeat1, 2), SHIFT_REPEAT(4), + [111] = {.count = 1, .reusable = true}, SHIFT(48), + [113] = {.count = 1, .reusable = true}, SHIFT(49), + [115] = {.count = 1, .reusable = true}, SHIFT(50), + [117] = {.count = 1, .reusable = true}, REDUCE(sym_start_tag, 3), + [119] = {.count = 1, .reusable = false}, REDUCE(sym_start_tag, 3), + [121] = {.count = 1, .reusable = true}, REDUCE(sym_self_closing_tag, 3), + [123] = {.count = 1, .reusable = false}, REDUCE(sym_self_closing_tag, 3), + [125] = {.count = 1, .reusable = true}, REDUCE(aux_sym_start_tag_repeat1, 2), + [127] = {.count = 2, .reusable = true}, REDUCE(aux_sym_start_tag_repeat1, 2), SHIFT_REPEAT(13), + [130] = {.count = 1, .reusable = true}, SHIFT(51), + [132] = {.count = 1, .reusable = true}, SHIFT(52), + [134] = {.count = 1, .reusable = true}, SHIFT(53), + [136] = {.count = 1, .reusable = true}, REDUCE(sym__raw_start_tag, 3), + [138] = {.count = 2, .reusable = true}, REDUCE(aux_sym_start_tag_repeat1, 2), SHIFT_REPEAT(16), + [141] = {.count = 1, .reusable = true}, SHIFT(54), + [143] = {.count = 1, .reusable = true}, SHIFT(55), + [145] = {.count = 1, .reusable = true}, SHIFT(56), + [147] = {.count = 1, .reusable = true}, SHIFT(57), + [149] = {.count = 1, .reusable = true}, SHIFT(58), + [151] = {.count = 1, .reusable = true}, REDUCE(sym_element, 3), + [153] = {.count = 1, .reusable = false}, REDUCE(sym_element, 3), + [155] = {.count = 2, .reusable = true}, REDUCE(aux_sym_fragment_repeat1, 2), SHIFT_REPEAT(19), + [158] = {.count = 2, .reusable = true}, REDUCE(aux_sym_fragment_repeat1, 2), SHIFT_REPEAT(22), + [161] = {.count = 2, .reusable = false}, REDUCE(aux_sym_fragment_repeat1, 2), SHIFT_REPEAT(21), + [164] = {.count = 1, .reusable = true}, REDUCE(sym_raw_element, 3, .alias_sequence_id = 1), + [166] = {.count = 1, .reusable = false}, REDUCE(sym_raw_element, 3, .alias_sequence_id = 1), + [168] = {.count = 1, .reusable = true}, REDUCE(sym_attribute, 3), + [170] = {.count = 1, .reusable = false}, SHIFT(59), + [172] = {.count = 1, .reusable = true}, SHIFT(60), + [174] = {.count = 1, .reusable = true}, SHIFT(61), + [176] = {.count = 1, .reusable = false}, SHIFT(62), + [178] = {.count = 1, .reusable = true}, SHIFT(63), + [180] = {.count = 1, .reusable = true}, SHIFT(64), + [182] = {.count = 1, .reusable = true}, REDUCE(sym_doctype, 4), + [184] = {.count = 1, .reusable = false}, REDUCE(sym_doctype, 4), + [186] = {.count = 1, .reusable = true}, SHIFT(65), + [188] = {.count = 1, .reusable = true}, REDUCE(sym_quoted_attribute_value, 2), + [190] = {.count = 1, .reusable = true}, SHIFT(66), + [192] = {.count = 1, .reusable = true}, SHIFT(67), + [194] = {.count = 1, .reusable = true}, REDUCE(sym_quoted_attribute_value, 3, .alias_sequence_id = 2), }; void *tree_sitter_html_external_scanner_create(); diff --git a/src/scanner.cc b/src/scanner.cc index 5e3e0ad..53efc90 100644 --- a/src/scanner.cc +++ b/src/scanner.cc @@ -3,7 +3,6 @@ #include #include #include - #include "tag.h" namespace { @@ -13,12 +12,14 @@ using std::string; enum TokenType { OPEN_START_TAG, + OPEN_RAW_START_TAG, CLOSE_START_TAG, SELF_CLOSE_START_TAG, END_TAG, IMPLICIT_END_TAG, ERRONEOUS_END_TAG, - COMMENT, + RAW_TEXT, + COMMENT }; struct Scanner { @@ -97,6 +98,31 @@ struct Scanner { return false; } + bool raw_text(TSLexer *lexer) { + if (!tags.size()) return false; + + lexer->mark_end(lexer); + + const string &end_delimiter = tags.back().type == SCRIPT + ? "lookahead) { + if (lexer->lookahead == end_delimiter[delimiter_index]) { + delimiter_index++; + if (delimiter_index == end_delimiter.size()) break; + } else { + delimiter_index = 0; + lexer->mark_end(lexer); + } + lexer->advance(lexer, false); + } + + lexer->result_symbol = RAW_TEXT; + return true; + } + bool start_tag(TSLexer *lexer) { if (!tags.empty() && tags.back().is_void()) { tags.pop_back(); @@ -111,7 +137,7 @@ struct Scanner { tags.push_back(tag); lexer->mark_end(lexer); - lexer->result_symbol = OPEN_START_TAG; + lexer->result_symbol = tag.is_raw() ? OPEN_RAW_START_TAG : OPEN_START_TAG; return true; } @@ -150,6 +176,10 @@ struct Scanner { lexer->advance(lexer, true); } + if (valid_symbols[RAW_TEXT] && !valid_symbols[OPEN_START_TAG] && !valid_symbols[CLOSE_START_TAG]) { + return raw_text(lexer); + } + switch (lexer->lookahead) { case '<': lexer->mark_end(lexer); diff --git a/src/tag.h b/src/tag.h index 5246433..91a5ca7 100644 --- a/src/tag.h +++ b/src/tag.h @@ -279,6 +279,10 @@ struct Tag { return type < END_OF_VOID_TAGS; } + inline bool is_raw() const { + return type == SCRIPT || type == STYLE; + } + // string name() const { // return type == TagType::CUSTOM // ? custom_tag_name