Skip to content

Commit

Permalink
Add semver_matches() function
Browse files Browse the repository at this point in the history
  • Loading branch information
laniakea64 committed Nov 8, 2023
1 parent 5028fc8 commit 743cbe2
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ functionsWithArgs := '''
path_exists
quote
replace
semver_matches
sha256
sha256_file
shoutykebabcase
Expand Down
6 changes: 3 additions & 3 deletions syntax/just.vim
Original file line number Diff line number Diff line change
Expand Up @@ -184,14 +184,14 @@ syn cluster justOtherCurlyBraces contains=justCurlyBraces,justBadCurlyBraces

syn region justBuiltInFunction
\ transparent end=')'
\ matchgroup=justFunction start="\v%(a%(bsolute_pat|rc)h|c%(apitalize|lean)|e%(nv%(_var%(_or_default)?)?|xtension)|file_%(name|stem)|j%(oin|ust%(_executable|file%(_directory)?))|kebabcase|lowerca%(melca)?se|pa%(rent_directory|th_exists)|quote|replace|s%(h%(a256%(_file)?|outy%(kebab|snake)case)|nakecase)|t%(itlecase|rim%(_%(end|start)%(_match%(es)?)?)?)|u%(pperca%(melca)?se|uid)|without_extension|invocation_directory%(_native)?|num_cpus|os%(_family)?)%(%(\s|\\\n)*\()@="
\ matchgroup=justFunction start="\v%(a%(bsolute_pat|rc)h|c%(apitalize|lean)|e%(nv%(_var%(_or_default)?)?|xtension)|file_%(name|stem)|j%(oin|ust%(_executable|file%(_directory)?))|kebabcase|lowerca%(melca)?se|pa%(rent_directory|th_exists)|quote|replace|s%(emver_matches|h%(a256%(_file)?|outy%(kebab|snake)case)|nakecase)|t%(itlecase|rim%(_%(end|start)%(_match%(es)?)?)?)|u%(pperca%(melca)?se|uid)|without_extension|invocation_directory%(_native)?|num_cpus|os%(_family)?)%(%(\s|\\\n)*\()@="
\ matchgroup=justUserDefinedError start="\verror%(%(\s|\\\n)*\()@="
\ matchgroup=justBuiltInFunctionsError start="\v\h[a-zA-Z0-9_-]*%(\s|\\\n)*\("
\ contains=justNoise,@justExpr

syn region justBuiltInFuncParamValue
\ transparent end=')'
\ matchgroup=justFunction start="\v%(a%(bsolute_pat|rc)h|c%(apitalize|lean)|e%(nv%(_var%(_or_default)?)?|xtension)|file_%(name|stem)|j%(oin|ust%(_executable|file%(_directory)?))|kebabcase|lowerca%(melca)?se|pa%(rent_directory|th_exists)|quote|replace|s%(h%(a256%(_file)?|outy%(kebab|snake)case)|nakecase)|t%(itlecase|rim%(_%(end|start)%(_match%(es)?)?)?)|u%(pperca%(melca)?se|uid)|without_extension|invocation_directory%(_native)?|num_cpus|os%(_family)?)%(%(\s|\\\n)*\()@="
\ matchgroup=justFunction start="\v%(a%(bsolute_pat|rc)h|c%(apitalize|lean)|e%(nv%(_var%(_or_default)?)?|xtension)|file_%(name|stem)|j%(oin|ust%(_executable|file%(_directory)?))|kebabcase|lowerca%(melca)?se|pa%(rent_directory|th_exists)|quote|replace|s%(emver_matches|h%(a256%(_file)?|outy%(kebab|snake)case)|nakecase)|t%(itlecase|rim%(_%(end|start)%(_match%(es)?)?)?)|u%(pperca%(melca)?se|uid)|without_extension|invocation_directory%(_native)?|num_cpus|os%(_family)?)%(%(\s|\\\n)*\()@="
\ matchgroup=justUserDefinedError start="\verror%(%(\s|\\\n)*\()@="
\ matchgroup=justBuiltInFunctionsError start="\v\h[a-zA-Z0-9_-]*%(\s|\\\n)*\("
\ contained
Expand All @@ -200,7 +200,7 @@ syn region justBuiltInFuncParamValue

syn region justBuiltInFuncInInterp
\ transparent end=')'
\ matchgroup=justFunction start="\v%(a%(bsolute_pat|rc)h|c%(apitalize|lean)|e%(nv%(_var%(_or_default)?)?|xtension)|file_%(name|stem)|j%(oin|ust%(_executable|file%(_directory)?))|kebabcase|lowerca%(melca)?se|pa%(rent_directory|th_exists)|quote|replace|s%(h%(a256%(_file)?|outy%(kebab|snake)case)|nakecase)|t%(itlecase|rim%(_%(end|start)%(_match%(es)?)?)?)|u%(pperca%(melca)?se|uid)|without_extension|invocation_directory%(_native)?|num_cpus|os%(_family)?)%(%(\s|\\\n)*\()@="
\ matchgroup=justFunction start="\v%(a%(bsolute_pat|rc)h|c%(apitalize|lean)|e%(nv%(_var%(_or_default)?)?|xtension)|file_%(name|stem)|j%(oin|ust%(_executable|file%(_directory)?))|kebabcase|lowerca%(melca)?se|pa%(rent_directory|th_exists)|quote|replace|s%(emver_matches|h%(a256%(_file)?|outy%(kebab|snake)case)|nakecase)|t%(itlecase|rim%(_%(end|start)%(_match%(es)?)?)?)|u%(pperca%(melca)?se|uid)|without_extension|invocation_directory%(_native)?|num_cpus|os%(_family)?)%(%(\s|\\\n)*\()@="
\ matchgroup=justUserDefinedError start="\verror%(%(\s|\\\n)*\()@="
\ matchgroup=justBuiltInFunctionsError start="\v\h[a-zA-Z0-9_-]*%(\s|\\\n)*\("
\ contained
Expand Down
2 changes: 1 addition & 1 deletion tests/cases/recipes-with-extras.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

p1 <span class="Operator">:=</span> <span class="String">'test'</span>
p2 <span class="Operator">:=</span> <span class="String">'OtherTest'</span>
param <span class="Operator">:=</span> <span class="String">'ThirdTest'</span>
param <span class="Operator">:=</span> <span class="Function">semver_matches</span>(<span class="String">'0.1.1'</span>, <span class="String">'&gt;=0.1.0'</span>)

<span class="Special">@</span><span class="Function">foo1</span> <span class="Identifier">param1</span> <span class="Identifier">param2</span><span class="Operator">=</span><span class="String">"default test"</span> <span class="Statement">+</span><span class="Identifier">varparam</span><span class="Operator">=</span><span class="String">'default'</span><span class="Operator">:</span> <span class="Function">dependency1</span> <span class="Delimiter">(</span><span class="Function">dependency2</span> p1 p2<span class="Delimiter">)</span> <span class="Delimiter">(</span><span class="Function">dependency3</span> param<span class="Delimiter">)</span>
<span class="Number"> echo many lines</span>
Expand Down
2 changes: 1 addition & 1 deletion tests/cases/recipes-with-extras.just
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ foo: # comment

p1 := 'test'
p2 := 'OtherTest'
param := 'ThirdTest'
param := semver_matches('0.1.1', '>=0.1.0')

@foo1 param1 param2="default test" +varparam='default': dependency1 (dependency2 p1 p2) (dependency3 param)
echo many lines
Expand Down

0 comments on commit 743cbe2

Please sign in to comment.