e

package
v0.8.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 12, 2020 License: MIT Imports: 2 Imported by: 13

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Ebnf = internal.Register(MustNewLexer(
	&Config{
		Name:      "EBNF",
		Aliases:   []string{"ebnf"},
		Filenames: []string{"*.ebnf"},
		MimeTypes: []string{"text/x-ebnf"},
	},
	Rules{
		"root": {
			Include("whitespace"),
			Include("comment_start"),
			Include("identifier"),
			{`=`, Operator, Push("production")},
		},
		"production": {
			Include("whitespace"),
			Include("comment_start"),
			Include("identifier"),
			{`"[^"]*"`, LiteralStringDouble, nil},
			{`'[^']*'`, LiteralStringSingle, nil},
			{`(\?[^?]*\?)`, NameEntity, nil},
			{`[\[\]{}(),|]`, Punctuation, nil},
			{`-`, Operator, nil},
			{`;`, Punctuation, Pop(1)},
			{`\.`, Punctuation, Pop(1)},
		},
		"whitespace": {
			{`\s+`, Text, nil},
		},
		"comment_start": {
			{`\(\*`, CommentMultiline, Push("comment")},
		},
		"comment": {
			{`[^*)]`, CommentMultiline, nil},
			Include("comment_start"),
			{`\*\)`, CommentMultiline, Pop(1)},
			{`[*)]`, CommentMultiline, nil},
		},
		"identifier": {
			{`([a-zA-Z][\w \-]*)`, Keyword, nil},
		},
	},
))

Ebnf lexer.

View Source
var Elixir = internal.Register(MustNewLexer(
	&Config{
		Name:      "Elixir",
		Aliases:   []string{"elixir", "ex", "exs"},
		Filenames: []string{"*.ex", "*.exs"},
		MimeTypes: []string{"text/x-elixir"},
	},
	Rules{
		"root": {
			{`\s+`, Text, nil},
			{`#.*$`, CommentSingle, nil},
			{`(\?)(\\x\{)([\da-fA-F]+)(\})`, ByGroups(LiteralStringChar, LiteralStringEscape, LiteralNumberHex, LiteralStringEscape), nil},
			{`(\?)(\\x[\da-fA-F]{1,2})`, ByGroups(LiteralStringChar, LiteralStringEscape), nil},
			{`(\?)(\\[abdefnrstv])`, ByGroups(LiteralStringChar, LiteralStringEscape), nil},
			{`\?\\?.`, LiteralStringChar, nil},
			{`:::`, LiteralStringSymbol, nil},
			{`::`, Operator, nil},
			{`:(?:\.\.\.|<<>>|%\{\}|%|\{\})`, LiteralStringSymbol, nil},
			{`:(?:(?:\.\.\.|[a-z_]\w*[!?]?)|[A-Z]\w*(?:\.[A-Z]\w*)*|(?:\<\<\<|\>\>\>|\|\|\||\&\&\&|\^\^\^|\~\~\~|\=\=\=|\!\=\=|\~\>\>|\<\~\>|\|\~\>|\<\|\>|\=\=|\!\=|\<\=|\>\=|\&\&|\|\||\<\>|\+\+|\-\-|\|\>|\=\~|\-\>|\<\-|\||\.|\=|\~\>|\<\~|\<|\>|\+|\-|\*|\/|\!|\^|\&))`, LiteralStringSymbol, nil},
			{`:"`, LiteralStringSymbol, Push("string_double_atom")},
			{`:'`, LiteralStringSymbol, Push("string_single_atom")},
			{`((?:\.\.\.|<<>>|%\{\}|%|\{\})|(?:(?:\.\.\.|[a-z_]\w*[!?]?)|[A-Z]\w*(?:\.[A-Z]\w*)*|(?:\<\<\<|\>\>\>|\|\|\||\&\&\&|\^\^\^|\~\~\~|\=\=\=|\!\=\=|\~\>\>|\<\~\>|\|\~\>|\<\|\>|\=\=|\!\=|\<\=|\>\=|\&\&|\|\||\<\>|\+\+|\-\-|\|\>|\=\~|\-\>|\<\-|\||\.|\=|\~\>|\<\~|\<|\>|\+|\-|\*|\/|\!|\^|\&)))(:)(?=\s|\n)`, ByGroups(LiteralStringSymbol, Punctuation), nil},
			{`(fn|do|end|after|else|rescue|catch)\b`, Keyword, nil},
			{`(not|and|or|when|in)\b`, OperatorWord, nil},
			{`(case|cond|for|if|unless|try|receive|raise|quote|unquote|unquote_splicing|throw|super|while)\b`, Keyword, nil},
			{`(def|defp|defmodule|defprotocol|defmacro|defmacrop|defdelegate|defexception|defstruct|defimpl|defcallback)\b`, KeywordDeclaration, nil},
			{`(import|require|use|alias)\b`, KeywordNamespace, nil},
			{`(nil|true|false)\b`, NameConstant, nil},
			{`(_|__MODULE__|__DIR__|__ENV__|__CALLER__)\b`, NamePseudo, nil},
			{`@(?:\.\.\.|[a-z_]\w*[!?]?)`, NameAttribute, nil},
			{`(?:\.\.\.|[a-z_]\w*[!?]?)`, Name, nil},
			{`(%?)([A-Z]\w*(?:\.[A-Z]\w*)*)`, ByGroups(Punctuation, NameClass), nil},
			{`\<\<\<|\>\>\>|\|\|\||\&\&\&|\^\^\^|\~\~\~|\=\=\=|\!\=\=|\~\>\>|\<\~\>|\|\~\>|\<\|\>`, Operator, nil},
			{`\=\=|\!\=|\<\=|\>\=|\&\&|\|\||\<\>|\+\+|\-\-|\|\>|\=\~|\-\>|\<\-|\||\.|\=|\~\>|\<\~`, Operator, nil},
			{`\\\\|\<\<|\>\>|\=\>|\(|\)|\:|\;|\,|\[|\]`, Punctuation, nil},
			{`&\d`, NameEntity, nil},
			{`\<|\>|\+|\-|\*|\/|\!|\^|\&`, Operator, nil},
			{`0b[01](_?[01])*`, LiteralNumberBin, nil},
			{`0o[0-7](_?[0-7])*`, LiteralNumberOct, nil},
			{`0x[\da-fA-F](_?[\dA-Fa-f])*`, LiteralNumberHex, nil},
			{`\d(_?\d)*\.\d(_?\d)*([eE][-+]?\d(_?\d)*)?`, LiteralNumberFloat, nil},
			{`\d(_?\d)*`, LiteralNumberInteger, nil},
			{`"""\s*`, LiteralStringHeredoc, Push("heredoc_double")},
			{`'''\s*$`, LiteralStringHeredoc, Push("heredoc_single")},
			{`"`, LiteralStringDouble, Push("string_double")},
			{`'`, LiteralStringSingle, Push("string_single")},
			Include("sigils"),
			{`%\{`, Punctuation, Push("map_key")},
			{`\{`, Punctuation, Push("tuple")},
		},
		"heredoc_double": {
			{`^\s*"""`, LiteralStringHeredoc, Pop(1)},
			Include("heredoc_interpol"),
		},
		"heredoc_single": {
			{`^\s*'''`, LiteralStringHeredoc, Pop(1)},
			Include("heredoc_interpol"),
		},
		"heredoc_interpol": {
			{`[^#\\\n]+`, LiteralStringHeredoc, nil},
			Include("escapes"),
			{`\\.`, LiteralStringHeredoc, nil},
			{`\n+`, LiteralStringHeredoc, nil},
			Include("interpol"),
		},
		"heredoc_no_interpol": {
			{`[^\\\n]+`, LiteralStringHeredoc, nil},
			{`\\.`, LiteralStringHeredoc, nil},
			{`\n+`, LiteralStringHeredoc, nil},
		},
		"escapes": {
			{`(\\x\{)([\da-fA-F]+)(\})`, ByGroups(LiteralStringEscape, LiteralNumberHex, LiteralStringEscape), nil},
			{`(\\x[\da-fA-F]{1,2})`, LiteralStringEscape, nil},
			{`(\\[abdefnrstv])`, LiteralStringEscape, nil},
		},
		"interpol": {
			{`#\{`, LiteralStringInterpol, Push("interpol_string")},
		},
		"interpol_string": {
			{`\}`, LiteralStringInterpol, Pop(1)},
			Include("root"),
		},
		"map_key": {
			Include("root"),
			{`:`, Punctuation, Push("map_val")},
			{`=>`, Punctuation, Push("map_val")},
			{`\}`, Punctuation, Pop(1)},
		},
		"map_val": {
			Include("root"),
			{`,`, Punctuation, Pop(1)},
			{`(?=\})`, Punctuation, Pop(1)},
		},
		"tuple": {
			Include("root"),
			{`\}`, Punctuation, Pop(1)},
		},
		"string_double": {
			{`[^#"\\]+`, LiteralStringDouble, nil},
			Include("escapes"),
			{`\\.`, LiteralStringDouble, nil},
			{`(")`, ByGroups(LiteralStringDouble), Pop(1)},
			Include("interpol"),
		},
		"string_single": {
			{`[^#'\\]+`, LiteralStringSingle, nil},
			Include("escapes"),
			{`\\.`, LiteralStringSingle, nil},
			{`(')`, ByGroups(LiteralStringSingle), Pop(1)},
			Include("interpol"),
		},
		"string_double_atom": {
			{`[^#"\\]+`, LiteralStringSymbol, nil},
			Include("escapes"),
			{`\\.`, LiteralStringSymbol, nil},
			{`(")`, ByGroups(LiteralStringSymbol), Pop(1)},
			Include("interpol"),
		},
		"string_single_atom": {
			{`[^#'\\]+`, LiteralStringSymbol, nil},
			Include("escapes"),
			{`\\.`, LiteralStringSymbol, nil},
			{`(')`, ByGroups(LiteralStringSymbol), Pop(1)},
			Include("interpol"),
		},
		"sigils": {
			{`(~[a-z])(""")`, ByGroups(LiteralStringOther, LiteralStringHeredoc), Push("triquot-end", "triquot-intp")},
			{`(~[A-Z])(""")`, ByGroups(LiteralStringOther, LiteralStringHeredoc), Push("triquot-end", "triquot-no-intp")},
			{`(~[a-z])(''')`, ByGroups(LiteralStringOther, LiteralStringHeredoc), Push("triapos-end", "triapos-intp")},
			{`(~[A-Z])(''')`, ByGroups(LiteralStringOther, LiteralStringHeredoc), Push("triapos-end", "triapos-no-intp")},
			{`~[a-z]\{`, LiteralStringOther, Push("cb-intp")},
			{`~[A-Z]\{`, LiteralStringOther, Push("cb-no-intp")},
			{`~[a-z]\[`, LiteralStringOther, Push("sb-intp")},
			{`~[A-Z]\[`, LiteralStringOther, Push("sb-no-intp")},
			{`~[a-z]\(`, LiteralStringOther, Push("pa-intp")},
			{`~[A-Z]\(`, LiteralStringOther, Push("pa-no-intp")},
			{`~[a-z]<`, LiteralStringOther, Push("ab-intp")},
			{`~[A-Z]<`, LiteralStringOther, Push("ab-no-intp")},
			{`~[a-z]/`, LiteralStringOther, Push("slas-intp")},
			{`~[A-Z]/`, LiteralStringOther, Push("slas-no-intp")},
			{`~[a-z]\|`, LiteralStringOther, Push("pipe-intp")},
			{`~[A-Z]\|`, LiteralStringOther, Push("pipe-no-intp")},
			{`~[a-z]"`, LiteralStringOther, Push("quot-intp")},
			{`~[A-Z]"`, LiteralStringOther, Push("quot-no-intp")},
			{`~[a-z]'`, LiteralStringOther, Push("apos-intp")},
			{`~[A-Z]'`, LiteralStringOther, Push("apos-no-intp")},
		},
		"triquot-end": {
			{`[a-zA-Z]+`, LiteralStringOther, Pop(1)},
			Default(Pop(1)),
		},
		"triquot-intp": {
			{`^\s*"""`, LiteralStringHeredoc, Pop(1)},
			Include("heredoc_interpol"),
		},
		"triquot-no-intp": {
			{`^\s*"""`, LiteralStringHeredoc, Pop(1)},
			Include("heredoc_no_interpol"),
		},
		"triapos-end": {
			{`[a-zA-Z]+`, LiteralStringOther, Pop(1)},
			Default(Pop(1)),
		},
		"triapos-intp": {
			{`^\s*'''`, LiteralStringHeredoc, Pop(1)},
			Include("heredoc_interpol"),
		},
		"triapos-no-intp": {
			{`^\s*'''`, LiteralStringHeredoc, Pop(1)},
			Include("heredoc_no_interpol"),
		},
		"cb-intp": {
			{`[^#\}\\]+`, LiteralStringOther, nil},
			Include("escapes"),
			{`\\.`, LiteralStringOther, nil},
			{`\}[a-zA-Z]*`, LiteralStringOther, Pop(1)},
			Include("interpol"),
		},
		"cb-no-intp": {
			{`[^\}\\]+`, LiteralStringOther, nil},
			{`\\.`, LiteralStringOther, nil},
			{`\}[a-zA-Z]*`, LiteralStringOther, Pop(1)},
		},
		"sb-intp": {
			{`[^#\]\\]+`, LiteralStringOther, nil},
			Include("escapes"),
			{`\\.`, LiteralStringOther, nil},
			{`\][a-zA-Z]*`, LiteralStringOther, Pop(1)},
			Include("interpol"),
		},
		"sb-no-intp": {
			{`[^\]\\]+`, LiteralStringOther, nil},
			{`\\.`, LiteralStringOther, nil},
			{`\][a-zA-Z]*`, LiteralStringOther, Pop(1)},
		},
		"pa-intp": {
			{`[^#\)\\]+`, LiteralStringOther, nil},
			Include("escapes"),
			{`\\.`, LiteralStringOther, nil},
			{`\)[a-zA-Z]*`, LiteralStringOther, Pop(1)},
			Include("interpol"),
		},
		"pa-no-intp": {
			{`[^\)\\]+`, LiteralStringOther, nil},
			{`\\.`, LiteralStringOther, nil},
			{`\)[a-zA-Z]*`, LiteralStringOther, Pop(1)},
		},
		"ab-intp": {
			{`[^#>\\]+`, LiteralStringOther, nil},
			Include("escapes"),
			{`\\.`, LiteralStringOther, nil},
			{`>[a-zA-Z]*`, LiteralStringOther, Pop(1)},
			Include("interpol"),
		},
		"ab-no-intp": {
			{`[^>\\]+`, LiteralStringOther, nil},
			{`\\.`, LiteralStringOther, nil},
			{`>[a-zA-Z]*`, LiteralStringOther, Pop(1)},
		},
		"slas-intp": {
			{`[^#/\\]+`, LiteralStringOther, nil},
			Include("escapes"),
			{`\\.`, LiteralStringOther, nil},
			{`/[a-zA-Z]*`, LiteralStringOther, Pop(1)},
			Include("interpol"),
		},
		"slas-no-intp": {
			{`[^/\\]+`, LiteralStringOther, nil},
			{`\\.`, LiteralStringOther, nil},
			{`/[a-zA-Z]*`, LiteralStringOther, Pop(1)},
		},
		"pipe-intp": {
			{`[^#\|\\]+`, LiteralStringOther, nil},
			Include("escapes"),
			{`\\.`, LiteralStringOther, nil},
			{`\|[a-zA-Z]*`, LiteralStringOther, Pop(1)},
			Include("interpol"),
		},
		"pipe-no-intp": {
			{`[^\|\\]+`, LiteralStringOther, nil},
			{`\\.`, LiteralStringOther, nil},
			{`\|[a-zA-Z]*`, LiteralStringOther, Pop(1)},
		},
		"quot-intp": {
			{`[^#"\\]+`, LiteralStringOther, nil},
			Include("escapes"),
			{`\\.`, LiteralStringOther, nil},
			{`"[a-zA-Z]*`, LiteralStringOther, Pop(1)},
			Include("interpol"),
		},
		"quot-no-intp": {
			{`[^"\\]+`, LiteralStringOther, nil},
			{`\\.`, LiteralStringOther, nil},
			{`"[a-zA-Z]*`, LiteralStringOther, Pop(1)},
		},
		"apos-intp": {
			{`[^#'\\]+`, LiteralStringOther, nil},
			Include("escapes"),
			{`\\.`, LiteralStringOther, nil},
			{`'[a-zA-Z]*`, LiteralStringOther, Pop(1)},
			Include("interpol"),
		},
		"apos-no-intp": {
			{`[^'\\]+`, LiteralStringOther, nil},
			{`\\.`, LiteralStringOther, nil},
			{`'[a-zA-Z]*`, LiteralStringOther, Pop(1)},
		},
	},
))

Elixir lexer.

View Source
var Elm = internal.Register(MustNewLexer(
	&Config{
		Name:      "Elm",
		Aliases:   []string{"elm"},
		Filenames: []string{"*.elm"},
		MimeTypes: []string{"text/x-elm"},
	},
	Rules{
		"root": {
			{`\{-`, CommentMultiline, Push("comment")},
			{`--.*`, CommentSingle, nil},
			{`\s+`, Text, nil},
			{`"`, LiteralString, Push("doublequote")},
			{`^\s*module\s*`, KeywordNamespace, Push("imports")},
			{`^\s*import\s*`, KeywordNamespace, Push("imports")},
			{`\[glsl\|.*`, NameEntity, Push("shader")},
			{Words(``, `\b`, `alias`, `as`, `case`, `else`, `if`, `import`, `in`, `let`, `module`, `of`, `port`, `then`, `type`, `where`), KeywordReserved, nil},
			{`[A-Z]\w*`, KeywordType, nil},
			{`^main `, KeywordReserved, nil},
			{Words(`\(`, `\)`, `~`, `||`, `|>`, `|`, "`", `^`, `\`, `'`, `>>`, `>=`, `>`, `==`, `=`, `<~`, `<|`, `<=`, `<<`, `<-`, `<`, `::`, `:`, `/=`, `//`, `/`, `..`, `.`, `->`, `-`, `++`, `+`, `*`, `&&`, `%`), NameFunction, nil},
			{Words(``, ``, `~`, `||`, `|>`, `|`, "`", `^`, `\`, `'`, `>>`, `>=`, `>`, `==`, `=`, `<~`, `<|`, `<=`, `<<`, `<-`, `<`, `::`, `:`, `/=`, `//`, `/`, `..`, `.`, `->`, `-`, `++`, `+`, `*`, `&&`, `%`), NameFunction, nil},
			Include("numbers"),
			{`[a-z_][a-zA-Z_\']*`, NameVariable, nil},
			{`[,()\[\]{}]`, Punctuation, nil},
		},
		"comment": {
			{`-(?!\})`, CommentMultiline, nil},
			{`\{-`, CommentMultiline, Push("comment")},
			{`[^-}]`, CommentMultiline, nil},
			{`-\}`, CommentMultiline, Pop(1)},
		},
		"doublequote": {
			{`\\u[0-9a-fA-F]{4}`, LiteralStringEscape, nil},
			{`\\[nrfvb\\"]`, LiteralStringEscape, nil},
			{`[^"]`, LiteralString, nil},
			{`"`, LiteralString, Pop(1)},
		},
		"imports": {
			{`\w+(\.\w+)*`, NameClass, Pop(1)},
		},
		"numbers": {
			{`_?\d+\.(?=\d+)`, LiteralNumberFloat, nil},
			{`_?\d+`, LiteralNumberInteger, nil},
		},
		"shader": {
			{`\|(?!\])`, NameEntity, nil},
			{`\|\]`, NameEntity, Pop(1)},
			{`.*\n`, NameEntity, nil},
		},
	},
))

Elm lexer.

View Source
var EmacsLisp = internal.Register(TypeRemappingLexer(MustNewLexer(
	&Config{
		Name:      "EmacsLisp",
		Aliases:   []string{"emacs", "elisp", "emacs-lisp"},
		Filenames: []string{"*.el"},
		MimeTypes: []string{"text/x-elisp", "application/x-elisp"},
	},
	Rules{
		"root": {
			Default(Push("body")),
		},
		"body": {
			{`\s+`, Text, nil},
			{`;.*$`, CommentSingle, nil},
			{`"`, LiteralString, Push("string")},
			{`\?([^\\]|\\.)`, LiteralStringChar, nil},
			{`:((?:\\.|[\w!$%&*+-/<=>?@^{}~|])(?:\\.|[\w!$%&*+-/<=>?@^{}~|]|[#.:])*)`, NameBuiltin, nil},
			{`::((?:\\.|[\w!$%&*+-/<=>?@^{}~|])(?:\\.|[\w!$%&*+-/<=>?@^{}~|]|[#.:])*)`, LiteralStringSymbol, nil},
			{`'((?:\\.|[\w!$%&*+-/<=>?@^{}~|])(?:\\.|[\w!$%&*+-/<=>?@^{}~|]|[#.:])*)`, LiteralStringSymbol, nil},
			{`'`, Operator, nil},
			{"`", Operator, nil},
			{"[-+]?\\d+\\.?(?=[ \"()\\]\\'\\n,;`])", LiteralNumberInteger, nil},
			{"[-+]?\\d+/\\d+(?=[ \"()\\]\\'\\n,;`])", LiteralNumber, nil},
			{"[-+]?(\\d*\\.\\d+([defls][-+]?\\d+)?|\\d+(\\.\\d*)?[defls][-+]?\\d+)(?=[ \"()\\]\\'\\n,;`])", LiteralNumberFloat, nil},
			{`\[|\]`, Punctuation, nil},
			{`#:((?:\\.|[\w!$%&*+-/<=>?@^{}~|])(?:\\.|[\w!$%&*+-/<=>?@^{}~|]|[#.:])*)`, LiteralStringSymbol, nil},
			{`#\^\^?`, Operator, nil},
			{`#\'`, NameFunction, nil},
			{`#[bB][+-]?[01]+(/[01]+)?`, LiteralNumberBin, nil},
			{`#[oO][+-]?[0-7]+(/[0-7]+)?`, LiteralNumberOct, nil},
			{`#[xX][+-]?[0-9a-fA-F]+(/[0-9a-fA-F]+)?`, LiteralNumberHex, nil},
			{`#\d+r[+-]?[0-9a-zA-Z]+(/[0-9a-zA-Z]+)?`, LiteralNumber, nil},
			{`#\d+=`, Operator, nil},
			{`#\d+#`, Operator, nil},
			{`(,@|,|\.|:)`, Operator, nil},
			{"(t|nil)(?=[ \"()\\]\\'\\n,;`])", NameConstant, nil},
			{`\*((?:\\.|[\w!$%&*+-/<=>?@^{}~|])(?:\\.|[\w!$%&*+-/<=>?@^{}~|]|[#.:])*)\*`, NameVariableGlobal, nil},
			{`((?:\\.|[\w!$%&*+-/<=>?@^{}~|])(?:\\.|[\w!$%&*+-/<=>?@^{}~|]|[#.:])*)`, NameVariable, nil},
			{`#\(`, Operator, Push("body")},
			{`\(`, Punctuation, Push("body")},
			{`\)`, Punctuation, Pop(1)},
		},
		"string": {
			{"[^\"\\\\`]+", LiteralString, nil},
			{"`((?:\\\\.|[\\w!$%&*+-/<=>?@^{}~|])(?:\\\\.|[\\w!$%&*+-/<=>?@^{}~|]|[#.:])*)\\'", LiteralStringSymbol, nil},
			{"`", LiteralString, nil},
			{`\\.`, LiteralString, nil},
			{`\\\n`, LiteralString, nil},
			{`"`, LiteralString, Pop(1)},
		},
	},
), TypeMapping{
	{NameVariable, NameFunction, emacsBuiltinFunction},
	{NameVariable, NameBuiltin, emacsSpecialForms},
	{NameVariable, NameException, emacsErrorKeywords},
	{NameVariable, NameBuiltin, append(emacsBuiltinFunctionHighlighted, emacsMacros...)},
	{NameVariable, KeywordPseudo, emacsLambdaListKeywords},
}))

EmacsLisp lexer.

View Source
var Erlang = internal.Register(MustNewLexer(
	&Config{
		Name:      "Erlang",
		Aliases:   []string{"erlang"},
		Filenames: []string{"*.erl", "*.hrl", "*.es", "*.escript"},
		MimeTypes: []string{"text/x-erlang"},
	},
	Rules{
		"root": {
			{`\s+`, Text, nil},
			{`%.*\n`, Comment, nil},
			{Words(``, `\b`, `after`, `begin`, `case`, `catch`, `cond`, `end`, `fun`, `if`, `let`, `of`, `query`, `receive`, `try`, `when`), Keyword, nil},
			{Words(``, `\b`, `abs`, `append_element`, `apply`, `atom_to_list`, `binary_to_list`, `bitstring_to_list`, `binary_to_term`, `bit_size`, `bump_reductions`, `byte_size`, `cancel_timer`, `check_process_code`, `delete_module`, `demonitor`, `disconnect_node`, `display`, `element`, `erase`, `exit`, `float`, `float_to_list`, `fun_info`, `fun_to_list`, `function_exported`, `garbage_collect`, `get`, `get_keys`, `group_leader`, `hash`, `hd`, `integer_to_list`, `iolist_to_binary`, `iolist_size`, `is_atom`, `is_binary`, `is_bitstring`, `is_boolean`, `is_builtin`, `is_float`, `is_function`, `is_integer`, `is_list`, `is_number`, `is_pid`, `is_port`, `is_process_alive`, `is_record`, `is_reference`, `is_tuple`, `length`, `link`, `list_to_atom`, `list_to_binary`, `list_to_bitstring`, `list_to_existing_atom`, `list_to_float`, `list_to_integer`, `list_to_pid`, `list_to_tuple`, `load_module`, `localtime_to_universaltime`, `make_tuple`, `md5`, `md5_final`, `md5_update`, `memory`, `module_loaded`, `monitor`, `monitor_node`, `node`, `nodes`, `open_port`, `phash`, `phash2`, `pid_to_list`, `port_close`, `port_command`, `port_connect`, `port_control`, `port_call`, `port_info`, `port_to_list`, `process_display`, `process_flag`, `process_info`, `purge_module`, `put`, `read_timer`, `ref_to_list`, `register`, `resume_process`, `round`, `send`, `send_after`, `send_nosuspend`, `set_cookie`, `setelement`, `size`, `spawn`, `spawn_link`, `spawn_monitor`, `spawn_opt`, `split_binary`, `start_timer`, `statistics`, `suspend_process`, `system_flag`, `system_info`, `system_monitor`, `system_profile`, `term_to_binary`, `tl`, `trace`, `trace_delivered`, `trace_info`, `trace_pattern`, `trunc`, `tuple_size`, `tuple_to_list`, `universaltime_to_localtime`, `unlink`, `unregister`, `whereis`), NameBuiltin, nil},
			{Words(``, `\b`, `and`, `andalso`, `band`, `bnot`, `bor`, `bsl`, `bsr`, `bxor`, `div`, `not`, `or`, `orelse`, `rem`, `xor`), OperatorWord, nil},
			{`^-`, Punctuation, Push("directive")},
			{`(\+\+?|--?|\*|/|<|>|/=|=:=|=/=|=<|>=|==?|<-|!|\?)`, Operator, nil},
			{`"`, LiteralString, Push("string")},
			{`<<`, NameLabel, nil},
			{`>>`, NameLabel, nil},
			{`((?:[a-z]\w*|'[^\n']*[^\\]'))(:)`, ByGroups(NameNamespace, Punctuation), nil},
			{`(?:^|(?<=:))((?:[a-z]\w*|'[^\n']*[^\\]'))(\s*)(\()`, ByGroups(NameFunction, Text, Punctuation), nil},
			{`[+-]?(?:[2-9]|[12][0-9]|3[0-6])#[0-9a-zA-Z]+`, LiteralNumberInteger, nil},
			{`[+-]?\d+`, LiteralNumberInteger, nil},
			{`[+-]?\d+.\d+`, LiteralNumberFloat, nil},
			{`[]\[:_@\".{}()|;,]`, Punctuation, nil},
			{`(?:[A-Z_]\w*)`, NameVariable, nil},
			{`(?:[a-z]\w*|'[^\n']*[^\\]')`, Name, nil},
			{`\?(?:(?:[A-Z_]\w*)|(?:[a-z]\w*|'[^\n']*[^\\]'))`, NameConstant, nil},
			{`\$(?:(?:\\(?:[bdefnrstv\'"\\]|[0-7][0-7]?[0-7]?|(?:x[0-9a-fA-F]{2}|x\{[0-9a-fA-F]+\})|\^[a-zA-Z]))|\\[ %]|[^\\])`, LiteralStringChar, nil},
			{`#(?:[a-z]\w*|'[^\n']*[^\\]')(:?\.(?:[a-z]\w*|'[^\n']*[^\\]'))?`, NameLabel, nil},
			{`\A#!.+\n`, CommentHashbang, nil},
			{`#\{`, Punctuation, Push("map_key")},
		},
		"string": {
			{`(?:\\(?:[bdefnrstv\'"\\]|[0-7][0-7]?[0-7]?|(?:x[0-9a-fA-F]{2}|x\{[0-9a-fA-F]+\})|\^[a-zA-Z]))`, LiteralStringEscape, nil},
			{`"`, LiteralString, Pop(1)},
			{`~[0-9.*]*[~#+BPWXb-ginpswx]`, LiteralStringInterpol, nil},
			{`[^"\\~]+`, LiteralString, nil},
			{`~`, LiteralString, nil},
		},
		"directive": {
			{`(define)(\s*)(\()((?:(?:[A-Z_]\w*)|(?:[a-z]\w*|'[^\n']*[^\\]')))`, ByGroups(NameEntity, Text, Punctuation, NameConstant), Pop(1)},
			{`(record)(\s*)(\()((?:(?:[A-Z_]\w*)|(?:[a-z]\w*|'[^\n']*[^\\]')))`, ByGroups(NameEntity, Text, Punctuation, NameLabel), Pop(1)},
			{`(?:[a-z]\w*|'[^\n']*[^\\]')`, NameEntity, Pop(1)},
		},
		"map_key": {
			Include("root"),
			{`=>`, Punctuation, Push("map_val")},
			{`:=`, Punctuation, Push("map_val")},
			{`\}`, Punctuation, Pop(1)},
		},
		"map_val": {
			Include("root"),
			{`,`, Punctuation, Pop(1)},
			{`(?=\})`, Punctuation, Pop(1)},
		},
	},
))

Erlang lexer.

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL