Skip to content

Commit

Permalink
rename: description -> value
Browse files Browse the repository at this point in the history
  • Loading branch information
mrossinek committed Nov 9, 2021
1 parent ab7f37f commit 3efff85
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 23 deletions.
4 changes: 2 additions & 2 deletions grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ module.exports = grammar({
$.keyword,
$._separator,
$._space,
$.description
$.value
),

keyword: $ => /[^\s:]+/,

description: $ => /[^\n]+/,
value: $ => /[^\n]+/,

_separator: $ => ":",

Expand Down
2 changes: 1 addition & 1 deletion queries/highlights.scm
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
(keyword) @keyword
(description) @string
(value) @string
4 changes: 2 additions & 2 deletions src/grammar.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@
},
{
"type": "SYMBOL",
"name": "description"
"name": "value"
}
]
},
"keyword": {
"type": "PATTERN",
"value": "[^\\s:]+"
},
"description": {
"value": {
"type": "PATTERN",
"value": "[^\\n]+"
},
Expand Down
8 changes: 4 additions & 4 deletions src/node-types.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,22 @@
"required": true,
"types": [
{
"type": "description",
"type": "keyword",
"named": true
},
{
"type": "keyword",
"type": "value",
"named": true
}
]
}
},
{
"type": "description",
"type": "keyword",
"named": true
},
{
"type": "keyword",
"type": "value",
"named": true
}
]
14 changes: 7 additions & 7 deletions src/parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

enum {
sym_keyword = 1,
sym_description = 2,
sym_value = 2,
sym__separator = 3,
sym__space = 4,
sym_metadata = 5,
Expand All @@ -29,7 +29,7 @@ enum {
static const char * const ts_symbol_names[] = {
[ts_builtin_sym_end] = "end",
[sym_keyword] = "keyword",
[sym_description] = "description",
[sym_value] = "value",
[sym__separator] = "_separator",
[sym__space] = "_space",
[sym_metadata] = "metadata",
Expand All @@ -40,7 +40,7 @@ static const char * const ts_symbol_names[] = {
static const TSSymbol ts_symbol_map[] = {
[ts_builtin_sym_end] = ts_builtin_sym_end,
[sym_keyword] = sym_keyword,
[sym_description] = sym_description,
[sym_value] = sym_value,
[sym__separator] = sym__separator,
[sym__space] = sym__space,
[sym_metadata] = sym_metadata,
Expand All @@ -57,7 +57,7 @@ static const TSSymbolMetadata ts_symbol_metadata[] = {
.visible = true,
.named = true,
},
[sym_description] = {
[sym_value] = {
.visible = true,
.named = true,
},
Expand Down Expand Up @@ -130,15 +130,15 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) {
lookahead != ':') ADVANCE(4);
END_STATE();
case 5:
ACCEPT_TOKEN(sym_description);
ACCEPT_TOKEN(sym_value);
if (lookahead == '\t' ||
lookahead == '\r' ||
lookahead == ' ') ADVANCE(5);
if (lookahead != 0 &&
lookahead != '\n') ADVANCE(6);
END_STATE();
case 6:
ACCEPT_TOKEN(sym_description);
ACCEPT_TOKEN(sym_value);
if (lookahead != 0 &&
lookahead != '\n') ADVANCE(6);
END_STATE();
Expand Down Expand Up @@ -216,7 +216,7 @@ static const uint16_t ts_small_parse_table[] = {
sym__space,
[39] = 1,
ACTIONS(22), 1,
sym_description,
sym_value,
};

static const uint32_t ts_small_parse_table_map[] = {
Expand Down
14 changes: 7 additions & 7 deletions test/corpus/document.meta.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ title: Neorg
(metadata
(statement
(keyword)
(description)
(value)
)
)

Expand All @@ -19,22 +19,22 @@ author: nvim-neorg
(metadata
(statement
(keyword)
(description)
(value)
)
(statement
(keyword)
(description)
(value)
)
)

======================
Multi-word description
======================
=================
Multi-word values
=================
description: This is a longer text.
---
(metadata
(statement
(keyword)
(description)
(value)
)
)

0 comments on commit 3efff85

Please sign in to comment.