Skip to content

Commit 0b4c418

Browse files
committed
Support ? sigil
1 parent 211d710 commit 0b4c418

2 files changed

Lines changed: 40 additions & 5 deletions

File tree

Syntax/Just.sublime-syntax

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -631,14 +631,33 @@ contexts:
631631
pop: 1
632632

633633
recipe-content-modifiers:
634-
- match: ^\s+((@)|(-)(@)|(-)|(@)(-))(?!-)
634+
- match: |
635+
(?x) # Allow whitespace/comments in regex for clarity
636+
(?:
637+
(@)(\?) # @?
638+
| (\?)(@) # ?@
639+
| (@)(-) # @-
640+
| (-)(@) # -@
641+
| (@) # @ alone
642+
| (-) # - alone
643+
| (\?) # ? alone
644+
| ([-\?@]+) # Any other combinations are invalid
645+
)
646+
(?![-?@]) # Ensure no more modifiers follow (prevents --- or ??)
635647
captures:
636-
2: storage.modifier.quiet.just
637-
3: storage.modifier.ignore-error.just
648+
1: storage.modifier.quiet.just
649+
2: storage.modifier.exit-if-one.just
650+
3: storage.modifier.exit-if-one.just
638651
4: storage.modifier.quiet.just
639-
5: storage.modifier.ignore-error.just
640-
6: storage.modifier.quiet.just
652+
5: storage.modifier.quiet.just
653+
6: storage.modifier.ignore-error.just
641654
7: storage.modifier.ignore-error.just
655+
8: storage.modifier.quiet.just
656+
9: storage.modifier.quiet.just
657+
10: storage.modifier.ignore-error.just
658+
11: storage.modifier.exit-if-one.just
659+
12: invalid.illegal.just
660+
pop: 1 # Only consume the first run of space-separated sigil characters
642661
- include: else-pop
643662

644663
recipe-content-interpolations:

Syntax/tests/syntax_test_just.recipe_content.just

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,22 @@ d:
7777
# ^ storage.modifier.ignore-error.just
7878
# ^ storage.modifier.quiet.just
7979

80+
e:
81+
?@echo "hi"
82+
# ^ storage.modifier.exit-if-one.just
83+
# ^ storage.modifier.quiet.just
84+
85+
# ? and - cannot be used together
86+
f:
87+
?-echo "hi"
88+
# ^^ invalid.illegal.just
89+
90+
# Duplicates are sent to the shell, which will be invalid
91+
g:
92+
@@echo "hi"
93+
# ^^ invalid.illegal.just
94+
95+
8096
line-prefix-for-default-shell-only:
8197
#!/usr/bin/sh
8298
-echo "hi"

0 commit comments

Comments
 (0)