summaryrefslogtreecommitdiff
path: root/src/curly_parser.mly
diff options
context:
space:
mode:
Diffstat (limited to 'src/curly_parser.mly')
-rw-r--r--src/curly_parser.mly20
1 files changed, 4 insertions, 16 deletions
diff --git a/src/curly_parser.mly b/src/curly_parser.mly
index 560d84c..54443b5 100644
--- a/src/curly_parser.mly
+++ b/src/curly_parser.mly
@@ -37,23 +37,11 @@
%start <Config_tree.t> config
%%
-(* Shift-reduce conflicts are reduced to shift by default,
- so it should be fine *)
opt_comment:
| (* empty *) { None }
| c = COMMENT { Some (String.trim c) }
;
-opt_inactive:
- | (* empty *) { false }
- | INACTIVE { true }
-;
-
-opt_ephemeral:
- | (* empty *) { false }
- | EPHEMERAL { true }
-;
-
value:
| v = STRING
{ v }
@@ -68,14 +56,14 @@ values:
;
leaf_node:
- | comment = opt_comment; inactive = opt_inactive; ephemeral = opt_ephemeral; name = IDENTIFIER; values = values; SEMI
+ | comment = opt_comment; inactive = boption(INACTIVE); ephemeral = boption(EPHEMERAL); name = IDENTIFIER; values = values; SEMI
{ Vytree.make_full {values=(List.rev values); comment=comment; inactive=inactive; ephemeral=ephemeral} name []}
- | comment = opt_comment; inactive = opt_inactive; ephemeral = opt_ephemeral; name = IDENTIFIER; SEMI (* valueless node *)
+ | comment = opt_comment; inactive = boption(INACTIVE); ephemeral = boption(EPHEMERAL); name = IDENTIFIER; SEMI (* valueless node *)
{ Vytree.make_full {default_data with comment=comment; inactive=inactive; ephemeral=ephemeral} name [] }
;
node:
- | comment = opt_comment; inactive = opt_inactive; ephemeral = opt_ephemeral; name = IDENTIFIER; LEFT_BRACE; children = list(node_content); RIGHT_BRACE
+ | comment = opt_comment; inactive = boption(INACTIVE); ephemeral = boption(EPHEMERAL); name = IDENTIFIER; LEFT_BRACE; children = list(node_content); RIGHT_BRACE
{
let node = Vytree.make_full {default_data with comment=comment; inactive=inactive; ephemeral=ephemeral} name [] in
let node = List.fold_left Vytree.adopt node (List.rev children) |> Vytree.merge_children merge_data in
@@ -89,7 +77,7 @@ node:
;
tag_node:
- | comment = opt_comment; inactive = opt_inactive; ephemeral = opt_ephemeral; name = IDENTIFIER; tag = IDENTIFIER; LEFT_BRACE; children = list(node_content); RIGHT_BRACE
+ | comment = opt_comment; inactive = boption(INACTIVE); ephemeral = boption(EPHEMERAL); name = IDENTIFIER; tag = IDENTIFIER; LEFT_BRACE; children = list(node_content); RIGHT_BRACE
{
let outer_node = Vytree.make_full default_data name [] in
let inner_node = Vytree.make_full {default_data with comment=comment; inactive=inactive; ephemeral=ephemeral} tag [] in