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
|
||||||
|
|
|
@ -696,11 +696,20 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "SEQ",
|
"type": "SEQ",
|
||||||
|
"members": [
|
||||||
|
{
|
||||||
|
"type": "CHOICE",
|
||||||
"members": [
|
"members": [
|
||||||
{
|
{
|
||||||
"type": "STRING",
|
"type": "STRING",
|
||||||
"value": "=~"
|
"value": "=~"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type": "STRING",
|
||||||
|
"value": "=="
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "CHOICE",
|
"type": "CHOICE",
|
||||||
"members": [
|
"members": [
|
||||||
|
@ -770,11 +779,20 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "SEQ",
|
"type": "SEQ",
|
||||||
|
"members": [
|
||||||
|
{
|
||||||
|
"type": "CHOICE",
|
||||||
"members": [
|
"members": [
|
||||||
{
|
{
|
||||||
"type": "STRING",
|
"type": "STRING",
|
||||||
"value": "=~"
|
"value": "=~"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type": "STRING",
|
||||||
|
"value": "=="
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "CHOICE",
|
"type": "CHOICE",
|
||||||
"members": [
|
"members": [
|
||||||
|
@ -817,11 +835,20 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "SEQ",
|
"type": "SEQ",
|
||||||
|
"members": [
|
||||||
|
{
|
||||||
|
"type": "CHOICE",
|
||||||
"members": [
|
"members": [
|
||||||
{
|
{
|
||||||
"type": "STRING",
|
"type": "STRING",
|
||||||
"value": "=~"
|
"value": "=~"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type": "STRING",
|
||||||
|
"value": "=="
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "CHOICE",
|
"type": "CHOICE",
|
||||||
"members": [
|
"members": [
|
||||||
|
@ -1488,9 +1515,18 @@
|
||||||
"type": "STRING",
|
"type": "STRING",
|
||||||
"value": "$"
|
"value": "$"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type": "CHOICE",
|
||||||
|
"members": [
|
||||||
{
|
{
|
||||||
"type": "SYMBOL",
|
"type": "SYMBOL",
|
||||||
"name": "string"
|
"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