Skip to content

Commit

Permalink
feat(grammar): concrete keyword aliases
Browse files Browse the repository at this point in the history
  • Loading branch information
rydesun committed Aug 24, 2022
1 parent 9172307 commit 07e91a1
Show file tree
Hide file tree
Showing 9 changed files with 1,678 additions and 1,617 deletions.
18 changes: 9 additions & 9 deletions grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ module.exports = grammar({
rules: {
source_file: $ => seq(
optional(
alias(ignoreCase('strict'), $.keyword),
alias(ignoreCase('strict'), 'strict'),
),
choice(
alias(ignoreCase('graph'), 'graph'),
alias(ignoreCase('digraph'), 'digraph'),
),
field('type', choice(
alias(ignoreCase('graph'), $.keyword),
alias(ignoreCase('digraph'), $.keyword),
)),
optional(field('id', $.id)),
field('block', $.block),
),
Expand Down Expand Up @@ -46,7 +46,7 @@ module.exports = grammar({
subgraph: $ => seq(
optional(
seq(
alias(ignoreCase('subgraph'), $.keyword),
alias(ignoreCase('subgraph'), 'subgraph'),
optional(field('id', $.id)),
),
),
Expand Down Expand Up @@ -77,9 +77,9 @@ module.exports = grammar({

attr_stmt: $ => seq(
choice(
alias(ignoreCase('graph'), $.keyword),
alias(ignoreCase('node'), $.keyword),
alias(ignoreCase('edge'), $.keyword),
alias(ignoreCase('graph'), 'graph'),
alias(ignoreCase('node'), 'node'),
alias(ignoreCase('edge'), 'edge'),
),
$.attr_list,
),
Expand Down
9 changes: 8 additions & 1 deletion queries/highlights.scm
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
(keyword) @keyword
[
"strict"
"graph"
"digraph"
"subgraph"
"node"
"edge"
] @keyword
(string_literal) @string
(number_literal) @number

Expand Down
64 changes: 30 additions & 34 deletions src/grammar.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

60 changes: 23 additions & 37 deletions src/node-types.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 07e91a1

Please sign in to comment.