Skip to content

Commit

Permalink
Add import statement
Browse files Browse the repository at this point in the history
  • Loading branch information
laniakea64 committed Dec 24, 2023
1 parent 3803517 commit d77886e
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 4 deletions.
3 changes: 3 additions & 0 deletions syntax/just.vim
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,8 @@ syn match justOperator "\v\=[=~]|!\=|[+/]"
syn cluster justExprBase contains=@justAllStrings,justConditional,justConditionalBraces,justOperator
syn cluster justExpr contains=@justExprBase,@justBuiltInFunctions,justBuiltInFunctionArgs,justReplaceRegex

syn match justImport /\v^import\ze%(\s|\\\n)+['"]@=/

syn match justOldInclude "^!include\s.*$" contains=justOldIncludeDirective
syn match justOldIncludeDirective "^!include" contained

Expand All @@ -258,6 +260,7 @@ hi def link justConditional Conditional
hi def link justCurlyBraces Special
hi def link justExport Statement
hi def link justFunction Function
hi def link justImport Include
hi def link justIndentError Error
hi def link justInterpolation Normal
hi def link justInterpolationDelim Delimiter
Expand Down
7 changes: 7 additions & 0 deletions tests/cases/import.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<span class="Include">import</span> <span class="String">'recipes-simple.just'</span>

<span class="Include">import</span><span class="Special">\</span>
<span class="String">'line-continuations.just'</span>

<span class="Include">import</span> <span class="String">"""</span>
<span class="String"> tricky.just"""</span>
7 changes: 7 additions & 0 deletions tests/cases/import.just
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import 'recipes-simple.just'

import\
'line-continuations.just'

import """
tricky.just"""
4 changes: 2 additions & 2 deletions tests/cases/tricky.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@
valid_uuid <span class="Operator">+</span> testing
} <span class="Conditional">else</span> { <span class="String">''</span> }

<span class="Function">test</span><span class="Operator">:</span>
<span class="Function">back2back_interpolations</span><span class="Operator">:</span>
<span class="Number"> echo </span><span class="Delimiter">{{</span><span class="Identifier">something</span><span class="Delimiter">}}{{</span><span class="Identifier">testing</span><span class="Delimiter">}}</span>

<span class="Function">test2</span><span class="Operator">:</span>
<span class="Function">interp_immediately_after_string</span><span class="Operator">:</span>
<span class="Number"> </span><span class="SpecialComment">#!/usr/bin/env python3</span>
<span class="Number"> print(</span><span class="String">''</span><span class="Delimiter">{{</span><span class="Function">quote</span><span class="Normal">(</span><span class="Identifier">something</span><span class="Normal">)</span><span class="Delimiter">}}</span><span class="String">''</span><span class="Number">.split(</span><span class="String">"T"</span><span class="Number">))</span>

Expand Down
4 changes: 2 additions & 2 deletions tests/cases/tricky.just
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ conditional_without_indent := if env('SHELL') == '/bin/bash' {
valid_uuid + testing
} else { '' }

test:
back2back_interpolations:
echo {{something}}{{testing}}

test2:
interp_immediately_after_string:
#!/usr/bin/env python3
print(''{{quote(something)}}''.split("T"))
Expand Down

0 comments on commit d77886e

Please sign in to comment.