mirror of
https://github.com/vim/vim.git
synced 2025-12-23 12:15:17 +01:00
Problem: filetype: Erlang lexical files are not recognized
Solution: Detect *.xrl files as leex filetype, include syntax and
filetype plugins (Jon Parise).
leex is the lexical analyzer generator for Erlang. Its input file format
follows a section-based structure and uses the `.xrl` file extension.
This initial work includes file detection, an ftplugin (which inherits
the Erlang configuration), and a syntax definition.
Reference:
- https://www.erlang.org/doc/apps/parsetools/leex.html
related: #18819
closes: #18832
Signed-off-by: Jon Parise <jon@indelible.org>
Signed-off-by: Csaba Hoch <csaba.hoch@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
29 lines
591 B
Erlang
29 lines
591 B
Erlang
% Header comment
|
|
%% Header comment
|
|
%%% Header comment
|
|
|
|
Definitions.
|
|
floats = (\+|-)?[0-9]+\.[0-9]+((E|e)(\+|-)?[0-9]+)?
|
|
D = [0-9]
|
|
A = ({D}|_|@)
|
|
WS = ([\000-\s]|%.*) % whitespace
|
|
|
|
Rules.
|
|
{D}+ :
|
|
% Comment
|
|
{token,{integer,TokenLine,list_to_integer(TokenChars)}}.
|
|
{D}+\.{D}+((E|e)(\+|\-)?{D}+)? :
|
|
% Coment with period.
|
|
{token,{float,TokenLine,list_to_float(TokenChars)}}.
|
|
{A} : ErlangCode. % comment
|
|
{WS} : ErlangCode.
|
|
:= :{token,{':=',TokenLine}}.
|
|
|
|
Erlang code.
|
|
|
|
-export([reserved_word/1]).
|
|
|
|
%% reserved_word(Atom) -> Bool
|
|
reserved_word('reserved') -> true;
|
|
reserved_word(_) -> false.
|