Add comments
This commit is contained in:
parent
a46748839e
commit
5a9bfe1571
|
@ -0,0 +1,12 @@
|
|||
===============================
|
||||
Comments
|
||||
===============================
|
||||
|
||||
#!/bin/bash
|
||||
# hi
|
||||
|
||||
---
|
||||
|
||||
(program
|
||||
(comment)
|
||||
(comment))
|
13
grammar.js
13
grammar.js
|
@ -10,6 +10,11 @@ module.exports = grammar({
|
|||
$._heredoc_end
|
||||
],
|
||||
|
||||
extras: $ => [
|
||||
$.comment,
|
||||
/\s/
|
||||
],
|
||||
|
||||
rules: {
|
||||
program: $ => repeat($.command),
|
||||
|
||||
|
@ -111,13 +116,15 @@ module.exports = grammar({
|
|||
|
||||
file_descriptor: $ => token(prec(1, /\d+/)),
|
||||
|
||||
leading_word: $ => /[^\s=|;:{}]+/,
|
||||
leading_word: $ => /[^\s#=|;:{}]+/,
|
||||
|
||||
word: $ => /[^\s$<>{}&]+/,
|
||||
word: $ => /[^# \s$<>{}&]+/,
|
||||
|
||||
control_operator: $ => choice(
|
||||
'\n',
|
||||
';;'
|
||||
)
|
||||
),
|
||||
|
||||
comment: $ => /#.*/,
|
||||
}
|
||||
});
|
||||
|
|
|
@ -435,11 +435,11 @@
|
|||
},
|
||||
"leading_word": {
|
||||
"type": "PATTERN",
|
||||
"value": "[^\\s=|;:{}]+"
|
||||
"value": "[^\\s#=|;:{}]+"
|
||||
},
|
||||
"word": {
|
||||
"type": "PATTERN",
|
||||
"value": "[^\\s$<>{}&]+"
|
||||
"value": "[^# \\s$<>{}&]+"
|
||||
},
|
||||
"control_operator": {
|
||||
"type": "CHOICE",
|
||||
|
@ -453,9 +453,17 @@
|
|||
"value": ";;"
|
||||
}
|
||||
]
|
||||
},
|
||||
"comment": {
|
||||
"type": "PATTERN",
|
||||
"value": "#.*"
|
||||
}
|
||||
},
|
||||
"extras": [
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "comment"
|
||||
},
|
||||
{
|
||||
"type": "PATTERN",
|
||||
"value": "\\s"
|
||||
|
|
3021
src/parser.c
3021
src/parser.c
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue