Skip to content
This repository was archived by the owner on May 5, 2023. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 20 additions & 2 deletions grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -1036,16 +1036,34 @@ module.exports = grammar({
),
),

// Any ascii non-blanck printable character (no unicode)
_syn_keyword_identifier: ($) =>
choice(
seq(/[!-~]/, repeat(token.immediate(/[!-~]/))),
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks really weird, why not a simple regex ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it comes from a misunderstanding of priorities for me, but if I use a simple regex, the result is not the same as
regex has a lower priority. Adding manually a higher priority with prec(*) doesn't give the same result either.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then that's pretty weird, because I thought regexes where there to lex things...

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you find how to do it properly I would be glad to see it cause I have spent probably two hours trying to make it work

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll try to find a way, but that worries me a litte.

seq(
choice(
'conceal',
'contained',
'transparent',
'skipwhite',
'skipnl',
'skipempty',
),
token.immediate('['),
repeat(token.immediate(/[!-~]/)),
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above ?

token.immediate(']'),
),
),
_syn_keyword: ($) =>
sub_cmd(
'keyword',
$.hl_group,
repeat(alias($._syn_arguments_keyword, $.syntax_argument)),
// The list of keyword cannot be empty, but we can have arguments anywhere on the line
alias(/[a-zA-Z0-9\[\]_]+/, $.keyword),
alias($._syn_keyword_identifier, $.keyword),
repeat(choice(
alias($._syn_arguments_keyword, $.syntax_argument),
alias(/[a-zA-Z0-9\[\]_]+/, $.keyword),
alias($._syn_keyword_identifier, $.keyword),
)),
),

Expand Down
90 changes: 86 additions & 4 deletions src/grammar.json

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

17 changes: 9 additions & 8 deletions src/node-types.json

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

Loading