1% testing for the erlang syntax highlighter
2% NOTE alerts work in comments to TODO !
3
4% pragmas (show as keywords)
5-module
6-export
7-define
8-undef
9-ifdef
10-ifndef
11-else
12-endif
13-include
14-include_lib
15
16% key words
17after begin case catch cond  end fun if let of query receive all_true some_true
18
19% operators
20div rem or xor bor bxor bsl bsr and band not bnot
21+ - * / == /= =:= =/= < =< > >= ++ -- = ! <-
22
23% separators (show as functions)
24( ) { } [ ] . : | || ; , ? -> #
25
26% functions - predefined (part of erlang module) - show as functions
27abs accept alarm apply atom_to_list binary_to_list binary_to_term check_process_code
28concat_binary date delete_module disconnect_node element erase exit float float_to_list
29garbage_collect get get_keys group_leader halt hd integer_to_list is_alive is_atom is_binary
30is_boolean is_float is_function is_integer is_list is_number is_pid is_port is_process_alive
31is_record is_reference is_tuple length link list_to_atom list_to_binary list_to_float list_to_integer
32list_to_pid list_to_tuple load_module loaded localtime make_ref module_loaded node nodes now
33open_port pid_to_list port_close port_command port_connect port_control ports pre_loaded process_flag
34process_info processes purge_module put register registered round self setelement size
35spawn spawn_link spawn_opt split_binary statistics term_to_binary throw time tl trunc tuple_to_list
36unlink unregister whereis
37
38% functions - inferred
39module:function
40function()
41
42% atoms (show as "char")
43% begin with underscore, lowercase, contain numbers letters and @ - or anything between ''
44middle_underscore
45abc ab4d a@cd8 a@
46'And this is (\012) an atom \' Atoo' Variable 'atom again'
47
48% variables (begin with capital letter or underscore, contain numbers, letters and @)
49_leadingUnderscore AbdD@ B45@c
50
51% this is a string
52"a string sits between \" double quotes" atom "more string"
53
54% integers (decimal)
551. 234 $A
56
57% integers (specified base)
582#10101 34#567
59
60% float
6112.23 12.9e-67 12.8E+89 33.34e89
62
63% and finally some real code, so we can see what it looks like...
64-module(codetest).			% everything is in a module
65-export([fac/1]).		% name and number of arguments - need this to be called outside of the module
66
67fac(N) when N > 0  -> N * fac(N-1);
68fac(N) when N == 0 -> 1.
69