@@ -676,31 +676,55 @@ export const scalaTmLanguage: TmLanguage = {
676
676
}
677
677
}
678
678
} ,
679
- { // Higher precedence than other kinds of operators to prevent
680
- // decomposition of operators like ->
681
- match : `(<-|←|->|→|=>|⇒|\\?|\\:|@|\\^)+${ opchar } *` ,
679
+ { // Operators with three or more characters
680
+ match : `(${ opchar } ${ opchar } ${ opchar } +)` ,
682
681
name : 'keyword.operator.scala'
683
682
} ,
684
- { // The 'special' below operators directly follower by another symbol
685
- // are just operators for example +:, /:, ++ and ==>
686
- match : `(\\-|\\+|\\*|/(?![/*])|%|~|==|!=|<=|>=|<>)${ opchar } +` ,
687
- name : 'keyword.operator.scala'
688
- } ,
689
- {
690
- match : '(==?|!=|<=|>=|<>|<|>)' ,
691
- name : 'keyword.operator.comparison.scala'
692
- } ,
693
- {
694
- match : '(\\-|\\+|\\*|/(?![/*])|%|~)' ,
695
- name : 'keyword.operator.arithmetic.scala'
696
- } ,
697
- {
698
- match : `(?<!${ opchar } |_)(!|&&|\\|\\|)(?!${ opchar } )` ,
699
- name : 'keyword.operator.logical.scala'
683
+ { // Operators with two characters
684
+ match : `(${ opchar } ${ opchar } |\\\\${ opchar } )` ,
685
+ captures : {
686
+ '1' : {
687
+ patterns : [
688
+ {
689
+ match : '(\\|\\||&&)' ,
690
+ name : 'keyword.operator.logical.scala'
691
+ } ,
692
+ {
693
+ match : '(\\!=|==|\\<=|>=)' ,
694
+ name : 'keyword.operator.comparison.scala'
695
+ } ,
696
+ {
697
+ match : '..' ,
698
+ name : 'keyword.operator.scala'
699
+ }
700
+ ]
701
+ }
702
+ }
700
703
} ,
701
- { // Lower precedence than logical || operator
702
- match : `(\\|)${ opchar } *` ,
703
- name : 'keyword.operator.scala'
704
+ { // Operators with one character
705
+ match : `(?<!${ letter } _)(${ opchar } )` ,
706
+ captures : {
707
+ '1' : {
708
+ patterns : [
709
+ {
710
+ match : '(\\!)' ,
711
+ name : 'keyword.operator.logical.scala'
712
+ } ,
713
+ {
714
+ match : '(\\*|-|\\+|/|%|~)' ,
715
+ name : 'keyword.operator.arithmetic.scala'
716
+ } ,
717
+ {
718
+ match : '(=|\\<|>)' ,
719
+ name : 'keyword.operator.comparison.scala'
720
+ } ,
721
+ {
722
+ match : '.' ,
723
+ name : 'keyword.operator.scala'
724
+ }
725
+ ]
726
+ }
727
+ }
704
728
}
705
729
]
706
730
} ,
0 commit comments