Skip to content

Commit 0ded5ea

Browse files
committed
Add support for u128 and i128 types
1 parent 6e9db46 commit 0ded5ea

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

rust-mode.el

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -544,6 +544,7 @@ buffer."
544544
"u16" "i16"
545545
"u32" "i32"
546546
"u64" "i64"
547+
"u128" "i128"
547548

548549
"f32" "f64"
549550
"float" "int" "uint" "isize" "usize"
@@ -753,7 +754,7 @@ match data if found. Returns nil if not within a Rust string."
753754
can have a where clause, rewind back to just before the name of
754755
the subject of that where clause and return the new point.
755756
Otherwise return nil"
756-
757+
757758
(let* ((ident-pos (point))
758759
(newpos (save-excursion
759760
(rust-rewind-irrelevant)
@@ -796,7 +797,7 @@ match data if found. Returns nil if not within a Rust string."
796797
;; A type alias or ascription could have a type param list. Skip backwards past it.
797798
(when (member token '(ambiguous-operator open-brace))
798799
(rust-rewind-type-param-list))
799-
800+
800801
(cond
801802

802803
;; Certain keywords always introduce expressions
@@ -811,7 +812,7 @@ match data if found. Returns nil if not within a Rust string."
811812
;; An ident! followed by an open brace is a macro invocation. Consider
812813
;; it to be an expression.
813814
((and (equal token 'open-brace) (rust-looking-back-macro)) t)
814-
815+
815816
;; In a brace context a "]" introduces an expression.
816817
((and (eq token 'open-brace) (rust-looking-back-str "]")))
817818

@@ -828,7 +829,7 @@ match data if found. Returns nil if not within a Rust string."
828829
(backward-sexp)
829830
(rust-rewind-irrelevant)
830831
(looking-back "[{;]" (1- (point))))
831-
832+
832833
((rust-looking-back-ident)
833834
(rust-rewind-qualified-ident)
834835
(rust-rewind-irrelevant)
@@ -851,7 +852,7 @@ match data if found. Returns nil if not within a Rust string."
851852
(rust-rewind-irrelevant)
852853
(rust-looking-back-symbols '("enum" "struct" "union" "trait" "type"))))))
853854
))
854-
855+
855856
((equal token 'ambiguous-operator)
856857
(cond
857858
;; An ampersand after an ident has to be an operator rather than a & at the beginning of a ref type
@@ -882,7 +883,7 @@ match data if found. Returns nil if not within a Rust string."
882883
(rust-rewind-irrelevant)
883884
(rust-looking-back-str "enum")))))
884885
t)
885-
886+
886887
;; Otherwise the ambiguous operator is a type if the identifier is a type
887888
((rust-is-in-expression-context 'ident) t)))
888889

@@ -931,7 +932,7 @@ match data if found. Returns nil if not within a Rust string."
931932

932933
;; A :: introduces a type (or module, but not an expression in any case)
933934
((rust-looking-back-str "::") nil)
934-
935+
935936
((rust-looking-back-str ":")
936937
(backward-char)
937938
(rust-is-in-expression-context 'colon))
@@ -970,7 +971,7 @@ match data if found. Returns nil if not within a Rust string."
970971
(defun rust-is-lt-char-operator ()
971972
"Return t if the < sign just after point is an operator rather
972973
than an opening angle bracket, otherwise nil."
973-
974+
974975
(let ((case-fold-search nil))
975976
(save-excursion
976977
(rust-rewind-irrelevant)
@@ -982,7 +983,7 @@ match data if found. Returns nil if not within a Rust string."
982983
((and (rust-looking-back-str "<")
983984
(not (equal 4 (rust-syntax-class-before-point)))
984985
(not (rust-looking-back-str "<<"))))
985-
986+
986987
;; On the other hand, if we are after a closing paren/brace/bracket it
987988
;; can only be an operator, not an angle bracket. Likewise, if we are
988989
;; after a string it's an operator. (The string case could actually be
@@ -1010,7 +1011,7 @@ match data if found. Returns nil if not within a Rust string."
10101011
;; The special types can't take type param lists, so a < after one is
10111012
;; always an operator
10121013
(looking-at rust-re-special-types)
1013-
1014+
10141015
(rust-is-in-expression-context 'ident)))
10151016

10161017
;; Otherwise, assume it's an angle bracket
@@ -1045,7 +1046,7 @@ should be considered a paired angle bracket."
10451046
;; to balance regardless of the < and >, so if we don't treat any < or >
10461047
;; as angle brackets it won't mess up any paren balancing.
10471048
((rust-in-macro) t)
1048-
1049+
10491050
((looking-at "<")
10501051
(rust-is-lt-char-operator))
10511052

0 commit comments

Comments
 (0)