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

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

No observable impact.
parent 081abe25
......@@ -223,8 +223,8 @@ rule:
flags = flags /* flags */
symbol = symbol /* the symbol that is being defined */
params = plist(symbol) /* formal parameters */
COLON optional_bar
prods = separated_nonempty_list(BAR, production_group) /* productions */
COLON
branches = branches
{
let public, inline = flags in
[
......@@ -234,13 +234,17 @@ rule:
pr_nt = Positions.value symbol;
pr_positions = [ Positions.position symbol ];
pr_parameters = List.map Positions.value params;
pr_branches = List.flatten prods
pr_branches = branches
}
]
}
| error
{ 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:
/* epsilon */
{ false, false }
......
......@@ -161,19 +161,23 @@ rule:
flags
symbol
optional_formal_parameters
COLON optional_bar
production_group production_groups
{
COLON
branches
{
let public, inline = $1 in
{ pr_public_flag = public;
pr_inline_flag = inline;
pr_nt = Positions.value $2;
pr_positions = [ Positions.position $2 ];
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:
/* epsilon */
{ 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