fix meta parsing
This commit is contained in:
parent
a71db86d88
commit
567dac033f
21
src/meta.ml
21
src/meta.ml
|
@ -47,25 +47,25 @@ module Parse = struct
|
||||||
| Plus_equal -> Add
|
| Plus_equal -> Add
|
||||||
| _ -> error lb "'=' or '+=' expected"
|
| _ -> error lb "'=' or '+=' expected"
|
||||||
|
|
||||||
let comma lb =
|
|
||||||
match next lb with
|
|
||||||
| Comma -> ()
|
|
||||||
| _ -> error lb "',' expected"
|
|
||||||
|
|
||||||
let rec predicates_and_action lb acc =
|
let rec predicates_and_action lb acc =
|
||||||
match next lb with
|
match next lb with
|
||||||
| Rparen -> (List.rev acc, action lb)
|
| Rparen -> (List.rev acc, action lb)
|
||||||
| Name n -> comma lb; predicates_and_action lb (P n :: acc)
|
| Name n -> after_predicate lb (P n :: acc)
|
||||||
| Minus ->
|
| Minus ->
|
||||||
let n =
|
let n =
|
||||||
match next lb with
|
match next lb with
|
||||||
| Name p -> p
|
| Name p -> p
|
||||||
| _ -> error lb "name expected"
|
| _ -> error lb "name expected"
|
||||||
in
|
in
|
||||||
comma lb;
|
after_predicate lb (A n :: acc)
|
||||||
predicates_and_action lb (A n :: acc)
|
|
||||||
| _ -> error lb "name, '-' or ')' expected"
|
| _ -> error lb "name, '-' or ')' expected"
|
||||||
|
|
||||||
|
and after_predicate lb acc =
|
||||||
|
match next lb with
|
||||||
|
| Rparen -> (List.rev acc, action lb)
|
||||||
|
| Comma -> predicates_and_action lb acc
|
||||||
|
| _ -> error lb "')' or ',' expected"
|
||||||
|
|
||||||
let rec entries lb depth acc =
|
let rec entries lb depth acc =
|
||||||
match next lb with
|
match next lb with
|
||||||
| Rparen ->
|
| Rparen ->
|
||||||
|
@ -73,6 +73,11 @@ module Parse = struct
|
||||||
List.rev acc
|
List.rev acc
|
||||||
else
|
else
|
||||||
error lb "closing parenthesis without matching opening one"
|
error lb "closing parenthesis without matching opening one"
|
||||||
|
| Eof ->
|
||||||
|
if depth = 0 then
|
||||||
|
List.rev acc
|
||||||
|
else
|
||||||
|
error lb "%d closing parentheses missing" depth
|
||||||
| Name "package" ->
|
| Name "package" ->
|
||||||
let name = package_name lb in
|
let name = package_name lb in
|
||||||
lparen lb;
|
lparen lb;
|
||||||
|
|
Loading…
Reference in New Issue