Skip to content

Commit da2b4ec

Browse files
committed
Better handling of _tags_ and _arrow like words
1 parent 4fc2d61 commit da2b4ec

File tree

3 files changed

+23
-2
lines changed

3 files changed

+23
-2
lines changed

Rebol.sublime-syntax

+9-1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ variables:
2424
any_word_chars: '[^{{lex_delimit}}]*'
2525
lit_word_start_chars: ^[\d\'\:@] #awoid: '2nd ''word ':word '@ref
2626
lit_word_chars: '[{{lit_word_start_chars}}]{{any_word_chars}}'
27+
arrow_word_chars: '[-<>]+'
2728
refinement_chars: '{{any_word_chars}}'
2829
word_boundary: (?![^{{non_ident_chars}}])
2930
words_control_conditional: (if|either|unless|case|switch)
@@ -52,6 +53,7 @@ contexts:
5253
- include: match-money
5354
- include: match-tuple
5455
- include: match-pair
56+
- include: match-arrow-word
5557
- include: match-tag
5658
- include: match-lit-word
5759
- include: match-refinement
@@ -169,6 +171,8 @@ contexts:
169171
- meta_scope: string.quoted.double.xml
170172
- match: '"'
171173
pop: true
174+
- match: '<[^>]+>'
175+
scope: entity.tag.rebol
172176

173177
# Note: the email literal in Red is EXTREMELY permissive.
174178
# Note: this is actually ref! datatype: @name
@@ -532,6 +536,10 @@ contexts:
532536
1: keyword.operator.quote.rebol
533537
2: invalid.illegal.rebol
534538

539+
match-arrow-word:
540+
- match: (<)({{arrow_word_chars}}){{word_boundary}}
541+
scope: variable.other.rebol
542+
535543
match-refinement:
536544
- match: (/)({{refinement_chars}}){{word_boundary}}
537545
captures:
@@ -553,7 +561,7 @@ contexts:
553561
scope: keyword.operator.logical.rebol
554562
- match: '(\+\+|--){{word_boundary}}'
555563
scope: keyword.operator.assignment.augmented.rebol
556-
- match: \+|\-|\*|\*\*|/|//|<<|>>|&|\|
564+
- match: '(\+|\-|\*|\*\*|/|//|<<|>>|&|\|){{word_boundary}}'
557565
scope: keyword.operator.arithmetic.rebol
558566
- include: match-keyword-bincode
559567
- include: match-keyword-tests

syntax_test_rebol.reb

+6
Original file line numberDiff line numberDiff line change
@@ -361,3 +361,9 @@ true: false: none:
361361
my-module: module [][]
362362
;^^^^^^^^^ entity.name.function.rebol
363363
my-module: module/mixin [][] ctx2
364+
365+
366+
<--->
367+
;^^^^^ variable.other.rebol
368+
---->
369+
;^^^^^ variable.other.rebol

test.reb

+8-1
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,14 @@ [email protected]
176176
;-- tag!
177177
<tag></tag><tag/>
178178
<tag id='a' foo="b">
179-
<---> ;<-- this is word! in Red, not a tag!
179+
<-s>
180+
<@> ;not email!
181+
<#a>
182+
; arrow like word examples (not tags!)
183+
<--->
184+
<----
185+
---->
186+
<<->>
180187

181188
;-- url!
182189
http://user:pass@host:80/path?query#tag

0 commit comments

Comments
 (0)