1name = "Erlang"
2grammar = "erlang"
3# TODO: support parsing rebar.config files
4# # https://github.com/WhatsApp/tree-sitter-erlang/issues/3
5path_suffixes = ["erl", "hrl", "app.src", "escript", "xrl", "yrl", "Emakefile", "rebar.config"]
6line_comments = ["% ", "%% ", "%%% "]
7autoclose_before = ";:.,=}])>"
8brackets = [
9 { start = "{", end = "}", close = true, newline = true },
10 { start = "[", end = "]", close = true, newline = true },
11 { start = "(", end = ")", close = true, newline = true },
12 { start = "<<", end = ">>", close = true, newline = false, not_in = ["string"] },
13 { start = "\"", end = "\"", close = true, newline = false, not_in = ["string"] },
14 { start = "'", end = "'", close = true, newline = false, not_in = ["string", "comment"] },
15]
16# Indent if a line ends brackets, "->" or most keywords. Also if prefixed
17# with "||". This should work with most formatting models.
18# The ([^%]).* is to ensure this doesn't match inside comments.
19increase_indent_pattern = "^([^%]).*([{(\\[]]|\\->|after|begin|case|catch|fun|if|of|try|when|maybe|else|(\\|\\|.*))\\s*$"
20
21# Dedent after brackets, end or lone "->". The latter happens in a spec
22# with indented types, typically after "when". Only do this if it's _only_
23# preceded by whitespace.
24decrease_indent_pattern = "^\\s*([)}\\]]|end|else|\\->\\s*$)"