'*******************************************************************************
' EverEdit Syntax File
' Language:   Erlang
' Maintainer: yoastg@gmail.com  
' History:
'   2013/03/6 First Version
'*******************************************************************************

Include( ".\const.mac" )

Set erl=CreateParser()

'comment
Set rLineComment=erl.CreateRegion( COLOR_COMMENT1, "+%+", "$", True )
erl.AddRegion( rLineComment )

'add todo to comment
Set iTodo=erl.CreateItem( COLOR_HIGHLIGHT2, "\b(TODO|FIX)\b", False )
rLineComment.AddItem( iTodo )

'single quote atom
Set rString1=erl.CreateStringRegion( COLOR_STRING1, "'", "\", False )
erl.AddRegion( rString1 )

'double quote string
Set rString2=erl.CreateStringRegion( COLOR_STRING2, """", "\", False )
erl.AddRegion( rString2 )

'binary
Set rBlockComment=erl.CreateRegion( COLOR_STRING1, "+<<+", "+>>+", True )
erl.AddRegion( rBlockComment )

'function
erl.AddItem( erl.CreateItem(COLOR_FUNCTION, "[\w_]+(?=\()", False) )

'Reserved words
erl.AddWord( erl.CreateWord(COLOR_WORD1, "after and andalso band begin bnot bor bsl bsr bxor case catch cond div end fun if let not of or orelse query receive rem try when xor", True ) )

'other words
erl.AddWord( erl.CreateWord(COLOR_WORD1, "-define -else -endif -ifdef -ifndef -include -include_lib -undef -behavior -behaviour -compile -created -created_by -export -file -import -module -modified -modified_by -record -revision -spec -type -vsn @author @clear @copyright @deprecated @doc @docfile @end @equiv @headerfile @hidden @private @reference @see @since @spec @throws @title @todo @TODO @type @version @date @docRoot @link @module @package @section @time @type @version", True ) )

'bif
erl.AddWord( erl.CreateWord(COLOR_WORD1, "erlang: abs adler32 adler32_combine erlang:append_element apply atom_to_binary atom_to_list binary_to_atom binary_to_existing_atom binary_to_list bitstring_to_list binary_to_term bit_size erlang:bump_reductions byte_size erlang:cancel_timer check_process_code concat_binary crc32 crc32_combine date decode_packet delete_module erlang:demonitor disconnect_node erlang:display element erase erlang:error exit float float_to_list erlang:fun_info erlang:fun_to_list erlang:function_exported garbage_collect get erlang:get_cookie get_keys erlang:get_stacktrace group_leader halt erlang:hash hd erlang:hibernate integer_to_list erlang:integer_to_list iolist_to_binary iolist_size is_alive is_atom is_binary is_bitstring is_boolean erlang: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 erlang:list_to_integer list_to_pid list_to_tuple load_module erlang:load_nif erlang:loaded erlang:localtime erlang:localtime_to_universaltime make_ref erlang:make_tuple erlang:max erlang:md5 erlang:md5_final erlang:md5_init erlang:md5_update erlang:memory erlang:min module_loaded erlang:monitor monitor_node node nodes now open_port erlang:phash erlang:phash2 pid_to_list port_close port_command erlang:port_command port_connect port_control erlang:port_call erlang:port_info erlang:port_to_list erlang:ports pre_loaded erlang:process_display process_flag process_info processes purge_module put erlang:raise erlang:read_timer erlang:ref_to_list register registered erlang:resume_process round self erlang:send erlang:send_after erlang:send_nosuspend erlang:set_cookie setelement size spawn spawn_link spawn_monitor spawn_opt split_binary erlang:start_timer statistics erlang:suspend_process erlang:system_flag erlang:system_info erlang:system_monitor erlang:system_profile term_to_binary throw time tl erlang:trace erlang:trace_delivered erlang:trace_info erlang:trace_pattern trunc tuple_size tuple_to_list erlang:universaltime erlang:universaltime_to_localtime unlink unregister whereis erlang:yield", True ) )

'operators
erl.AddItem( erl.CreateItem(COLOR_OPERATOR, "[\{\}\(\)\+\-\*\\=%&\^!~\|<>?\.;\[\]]",False ) )

'number
erl.AddItem( erl.CreateItem(COLOR_NUMBER, "\b\d+\b", False) )


Call erl.IndentText( "(->|of)$", False )

Call erl.SetPairs( "[]{}()""""''" )

Call erl.CommentLine("%")
