Allow regexes after '==', not just '=~'
This commit is contained in:
parent
30844a0381
commit
87a832d94e
|
@ -95,7 +95,6 @@ fi
|
||||||
(if_statement
|
(if_statement
|
||||||
(bracket_command
|
(bracket_command
|
||||||
(string (command_substitution (command (command_name (word)))))
|
(string (command_substitution (command (command_name (word)))))
|
||||||
(word)
|
|
||||||
(raw_string))
|
(raw_string))
|
||||||
(command (command_name (word)) (word))))
|
(command (command_name (word)) (word))))
|
||||||
|
|
||||||
|
|
20
grammar.js
20
grammar.js
|
@ -196,10 +196,10 @@ module.exports = grammar({
|
||||||
$.command_name,
|
$.command_name,
|
||||||
repeat(choice(
|
repeat(choice(
|
||||||
$._expression,
|
$._expression,
|
||||||
seq('=~', choice(
|
seq(
|
||||||
$.regex,
|
choice('=~', '=='),
|
||||||
$._expression
|
choice($.regex, $._expression)
|
||||||
))
|
)
|
||||||
)),
|
)),
|
||||||
repeat(choice(
|
repeat(choice(
|
||||||
$.file_redirect,
|
$.file_redirect,
|
||||||
|
@ -213,10 +213,10 @@ module.exports = grammar({
|
||||||
bracket_command: $ => {
|
bracket_command: $ => {
|
||||||
const args = repeat1(choice(
|
const args = repeat1(choice(
|
||||||
$._expression,
|
$._expression,
|
||||||
seq('=~', choice(
|
seq(
|
||||||
$.regex,
|
choice('=~', '=='),
|
||||||
$._expression
|
choice($.regex, $._expression)
|
||||||
))
|
)
|
||||||
))
|
))
|
||||||
|
|
||||||
return seq(
|
return seq(
|
||||||
|
@ -427,8 +427,8 @@ module.exports = grammar({
|
||||||
seq('\\', noneOf('\\s'))
|
seq('\\', noneOf('\\s'))
|
||||||
))),
|
))),
|
||||||
|
|
||||||
regex: $ => /([^\s]|\\.)+/,
|
regex: $ => /([^"\s]|\\.)([^\s]|\\.)*/,
|
||||||
regex_without_right_brace: $ => /([^\s}]|\\.)+/,
|
regex_without_right_brace: $ => /([^"\s}]|\\.)([^\s}]|\\.)*/,
|
||||||
|
|
||||||
_terminator: $ => choice(';', ';;', '\n', '&')
|
_terminator: $ => choice(';', ';;', '\n', '&')
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
examples/bash-it/plugins/available/git.plugin.bash
|
examples/bash-it/plugins/available/git.plugin.bash
|
||||||
examples/bash-it/plugins/available/fzf.plugin.bash
|
|
||||||
examples/bash-it/plugins/available/extract.plugin.bash
|
examples/bash-it/plugins/available/extract.plugin.bash
|
||||||
examples/bash-it/plugins/available/less-pretty-cat.plugin.bash
|
examples/bash-it/plugins/available/less-pretty-cat.plugin.bash
|
||||||
examples/bash-it/plugins/available/z_autoenv.plugin.bash
|
examples/bash-it/plugins/available/z_autoenv.plugin.bash
|
||||||
|
@ -42,7 +41,6 @@ examples/bash-it/lib/search.bash
|
||||||
examples/bash-it/test_lib/bats-support/src/lang.bash
|
examples/bash-it/test_lib/bats-support/src/lang.bash
|
||||||
examples/bash-it/test_lib/bats-support/src/output.bash
|
examples/bash-it/test_lib/bats-support/src/output.bash
|
||||||
examples/bash-it/test_lib/bats-assert/src/assert.bash
|
examples/bash-it/test_lib/bats-assert/src/assert.bash
|
||||||
examples/bash-it/test_lib/bats-core/test/test_helper.bash
|
|
||||||
examples/bash-it/test_lib/bats-file/src/temp.bash
|
examples/bash-it/test_lib/bats-file/src/temp.bash
|
||||||
examples/bash-it/themes/hawaii50/hawaii50.theme.bash
|
examples/bash-it/themes/hawaii50/hawaii50.theme.bash
|
||||||
examples/bash-it/themes/iterate/iterate.theme.bash
|
examples/bash-it/themes/iterate/iterate.theme.bash
|
||||||
|
|
|
@ -698,8 +698,17 @@
|
||||||
"type": "SEQ",
|
"type": "SEQ",
|
||||||
"members": [
|
"members": [
|
||||||
{
|
{
|
||||||
"type": "STRING",
|
"type": "CHOICE",
|
||||||
"value": "=~"
|
"members": [
|
||||||
|
{
|
||||||
|
"type": "STRING",
|
||||||
|
"value": "=~"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "STRING",
|
||||||
|
"value": "=="
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "CHOICE",
|
"type": "CHOICE",
|
||||||
|
@ -772,8 +781,17 @@
|
||||||
"type": "SEQ",
|
"type": "SEQ",
|
||||||
"members": [
|
"members": [
|
||||||
{
|
{
|
||||||
"type": "STRING",
|
"type": "CHOICE",
|
||||||
"value": "=~"
|
"members": [
|
||||||
|
{
|
||||||
|
"type": "STRING",
|
||||||
|
"value": "=~"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "STRING",
|
||||||
|
"value": "=="
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "CHOICE",
|
"type": "CHOICE",
|
||||||
|
@ -819,8 +837,17 @@
|
||||||
"type": "SEQ",
|
"type": "SEQ",
|
||||||
"members": [
|
"members": [
|
||||||
{
|
{
|
||||||
"type": "STRING",
|
"type": "CHOICE",
|
||||||
"value": "=~"
|
"members": [
|
||||||
|
{
|
||||||
|
"type": "STRING",
|
||||||
|
"value": "=~"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "STRING",
|
||||||
|
"value": "=="
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "CHOICE",
|
"type": "CHOICE",
|
||||||
|
@ -1489,8 +1516,17 @@
|
||||||
"value": "$"
|
"value": "$"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "SYMBOL",
|
"type": "CHOICE",
|
||||||
"name": "string"
|
"members": [
|
||||||
|
{
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "string"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "raw_string"
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
@ -1801,11 +1837,11 @@
|
||||||
},
|
},
|
||||||
"regex": {
|
"regex": {
|
||||||
"type": "PATTERN",
|
"type": "PATTERN",
|
||||||
"value": "([^\\s]|\\\\.)+"
|
"value": "([^\"\\s]|\\\\.)([^\\s]|\\\\.)*"
|
||||||
},
|
},
|
||||||
"regex_without_right_brace": {
|
"regex_without_right_brace": {
|
||||||
"type": "PATTERN",
|
"type": "PATTERN",
|
||||||
"value": "([^\\s}]|\\\\.)+"
|
"value": "([^\"\\s}]|\\\\.)([^\\s}]|\\\\.)*"
|
||||||
},
|
},
|
||||||
"_terminator": {
|
"_terminator": {
|
||||||
"type": "CHOICE",
|
"type": "CHOICE",
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue