diff options
| author | Tom Tromey <tom@tromey.com> | 2017-08-20 07:51:50 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-08-20 07:51:50 -0600 |
| commit | f57a8ebfc33de72e0ca6fe61ed3d7a622510b5b3 (patch) | |
| tree | 194ade345a89e0e238e43bc31bdffc9c603cc1dc | |
| parent | 6e9db4665036ca6f0fe8eecf55cd243eaebccc62 (diff) | |
| parent | 0ded5ea5e8001db2b278b81537e32e504d9e53f5 (diff) | |
| download | rust-mode-f57a8ebfc33de72e0ca6fe61ed3d7a622510b5b3.tar.gz | |
Merge pull request #233 from shanavas786/add-128
Add support for u128 and i128 types
| -rw-r--r-- | rust-mode.el | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/rust-mode.el b/rust-mode.el index ed5b5ed..97b5c3c 100644 --- a/rust-mode.el +++ b/rust-mode.el @@ -544,6 +544,7 @@ buffer." "u16" "i16" "u32" "i32" "u64" "i64" + "u128" "i128" "f32" "f64" "float" "int" "uint" "isize" "usize" @@ -753,7 +754,7 @@ match data if found. Returns nil if not within a Rust string." can have a where clause, rewind back to just before the name of the subject of that where clause and return the new point. Otherwise return nil" - + (let* ((ident-pos (point)) (newpos (save-excursion (rust-rewind-irrelevant) @@ -796,7 +797,7 @@ match data if found. Returns nil if not within a Rust string." ;; A type alias or ascription could have a type param list. Skip backwards past it. (when (member token '(ambiguous-operator open-brace)) (rust-rewind-type-param-list)) - + (cond ;; Certain keywords always introduce expressions @@ -811,7 +812,7 @@ match data if found. Returns nil if not within a Rust string." ;; An ident! followed by an open brace is a macro invocation. Consider ;; it to be an expression. ((and (equal token 'open-brace) (rust-looking-back-macro)) t) - + ;; In a brace context a "]" introduces an expression. ((and (eq token 'open-brace) (rust-looking-back-str "]"))) @@ -828,7 +829,7 @@ match data if found. Returns nil if not within a Rust string." (backward-sexp) (rust-rewind-irrelevant) (looking-back "[{;]" (1- (point)))) - + ((rust-looking-back-ident) (rust-rewind-qualified-ident) (rust-rewind-irrelevant) @@ -851,7 +852,7 @@ match data if found. Returns nil if not within a Rust string." (rust-rewind-irrelevant) (rust-looking-back-symbols '("enum" "struct" "union" "trait" "type")))))) )) - + ((equal token 'ambiguous-operator) (cond ;; 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." (rust-rewind-irrelevant) (rust-looking-back-str "enum"))))) t) - + ;; Otherwise the ambiguous operator is a type if the identifier is a type ((rust-is-in-expression-context 'ident) t))) @@ -931,7 +932,7 @@ match data if found. Returns nil if not within a Rust string." ;; A :: introduces a type (or module, but not an expression in any case) ((rust-looking-back-str "::") nil) - + ((rust-looking-back-str ":") (backward-char) (rust-is-in-expression-context 'colon)) @@ -970,7 +971,7 @@ match data if found. Returns nil if not within a Rust string." (defun rust-is-lt-char-operator () "Return t if the < sign just after point is an operator rather than an opening angle bracket, otherwise nil." - + (let ((case-fold-search nil)) (save-excursion (rust-rewind-irrelevant) @@ -982,7 +983,7 @@ match data if found. Returns nil if not within a Rust string." ((and (rust-looking-back-str "<") (not (equal 4 (rust-syntax-class-before-point))) (not (rust-looking-back-str "<<")))) - + ;; On the other hand, if we are after a closing paren/brace/bracket it ;; can only be an operator, not an angle bracket. Likewise, if we are ;; 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." ;; The special types can't take type param lists, so a < after one is ;; always an operator (looking-at rust-re-special-types) - + (rust-is-in-expression-context 'ident))) ;; Otherwise, assume it's an angle bracket @@ -1045,7 +1046,7 @@ should be considered a paired angle bracket." ;; to balance regardless of the < and >, so if we don't treat any < or > ;; as angle brackets it won't mess up any paren balancing. ((rust-in-macro) t) - + ((looking-at "<") (rust-is-lt-char-operator)) |
