chroma
chroma copied to clipboard
Elixir lexer missing builtin keywords
Bug description
The ElixirLexer from pygments appears to have a non-standard way of declaring all of the builtin terms. This makes the rendering of Elixir code appear nearly broken since not even function declarations are highlighted.
Sample code
defmodule MyApp.Languages do
require Logger
use MyApp.Stats
alias MyApp.Config
@iso_codes for line <- File.stream!("priv/data/iso-639-3.tab"),
row = String.split(line, "\t"),
code = Enum.at(row, 3),
String.length(code) == 2,
code = String.to_atom(code),
Enum.at(row, 5) == "L",
name = Enum.at(row, 6),
do: {code, name},
into: %{}
def iso_codes, do: @iso_codes
for {code, name} <- @iso_codes do
def get_lang_name(unquote(code)), do: {:ok, unquote(name)}
end
def get_lang_name(_), do: {:error, :invalid}
end
Compare the highlighting here on GitHub with the Chroma Playground. Words missing highlighting include defmodule
, do
, require
, use
, alias
, def
, for
, end
, quote
, unquote
Screenshot from Chroma Playground

Steps taken
I ran pygments2chroma.py
for pygments.lexers.erlang.ElixirLexer
which produces nearly the same code as exists now, so there's something either wrong with the pygments lexer or the invocation of it to create a Chroma lexer.