Skip to content

Commit 51e52ed

Browse files
committed
Have the lexer recognize parens, too
This lets us detect function calls in case match statements. All good now.
1 parent 1ac195b commit 51e52ed

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

elixir-smie.el

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@
2626
(elixir-smie-define-regexp comma ",")
2727
(elixir-smie-define-regexp -> "->")
2828
(elixir-smie-define-regexp << "<<")
29-
(elixir-smie-define-regexp >> ">>"))
29+
(elixir-smie-define-regexp >> ">>")
30+
(elixir-smie-define-regexp-opt parens "(" ")" "{" "}" "[" "]" "<<" ">>"))
3031

3132
(defvar elixir-tokenizer-syntax-table (let ((table (copy-syntax-table elixir-mode-syntax-table)))
3233
(modify-syntax-entry ?\n "." table)
@@ -81,7 +82,9 @@
8182
(goto-char (if forwardp
8283
(match-end 0)
8384
(match-beginning 0)))
84-
(cdr found-token-class))
85+
(if (string= "PARENS" (cdr found-token-class))
86+
(buffer-substring-no-properties (match-beginning 0) (match-end 0))
87+
(cdr found-token-class)))
8588
((when (= ?\" (char-syntax (if forwardp
8689
(following-char)
8790
(preceding-char))))
@@ -163,11 +166,12 @@
163166
(expr)
164167
)
165168
(non-block-expr
166-
("<<" non-block-expr ">>")
167169
(non-block-expr "OP" non-block-expr)
168170
(non-block-expr "DOT" non-block-expr)
169171
(non-block-expr "COMMA" non-block-expr)
170172
("(" statements ")")
173+
("{" statements "}")
174+
("[" statements "]")
171175
("STRING"))
172176
(match-statements
173177
(match-statement "MATCH-STATEMENT-DELIMITER" match-statements)

0 commit comments

Comments
 (0)