Packages
kafka_protocol
1.0.0
4.3.4
4.3.3
4.3.2
4.3.1
4.3.0
4.2.9
4.2.8
4.2.7
4.2.6
4.2.5
4.2.4
4.2.3
4.2.2
4.2.1
4.2.0
4.1.10
4.1.9
4.1.8
4.1.7
4.1.6
4.1.5
4.1.4
4.1.3
4.1.2
4.1.1
4.1.0
4.0.3
4.0.2
4.0.1
3.0.1
3.0.0
2.4.1
2.3.6
2.3.5
2.3.4
2.3.3
2.3.2
2.3.1
2.3.0
2.2.9
2.2.8
2.2.7
2.2.6
2.2.5
2.2.4
2.2.3
2.2.2
2.2.1
2.2.0
2.1.2
2.1.1
2.1.0
2.0.1
2.0.0
1.1.3
1.1.2
1.1.1
1.1.0
1.0.0
0.9.2
0.9.1
0.9.0
0.8.0
0.7.8
0.7.7
0.7.6
0.7.5
0.7.4
0.7.3
0.7.2
0.7.1
0.7.0
0.6.0
0.4.0
0.3.2
0.3.1
0.2.3
Kafka protocol library for Erlang/Elixir
Current section
Files
Jump to
Current section
Files
priv/kpro_parser.yrl
Nonterminals bnf groups defs def fields field
new_line new_line_and_indent some_empty_lines.
Terminals name prim '[' ']' '=>' one_new_line one_new_line_and_indent.
Rootsymbol bnf.
bnf -> some_empty_lines groups : '$2'.
groups -> defs : ['$1'].
groups -> defs groups : ['$1' | '$2'].
defs -> def new_line : ['$1'].
defs -> def new_line_and_indent defs : ['$1' | '$3'].
def -> name '=>' : {v('$1'), []}.
def -> name '=>' prim : {v('$1'), v('$3')}.
def -> name '=>' '[' prim ']' : {v('$1'), {array, v('$4')}}.
def -> name '=>' fields : {v('$1'), '$3'}.
fields -> field : ['$1'].
fields -> field fields : ['$1' | '$2'].
field -> name : v('$1').
field -> '[' name ']' : {array, v('$2')}.
some_empty_lines -> '$empty'.
some_empty_lines -> new_line.
some_empty_lines -> new_line_and_indent.
new_line -> some_empty_lines one_new_line.
new_line_and_indent -> some_empty_lines one_new_line_and_indent.
Erlang code.
-export([file/1]).
v({_Tag, _Line, Value}) -> Value.
file(Filename) ->
{ok, Contents} = file:read_file(Filename),
{ok, Tokens, _EndLine} = kpro_scanner:string(binary_to_list(Contents)),
parse(Tokens).