Rename module highlight token (#16)

* Rename module highlight token

* Fix CRLF in scanner lookahead
This commit is contained in:
Jonatan Kłosko 2021-12-15 23:29:48 +01:00 committed by GitHub
parent de3ec57591
commit 1b3ecf7765
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 33 additions and 30 deletions

View File

@ -62,11 +62,11 @@
(float) (float)
] @number ] @number
(alias) @type (alias) @module
(call (call
target: (dot target: (dot
left: (atom) @type)) left: (atom) @module))
(char) @constant (char) @constant

View File

@ -56,7 +56,10 @@ bool is_inline_whitespace(int32_t c) {
} }
bool is_newline(int32_t c) { bool is_newline(int32_t c) {
return c == '\n'; // Note: this implies \r\n is treated as two line breaks,
// but in our case it's fine, since multiple line breaks
// make no difference
return c == '\n' || c == '\r';
} }
bool is_digit(int32_t c) { bool is_digit(int32_t c) {

View File

@ -43,7 +43,7 @@ end
&Set.put(&1, &2) &Set.put(&1, &2)
# <- operator # <- operator
# ^ type # ^ module
# ^ operator # ^ operator
# ^ function # ^ function
# ^ punctuation.bracket # ^ punctuation.bracket
@ -55,7 +55,7 @@ end
&( Set.put(&1, &1) ) &( Set.put(&1, &1) )
#<- operator #<- operator
#^ punctuation.bracket #^ punctuation.bracket
# ^ type # ^ module
# ^ operator # ^ operator
# ^ function # ^ function
# ^ punctuation.bracket # ^ punctuation.bracket

View File

@ -1,5 +1,5 @@
Path.expand("..", __DIR__) Path.expand("..", __DIR__)
# ^ type # ^ module
# ^ operator # ^ operator
# ^ function # ^ function
# ^ punctuation.bracket # ^ punctuation.bracket
@ -35,7 +35,7 @@ hd([1,2])
# ^ punctuation.bracket # ^ punctuation.bracket
Kernel.spawn(fn -> :ok end) Kernel.spawn(fn -> :ok end)
# ^ type # ^ module
# ^ operator # ^ operator
# ^ function # ^ function
# ^ punctuation.bracket # ^ punctuation.bracket
@ -46,12 +46,12 @@ Kernel.spawn(fn -> :ok end)
# ^ punctuation.bracket # ^ punctuation.bracket
IO.ANSI.black IO.ANSI.black
# ^ type # ^ module
# ^ operator # ^ operator
# ^ function # ^ function
Kernel.-(number) Kernel.-(number)
# ^ type # ^ module
# ^ operator # ^ operator
# ^ operator # ^ operator
# ^ punctuation.bracket # ^ punctuation.bracket
@ -59,7 +59,7 @@ Kernel.-(number)
# ^ punctuation.bracket # ^ punctuation.bracket
Enum.map([1, 2], fn x -> Enum.map([1, 2], fn x ->
# ^ type # ^ module
# ^ operator # ^ operator
# ^ function # ^ function
# ^ punctuation.bracket # ^ punctuation.bracket
@ -81,7 +81,7 @@ end)
# ^ punctuation.bracket # ^ punctuation.bracket
:erlang.abs(-1) :erlang.abs(-1)
# ^ type # ^ module
# ^ operator # ^ operator
# ^ function # ^ function
# ^ punctuation.bracket # ^ punctuation.bracket

View File

@ -160,8 +160,8 @@
%Long.Module.Name{name: "Silly"} %Long.Module.Name{name: "Silly"}
# <- punctuation # <- punctuation
# ^ type # ^ module
# ^ type # ^ module
# ^ punctuation.bracket # ^ punctuation.bracket
# ^ string.special.symbol # ^ string.special.symbol
# ^ string # ^ string
@ -169,7 +169,7 @@
%Long.Module.Name{s | height: {192, :cm}} %Long.Module.Name{s | height: {192, :cm}}
# <- punctuation # <- punctuation
# ^ type # ^ module
# ^ punctuation.bracket # ^ punctuation.bracket
# ^ variable # ^ variable
# ^ operator # ^ operator
@ -185,7 +185,7 @@
# ^ string # ^ string
# ^ punctuation.special # ^ punctuation.special
# ^ punctuation # ^ punctuation
# ^ type # ^ module
# ^ punctuation.bracket # ^ punctuation.bracket
# ^ variable # ^ variable
# ^ operator # ^ operator

View File

@ -5,7 +5,7 @@ _018OP
# ^ comment.unused # ^ comment.unused
A__0 A__0
# ^ type # ^ module
__MODULE__ ; __STACKTRACE__ __MODULE__ ; __STACKTRACE__
# ^ constant.builtin # ^ constant.builtin

View File

@ -139,14 +139,14 @@ end
raise RuntimeError, message: "This is not an error" raise RuntimeError, message: "This is not an error"
# ^ keyword # ^ keyword
# ^ type # ^ module
# ^ punctuation.delimiter # ^ punctuation.delimiter
# ^ string.special.symbol # ^ string.special.symbol
# ^ string # ^ string
import Kernel, except: [spawn: 1, +: 2, /: 2, Unless: 2] import Kernel, except: [spawn: 1, +: 2, /: 2, Unless: 2]
# ^ keyword # ^ keyword
# ^ type # ^ module
# ^ punctuation.delimiter # ^ punctuation.delimiter
# ^ string.special.symbol # ^ string.special.symbol
# ^ punctuation.bracket # ^ punctuation.bracket
@ -165,11 +165,11 @@ import Kernel, except: [spawn: 1, +: 2, /: 2, Unless: 2]
alias Long.Module.Name, as: N0men123_and4 alias Long.Module.Name, as: N0men123_and4
# ^ keyword # ^ keyword
# ^ type # ^ module
# ^ punctuation.delimiter # ^ punctuation.delimiter
# ^ string.special.symbol # ^ string.special.symbol
# ^ type # ^ module
use Bitwise use Bitwise
# ^ keyword # ^ keyword
# ^ type # ^ module

View File

@ -1,7 +1,7 @@
defmodule Long.Module.Name do defmodule Long.Module.Name do
# ^ keyword # ^ keyword
# ^ type # ^ module
# ^ type # ^ module
# ^ keyword # ^ keyword
@moduledoc "Simple doc" @moduledoc "Simple doc"
@ -80,7 +80,7 @@ defmodule Long.Module.Name do
# ^ attribute # ^ attribute
# ^ variable # ^ variable
# ^ operator # ^ operator
# ^ type # ^ module
# ^ operator # ^ operator
# ^ function # ^ function
# ^ punctuation.bracket # ^ punctuation.bracket
@ -256,7 +256,7 @@ defmodule Long.Module.Name do
# ^ punctuation.bracket # ^ punctuation.bracket
# ^ punctuation.delimiter # ^ punctuation.delimiter
# ^ string.special.symbol # ^ string.special.symbol
# ^ type # ^ module
defmacro meta_function(name) do defmacro meta_function(name) do
# ^ keyword # ^ keyword
@ -297,7 +297,7 @@ end
defprotocol Useless do defprotocol Useless do
# ^ keyword # ^ keyword
# ^ type # ^ module
# ^ keyword # ^ keyword
def func(this) def func(this)
# ^ keyword # ^ keyword
@ -310,10 +310,10 @@ end
defimpl Useless, for: Atom do defimpl Useless, for: Atom do
# ^ keyword # ^ keyword
# ^ type # ^ module
# ^ punctuation.delimiter # ^ punctuation.delimiter
# ^ string.special.symbol # ^ string.special.symbol
# ^ type # ^ module
# ^ keyword # ^ keyword
end end
# <- keyword # <- keyword

View File

@ -75,10 +75,10 @@ y = true and false
"hello" |> String.upcase |> String.downcase() "hello" |> String.upcase |> String.downcase()
# ^ string # ^ string
# ^ operator # ^ operator
# ^ type # ^ module
# ^ operator # ^ operator
# ^ function # ^ function
# ^ operator # ^ operator
# ^ type # ^ module
# ^ operator # ^ operator
# ^ function # ^ function