Commit 592dd96e authored by POTTIER Francois's avatar POTTIER Francois
Browse files

Introduced the non-terminal symbol [branches] in the grammars.

No observable impact.
parent 081abe25
...@@ -223,8 +223,8 @@ rule: ...@@ -223,8 +223,8 @@ rule:
flags = flags /* flags */ flags = flags /* flags */
symbol = symbol /* the symbol that is being defined */ symbol = symbol /* the symbol that is being defined */
params = plist(symbol) /* formal parameters */ params = plist(symbol) /* formal parameters */
COLON optional_bar COLON
prods = separated_nonempty_list(BAR, production_group) /* productions */ branches = branches
{ {
let public, inline = flags in let public, inline = flags in
[ [
...@@ -234,13 +234,17 @@ rule: ...@@ -234,13 +234,17 @@ rule:
pr_nt = Positions.value symbol; pr_nt = Positions.value symbol;
pr_positions = [ Positions.position symbol ]; pr_positions = [ Positions.position symbol ];
pr_parameters = List.map Positions.value params; pr_parameters = List.map Positions.value params;
pr_branches = List.flatten prods pr_branches = branches
} }
] ]
} }
| error | error
{ Error.error (Positions.two $startpos $endpos) "syntax error inside the definition of a nonterminal symbol." } { Error.error (Positions.two $startpos $endpos) "syntax error inside the definition of a nonterminal symbol." }
%inline branches:
optional_bar prods = separated_nonempty_list(BAR, production_group)
{ List.flatten prods }
flags: flags:
/* epsilon */ /* epsilon */
{ false, false } { false, false }
......
...@@ -161,19 +161,23 @@ rule: ...@@ -161,19 +161,23 @@ rule:
flags flags
symbol symbol
optional_formal_parameters optional_formal_parameters
COLON optional_bar COLON
production_group production_groups branches
{ {
let public, inline = $1 in let public, inline = $1 in
{ pr_public_flag = public; { pr_public_flag = public;
pr_inline_flag = inline; pr_inline_flag = inline;
pr_nt = Positions.value $2; pr_nt = Positions.value $2;
pr_positions = [ Positions.position $2 ]; pr_positions = [ Positions.position $2 ];
pr_parameters = $3; pr_parameters = $3;
pr_branches = List.flatten ($6 :: List.rev $7) pr_branches = $5
} }
} }
branches:
optional_bar production_group production_groups
{ List.flatten ($2 :: List.rev $3) }
flags: flags:
/* epsilon */ /* epsilon */
{ false, false } { false, false }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment