forked from SeleniumHQ/selenium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbase_grammar.rl
31 lines (22 loc) · 994 Bytes
/
base_grammar.rl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
%%{
machine build;
string = '"' >start_string /[^"]*/ $track %leaving '"';
map_value = string;
map_key = string;
map_entry = map_key >start_map_entry space* ':' space* map_value %leaving;
map_entries = space* map_entry space* (',' space* map_entry space*)*;
map = '{' >start_map map_entries '}' %leaving;
array_value = (string | map);
array_values = space* array_value space* (',' space* array_value space*)*;
array = '[' > start_array array_values space* ','? space* ']' %leaving;
type_name = [a-z] >start_type_name $track [a-z0-9_]* $track %leaving;
arg_name = [a-z] >start_arg_name $track [a-z0-9_]* $track %leaving;
arg_value = string | array;
arg = space* >start_arg arg_name space* '=' space* arg_value space* %leaving;
args = arg (',' arg)*;
output_type = type_name >start_type '(' args ')' %leaving;
eol = '\n' | '\r' | '\r\n';
comment = '#' ^eol* eol;
ignored = space | comment;
main := (ignored* output_type ignored*)+ @done;
}%%