mirror of
https://codeberg.org/ProgramSnail/tree-sitter-lang.git
synced 2025-12-06 06:38:51 +00:00
exec comments added (for shell)
This commit is contained in:
parent
567f75620d
commit
39f31b901d
3 changed files with 6 additions and 1 deletions
|
|
@ -2,6 +2,8 @@
|
||||||
Test
|
Test
|
||||||
================================================================================
|
================================================================================
|
||||||
|
|
||||||
|
#! lang
|
||||||
|
|
||||||
:: module; // import module to current namespace
|
:: module; // import module to current namespace
|
||||||
|
|
||||||
:: _ = module; // import module to current namespace and use functions inside without namespace
|
:: _ = module; // import module to current namespace and use functions inside without namespace
|
||||||
|
|
|
||||||
|
|
@ -144,6 +144,7 @@ literal: FLOAT_NUMBER_LITERAL
|
||||||
DEFINITION_INFO : : ': ' ([^\n]*)+ ;
|
DEFINITION_INFO : : ': ' ([^\n]*)+ ;
|
||||||
ANNOTATION_INFO : ANNOTATION_IDENTIFIER [^\n]* ;
|
ANNOTATION_INFO : ANNOTATION_IDENTIFIER [^\n]* ;
|
||||||
|
|
||||||
|
LINE_COMMENT : '#!' [^\n]* -> skip ;
|
||||||
LINE_COMMENT : '//' [^\n]* -> skip ;
|
LINE_COMMENT : '//' [^\n]* -> skip ;
|
||||||
BLOCK_COMMENT : '\*' ([^*] |('\*' [^/]))* '*/' -> skip ;
|
BLOCK_COMMENT : '\*' ([^*] |('\*' [^/]))* '*/' -> skip ;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ module.exports = grammar({
|
||||||
word: $ => $.identifier,
|
word: $ => $.identifier,
|
||||||
|
|
||||||
extras: $ => [
|
extras: $ => [
|
||||||
|
$._exec_comment,
|
||||||
$._line_comment,
|
$._line_comment,
|
||||||
$._block_comment,
|
$._block_comment,
|
||||||
/\s/
|
/\s/
|
||||||
|
|
@ -240,6 +241,7 @@ module.exports = grammar({
|
||||||
definition_info: $ => repeat1(seq(': ', /[^\n]*/)),
|
definition_info: $ => repeat1(seq(': ', /[^\n]*/)),
|
||||||
annotation_info: $ => seq($.annotation_identifier, /[^\n]*/),
|
annotation_info: $ => seq($.annotation_identifier, /[^\n]*/),
|
||||||
|
|
||||||
|
_exec_comment: $ => token(seq('#!', /[^\n]*/)),
|
||||||
_line_comment: $ => token(seq('//', /[^\n]*/)),
|
_line_comment: $ => token(seq('//', /[^\n]*/)),
|
||||||
_block_comment: $ => token(seq('/*', /([^*]|(\*[^/]))*/, '*/')),
|
_block_comment: $ => token(seq('/*', /([^*]|(\*[^/]))*/, '*/')),
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue