name = "Erlang"
grammar = "erlang"
# TODO: support parsing rebar.config files
# # https://github.com/WhatsApp/tree-sitter-erlang/issues/3
path_suffixes = ["erl", "hrl", "app.src", "escript", "xrl", "yrl", "Emakefile", "rebar.config"]
line_comments = ["% ", "%% ", "%%% "]
autoclose_before = ";:.,=}])>"
brackets = [
    { start = "{", end = "}", close = true, newline = true },
    { start = "[", end = "]", close = true, newline = true },
    { start = "(", end = ")", close = true, newline = true },
    { start = "<<", end = ">>", close = true, newline = false, not_in = ["string"] },
    { start = "\"", end = "\"", close = true, newline = false, not_in = ["string"] },
    { start = "'", end = "'", close = true, newline = false, not_in = ["string", "comment"] },
]
# Indent if a line ends brackets, "->" or most keywords. Also if prefixed
# with "||". This should work with most formatting models.
# The ([^%]).* is to ensure this doesn't match inside comments.
increase_indent_pattern = "^([^%]).*([{(\\[]]|\\->|after|begin|case|catch|fun|if|of|try|when|maybe|else|(\\|\\|.*))\\s*$"

# Dedent after brackets, end or lone "->". The latter happens in a spec
# with indented types, typically after "when". Only do this if it's _only_
# preceded by whitespace.
decrease_indent_pattern = "^\\s*([)}\\]]|end|else|\\->\\s*$)"
