diff --git a/syntax/just.vim b/syntax/just.vim index 266f036..6e0e907 100644 --- a/syntax/just.vim +++ b/syntax/just.vim @@ -268,9 +268,10 @@ syn match justRecipeDepParenName '\v%(\(\n?)@3<=%(\_s|\\\n)*\h\k*' syn cluster justBuiltInFunctions contains=justFunctionCall,justUserDefinedError -syn match justOperator "\V==" -syn match justOperator "\V!=" -syn match justOperator "\V=~" +syn match justConditionalOperator "\V==" +syn match justConditionalOperator "\V!=" +syn match justConditionalOperator "\V=~" + syn match justOperator "\V+" syn match justOperator "\V/" @@ -294,7 +295,7 @@ syn region justShellExpandDefault syn match justDollarEscape '\V$$' contained syn match justDollarEscapeSplit '\v\$%(\\\n\s*)*\$' contained -syn cluster justExprBase contains=@justAllStrings,@justBuiltInFunctions,justConditional,justOperator,justConstant +syn cluster justExprBase contains=@justAllStrings,@justBuiltInFunctions,justConditional,justConditionalOperator,justOperator,justConstant syn cluster justExpr contains=@justExprBase,justExprParen,justConditionalBraces,justReplaceRegex syn cluster justExprInInterp contains=@justExprBase,justName,justExprParenInInterp,justConditionalBracesInInterp,justReplaceRegexInInterp @@ -335,6 +336,7 @@ hi def link justComment Comment hi def link justCommentInBody Comment hi def link justCommentTodo Todo hi def link justConditional Conditional +hi def link justConditionalOperator Conditional hi def link justConstant Constant hi def link justCurlyBraces Special hi def link justDollarEscape Special @@ -366,7 +368,7 @@ hi def link justRecipeAttrSep Operator hi def link justRecipeAttrValueColon Operator hi def link justRecipeColon Operator hi def link justRecipeDepParamsParen Delimiter -hi def link justRecipeSubsequentDeps Operator +hi def link justRecipeSubsequentDeps Delimiter hi def link justRegexCapture Identifier hi def link justSet Statement hi def link justSetDeprecatedKeywords Underlined diff --git a/tests/cases/expressions.html b/tests/cases/expressions.html index f28c34a..3fcbca4 100644 --- a/tests/cases/expressions.html +++ b/tests/cases/expressions.html @@ -54,7 +54,7 @@ }\ """ -_true := assert('1' != '0', '1 is not 0') +_true := assert('1' != '0', '1 is not 0') shell_command := shell('echo "$@"', _true, random1) diff --git a/tests/cases/invalid.html b/tests/cases/invalid.html index 07186a8..2d5a422 100644 --- a/tests/cases/invalid.html +++ b/tests/cases/invalid.html @@ -65,7 +65,7 @@ echo "{{{{{{{{{Odd number of opening curly braces is an error.}}}}}" early-interpolation-close foo: - echo {{ if foo == "bar" { "hello" } else { "goodbye" }}} + echo {{ if foo == "bar" { "hello" } else { "goodbye" }}} other-recipe: echo interpolation ended in last recipe diff --git a/tests/cases/kitchen-sink.html b/tests/cases/kitchen-sink.html index 66d1a2a..51a7dfa 100644 --- a/tests/cases/kitchen-sink.html +++ b/tests/cases/kitchen-sink.html @@ -94,13 +94,13 @@ _another_var := env_var_or_default("HOME", justfile_directory()) python := `which python` -exists := if path_exists(just_executable()) =~ '^/User' { uuid() } else { 'yeah' } +exists := if path_exists(just_executable()) =~ '^/User' { uuid() } else { 'yeah' } -foo := if env_var("_") == "/usr/bin/env" { `touch /tmp/a_file` } else { "dummy-value" } -foo_b := if "hello" == "goodbye" { "xyz" } else { if "no" == "no" { "yep"} else { error("123") } } -foo_c := if "hello" == "goodbye" { +foo := if env_var("_") == "/usr/bin/env" { `touch /tmp/a_file` } else { "dummy-value" } +foo_b := if "hello" == "goodbye" { "xyz" } else { if "no" == "no" { "yep"} else { error("123") } } +foo_c := if "hello" == "goodbye" { "xyz" -} else if "a" == "a" { +} else if "a" == "a" { "abc" } else { "123" @@ -111,7 +111,7 @@ bar2 foo_stuff: - echo {{ if foo_stuff == "bar" { "hello" } else { "goodbye" } }} + echo {{ if foo_stuff == "bar" { "hello" } else { "goodbye" } }} executable: @echo The executable is at: {{just_executable()}} @@ -131,7 +131,7 @@ @echo "Starting server with database $DATABASE_ADDRESS on port $SERVER_PORT…" -shebang := if os() == 'windows' { +shebang := if os() == 'windows' { 'powershell.exe' } else { '/usr/bin/env pwsh' @@ -205,7 +205,7 @@ a: echo 'A!' -b: a && d +b: a && d echo 'B start!' just -f {{justfile()}} c echo 'B end!' diff --git a/tests/cases/line-continuations.html b/tests/cases/line-continuations.html index a128aaf..1c6a2e2 100644 --- a/tests/cases/line-continuations.html +++ b/tests/cases/line-continuations.html @@ -15,7 +15,7 @@ '456' + \ if \ 'a' \ -!= \ +!= \ 'b' \ {\ '\789'} \ diff --git a/tests/cases/recipes-with-extras.html b/tests/cases/recipes-with-extras.html index 122f00f..1034ba8 100644 --- a/tests/cases/recipes-with-extras.html +++ b/tests/cases/recipes-with-extras.html @@ -22,7 +22,7 @@ /bin/echo {{quote(firstparam)}} /bin/echo {{quote(secondparam)}} -dependency3 theparam=('a' + (if env_var_or_default('FOO', blake3_file(justfile())) == '1' { ' With Foo'} else { ' none ' + p1 / p2 }) / 'b'): +dependency3 theparam=('a' + (if env_var_or_default('FOO', blake3_file(justfile())) == '1' { ' With Foo'} else { ' none ' + p1 / p2 }) / 'b'): echo {{quote(theparam)}} dependency4: @@ -98,10 +98,10 @@ echo {{join('test',foo, `echo Bar`, somevar, "2")}} echo {{quote(blake3(foo+"-"))}} echo {{quote('x' + blake3(foo+"-"+ foo+'-'+foo) + foo+ 'y')}} - echo {{quote(if foo == '123' { '321' } else { 'foo bar' } )}} + echo {{quote(if foo == '123' { '321' } else { 'foo bar' } )}} interp_with_conditional foo: - echo {{if foo != 'foo' { quote(foo) } else { foo / foo } }} + echo {{if foo != 'foo' { quote(foo) } else { foo / foo } }} [no-quiet] loud: diff --git a/tests/cases/replace_regex-captures.html b/tests/cases/replace_regex-captures.html index 8cbf663..5b1e48a 100644 --- a/tests/cases/replace_regex-captures.html +++ b/tests/cases/replace_regex-captures.html @@ -52,7 +52,7 @@ not_a_regex := replace('Foo Bar', ' ', '$1') # special highlighting should only occur in the simplest case -replacement_conditional := replace_regex('123456789', '([2468])', if "$1" == "$2" { '$1_' } else { '_${1}_' }) +replacement_conditional := replace_regex('123456789', '([2468])', if "$1" == "$2" { '$1_' } else { '_${1}_' }) replacement_nested_func := replace_regex('987654321', '([13579])', trim_start(' $1 ')) replacement_split := replace_regex('012034', '(?P<capture>[1-9]+)', "!$cap" + 'ture' + '$captu' / "re") diff --git a/tests/cases/tricky.html b/tests/cases/tricky.html index 5909a7a..c122a90 100644 --- a/tests/cases/tricky.html +++ b/tests/cases/tricky.html @@ -41,7 +41,7 @@ , '_9${1}_' ) -conditional_without_indent := if env('SHELL') == '/bin/bash' { +conditional_without_indent := if env('SHELL') == '/bin/bash' { valid_uuid + testing } else { '' }