From bba0011949db2aff9a947002b4871f053161b2df Mon Sep 17 00:00:00 2001 From: konnerhorton Date: Thu, 19 Mar 2026 06:19:43 -0400 Subject: [PATCH 1/2] Update syntax highlights and some extension features Removed requirement for trailing new-line Added different colors for each detail type (weights vs rep_scheme etc.) Fix single-line entry highlighting so its consistent with multi-line entries Add token colors for themes (so color differences are more universal) --- editors/vscode/package.json | 19 + editors/vscode/syntaxes/ox.tmLanguage.json | 25 +- editors/vscode/themes/ox-dark.json | 6 +- settings.json | 2 + tree-sitter-ox/grammar.js | 42 +- tree-sitter-ox/src/grammar.json | 664 +++++----- tree-sitter-ox/src/parser.c | 1329 +++++++++++--------- 7 files changed, 1181 insertions(+), 906 deletions(-) create mode 100644 settings.json diff --git a/editors/vscode/package.json b/editors/vscode/package.json index f3352d3..38c4ea9 100644 --- a/editors/vscode/package.json +++ b/editors/vscode/package.json @@ -45,6 +45,25 @@ } ] }, + "configurationDefaults": { + "editor.tokenColorCustomizations": { + "textMateRules": [ + { "scope": "comment.line.number-sign.ox", "settings": { "foreground": "#6A9955", "fontStyle": "italic" } }, + { "scope": "keyword.control.block.ox", "settings": { "foreground": "#C586C0", "fontStyle": "bold" } }, + { "scope": "constant.numeric.date.ox", "settings": { "foreground": "#4EC9B0", "fontStyle": "bold" } }, + { "scope": "keyword.operator.flag.ox", "settings": { "foreground": "#FF6B6B", "fontStyle": "bold" } }, + { "scope": "entity.name.section.ox", "settings": { "foreground": "#DCDCAA" } }, + { "scope": "entity.name.function.ox", "settings": { "foreground": "#9CDCFE" } }, + { "scope": "support.type.property-name.ox", "settings": { "foreground": "#569CD6" } }, + { "scope": "constant.numeric.weight.ox", "settings": { "foreground": "#B5CEA8" } }, + { "scope": "constant.numeric.reps.ox", "settings": { "foreground": "#CE9178" } }, + { "scope": "constant.numeric.time.ox", "settings": { "foreground": "#DCDCAA" } }, + { "scope": "constant.numeric.distance.ox", "settings": { "foreground": "#D4A5FF" } }, + { "scope": "string.quoted.double.ox", "settings": { "foreground": "#E8B87A", "fontStyle": "italic" } }, + { "scope": "string.unquoted.ox", "settings": { "foreground": "#D4D4D4" } } + ] + } + }, "dependencies": { "vscode-languageclient": "^9.0.1" } diff --git a/editors/vscode/syntaxes/ox.tmLanguage.json b/editors/vscode/syntaxes/ox.tmLanguage.json index 13c065a..192d0c3 100644 --- a/editors/vscode/syntaxes/ox.tmLanguage.json +++ b/editors/vscode/syntaxes/ox.tmLanguage.json @@ -5,6 +5,8 @@ "patterns": [ { "include": "#comment" }, { "include": "#block-keyword" }, + { "include": "#singleline-entry" }, + { "include": "#weigh-in-entry" }, { "include": "#session-header" }, { "include": "#item-line" }, { "include": "#metadata-line" } @@ -18,6 +20,23 @@ "match": "^(@session|@exercise|@template|@end)\\b", "name": "keyword.control.block.ox" }, + "singleline-entry": { + "match": "^(\\d{4}-\\d{2}-\\d{2})\\s+([*!])\\s+([^#@:\\s][^:]*):\\s*(.*)$", + "captures": { + "1": { "name": "constant.numeric.date.ox" }, + "2": { "name": "keyword.operator.flag.ox" }, + "3": { "name": "entity.name.function.ox" }, + "4": { "patterns": [{ "include": "#details" }] } + } + }, + "weigh-in-entry": { + "match": "^(\\d{4}-\\d{2}-\\d{2})\\s+(W)\\s+(.*)$", + "captures": { + "1": { "name": "constant.numeric.date.ox" }, + "2": { "name": "keyword.operator.flag.ox" }, + "3": { "patterns": [{ "include": "#details" }] } + } + }, "session-header": { "match": "^(\\d{4}-\\d{2}-\\d{2})\\s+([*!W])\\s+(.+)$", "captures": { @@ -54,7 +73,7 @@ "name": "string.quoted.double.ox" }, "weight": { - "match": "\\b(BW|\\d+(kg|lbs)([+/]\\d+(kg|lbs))*)\\b", + "match": "\\b(BW|\\d+(\\.\\d+)?(g|gram|kg|kilogram|lb|pound|oz|ounce|stone|t|tonne|grain|gr|ct|carat)([+/]\\d+(\\.\\d+)?(g|gram|kg|kilogram|lb|pound|oz|ounce|stone|t|tonne|grain|gr|ct|carat))*)\\b", "name": "constant.numeric.weight.ox" }, "rep-scheme": { @@ -62,11 +81,11 @@ "name": "constant.numeric.reps.ox" }, "time": { - "match": "\\b\\d+(sec|min|hr)\\b", + "match": "PT(\\d+H(\\d+M(\\d+(\\.\\d+)?S)?)?|\\d+M(\\d+(\\.\\d+)?S)?|\\d+(\\.\\d+)?S)", "name": "constant.numeric.time.ox" }, "distance": { - "match": "\\b\\d+(km|mi|m|ft|in)\\b", + "match": "\\b\\d+(\\.\\d+)?(m|meter|metre|km|kilometer|cm|centimeter|mm|millimeter|in|inch|ft|foot|yd|yard|mi|mile|nmi)\\b", "name": "constant.numeric.distance.ox" } } diff --git a/editors/vscode/themes/ox-dark.json b/editors/vscode/themes/ox-dark.json index a5fa23c..b103983 100644 --- a/editors/vscode/themes/ox-dark.json +++ b/editors/vscode/themes/ox-dark.json @@ -77,21 +77,21 @@ "name": "Time", "scope": "constant.numeric.time.ox", "settings": { - "foreground": "#D7BA7D" + "foreground": "#DCDCAA" } }, { "name": "Distance", "scope": "constant.numeric.distance.ox", "settings": { - "foreground": "#D7BA7D" + "foreground": "#D4A5FF" } }, { "name": "Quoted strings", "scope": "string.quoted.double.ox", "settings": { - "foreground": "#CE9178", + "foreground": "#E8B87A", "fontStyle": "italic" } }, diff --git a/settings.json b/settings.json new file mode 100644 index 0000000..463e011 --- /dev/null +++ b/settings.json @@ -0,0 +1,2 @@ + { + "python.defaultInterpreterPath": "${workspaceFolder}/.venv/bin/python"} diff --git a/tree-sitter-ox/grammar.js b/tree-sitter-ox/grammar.js index 05b8923..0bcffaa 100644 --- a/tree-sitter-ox/grammar.js +++ b/tree-sitter-ox/grammar.js @@ -29,48 +29,48 @@ module.exports = grammar({ // Single-line entry: date flag item: details singleline_entry: ($) => - seq( + prec.right(seq( field("date", $.date), field("flag", $.flag), field("item", $.item), ":", optional(field("details", $.details)), - "\n" - ), + optional("\n") + )), // Standalone note entry: date note "text" note_entry: ($) => - seq( + prec.right(seq( field("date", $.date), "note", field("text", $.quoted_string), - "\n" - ), + optional("\n") + )), // Weigh-in entry: date W weight optional(T06:30) optional("scale name") weigh_in_entry: ($) => - seq( + prec.right(seq( field("date", $.date), "W", field("weight", $.weight), optional(field("time_of_day", $.time_of_day)), optional(field("scale", $.quoted_string)), - "\n" - ), + optional("\n") + )), // Query entry: date query "name" "SQL" query_entry: ($) => - seq( + prec.right(seq( field("date", $.date), "query", field("name", $.quoted_string), field("sql", $.quoted_string), - "\n" - ), + optional("\n") + )), // @session block session_block: ($) => - seq( + prec.right(seq( "@session", "\n", field("date", $.date), @@ -79,30 +79,30 @@ module.exports = grammar({ "\n", repeat(choice($.item_line, $.note_line)), "@end", - "\n" - ), + optional("\n") + )), // @exercise block exercise_block: ($) => - seq( + prec.right(seq( "@exercise", field("name", $.identifier), "\n", repeat($.metadata_line), "@end", - "\n" - ), + optional("\n") + )), // @template block template_block: ($) => - seq( + prec.right(seq( "@template", field("name", $.name), "\n", repeat(choice($.item_line, $.note_line)), "@end", - "\n" - ), + optional("\n") + )), // Item line within a block: item: details item_line: ($) => diff --git a/tree-sitter-ox/src/grammar.json b/tree-sitter-ox/src/grammar.json index 44c5e26..3d3922d 100644 --- a/tree-sitter-ox/src/grammar.json +++ b/tree-sitter-ox/src/grammar.json @@ -60,330 +60,414 @@ "value": "#[^\\n]*" }, "singleline_entry": { - "type": "SEQ", - "members": [ - { - "type": "FIELD", - "name": "date", - "content": { - "type": "SYMBOL", - "name": "date" - } - }, - { - "type": "FIELD", - "name": "flag", - "content": { - "type": "SYMBOL", - "name": "flag" - } - }, - { - "type": "FIELD", - "name": "item", - "content": { - "type": "SYMBOL", - "name": "item" - } - }, - { - "type": "STRING", - "value": ":" - }, - { - "type": "CHOICE", - "members": [ - { - "type": "FIELD", - "name": "details", - "content": { - "type": "SYMBOL", - "name": "details" - } - }, - { - "type": "BLANK" + "type": "PREC_RIGHT", + "value": 0, + "content": { + "type": "SEQ", + "members": [ + { + "type": "FIELD", + "name": "date", + "content": { + "type": "SYMBOL", + "name": "date" } - ] - }, - { - "type": "STRING", - "value": "\n" - } - ] + }, + { + "type": "FIELD", + "name": "flag", + "content": { + "type": "SYMBOL", + "name": "flag" + } + }, + { + "type": "FIELD", + "name": "item", + "content": { + "type": "SYMBOL", + "name": "item" + } + }, + { + "type": "STRING", + "value": ":" + }, + { + "type": "CHOICE", + "members": [ + { + "type": "FIELD", + "name": "details", + "content": { + "type": "SYMBOL", + "name": "details" + } + }, + { + "type": "BLANK" + } + ] + }, + { + "type": "CHOICE", + "members": [ + { + "type": "STRING", + "value": "\n" + }, + { + "type": "BLANK" + } + ] + } + ] + } }, "note_entry": { - "type": "SEQ", - "members": [ - { - "type": "FIELD", - "name": "date", - "content": { - "type": "SYMBOL", - "name": "date" - } - }, - { - "type": "STRING", - "value": "note" - }, - { - "type": "FIELD", - "name": "text", - "content": { - "type": "SYMBOL", - "name": "quoted_string" + "type": "PREC_RIGHT", + "value": 0, + "content": { + "type": "SEQ", + "members": [ + { + "type": "FIELD", + "name": "date", + "content": { + "type": "SYMBOL", + "name": "date" + } + }, + { + "type": "STRING", + "value": "note" + }, + { + "type": "FIELD", + "name": "text", + "content": { + "type": "SYMBOL", + "name": "quoted_string" + } + }, + { + "type": "CHOICE", + "members": [ + { + "type": "STRING", + "value": "\n" + }, + { + "type": "BLANK" + } + ] } - }, - { - "type": "STRING", - "value": "\n" - } - ] + ] + } }, "weigh_in_entry": { - "type": "SEQ", - "members": [ - { - "type": "FIELD", - "name": "date", - "content": { - "type": "SYMBOL", - "name": "date" - } - }, - { - "type": "STRING", - "value": "W" - }, - { - "type": "FIELD", - "name": "weight", - "content": { - "type": "SYMBOL", - "name": "weight" - } - }, - { - "type": "CHOICE", - "members": [ - { - "type": "FIELD", - "name": "time_of_day", - "content": { - "type": "SYMBOL", - "name": "time_of_day" - } - }, - { - "type": "BLANK" + "type": "PREC_RIGHT", + "value": 0, + "content": { + "type": "SEQ", + "members": [ + { + "type": "FIELD", + "name": "date", + "content": { + "type": "SYMBOL", + "name": "date" } - ] - }, - { - "type": "CHOICE", - "members": [ - { - "type": "FIELD", - "name": "scale", - "content": { - "type": "SYMBOL", - "name": "quoted_string" - } - }, - { - "type": "BLANK" + }, + { + "type": "STRING", + "value": "W" + }, + { + "type": "FIELD", + "name": "weight", + "content": { + "type": "SYMBOL", + "name": "weight" } - ] - }, - { - "type": "STRING", - "value": "\n" - } - ] + }, + { + "type": "CHOICE", + "members": [ + { + "type": "FIELD", + "name": "time_of_day", + "content": { + "type": "SYMBOL", + "name": "time_of_day" + } + }, + { + "type": "BLANK" + } + ] + }, + { + "type": "CHOICE", + "members": [ + { + "type": "FIELD", + "name": "scale", + "content": { + "type": "SYMBOL", + "name": "quoted_string" + } + }, + { + "type": "BLANK" + } + ] + }, + { + "type": "CHOICE", + "members": [ + { + "type": "STRING", + "value": "\n" + }, + { + "type": "BLANK" + } + ] + } + ] + } }, "query_entry": { - "type": "SEQ", - "members": [ - { - "type": "FIELD", - "name": "date", - "content": { - "type": "SYMBOL", - "name": "date" - } - }, - { - "type": "STRING", - "value": "query" - }, - { - "type": "FIELD", - "name": "name", - "content": { - "type": "SYMBOL", - "name": "quoted_string" - } - }, - { - "type": "FIELD", - "name": "sql", - "content": { - "type": "SYMBOL", - "name": "quoted_string" + "type": "PREC_RIGHT", + "value": 0, + "content": { + "type": "SEQ", + "members": [ + { + "type": "FIELD", + "name": "date", + "content": { + "type": "SYMBOL", + "name": "date" + } + }, + { + "type": "STRING", + "value": "query" + }, + { + "type": "FIELD", + "name": "name", + "content": { + "type": "SYMBOL", + "name": "quoted_string" + } + }, + { + "type": "FIELD", + "name": "sql", + "content": { + "type": "SYMBOL", + "name": "quoted_string" + } + }, + { + "type": "CHOICE", + "members": [ + { + "type": "STRING", + "value": "\n" + }, + { + "type": "BLANK" + } + ] } - }, - { - "type": "STRING", - "value": "\n" - } - ] + ] + } }, "session_block": { - "type": "SEQ", - "members": [ - { - "type": "STRING", - "value": "@session" - }, - { - "type": "STRING", - "value": "\n" - }, - { - "type": "FIELD", - "name": "date", - "content": { - "type": "SYMBOL", - "name": "date" - } - }, - { - "type": "FIELD", - "name": "flag", - "content": { - "type": "SYMBOL", - "name": "flag" - } - }, - { - "type": "FIELD", - "name": "name", - "content": { - "type": "SYMBOL", - "name": "name" - } - }, - { - "type": "STRING", - "value": "\n" - }, - { - "type": "REPEAT", - "content": { + "type": "PREC_RIGHT", + "value": 0, + "content": { + "type": "SEQ", + "members": [ + { + "type": "STRING", + "value": "@session" + }, + { + "type": "STRING", + "value": "\n" + }, + { + "type": "FIELD", + "name": "date", + "content": { + "type": "SYMBOL", + "name": "date" + } + }, + { + "type": "FIELD", + "name": "flag", + "content": { + "type": "SYMBOL", + "name": "flag" + } + }, + { + "type": "FIELD", + "name": "name", + "content": { + "type": "SYMBOL", + "name": "name" + } + }, + { + "type": "STRING", + "value": "\n" + }, + { + "type": "REPEAT", + "content": { + "type": "CHOICE", + "members": [ + { + "type": "SYMBOL", + "name": "item_line" + }, + { + "type": "SYMBOL", + "name": "note_line" + } + ] + } + }, + { + "type": "STRING", + "value": "@end" + }, + { "type": "CHOICE", "members": [ { - "type": "SYMBOL", - "name": "item_line" + "type": "STRING", + "value": "\n" }, { - "type": "SYMBOL", - "name": "note_line" + "type": "BLANK" } ] } - }, - { - "type": "STRING", - "value": "@end" - }, - { - "type": "STRING", - "value": "\n" - } - ] + ] + } }, "exercise_block": { - "type": "SEQ", - "members": [ - { - "type": "STRING", - "value": "@exercise" - }, - { - "type": "FIELD", - "name": "name", - "content": { - "type": "SYMBOL", - "name": "identifier" - } - }, - { - "type": "STRING", - "value": "\n" - }, - { - "type": "REPEAT", - "content": { - "type": "SYMBOL", - "name": "metadata_line" + "type": "PREC_RIGHT", + "value": 0, + "content": { + "type": "SEQ", + "members": [ + { + "type": "STRING", + "value": "@exercise" + }, + { + "type": "FIELD", + "name": "name", + "content": { + "type": "SYMBOL", + "name": "identifier" + } + }, + { + "type": "STRING", + "value": "\n" + }, + { + "type": "REPEAT", + "content": { + "type": "SYMBOL", + "name": "metadata_line" + } + }, + { + "type": "STRING", + "value": "@end" + }, + { + "type": "CHOICE", + "members": [ + { + "type": "STRING", + "value": "\n" + }, + { + "type": "BLANK" + } + ] } - }, - { - "type": "STRING", - "value": "@end" - }, - { - "type": "STRING", - "value": "\n" - } - ] + ] + } }, "template_block": { - "type": "SEQ", - "members": [ - { - "type": "STRING", - "value": "@template" - }, - { - "type": "FIELD", - "name": "name", - "content": { - "type": "SYMBOL", - "name": "name" - } - }, - { - "type": "STRING", - "value": "\n" - }, - { - "type": "REPEAT", - "content": { + "type": "PREC_RIGHT", + "value": 0, + "content": { + "type": "SEQ", + "members": [ + { + "type": "STRING", + "value": "@template" + }, + { + "type": "FIELD", + "name": "name", + "content": { + "type": "SYMBOL", + "name": "name" + } + }, + { + "type": "STRING", + "value": "\n" + }, + { + "type": "REPEAT", + "content": { + "type": "CHOICE", + "members": [ + { + "type": "SYMBOL", + "name": "item_line" + }, + { + "type": "SYMBOL", + "name": "note_line" + } + ] + } + }, + { + "type": "STRING", + "value": "@end" + }, + { "type": "CHOICE", "members": [ { - "type": "SYMBOL", - "name": "item_line" + "type": "STRING", + "value": "\n" }, { - "type": "SYMBOL", - "name": "note_line" + "type": "BLANK" } ] } - }, - { - "type": "STRING", - "value": "@end" - }, - { - "type": "STRING", - "value": "\n" - } - ] + ] + } }, "item_line": { "type": "SEQ", diff --git a/tree-sitter-ox/src/parser.c b/tree-sitter-ox/src/parser.c index 3721126..869d3e4 100644 --- a/tree-sitter-ox/src/parser.c +++ b/tree-sitter-ox/src/parser.c @@ -392,20 +392,20 @@ static const TSMapSlice ts_field_map_slices[PRODUCTION_ID_COUNT] = { [5] = {.index = 8, .length = 3}, [6] = {.index = 11, .length = 3}, [7] = {.index = 14, .length = 3}, - [8] = {.index = 17, .length = 1}, - [9] = {.index = 18, .length = 1}, - [10] = {.index = 19, .length = 1}, - [11] = {.index = 20, .length = 1}, - [12] = {.index = 21, .length = 1}, - [13] = {.index = 22, .length = 5}, - [14] = {.index = 27, .length = 1}, - [15] = {.index = 28, .length = 1}, - [16] = {.index = 29, .length = 4}, - [17] = {.index = 33, .length = 4}, + [8] = {.index = 17, .length = 4}, + [9] = {.index = 21, .length = 1}, + [10] = {.index = 22, .length = 1}, + [11] = {.index = 23, .length = 1}, + [12] = {.index = 24, .length = 1}, + [13] = {.index = 25, .length = 1}, + [14] = {.index = 26, .length = 4}, + [15] = {.index = 30, .length = 5}, + [16] = {.index = 35, .length = 1}, + [17] = {.index = 36, .length = 1}, [18] = {.index = 37, .length = 10}, - [19] = {.index = 47, .length = 2}, - [20] = {.index = 49, .length = 2}, - [21] = {.index = 51, .length = 3}, + [19] = {.index = 47, .length = 3}, + [20] = {.index = 50, .length = 2}, + [21] = {.index = 52, .length = 2}, }; static const TSFieldMapEntry ts_field_map_entries[] = { @@ -434,35 +434,35 @@ static const TSFieldMapEntry ts_field_map_entries[] = { {field_flag, 1}, {field_item, 2}, [17] = + {field_date, 0}, + {field_scale, 4}, + {field_time_of_day, 3}, + {field_weight, 2}, + [21] = {field_weight, 0}, - [18] = + [22] = {field_rep_scheme, 0}, - [19] = + [23] = {field_duration, 0}, - [20] = + [24] = {field_distance, 0}, - [21] = + [25] = {field_note, 0}, - [22] = + [26] = + {field_date, 0}, + {field_details, 4}, + {field_flag, 1}, + {field_item, 2}, + [30] = {field_distance, 0, .inherited = true}, {field_duration, 0, .inherited = true}, {field_note, 0, .inherited = true}, {field_rep_scheme, 0, .inherited = true}, {field_weight, 0, .inherited = true}, - [27] = + [35] = {field_key, 0}, - [28] = + [36] = {field_text, 1}, - [29] = - {field_date, 0}, - {field_scale, 4}, - {field_time_of_day, 3}, - {field_weight, 2}, - [33] = - {field_date, 0}, - {field_details, 4}, - {field_flag, 1}, - {field_item, 2}, [37] = {field_distance, 0, .inherited = true}, {field_distance, 1, .inherited = true}, @@ -475,15 +475,15 @@ static const TSFieldMapEntry ts_field_map_entries[] = { {field_weight, 0, .inherited = true}, {field_weight, 1, .inherited = true}, [47] = + {field_date, 2}, + {field_flag, 3}, + {field_name, 4}, + [50] = {field_key, 0}, {field_value, 2}, - [49] = + [52] = {field_details, 2}, {field_item, 0}, - [51] = - {field_date, 2}, - {field_flag, 3}, - {field_name, 4}, }; static const TSSymbol ts_alias_sequences[PRODUCTION_ID_COUNT][MAX_ALIAS_SEQUENCE_LENGTH] = { @@ -576,7 +576,7 @@ static const TSStateId ts_primary_state_ids[STATE_COUNT] = { [78] = 78, [79] = 79, [80] = 80, - [81] = 78, + [81] = 73, }; static bool ts_lex(TSLexer *lexer, TSStateId state) { @@ -1578,7 +1578,7 @@ static const TSLexerMode ts_lex_modes[STATE_COUNT] = { [4] = {.lex_state = 0}, [5] = {.lex_state = 0}, [6] = {.lex_state = 0}, - [7] = {.lex_state = 15}, + [7] = {.lex_state = 0}, [8] = {.lex_state = 0}, [9] = {.lex_state = 0}, [10] = {.lex_state = 0}, @@ -1586,51 +1586,51 @@ static const TSLexerMode ts_lex_modes[STATE_COUNT] = { [12] = {.lex_state = 0}, [13] = {.lex_state = 0}, [14] = {.lex_state = 0}, - [15] = {.lex_state = 15}, - [16] = {.lex_state = 0}, + [15] = {.lex_state = 0}, + [16] = {.lex_state = 15}, [17] = {.lex_state = 0}, [18] = {.lex_state = 0}, [19] = {.lex_state = 0}, [20] = {.lex_state = 15}, [21] = {.lex_state = 0}, - [22] = {.lex_state = 15}, - [23] = {.lex_state = 15}, + [22] = {.lex_state = 0}, + [23] = {.lex_state = 0}, [24] = {.lex_state = 0}, [25] = {.lex_state = 0}, [26] = {.lex_state = 0}, - [27] = {.lex_state = 2}, + [27] = {.lex_state = 0}, [28] = {.lex_state = 0}, [29] = {.lex_state = 0}, - [30] = {.lex_state = 0}, + [30] = {.lex_state = 15}, [31] = {.lex_state = 0}, [32] = {.lex_state = 0}, - [33] = {.lex_state = 16}, - [34] = {.lex_state = 16}, - [35] = {.lex_state = 16}, + [33] = {.lex_state = 0}, + [34] = {.lex_state = 0}, + [35] = {.lex_state = 0}, [36] = {.lex_state = 15}, [37] = {.lex_state = 0}, - [38] = {.lex_state = 1}, + [38] = {.lex_state = 0}, [39] = {.lex_state = 0}, - [40] = {.lex_state = 15}, - [41] = {.lex_state = 0}, - [42] = {.lex_state = 157}, - [43] = {.lex_state = 1}, - [44] = {.lex_state = 16}, - [45] = {.lex_state = 1}, - [46] = {.lex_state = 157}, - [47] = {.lex_state = 0}, + [40] = {.lex_state = 0}, + [41] = {.lex_state = 15}, + [42] = {.lex_state = 0}, + [43] = {.lex_state = 0}, + [44] = {.lex_state = 0}, + [45] = {.lex_state = 2}, + [46] = {.lex_state = 16}, + [47] = {.lex_state = 16}, [48] = {.lex_state = 16}, [49] = {.lex_state = 0}, - [50] = {.lex_state = 0}, - [51] = {.lex_state = 0}, - [52] = {.lex_state = 0}, - [53] = {.lex_state = 0}, - [54] = {.lex_state = 0}, - [55] = {.lex_state = 0}, - [56] = {.lex_state = 0}, - [57] = {.lex_state = 0}, + [50] = {.lex_state = 15}, + [51] = {.lex_state = 15}, + [52] = {.lex_state = 1}, + [53] = {.lex_state = 1}, + [54] = {.lex_state = 157}, + [55] = {.lex_state = 157}, + [56] = {.lex_state = 16}, + [57] = {.lex_state = 16}, [58] = {.lex_state = 0}, - [59] = {.lex_state = 0}, + [59] = {.lex_state = 1}, [60] = {.lex_state = 0}, [61] = {.lex_state = 0}, [62] = {.lex_state = 0}, @@ -1644,12 +1644,12 @@ static const TSLexerMode ts_lex_modes[STATE_COUNT] = { [70] = {.lex_state = 0}, [71] = {.lex_state = 0}, [72] = {.lex_state = 0}, - [73] = {.lex_state = 0}, + [73] = {.lex_state = 157}, [74] = {.lex_state = 0}, [75] = {.lex_state = 0}, [76] = {.lex_state = 0}, [77] = {.lex_state = 0}, - [78] = {.lex_state = 157}, + [78] = {.lex_state = 0}, [79] = {.lex_state = 0}, [80] = {.lex_state = 0}, [81] = {.lex_state = 1}, @@ -1680,16 +1680,16 @@ static const uint16_t ts_parse_table[LARGE_STATE_COUNT][SYMBOL_COUNT] = { [sym_quoted_string] = ACTIONS(1), }, [STATE(1)] = { - [sym_source_file] = STATE(56), - [sym__entry] = STATE(2), - [sym_singleline_entry] = STATE(2), - [sym_note_entry] = STATE(2), - [sym_weigh_in_entry] = STATE(2), - [sym_query_entry] = STATE(2), - [sym_session_block] = STATE(2), - [sym_exercise_block] = STATE(2), - [sym_template_block] = STATE(2), - [aux_sym_source_file_repeat1] = STATE(2), + [sym_source_file] = STATE(72), + [sym__entry] = STATE(3), + [sym_singleline_entry] = STATE(3), + [sym_note_entry] = STATE(3), + [sym_weigh_in_entry] = STATE(3), + [sym_query_entry] = STATE(3), + [sym_session_block] = STATE(3), + [sym_exercise_block] = STATE(3), + [sym_template_block] = STATE(3), + [aux_sym_source_file_repeat1] = STATE(3), [ts_builtin_sym_end] = ACTIONS(3), [anon_sym_LF] = ACTIONS(5), [sym_comment] = ACTIONS(5), @@ -1702,20 +1702,20 @@ static const uint16_t ts_parse_table[LARGE_STATE_COUNT][SYMBOL_COUNT] = { static const uint16_t ts_small_parse_table[] = { [0] = 7, - ACTIONS(7), 1, + ACTIONS(15), 1, + ts_builtin_sym_end, + ACTIONS(20), 1, anon_sym_ATsession, - ACTIONS(9), 1, + ACTIONS(23), 1, anon_sym_ATexercise, - ACTIONS(11), 1, + ACTIONS(26), 1, anon_sym_ATtemplate, - ACTIONS(13), 1, + ACTIONS(29), 1, sym_date, - ACTIONS(15), 1, - ts_builtin_sym_end, ACTIONS(17), 2, anon_sym_LF, sym_comment, - STATE(3), 9, + STATE(2), 9, sym__entry, sym_singleline_entry, sym_note_entry, @@ -1726,20 +1726,20 @@ static const uint16_t ts_small_parse_table[] = { sym_template_block, aux_sym_source_file_repeat1, [31] = 7, - ACTIONS(19), 1, - ts_builtin_sym_end, - ACTIONS(24), 1, + ACTIONS(7), 1, anon_sym_ATsession, - ACTIONS(27), 1, + ACTIONS(9), 1, anon_sym_ATexercise, - ACTIONS(30), 1, + ACTIONS(11), 1, anon_sym_ATtemplate, - ACTIONS(33), 1, + ACTIONS(13), 1, sym_date, - ACTIONS(21), 2, + ACTIONS(32), 1, + ts_builtin_sym_end, + ACTIONS(34), 2, anon_sym_LF, sym_comment, - STATE(3), 9, + STATE(2), 9, sym__entry, sym_singleline_entry, sym_note_entry, @@ -1749,33 +1749,43 @@ static const uint16_t ts_small_parse_table[] = { sym_exercise_block, sym_template_block, aux_sym_source_file_repeat1, - [62] = 8, - ACTIONS(36), 1, - anon_sym_LF, + [62] = 9, ACTIONS(38), 1, - sym_weight, + anon_sym_LF, ACTIONS(40), 1, - sym_rep_scheme, + sym_weight, ACTIONS(42), 1, - sym_duration, + sym_rep_scheme, ACTIONS(44), 1, - sym_distance, + sym_duration, ACTIONS(46), 1, + sym_distance, + ACTIONS(48), 1, sym_quoted_string, - STATE(17), 1, + STATE(5), 1, aux_sym_details_repeat1, - STATE(61), 1, + STATE(35), 1, sym_details, - [87] = 1, - ACTIONS(48), 7, + ACTIONS(36), 6, ts_builtin_sym_end, - anon_sym_LF, sym_comment, anon_sym_ATsession, anon_sym_ATexercise, anon_sym_ATtemplate, sym_date, - [97] = 1, + [95] = 7, + ACTIONS(40), 1, + sym_weight, + ACTIONS(42), 1, + sym_rep_scheme, + ACTIONS(44), 1, + sym_duration, + ACTIONS(46), 1, + sym_distance, + ACTIONS(48), 1, + sym_quoted_string, + STATE(6), 1, + aux_sym_details_repeat1, ACTIONS(50), 7, ts_builtin_sym_end, anon_sym_LF, @@ -1784,21 +1794,29 @@ static const uint16_t ts_small_parse_table[] = { anon_sym_ATexercise, anon_sym_ATtemplate, sym_date, - [107] = 5, - ACTIONS(52), 1, - anon_sym_ATend, + [123] = 7, ACTIONS(54), 1, - anon_sym_note_COLON, - ACTIONS(56), 1, - aux_sym_item_token1, - STATE(75), 1, - sym_item, - STATE(15), 3, - sym_item_line, - sym_note_line, - aux_sym_session_block_repeat1, - [125] = 1, - ACTIONS(58), 7, + sym_weight, + ACTIONS(57), 1, + sym_rep_scheme, + ACTIONS(60), 1, + sym_duration, + ACTIONS(63), 1, + sym_distance, + ACTIONS(66), 1, + sym_quoted_string, + STATE(6), 1, + aux_sym_details_repeat1, + ACTIONS(52), 7, + ts_builtin_sym_end, + anon_sym_LF, + sym_comment, + anon_sym_ATsession, + anon_sym_ATexercise, + anon_sym_ATtemplate, + sym_date, + [151] = 1, + ACTIONS(69), 12, ts_builtin_sym_end, anon_sym_LF, sym_comment, @@ -1806,8 +1824,13 @@ static const uint16_t ts_small_parse_table[] = { anon_sym_ATexercise, anon_sym_ATtemplate, sym_date, - [135] = 1, - ACTIONS(60), 7, + sym_weight, + sym_rep_scheme, + sym_duration, + sym_distance, + sym_quoted_string, + [166] = 1, + ACTIONS(71), 12, ts_builtin_sym_end, anon_sym_LF, sym_comment, @@ -1815,8 +1838,13 @@ static const uint16_t ts_small_parse_table[] = { anon_sym_ATexercise, anon_sym_ATtemplate, sym_date, - [145] = 1, - ACTIONS(62), 7, + sym_weight, + sym_rep_scheme, + sym_duration, + sym_distance, + sym_quoted_string, + [181] = 1, + ACTIONS(73), 12, ts_builtin_sym_end, anon_sym_LF, sym_comment, @@ -1824,8 +1852,13 @@ static const uint16_t ts_small_parse_table[] = { anon_sym_ATexercise, anon_sym_ATtemplate, sym_date, - [155] = 1, - ACTIONS(64), 7, + sym_weight, + sym_rep_scheme, + sym_duration, + sym_distance, + sym_quoted_string, + [196] = 1, + ACTIONS(75), 12, ts_builtin_sym_end, anon_sym_LF, sym_comment, @@ -1833,32 +1866,53 @@ static const uint16_t ts_small_parse_table[] = { anon_sym_ATexercise, anon_sym_ATtemplate, sym_date, - [165] = 7, - ACTIONS(38), 1, sym_weight, - ACTIONS(40), 1, sym_rep_scheme, - ACTIONS(42), 1, sym_duration, - ACTIONS(44), 1, sym_distance, - ACTIONS(46), 1, sym_quoted_string, - STATE(17), 1, - aux_sym_details_repeat1, - STATE(69), 1, - sym_details, - [187] = 1, - ACTIONS(66), 7, + [211] = 1, + ACTIONS(77), 12, + ts_builtin_sym_end, + anon_sym_LF, + sym_comment, + anon_sym_ATsession, + anon_sym_ATexercise, + anon_sym_ATtemplate, + sym_date, + sym_weight, + sym_rep_scheme, + sym_duration, + sym_distance, + sym_quoted_string, + [226] = 4, + ACTIONS(81), 1, + anon_sym_LF, + ACTIONS(83), 1, + sym_time_of_day, + ACTIONS(85), 1, + sym_quoted_string, + ACTIONS(79), 6, ts_builtin_sym_end, + sym_comment, + anon_sym_ATsession, + anon_sym_ATexercise, + anon_sym_ATtemplate, + sym_date, + [244] = 3, + ACTIONS(89), 1, anon_sym_LF, + ACTIONS(91), 1, + sym_quoted_string, + ACTIONS(87), 6, + ts_builtin_sym_end, sym_comment, anon_sym_ATsession, anon_sym_ATexercise, anon_sym_ATtemplate, sym_date, - [197] = 1, - ACTIONS(68), 7, + [259] = 1, + ACTIONS(93), 7, ts_builtin_sym_end, anon_sym_LF, sym_comment, @@ -1866,82 +1920,187 @@ static const uint16_t ts_small_parse_table[] = { anon_sym_ATexercise, anon_sym_ATtemplate, sym_date, - [207] = 5, - ACTIONS(70), 1, + [269] = 1, + ACTIONS(95), 7, + ts_builtin_sym_end, + anon_sym_LF, + sym_comment, + anon_sym_ATsession, + anon_sym_ATexercise, + anon_sym_ATtemplate, + sym_date, + [279] = 5, + ACTIONS(97), 1, anon_sym_ATend, - ACTIONS(72), 1, + ACTIONS(99), 1, anon_sym_note_COLON, - ACTIONS(75), 1, + ACTIONS(101), 1, aux_sym_item_token1, - STATE(75), 1, + STATE(63), 1, sym_item, - STATE(15), 3, + STATE(20), 3, sym_item_line, sym_note_line, aux_sym_session_block_repeat1, - [225] = 1, - ACTIONS(78), 7, + [297] = 2, + ACTIONS(105), 1, + anon_sym_LF, + ACTIONS(103), 6, ts_builtin_sym_end, + sym_comment, + anon_sym_ATsession, + anon_sym_ATexercise, + anon_sym_ATtemplate, + sym_date, + [309] = 2, + ACTIONS(109), 1, anon_sym_LF, + ACTIONS(107), 6, + ts_builtin_sym_end, sym_comment, anon_sym_ATsession, anon_sym_ATexercise, anon_sym_ATtemplate, sym_date, - [235] = 7, - ACTIONS(38), 1, - sym_weight, - ACTIONS(40), 1, - sym_rep_scheme, - ACTIONS(42), 1, - sym_duration, - ACTIONS(44), 1, - sym_distance, - ACTIONS(46), 1, - sym_quoted_string, - ACTIONS(80), 1, + [321] = 2, + ACTIONS(113), 1, anon_sym_LF, - STATE(18), 1, - aux_sym_details_repeat1, - [257] = 7, - ACTIONS(82), 1, + ACTIONS(111), 6, + ts_builtin_sym_end, + sym_comment, + anon_sym_ATsession, + anon_sym_ATexercise, + anon_sym_ATtemplate, + sym_date, + [333] = 5, + ACTIONS(99), 1, + anon_sym_note_COLON, + ACTIONS(101), 1, + aux_sym_item_token1, + ACTIONS(115), 1, + anon_sym_ATend, + STATE(63), 1, + sym_item, + STATE(30), 3, + sym_item_line, + sym_note_line, + aux_sym_session_block_repeat1, + [351] = 1, + ACTIONS(117), 7, + ts_builtin_sym_end, + anon_sym_LF, + sym_comment, + anon_sym_ATsession, + anon_sym_ATexercise, + anon_sym_ATtemplate, + sym_date, + [361] = 1, + ACTIONS(119), 7, + ts_builtin_sym_end, + anon_sym_LF, + sym_comment, + anon_sym_ATsession, + anon_sym_ATexercise, + anon_sym_ATtemplate, + sym_date, + [371] = 2, + ACTIONS(123), 1, + anon_sym_LF, + ACTIONS(121), 6, + ts_builtin_sym_end, + sym_comment, + anon_sym_ATsession, + anon_sym_ATexercise, + anon_sym_ATtemplate, + sym_date, + [383] = 2, + ACTIONS(127), 1, + anon_sym_LF, + ACTIONS(125), 6, + ts_builtin_sym_end, + sym_comment, + anon_sym_ATsession, + anon_sym_ATexercise, + anon_sym_ATtemplate, + sym_date, + [395] = 1, + ACTIONS(129), 7, + ts_builtin_sym_end, anon_sym_LF, - ACTIONS(84), 1, + sym_comment, + anon_sym_ATsession, + anon_sym_ATexercise, + anon_sym_ATtemplate, + sym_date, + [405] = 2, + ACTIONS(131), 1, + anon_sym_LF, + ACTIONS(129), 6, + ts_builtin_sym_end, + sym_comment, + anon_sym_ATsession, + anon_sym_ATexercise, + anon_sym_ATtemplate, + sym_date, + [417] = 1, + ACTIONS(133), 7, + ts_builtin_sym_end, + anon_sym_LF, + sym_comment, + anon_sym_ATsession, + anon_sym_ATexercise, + anon_sym_ATtemplate, + sym_date, + [427] = 7, + ACTIONS(40), 1, sym_weight, - ACTIONS(87), 1, + ACTIONS(42), 1, sym_rep_scheme, - ACTIONS(90), 1, + ACTIONS(44), 1, sym_duration, - ACTIONS(93), 1, + ACTIONS(46), 1, sym_distance, - ACTIONS(96), 1, + ACTIONS(48), 1, sym_quoted_string, - STATE(18), 1, + STATE(5), 1, aux_sym_details_repeat1, - [279] = 1, - ACTIONS(99), 7, - ts_builtin_sym_end, + STATE(69), 1, + sym_details, + [449] = 2, + ACTIONS(135), 1, anon_sym_LF, + ACTIONS(133), 6, + ts_builtin_sym_end, sym_comment, anon_sym_ATsession, anon_sym_ATexercise, anon_sym_ATtemplate, sym_date, - [289] = 5, - ACTIONS(54), 1, + [461] = 5, + ACTIONS(137), 1, + anon_sym_ATend, + ACTIONS(139), 1, anon_sym_note_COLON, - ACTIONS(56), 1, + ACTIONS(142), 1, aux_sym_item_token1, - ACTIONS(101), 1, - anon_sym_ATend, - STATE(75), 1, + STATE(63), 1, sym_item, - STATE(7), 3, + STATE(30), 3, sym_item_line, sym_note_line, aux_sym_session_block_repeat1, - [307] = 1, - ACTIONS(103), 7, + [479] = 2, + ACTIONS(147), 1, + anon_sym_LF, + ACTIONS(145), 6, + ts_builtin_sym_end, + sym_comment, + anon_sym_ATsession, + anon_sym_ATexercise, + anon_sym_ATtemplate, + sym_date, + [491] = 1, + ACTIONS(149), 7, ts_builtin_sym_end, anon_sym_LF, sym_comment, @@ -1949,34 +2108,99 @@ static const uint16_t ts_small_parse_table[] = { anon_sym_ATexercise, anon_sym_ATtemplate, sym_date, - [317] = 5, - ACTIONS(54), 1, + [501] = 1, + ACTIONS(151), 7, + ts_builtin_sym_end, + anon_sym_LF, + sym_comment, + anon_sym_ATsession, + anon_sym_ATexercise, + anon_sym_ATtemplate, + sym_date, + [511] = 1, + ACTIONS(153), 7, + ts_builtin_sym_end, + anon_sym_LF, + sym_comment, + anon_sym_ATsession, + anon_sym_ATexercise, + anon_sym_ATtemplate, + sym_date, + [521] = 2, + ACTIONS(157), 1, + anon_sym_LF, + ACTIONS(155), 6, + ts_builtin_sym_end, + sym_comment, + anon_sym_ATsession, + anon_sym_ATexercise, + anon_sym_ATtemplate, + sym_date, + [533] = 5, + ACTIONS(99), 1, anon_sym_note_COLON, - ACTIONS(56), 1, + ACTIONS(101), 1, aux_sym_item_token1, - ACTIONS(105), 1, + ACTIONS(159), 1, anon_sym_ATend, - STATE(75), 1, + STATE(63), 1, sym_item, - STATE(23), 3, + STATE(41), 3, sym_item_line, sym_note_line, aux_sym_session_block_repeat1, - [335] = 5, - ACTIONS(54), 1, + [551] = 1, + ACTIONS(161), 7, + ts_builtin_sym_end, + anon_sym_LF, + sym_comment, + anon_sym_ATsession, + anon_sym_ATexercise, + anon_sym_ATtemplate, + sym_date, + [561] = 1, + ACTIONS(163), 7, + ts_builtin_sym_end, + anon_sym_LF, + sym_comment, + anon_sym_ATsession, + anon_sym_ATexercise, + anon_sym_ATtemplate, + sym_date, + [571] = 1, + ACTIONS(165), 7, + ts_builtin_sym_end, + anon_sym_LF, + sym_comment, + anon_sym_ATsession, + anon_sym_ATexercise, + anon_sym_ATtemplate, + sym_date, + [581] = 2, + ACTIONS(169), 1, + anon_sym_LF, + ACTIONS(167), 6, + ts_builtin_sym_end, + sym_comment, + anon_sym_ATsession, + anon_sym_ATexercise, + anon_sym_ATtemplate, + sym_date, + [593] = 5, + ACTIONS(99), 1, anon_sym_note_COLON, - ACTIONS(56), 1, + ACTIONS(101), 1, aux_sym_item_token1, - ACTIONS(107), 1, + ACTIONS(171), 1, anon_sym_ATend, - STATE(75), 1, + STATE(63), 1, sym_item, - STATE(15), 3, + STATE(30), 3, sym_item_line, sym_note_line, aux_sym_session_block_repeat1, - [353] = 1, - ACTIONS(109), 7, + [611] = 1, + ACTIONS(173), 7, ts_builtin_sym_end, anon_sym_LF, sym_comment, @@ -1984,17 +2208,18 @@ static const uint16_t ts_small_parse_table[] = { anon_sym_ATexercise, anon_sym_ATtemplate, sym_date, - [363] = 1, - ACTIONS(111), 7, - ts_builtin_sym_end, + [621] = 2, + ACTIONS(175), 1, anon_sym_LF, + ACTIONS(173), 6, + ts_builtin_sym_end, sym_comment, anon_sym_ATsession, anon_sym_ATexercise, anon_sym_ATtemplate, sym_date, - [373] = 1, - ACTIONS(113), 7, + [633] = 1, + ACTIONS(177), 7, ts_builtin_sym_end, anon_sym_LF, sym_comment, @@ -2002,255 +2227,170 @@ static const uint16_t ts_small_parse_table[] = { anon_sym_ATexercise, anon_sym_ATtemplate, sym_date, - [383] = 5, - ACTIONS(115), 1, + [643] = 5, + ACTIONS(179), 1, anon_sym_note, - ACTIONS(117), 1, + ACTIONS(181), 1, anon_sym_W, - ACTIONS(119), 1, + ACTIONS(183), 1, anon_sym_query, - STATE(42), 1, + STATE(55), 1, sym_flag, - ACTIONS(121), 2, + ACTIONS(185), 2, anon_sym_STAR, anon_sym_BANG, - [400] = 1, - ACTIONS(123), 6, - anon_sym_LF, - sym_weight, - sym_rep_scheme, - sym_duration, - sym_distance, - sym_quoted_string, - [409] = 1, - ACTIONS(125), 6, - anon_sym_LF, - sym_weight, - sym_rep_scheme, - sym_duration, - sym_distance, - sym_quoted_string, - [418] = 1, - ACTIONS(127), 6, - anon_sym_LF, - sym_weight, - sym_rep_scheme, - sym_duration, - sym_distance, - sym_quoted_string, - [427] = 1, - ACTIONS(129), 6, - anon_sym_LF, - sym_weight, - sym_rep_scheme, - sym_duration, - sym_distance, - sym_quoted_string, - [436] = 1, - ACTIONS(131), 6, - anon_sym_LF, - sym_weight, - sym_rep_scheme, - sym_duration, - sym_distance, - sym_quoted_string, - [445] = 4, - ACTIONS(133), 1, + [660] = 4, + ACTIONS(187), 1, anon_sym_ATend, - ACTIONS(135), 1, + ACTIONS(189), 1, aux_sym_item_token1, - STATE(70), 1, + STATE(68), 1, sym_identifier, - STATE(33), 2, + STATE(47), 2, sym_metadata_line, aux_sym_exercise_block_repeat1, - [459] = 4, - ACTIONS(138), 1, - anon_sym_ATend, - ACTIONS(140), 1, + [674] = 4, + ACTIONS(189), 1, aux_sym_item_token1, - STATE(70), 1, + ACTIONS(191), 1, + anon_sym_ATend, + STATE(68), 1, sym_identifier, - STATE(35), 2, + STATE(48), 2, sym_metadata_line, aux_sym_exercise_block_repeat1, - [473] = 4, - ACTIONS(140), 1, - aux_sym_item_token1, - ACTIONS(142), 1, + [688] = 4, + ACTIONS(193), 1, anon_sym_ATend, - STATE(70), 1, + ACTIONS(195), 1, + aux_sym_item_token1, + STATE(68), 1, sym_identifier, - STATE(33), 2, + STATE(48), 2, sym_metadata_line, aux_sym_exercise_block_repeat1, - [487] = 2, - ACTIONS(146), 1, - anon_sym_note_COLON, - ACTIONS(144), 2, - anon_sym_ATend, - aux_sym_item_token1, - [495] = 3, - ACTIONS(148), 1, - anon_sym_LF, - ACTIONS(150), 1, - sym_time_of_day, - ACTIONS(152), 1, - sym_quoted_string, - [505] = 3, - ACTIONS(154), 1, - anon_sym_LF, - ACTIONS(156), 1, - aux_sym_name_token1, - STATE(66), 1, - sym_text_until_newline, - [515] = 2, - STATE(43), 1, + [702] = 2, + STATE(59), 1, sym_flag, - ACTIONS(158), 2, + ACTIONS(198), 2, anon_sym_STAR, anon_sym_BANG, - [523] = 2, - ACTIONS(162), 1, + [710] = 2, + ACTIONS(202), 1, anon_sym_note_COLON, - ACTIONS(160), 2, + ACTIONS(200), 2, anon_sym_ATend, aux_sym_item_token1, - [531] = 1, - ACTIONS(164), 2, - anon_sym_LF, - anon_sym_COLON, - [536] = 2, - ACTIONS(166), 1, - aux_sym_item_token1, - STATE(62), 1, - sym_item, - [543] = 2, - ACTIONS(168), 1, - aux_sym_name_token1, - STATE(53), 1, - sym_name, - [550] = 1, - ACTIONS(170), 2, + [718] = 2, + ACTIONS(206), 1, + anon_sym_note_COLON, + ACTIONS(204), 2, anon_sym_ATend, aux_sym_item_token1, - [555] = 2, - ACTIONS(168), 1, + [726] = 3, + ACTIONS(208), 1, + anon_sym_LF, + ACTIONS(210), 1, aux_sym_name_token1, - STATE(54), 1, + STATE(66), 1, + sym_text_until_newline, + [736] = 2, + ACTIONS(212), 1, + aux_sym_name_token1, + STATE(62), 1, sym_name, - [562] = 2, - ACTIONS(172), 1, + [743] = 2, + ACTIONS(214), 1, aux_sym_item_token1, - STATE(80), 1, + STATE(79), 1, sym_identifier, - [569] = 2, - ACTIONS(174), 1, - anon_sym_LF, - ACTIONS(176), 1, - sym_quoted_string, - [576] = 1, - ACTIONS(178), 2, + [750] = 2, + ACTIONS(216), 1, + aux_sym_item_token1, + STATE(75), 1, + sym_item, + [757] = 1, + ACTIONS(218), 2, anon_sym_ATend, aux_sym_item_token1, - [581] = 1, - ACTIONS(180), 1, - anon_sym_LF, - [585] = 1, - ACTIONS(182), 1, - anon_sym_LF, - [589] = 1, - ACTIONS(184), 1, - anon_sym_LF, - [593] = 1, - ACTIONS(186), 1, - anon_sym_LF, - [597] = 1, - ACTIONS(188), 1, - anon_sym_LF, - [601] = 1, - ACTIONS(190), 1, - anon_sym_LF, - [605] = 1, - ACTIONS(192), 1, - anon_sym_LF, - [609] = 1, - ACTIONS(194), 1, - ts_builtin_sym_end, - [613] = 1, - ACTIONS(196), 1, - anon_sym_LF, - [617] = 1, - ACTIONS(198), 1, - anon_sym_LF, - [621] = 1, - ACTIONS(200), 1, - sym_quoted_string, - [625] = 1, - ACTIONS(202), 1, - anon_sym_COLON, - [629] = 1, - ACTIONS(204), 1, + [762] = 1, + ACTIONS(220), 2, + anon_sym_ATend, + aux_sym_item_token1, + [767] = 1, + ACTIONS(222), 2, anon_sym_LF, - [633] = 1, - ACTIONS(206), 1, anon_sym_COLON, - [637] = 1, - ACTIONS(208), 1, - anon_sym_LF, - [641] = 1, - ACTIONS(210), 1, - sym_quoted_string, - [645] = 1, + [772] = 2, ACTIONS(212), 1, - anon_sym_LF, - [649] = 1, - ACTIONS(214), 1, - anon_sym_LF, - [653] = 1, - ACTIONS(216), 1, - anon_sym_LF, - [657] = 1, - ACTIONS(218), 1, - sym_weight, - [661] = 1, - ACTIONS(220), 1, - anon_sym_LF, - [665] = 1, - ACTIONS(222), 1, - anon_sym_COLON, - [669] = 1, + aux_sym_name_token1, + STATE(74), 1, + sym_name, + [779] = 1, ACTIONS(224), 1, - anon_sym_LF, - [673] = 1, + sym_weight, + [783] = 1, ACTIONS(226), 1, sym_quoted_string, - [677] = 1, + [787] = 1, ACTIONS(228), 1, - sym_quoted_string, - [681] = 1, - ACTIONS(230), 1, anon_sym_LF, - [685] = 1, - ACTIONS(232), 1, + [791] = 1, + ACTIONS(230), 1, anon_sym_COLON, - [689] = 1, + [795] = 1, + ACTIONS(232), 1, + anon_sym_LF, + [799] = 1, ACTIONS(234), 1, anon_sym_LF, - [693] = 1, + [803] = 1, ACTIONS(236), 1, - sym_date, - [697] = 1, + anon_sym_LF, + [807] = 1, ACTIONS(238), 1, - aux_sym_item_token1, - [701] = 1, + sym_quoted_string, + [811] = 1, ACTIONS(240), 1, - anon_sym_LF, - [705] = 1, + anon_sym_COLON, + [815] = 1, ACTIONS(242), 1, anon_sym_LF, - [709] = 1, - ACTIONS(238), 1, + [819] = 1, + ACTIONS(244), 1, + sym_quoted_string, + [823] = 1, + ACTIONS(246), 1, + anon_sym_COLON, + [827] = 1, + ACTIONS(248), 1, + ts_builtin_sym_end, + [831] = 1, + ACTIONS(250), 1, + aux_sym_item_token1, + [835] = 1, + ACTIONS(252), 1, + anon_sym_LF, + [839] = 1, + ACTIONS(254), 1, + anon_sym_COLON, + [843] = 1, + ACTIONS(256), 1, + anon_sym_LF, + [847] = 1, + ACTIONS(258), 1, + sym_date, + [851] = 1, + ACTIONS(260), 1, + sym_quoted_string, + [855] = 1, + ACTIONS(262), 1, + anon_sym_LF, + [859] = 1, + ACTIONS(264), 1, + anon_sym_LF, + [863] = 1, + ACTIONS(250), 1, aux_sym_name_token1, }; @@ -2258,202 +2398,213 @@ static const uint32_t ts_small_parse_table_map[] = { [SMALL_STATE(2)] = 0, [SMALL_STATE(3)] = 31, [SMALL_STATE(4)] = 62, - [SMALL_STATE(5)] = 87, - [SMALL_STATE(6)] = 97, - [SMALL_STATE(7)] = 107, - [SMALL_STATE(8)] = 125, - [SMALL_STATE(9)] = 135, - [SMALL_STATE(10)] = 145, - [SMALL_STATE(11)] = 155, - [SMALL_STATE(12)] = 165, - [SMALL_STATE(13)] = 187, - [SMALL_STATE(14)] = 197, - [SMALL_STATE(15)] = 207, - [SMALL_STATE(16)] = 225, - [SMALL_STATE(17)] = 235, - [SMALL_STATE(18)] = 257, - [SMALL_STATE(19)] = 279, - [SMALL_STATE(20)] = 289, - [SMALL_STATE(21)] = 307, - [SMALL_STATE(22)] = 317, - [SMALL_STATE(23)] = 335, - [SMALL_STATE(24)] = 353, - [SMALL_STATE(25)] = 363, - [SMALL_STATE(26)] = 373, - [SMALL_STATE(27)] = 383, - [SMALL_STATE(28)] = 400, - [SMALL_STATE(29)] = 409, - [SMALL_STATE(30)] = 418, - [SMALL_STATE(31)] = 427, - [SMALL_STATE(32)] = 436, - [SMALL_STATE(33)] = 445, - [SMALL_STATE(34)] = 459, - [SMALL_STATE(35)] = 473, - [SMALL_STATE(36)] = 487, - [SMALL_STATE(37)] = 495, - [SMALL_STATE(38)] = 505, - [SMALL_STATE(39)] = 515, - [SMALL_STATE(40)] = 523, - [SMALL_STATE(41)] = 531, - [SMALL_STATE(42)] = 536, - [SMALL_STATE(43)] = 543, - [SMALL_STATE(44)] = 550, - [SMALL_STATE(45)] = 555, - [SMALL_STATE(46)] = 562, - [SMALL_STATE(47)] = 569, - [SMALL_STATE(48)] = 576, - [SMALL_STATE(49)] = 581, - [SMALL_STATE(50)] = 585, - [SMALL_STATE(51)] = 589, - [SMALL_STATE(52)] = 593, - [SMALL_STATE(53)] = 597, - [SMALL_STATE(54)] = 601, - [SMALL_STATE(55)] = 605, - [SMALL_STATE(56)] = 609, - [SMALL_STATE(57)] = 613, - [SMALL_STATE(58)] = 617, - [SMALL_STATE(59)] = 621, - [SMALL_STATE(60)] = 625, - [SMALL_STATE(61)] = 629, - [SMALL_STATE(62)] = 633, - [SMALL_STATE(63)] = 637, - [SMALL_STATE(64)] = 641, - [SMALL_STATE(65)] = 645, - [SMALL_STATE(66)] = 649, - [SMALL_STATE(67)] = 653, - [SMALL_STATE(68)] = 657, - [SMALL_STATE(69)] = 661, - [SMALL_STATE(70)] = 665, - [SMALL_STATE(71)] = 669, - [SMALL_STATE(72)] = 673, - [SMALL_STATE(73)] = 677, - [SMALL_STATE(74)] = 681, - [SMALL_STATE(75)] = 685, - [SMALL_STATE(76)] = 689, - [SMALL_STATE(77)] = 693, - [SMALL_STATE(78)] = 697, - [SMALL_STATE(79)] = 701, - [SMALL_STATE(80)] = 705, - [SMALL_STATE(81)] = 709, + [SMALL_STATE(5)] = 95, + [SMALL_STATE(6)] = 123, + [SMALL_STATE(7)] = 151, + [SMALL_STATE(8)] = 166, + [SMALL_STATE(9)] = 181, + [SMALL_STATE(10)] = 196, + [SMALL_STATE(11)] = 211, + [SMALL_STATE(12)] = 226, + [SMALL_STATE(13)] = 244, + [SMALL_STATE(14)] = 259, + [SMALL_STATE(15)] = 269, + [SMALL_STATE(16)] = 279, + [SMALL_STATE(17)] = 297, + [SMALL_STATE(18)] = 309, + [SMALL_STATE(19)] = 321, + [SMALL_STATE(20)] = 333, + [SMALL_STATE(21)] = 351, + [SMALL_STATE(22)] = 361, + [SMALL_STATE(23)] = 371, + [SMALL_STATE(24)] = 383, + [SMALL_STATE(25)] = 395, + [SMALL_STATE(26)] = 405, + [SMALL_STATE(27)] = 417, + [SMALL_STATE(28)] = 427, + [SMALL_STATE(29)] = 449, + [SMALL_STATE(30)] = 461, + [SMALL_STATE(31)] = 479, + [SMALL_STATE(32)] = 491, + [SMALL_STATE(33)] = 501, + [SMALL_STATE(34)] = 511, + [SMALL_STATE(35)] = 521, + [SMALL_STATE(36)] = 533, + [SMALL_STATE(37)] = 551, + [SMALL_STATE(38)] = 561, + [SMALL_STATE(39)] = 571, + [SMALL_STATE(40)] = 581, + [SMALL_STATE(41)] = 593, + [SMALL_STATE(42)] = 611, + [SMALL_STATE(43)] = 621, + [SMALL_STATE(44)] = 633, + [SMALL_STATE(45)] = 643, + [SMALL_STATE(46)] = 660, + [SMALL_STATE(47)] = 674, + [SMALL_STATE(48)] = 688, + [SMALL_STATE(49)] = 702, + [SMALL_STATE(50)] = 710, + [SMALL_STATE(51)] = 718, + [SMALL_STATE(52)] = 726, + [SMALL_STATE(53)] = 736, + [SMALL_STATE(54)] = 743, + [SMALL_STATE(55)] = 750, + [SMALL_STATE(56)] = 757, + [SMALL_STATE(57)] = 762, + [SMALL_STATE(58)] = 767, + [SMALL_STATE(59)] = 772, + [SMALL_STATE(60)] = 779, + [SMALL_STATE(61)] = 783, + [SMALL_STATE(62)] = 787, + [SMALL_STATE(63)] = 791, + [SMALL_STATE(64)] = 795, + [SMALL_STATE(65)] = 799, + [SMALL_STATE(66)] = 803, + [SMALL_STATE(67)] = 807, + [SMALL_STATE(68)] = 811, + [SMALL_STATE(69)] = 815, + [SMALL_STATE(70)] = 819, + [SMALL_STATE(71)] = 823, + [SMALL_STATE(72)] = 827, + [SMALL_STATE(73)] = 831, + [SMALL_STATE(74)] = 835, + [SMALL_STATE(75)] = 839, + [SMALL_STATE(76)] = 843, + [SMALL_STATE(77)] = 847, + [SMALL_STATE(78)] = 851, + [SMALL_STATE(79)] = 855, + [SMALL_STATE(80)] = 859, + [SMALL_STATE(81)] = 863, }; 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_source_file, 0, 0, 0), - [5] = {.entry = {.count = 1, .reusable = true}}, SHIFT(2), - [7] = {.entry = {.count = 1, .reusable = true}}, SHIFT(55), - [9] = {.entry = {.count = 1, .reusable = true}}, SHIFT(46), - [11] = {.entry = {.count = 1, .reusable = true}}, SHIFT(45), - [13] = {.entry = {.count = 1, .reusable = true}}, SHIFT(27), - [15] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_source_file, 1, 0, 0), - [17] = {.entry = {.count = 1, .reusable = true}}, SHIFT(3), - [19] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_source_file_repeat1, 2, 0, 0), - [21] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_source_file_repeat1, 2, 0, 0), SHIFT_REPEAT(3), - [24] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_source_file_repeat1, 2, 0, 0), SHIFT_REPEAT(55), - [27] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_source_file_repeat1, 2, 0, 0), SHIFT_REPEAT(46), - [30] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_source_file_repeat1, 2, 0, 0), SHIFT_REPEAT(45), - [33] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_source_file_repeat1, 2, 0, 0), SHIFT_REPEAT(27), - [36] = {.entry = {.count = 1, .reusable = true}}, SHIFT(16), - [38] = {.entry = {.count = 1, .reusable = true}}, SHIFT(28), - [40] = {.entry = {.count = 1, .reusable = true}}, SHIFT(29), - [42] = {.entry = {.count = 1, .reusable = true}}, SHIFT(31), - [44] = {.entry = {.count = 1, .reusable = true}}, SHIFT(30), - [46] = {.entry = {.count = 1, .reusable = true}}, SHIFT(32), - [48] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_template_block, 6, 0, 3), - [50] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_query_entry, 5, 0, 6), - [52] = {.entry = {.count = 1, .reusable = false}}, SHIFT(76), - [54] = {.entry = {.count = 1, .reusable = true}}, SHIFT(73), - [56] = {.entry = {.count = 1, .reusable = false}}, SHIFT(60), - [58] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_note_entry, 4, 0, 1), - [60] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_weigh_in_entry, 4, 0, 2), - [62] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_weigh_in_entry, 5, 0, 5), - [64] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_exercise_block, 5, 0, 3), - [66] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_template_block, 5, 0, 3), - [68] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_weigh_in_entry, 5, 0, 4), - [70] = {.entry = {.count = 1, .reusable = false}}, REDUCE(aux_sym_session_block_repeat1, 2, 0, 0), - [72] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_session_block_repeat1, 2, 0, 0), SHIFT_REPEAT(73), - [75] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_session_block_repeat1, 2, 0, 0), SHIFT_REPEAT(60), - [78] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_singleline_entry, 5, 0, 7), - [80] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_details, 1, 0, 13), - [82] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_details_repeat1, 2, 0, 18), - [84] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_details_repeat1, 2, 0, 18), SHIFT_REPEAT(28), - [87] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_details_repeat1, 2, 0, 18), SHIFT_REPEAT(29), - [90] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_details_repeat1, 2, 0, 18), SHIFT_REPEAT(31), - [93] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_details_repeat1, 2, 0, 18), SHIFT_REPEAT(30), - [96] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_details_repeat1, 2, 0, 18), SHIFT_REPEAT(32), - [99] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_singleline_entry, 6, 0, 17), - [101] = {.entry = {.count = 1, .reusable = false}}, SHIFT(49), - [103] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_exercise_block, 6, 0, 3), - [105] = {.entry = {.count = 1, .reusable = false}}, SHIFT(74), - [107] = {.entry = {.count = 1, .reusable = false}}, SHIFT(79), - [109] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_weigh_in_entry, 6, 0, 16), - [111] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_session_block, 8, 0, 21), - [113] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_session_block, 9, 0, 21), - [115] = {.entry = {.count = 1, .reusable = true}}, SHIFT(64), - [117] = {.entry = {.count = 1, .reusable = true}}, SHIFT(68), - [119] = {.entry = {.count = 1, .reusable = true}}, SHIFT(72), - [121] = {.entry = {.count = 1, .reusable = true}}, SHIFT(78), - [123] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_details_repeat1, 1, 0, 8), - [125] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_details_repeat1, 1, 0, 9), - [127] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_details_repeat1, 1, 0, 11), - [129] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_details_repeat1, 1, 0, 10), - [131] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_details_repeat1, 1, 0, 12), - [133] = {.entry = {.count = 1, .reusable = false}}, REDUCE(aux_sym_exercise_block_repeat1, 2, 0, 0), - [135] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_exercise_block_repeat1, 2, 0, 0), SHIFT_REPEAT(41), - [138] = {.entry = {.count = 1, .reusable = false}}, SHIFT(67), - [140] = {.entry = {.count = 1, .reusable = false}}, SHIFT(41), - [142] = {.entry = {.count = 1, .reusable = false}}, SHIFT(63), - [144] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_item_line, 4, 0, 20), - [146] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_item_line, 4, 0, 20), - [148] = {.entry = {.count = 1, .reusable = true}}, SHIFT(9), - [150] = {.entry = {.count = 1, .reusable = true}}, SHIFT(47), - [152] = {.entry = {.count = 1, .reusable = true}}, SHIFT(50), - [154] = {.entry = {.count = 1, .reusable = false}}, SHIFT(44), - [156] = {.entry = {.count = 1, .reusable = true}}, SHIFT(65), - [158] = {.entry = {.count = 1, .reusable = true}}, SHIFT(81), - [160] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_note_line, 3, 0, 15), - [162] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_note_line, 3, 0, 15), - [164] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_identifier, 1, 0, 0), - [166] = {.entry = {.count = 1, .reusable = true}}, SHIFT(60), - [168] = {.entry = {.count = 1, .reusable = true}}, SHIFT(51), - [170] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_metadata_line, 3, 0, 14), - [172] = {.entry = {.count = 1, .reusable = true}}, SHIFT(41), - [174] = {.entry = {.count = 1, .reusable = true}}, SHIFT(14), - [176] = {.entry = {.count = 1, .reusable = true}}, SHIFT(52), - [178] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_metadata_line, 4, 0, 19), - [180] = {.entry = {.count = 1, .reusable = true}}, SHIFT(13), - [182] = {.entry = {.count = 1, .reusable = true}}, SHIFT(10), - [184] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_name, 1, 0, 0), - [186] = {.entry = {.count = 1, .reusable = true}}, SHIFT(24), - [188] = {.entry = {.count = 1, .reusable = true}}, SHIFT(22), - [190] = {.entry = {.count = 1, .reusable = true}}, SHIFT(20), - [192] = {.entry = {.count = 1, .reusable = true}}, SHIFT(77), - [194] = {.entry = {.count = 1, .reusable = true}}, ACCEPT_INPUT(), - [196] = {.entry = {.count = 1, .reusable = true}}, SHIFT(8), - [198] = {.entry = {.count = 1, .reusable = true}}, SHIFT(6), - [200] = {.entry = {.count = 1, .reusable = true}}, SHIFT(58), - [202] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_item, 1, 0, 0), - [204] = {.entry = {.count = 1, .reusable = true}}, SHIFT(19), - [206] = {.entry = {.count = 1, .reusable = true}}, SHIFT(4), - [208] = {.entry = {.count = 1, .reusable = true}}, SHIFT(21), - [210] = {.entry = {.count = 1, .reusable = true}}, SHIFT(57), - [212] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_text_until_newline, 1, 0, 0), - [214] = {.entry = {.count = 1, .reusable = true}}, SHIFT(48), - [216] = {.entry = {.count = 1, .reusable = true}}, SHIFT(11), - [218] = {.entry = {.count = 1, .reusable = true}}, SHIFT(37), - [220] = {.entry = {.count = 1, .reusable = true}}, SHIFT(36), - [222] = {.entry = {.count = 1, .reusable = true}}, SHIFT(38), - [224] = {.entry = {.count = 1, .reusable = true}}, SHIFT(40), - [226] = {.entry = {.count = 1, .reusable = true}}, SHIFT(59), - [228] = {.entry = {.count = 1, .reusable = true}}, SHIFT(71), - [230] = {.entry = {.count = 1, .reusable = true}}, SHIFT(25), - [232] = {.entry = {.count = 1, .reusable = true}}, SHIFT(12), - [234] = {.entry = {.count = 1, .reusable = true}}, SHIFT(5), - [236] = {.entry = {.count = 1, .reusable = true}}, SHIFT(39), - [238] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_flag, 1, 0, 0), - [240] = {.entry = {.count = 1, .reusable = true}}, SHIFT(26), - [242] = {.entry = {.count = 1, .reusable = true}}, SHIFT(34), + [5] = {.entry = {.count = 1, .reusable = true}}, SHIFT(3), + [7] = {.entry = {.count = 1, .reusable = true}}, SHIFT(76), + [9] = {.entry = {.count = 1, .reusable = true}}, SHIFT(54), + [11] = {.entry = {.count = 1, .reusable = true}}, SHIFT(53), + [13] = {.entry = {.count = 1, .reusable = true}}, SHIFT(45), + [15] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_source_file_repeat1, 2, 0, 0), + [17] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_source_file_repeat1, 2, 0, 0), SHIFT_REPEAT(2), + [20] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_source_file_repeat1, 2, 0, 0), SHIFT_REPEAT(76), + [23] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_source_file_repeat1, 2, 0, 0), SHIFT_REPEAT(54), + [26] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_source_file_repeat1, 2, 0, 0), SHIFT_REPEAT(53), + [29] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_source_file_repeat1, 2, 0, 0), SHIFT_REPEAT(45), + [32] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_source_file, 1, 0, 0), + [34] = {.entry = {.count = 1, .reusable = true}}, SHIFT(2), + [36] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_singleline_entry, 4, 0, 7), + [38] = {.entry = {.count = 1, .reusable = true}}, SHIFT(34), + [40] = {.entry = {.count = 1, .reusable = true}}, SHIFT(7), + [42] = {.entry = {.count = 1, .reusable = true}}, SHIFT(9), + [44] = {.entry = {.count = 1, .reusable = true}}, SHIFT(11), + [46] = {.entry = {.count = 1, .reusable = true}}, SHIFT(8), + [48] = {.entry = {.count = 1, .reusable = true}}, SHIFT(10), + [50] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_details, 1, 0, 15), + [52] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_details_repeat1, 2, 0, 18), + [54] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_details_repeat1, 2, 0, 18), SHIFT_REPEAT(7), + [57] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_details_repeat1, 2, 0, 18), SHIFT_REPEAT(9), + [60] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_details_repeat1, 2, 0, 18), SHIFT_REPEAT(11), + [63] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_details_repeat1, 2, 0, 18), SHIFT_REPEAT(8), + [66] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_details_repeat1, 2, 0, 18), SHIFT_REPEAT(10), + [69] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_details_repeat1, 1, 0, 9), + [71] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_details_repeat1, 1, 0, 12), + [73] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_details_repeat1, 1, 0, 10), + [75] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_details_repeat1, 1, 0, 13), + [77] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_details_repeat1, 1, 0, 11), + [79] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_weigh_in_entry, 3, 0, 2), + [81] = {.entry = {.count = 1, .reusable = true}}, SHIFT(22), + [83] = {.entry = {.count = 1, .reusable = true}}, SHIFT(13), + [85] = {.entry = {.count = 1, .reusable = true}}, SHIFT(23), + [87] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_weigh_in_entry, 4, 0, 4), + [89] = {.entry = {.count = 1, .reusable = true}}, SHIFT(44), + [91] = {.entry = {.count = 1, .reusable = true}}, SHIFT(31), + [93] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_template_block, 6, 0, 3), + [95] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_session_block, 9, 0, 19), + [97] = {.entry = {.count = 1, .reusable = false}}, SHIFT(19), + [99] = {.entry = {.count = 1, .reusable = true}}, SHIFT(61), + [101] = {.entry = {.count = 1, .reusable = false}}, SHIFT(71), + [103] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_note_entry, 3, 0, 1), + [105] = {.entry = {.count = 1, .reusable = true}}, SHIFT(21), + [107] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_exercise_block, 4, 0, 3), + [109] = {.entry = {.count = 1, .reusable = true}}, SHIFT(25), + [111] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_template_block, 4, 0, 3), + [113] = {.entry = {.count = 1, .reusable = true}}, SHIFT(27), + [115] = {.entry = {.count = 1, .reusable = false}}, SHIFT(29), + [117] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_note_entry, 4, 0, 1), + [119] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_weigh_in_entry, 4, 0, 2), + [121] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_weigh_in_entry, 4, 0, 5), + [123] = {.entry = {.count = 1, .reusable = true}}, SHIFT(32), + [125] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_query_entry, 4, 0, 6), + [127] = {.entry = {.count = 1, .reusable = true}}, SHIFT(33), + [129] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_exercise_block, 5, 0, 3), + [131] = {.entry = {.count = 1, .reusable = true}}, SHIFT(37), + [133] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_template_block, 5, 0, 3), + [135] = {.entry = {.count = 1, .reusable = true}}, SHIFT(14), + [137] = {.entry = {.count = 1, .reusable = false}}, REDUCE(aux_sym_session_block_repeat1, 2, 0, 0), + [139] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_session_block_repeat1, 2, 0, 0), SHIFT_REPEAT(61), + [142] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_session_block_repeat1, 2, 0, 0), SHIFT_REPEAT(71), + [145] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_weigh_in_entry, 5, 0, 8), + [147] = {.entry = {.count = 1, .reusable = true}}, SHIFT(38), + [149] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_weigh_in_entry, 5, 0, 5), + [151] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_query_entry, 5, 0, 6), + [153] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_singleline_entry, 5, 0, 7), + [155] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_singleline_entry, 5, 0, 14), + [157] = {.entry = {.count = 1, .reusable = true}}, SHIFT(39), + [159] = {.entry = {.count = 1, .reusable = false}}, SHIFT(40), + [161] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_exercise_block, 6, 0, 3), + [163] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_weigh_in_entry, 6, 0, 8), + [165] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_singleline_entry, 6, 0, 14), + [167] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_session_block, 7, 0, 19), + [169] = {.entry = {.count = 1, .reusable = true}}, SHIFT(42), + [171] = {.entry = {.count = 1, .reusable = false}}, SHIFT(43), + [173] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_session_block, 8, 0, 19), + [175] = {.entry = {.count = 1, .reusable = true}}, SHIFT(15), + [177] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_weigh_in_entry, 5, 0, 4), + [179] = {.entry = {.count = 1, .reusable = true}}, SHIFT(70), + [181] = {.entry = {.count = 1, .reusable = true}}, SHIFT(60), + [183] = {.entry = {.count = 1, .reusable = true}}, SHIFT(78), + [185] = {.entry = {.count = 1, .reusable = true}}, SHIFT(73), + [187] = {.entry = {.count = 1, .reusable = false}}, SHIFT(18), + [189] = {.entry = {.count = 1, .reusable = false}}, SHIFT(58), + [191] = {.entry = {.count = 1, .reusable = false}}, SHIFT(26), + [193] = {.entry = {.count = 1, .reusable = false}}, REDUCE(aux_sym_exercise_block_repeat1, 2, 0, 0), + [195] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_exercise_block_repeat1, 2, 0, 0), SHIFT_REPEAT(58), + [198] = {.entry = {.count = 1, .reusable = true}}, SHIFT(81), + [200] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_note_line, 3, 0, 17), + [202] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_note_line, 3, 0, 17), + [204] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_item_line, 4, 0, 21), + [206] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_item_line, 4, 0, 21), + [208] = {.entry = {.count = 1, .reusable = false}}, SHIFT(57), + [210] = {.entry = {.count = 1, .reusable = true}}, SHIFT(65), + [212] = {.entry = {.count = 1, .reusable = true}}, SHIFT(80), + [214] = {.entry = {.count = 1, .reusable = true}}, SHIFT(58), + [216] = {.entry = {.count = 1, .reusable = true}}, SHIFT(71), + [218] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_metadata_line, 4, 0, 20), + [220] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_metadata_line, 3, 0, 16), + [222] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_identifier, 1, 0, 0), + [224] = {.entry = {.count = 1, .reusable = true}}, SHIFT(12), + [226] = {.entry = {.count = 1, .reusable = true}}, SHIFT(64), + [228] = {.entry = {.count = 1, .reusable = true}}, SHIFT(16), + [230] = {.entry = {.count = 1, .reusable = true}}, SHIFT(28), + [232] = {.entry = {.count = 1, .reusable = true}}, SHIFT(50), + [234] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_text_until_newline, 1, 0, 0), + [236] = {.entry = {.count = 1, .reusable = true}}, SHIFT(56), + [238] = {.entry = {.count = 1, .reusable = true}}, SHIFT(24), + [240] = {.entry = {.count = 1, .reusable = true}}, SHIFT(52), + [242] = {.entry = {.count = 1, .reusable = true}}, SHIFT(51), + [244] = {.entry = {.count = 1, .reusable = true}}, SHIFT(17), + [246] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_item, 1, 0, 0), + [248] = {.entry = {.count = 1, .reusable = true}}, ACCEPT_INPUT(), + [250] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_flag, 1, 0, 0), + [252] = {.entry = {.count = 1, .reusable = true}}, SHIFT(36), + [254] = {.entry = {.count = 1, .reusable = true}}, SHIFT(4), + [256] = {.entry = {.count = 1, .reusable = true}}, SHIFT(77), + [258] = {.entry = {.count = 1, .reusable = true}}, SHIFT(49), + [260] = {.entry = {.count = 1, .reusable = true}}, SHIFT(67), + [262] = {.entry = {.count = 1, .reusable = true}}, SHIFT(46), + [264] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_name, 1, 0, 0), }; #ifdef __cplusplus From 2764b90adc92cc832c22dfba5daae87983ecbaef Mon Sep 17 00:00:00 2001 From: konnerhorton Date: Thu, 19 Mar 2026 07:08:48 -0400 Subject: [PATCH 2/2] Add autocomplete to LSP --- src/ox/lsp.py | 84 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) diff --git a/src/ox/lsp.py b/src/ox/lsp.py index 2c9af7c..70d445f 100644 --- a/src/ox/lsp.py +++ b/src/ox/lsp.py @@ -1,5 +1,7 @@ """Language Server Protocol implementation for ox.""" +import re + from lsprotocol import types as lsp from pygls.lsp.server import LanguageServer from tree_sitter import Language, Parser @@ -63,6 +65,88 @@ def did_save(params: lsp.DidSaveTextDocumentParams): publish_diagnostics(params.text_document.uri, diagnostics) +def _collect_movement_names(tree) -> set[str]: + """Walk the tree and collect all movement names from item fields.""" + names: set[str] = set() + for node in tree.root_node.children: + if node.type == "singleline_entry": + item = node.child_by_field_name("item") + if item: + names.add(item.text.decode("utf-8")) + elif node.type in ("session_block", "template_block"): + for child in node.children: + if child.type == "item_line": + item = child.child_by_field_name("item") + if item: + names.add(item.text.decode("utf-8")) + return names + + +_SINGLELINE_PREFIX = re.compile(r"^\d{4}-\d{2}-\d{2}\s+[*!]\s+") + + +def _cursor_wants_movement(text: str, line: int, col: int, tree) -> bool: + """Check whether the cursor position is a movement-name context.""" + lines = text.split("\n") + if line >= len(lines): + return False + current_line = lines[line] + + # Context A: singleline entry — line matches date+flag prefix, cursor after it + m = _SINGLELINE_PREFIX.match(current_line) + if m and col >= m.end(): + # Make sure we're not inside a session/template block + node = tree.root_node.descendant_for_point_range((line, col), (line, col)) + while node: + if node.type in ("session_block", "template_block"): + return False + node = node.parent + return True + + # Context B: inside a session/template block on an item line + stripped = current_line.lstrip() + if stripped.startswith("@") or stripped.startswith("note:"): + return False + node = tree.root_node.descendant_for_point_range((line, col), (line, col)) + while node: + if node.type in ("session_block", "template_block"): + # Exclude the header line (date/flag/name line) + header_line = node.start_point[0] + 1 # header is 1 line after @session + if line == header_line: + return False + return True + node = node.parent + return False + + +@server.feature( + lsp.TEXT_DOCUMENT_COMPLETION, + lsp.CompletionOptions(trigger_characters=[" "]), +) +def completion(params: lsp.CompletionParams) -> lsp.CompletionList: + """Provide movement name completions.""" + document = server.workspace.get_text_document(params.text_document.uri) + text = document.source + tree = _parser.parse(bytes(text, encoding="utf-8")) + line = params.position.line + col = params.position.character + + if not _cursor_wants_movement(text, line, col, tree): + return lsp.CompletionList(is_incomplete=False, items=[]) + + names = _collect_movement_names(tree) + items = [ + lsp.CompletionItem( + label=name, + insert_text=name + ": ", + kind=lsp.CompletionItemKind.Value, + detail="movement", + ) + for name in sorted(names) + ] + return lsp.CompletionList(is_incomplete=False, items=items) + + def main(): """Run the language server.""" server.start_io()