Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support tabs as whitespace #33

Merged
merged 2 commits into from
Jul 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/makeup/lexers/elixir_lexer.ex
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ defmodule Makeup.Lexers.ElixirLexer do
# TODO: check we're following this convention
# NOTE: if Elixir had a good static type system it would help us do the right thing here.

whitespace = ascii_string([?\r, ?\s, ?\n, ?\f], min: 1) |> token(:whitespace)
whitespace = ascii_string([?\r, ?\s, ?\n, ?\t], min: 1) |> token(:whitespace)

newlines =
optional(ascii_string([?\s, ?\t, ?\r], min: 1))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@ defmodule ElixirLexerTokenizerTestSnippet do
use ExUnit.Case, async: false
import Makeup.Lexers.ElixirLexer.Testing, only: [lex: 1]

test "?\\f is recognized as whitespace character" do
assert lex("\f") == [{:whitespace, %{}, "\f"}]
test "whitespace" do
assert lex(" ") == [{:whitespace, %{}, " "}]
assert lex("\s") == [{:whitespace, %{}, "\s"}]
assert lex("\n") == [{:whitespace, %{}, "\n"}]
assert lex("\t") == [{:whitespace, %{}, "\t"}]
assert lex("\r") == [{:whitespace, %{}, "\r"}]
end

test "builtins" do
Expand Down
Loading