Skip to content

Commit

Permalink
feat: add basic support for anchor declarations
Browse files Browse the repository at this point in the history
  • Loading branch information
vhyrro committed Nov 9, 2021
1 parent 615aeb2 commit 3f0541c
Show file tree
Hide file tree
Showing 5 changed files with 198,476 additions and 193,619 deletions.
23 changes: 23 additions & 0 deletions grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,14 @@ module.exports = grammar({
$.link_text,
$.link_text_end,

$.anchor_declaration_begin,
$.anchor_declaration_text,
$.anchor_declaration_end,
$.anchor_definition_begin,
$.anchor_definition_location,
$.anchor_definition_text,
$.anchor_definition_end,

$.ranged_tag_prefix,
$.ranged_tag_end_prefix,

Expand Down Expand Up @@ -209,6 +217,8 @@ module.exports = grammar({
alias($.word, "_word"),
alias($.space, "_space"),
$.link,
$.anchor_declaration,
// $.anchor_definition,
$.escape_sequence,
$._attached_modifier,
),
Expand Down Expand Up @@ -499,6 +509,19 @@ module.exports = grammar({
)
),

anchor_declaration: $ =>
seq(
$.anchor_declaration_begin,
$.anchor_declaration_text,
$.anchor_declaration_end,
),

anchor_definition: $ =>
seq(
$.anchor_declaration,
// other stuff here
),

unordered_link1: $ =>
prec.right(1,
seq(
Expand Down
58 changes: 58 additions & 0 deletions src/grammar.json
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,10 @@
"type": "SYMBOL",
"name": "link"
},
{
"type": "SYMBOL",
"name": "anchor_declaration"
},
{
"type": "SYMBOL",
"name": "escape_sequence"
Expand Down Expand Up @@ -1122,6 +1126,32 @@
}
]
},
"anchor_declaration": {
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "anchor_declaration_begin"
},
{
"type": "SYMBOL",
"name": "anchor_declaration_text"
},
{
"type": "SYMBOL",
"name": "anchor_declaration_end"
}
]
},
"anchor_definition": {
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "anchor_declaration"
}
]
},
"unordered_link1": {
"type": "PREC_RIGHT",
"value": 1,
Expand Down Expand Up @@ -5887,6 +5917,34 @@
"type": "SYMBOL",
"name": "link_text_end"
},
{
"type": "SYMBOL",
"name": "anchor_declaration_begin"
},
{
"type": "SYMBOL",
"name": "anchor_declaration_text"
},
{
"type": "SYMBOL",
"name": "anchor_declaration_end"
},
{
"type": "SYMBOL",
"name": "anchor_definition_begin"
},
{
"type": "SYMBOL",
"name": "anchor_definition_location"
},
{
"type": "SYMBOL",
"name": "anchor_definition_text"
},
{
"type": "SYMBOL",
"name": "anchor_definition_end"
},
{
"type": "SYMBOL",
"name": "ranged_tag_prefix"
Expand Down
43 changes: 43 additions & 0 deletions src/node-types.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
"multiple": true,
"required": false,
"types": [
{
"type": "anchor_declaration",
"named": true
},
{
"type": "bold",
"named": true
Expand Down Expand Up @@ -67,6 +71,29 @@
"named": false,
"fields": {}
},
{
"type": "anchor_declaration",
"named": true,
"fields": {},
"children": {
"multiple": true,
"required": true,
"types": [
{
"type": "anchor_declaration_begin",
"named": true
},
{
"type": "anchor_declaration_end",
"named": true
},
{
"type": "anchor_declaration_text",
"named": true
}
]
}
},
{
"type": "bold",
"named": true,
Expand Down Expand Up @@ -2454,6 +2481,10 @@
"multiple": true,
"required": false,
"types": [
{
"type": "anchor_declaration",
"named": true
},
{
"type": "bold",
"named": true
Expand Down Expand Up @@ -4521,6 +4552,18 @@
"type": "_uppercase",
"named": false
},
{
"type": "anchor_declaration_begin",
"named": true
},
{
"type": "anchor_declaration_end",
"named": true
},
{
"type": "anchor_declaration_text",
"named": true
},
{
"type": "any_char",
"named": true
Expand Down
Loading

0 comments on commit 3f0541c

Please sign in to comment.