variables.ex.exs (1144B)
1 defmodule Makeup.Lexers.ElixirLexer.Variables do 2 @moduledoc false 3 4 # parsec:Makeup.Lexers.ElixirLexer.Variables 5 # This module is generated at "dev time" so that the lexer 6 # doesn't have to depend on the (excellent) `unicode_set` library, 7 # which takes several minutes to compile. 8 import NimbleParsec 9 10 variable_start_unicode_syntax = 11 "[[:L:][:Nl:][:Other_ID_Start:]-[:Pattern_Syntax:]-[:Pattern_White_Space:]-[:Lu:]-[:Lt:][_]]" 12 13 variable_continue_unicode_syntax = 14 "[[:ID_Start:][:Mn:][:Mc:][:Nd:][:Pc:][:Other_ID_Continue:]-[:Pattern_Syntax:]-[:Pattern_White_Space:]]" 15 16 # TODO: Why do we need to flatten these lists? A bug in `unicode_set`? 17 variable_start_chars = Unicode.Set.to_utf8_char(variable_start_unicode_syntax) |> List.flatten() 18 19 variable_continue_chars = 20 Unicode.Set.to_utf8_char(variable_continue_unicode_syntax) |> List.flatten() 21 22 defcombinator(:variable_start_chars, label(utf8_char(variable_start_chars), "variable start")) 23 24 defcombinator( 25 :variable_continue_chars, 26 label(utf8_char(variable_continue_chars), "variable continue") 27 ) 28 29 # parsec:Makeup.Lexers.ElixirLexer.Variables 30 end