Skip to content

Commit 94171b8

Browse files
committed
Improvements
1 parent 11426c5 commit 94171b8

File tree

5 files changed

+31
-7
lines changed

5 files changed

+31
-7
lines changed

grammar.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ module.exports = grammar({
172172
// * operator identifier in `(-> / 2)`
173173
[$.operator_identifier, $.stab_clause],
174174

175-
// Given `& /`, ampersand can be either:
175+
// Given `& /`, ampersand can be either:
176176
// * capture operator in `& / / 2`
177177
// * operator identifier in `& / 1`
178178
[$.unary_operator, $.operator_identifier],
@@ -530,16 +530,15 @@ module.exports = grammar({
530530
...ARROW_OPS,
531531
"in",
532532
alias($._not_in, "not in"),
533-
"^^",
533+
"^^^",
534534
...CONCAT_OPS,
535535
// The range operator has both a binary and a nullary version.
536536
// The nullary version is already parsed as operator_identifier,
537537
// so it covers this case
538538
// ".."
539539
...MULT_OPS,
540540
"**",
541-
"->",
542-
"."
541+
"->"
543542
),
544543

545544
dot: ($) =>

queries/highlights.scm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@
117117
; * kernel or special forms keyword
118118
(call
119119
target: (identifier) @keyword
120-
(#match? @keyword "^(alias|case|cond|else|for|if|import|quote|raise|receive|require|reraise|super|throw|try|unless|unquote|unquote_splicing|use|with)$"))
120+
(#match? @keyword "^(alias|case|cond|for|if|import|quote|raise|receive|require|reraise|super|throw|try|unless|unquote|unquote_splicing|use|with)$"))
121121

122122
; * function call
123123
(call

src/scanner.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,7 @@ static bool scan_newline(TSLexer *lexer, const bool *valid_symbols) {
463463
advance(lexer);
464464
return check_operator_end(lexer);
465465
}
466+
// when
466467
} else if (lexer->lookahead == 'w') {
467468
advance(lexer);
468469
if (lexer->lookahead == 'h') {
@@ -475,6 +476,7 @@ static bool scan_newline(TSLexer *lexer, const bool *valid_symbols) {
475476
}
476477
}
477478
}
479+
// and
478480
} else if (lexer->lookahead == 'a') {
479481
advance(lexer);
480482
if (lexer->lookahead == 'n') {

test/corpus/expression/anonymous_function.txt

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,29 @@ end
115115

116116
---
117117

118+
(source
119+
(anonymous_function
120+
(stab_clause
121+
(arguments
122+
(identifier)
123+
(identifier))
124+
(body
125+
(identifier)
126+
(identifier)))))
127+
128+
=====================================
129+
multiline body with extra newlines
130+
=====================================
131+
132+
fn x, y ->
133+
y
134+
135+
x
136+
137+
end
138+
139+
---
140+
118141
(source
119142
(anonymous_function
120143
(stab_clause

test/highlight/module.ex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,15 +147,15 @@ defmodule Long.Module.Name do
147147
end
148148
# <- keyword
149149

150-
def with_guard(x) when x == 1 do: nil
150+
def with_guard(x) when x == 1, do: nil
151151
# <- keyword
152152
# ^ function
153153
# ^ variable
154154
# ^ keyword
155155
# ^ variable
156156
# ^ operator
157157
# ^ number
158-
# ^ keyword
158+
# ^ string.special.symbol
159159
# <- keyword
160160

161161
def with_guard when is_integer(1), do: nil

0 commit comments

Comments
 (0)