fix meta parsing

This commit is contained in:
Jeremie Dimino 2016-11-13 12:37:18 +00:00
parent a71db86d88
commit 567dac033f
1 changed files with 13 additions and 8 deletions

View File

@ -47,25 +47,25 @@ module Parse = struct
| Plus_equal -> Add
| _ -> error lb "'=' or '+=' expected"
let comma lb =
match next lb with
| Comma -> ()
| _ -> error lb "',' expected"
let rec predicates_and_action lb acc =
match next lb with
| 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 ->
let n =
match next lb with
| Name p -> p
| _ -> error lb "name expected"
in
comma lb;
predicates_and_action lb (A n :: acc)
after_predicate lb (A n :: acc)
| _ -> 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 =
match next lb with
| Rparen ->
@ -73,6 +73,11 @@ module Parse = struct
List.rev acc
else
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" ->
let name = package_name lb in
lparen lb;