Diff of /trunk/Toss/Solver/StructureParser.mly [r1812] .. [r1813] Maximize Restore

  Switch to side-by-side view

--- a/trunk/Toss/Solver/StructureParser.mly
+++ b/trunk/Toss/Solver/StructureParser.mly
@@ -8,7 +8,8 @@
 
 %start parse_rel_defs parse_rel_const_defs parse_structure
 %type <string array> elem_tuple
-%type <string * int option * string array list> rel_expr
+%type <(string * int option * string array list, 
+        string * string) Aux.choice> rel_or_const_expr
 %type <(string * string list * Formula.formula) list> parse_rel_defs
 %type <(string * string list * Formula.formula) list * 
   (string * (int, string) Aux.choice) list> parse_rel_const_defs
@@ -35,15 +36,17 @@
    we only allow semicolons below to avoid confusion with
    constructing tuples. */
 
-rel_expr:
+rel_or_const_expr:
   | rel = ID
     tup = delimited (OPEN, separated_list (COMMA, ID), CLOSE)
-    { rel, None, [Array.of_list tup] }
+    { Aux.Left (rel, None, [Array.of_list tup]) }
   | rel = ID
     arity = option (preceded (COLON, INT))
     tups = delimited (OPENCUR, separated_list (SEMICOLON, elem_tuple),
                       CLOSECUR)
-    { rel, arity, tups }
+    { Aux.Left (rel, arity, tups) }
+  | DOT c = ID EQ r = ID  { Aux.Right ("." ^ c, r) }
+  | DOT c = ID EQ r = INT { Aux.Right ("." ^ c, string_of_int r) }
   | rel = ID error
     { Lexer.report_parsing_error $startpos $endpos
         ("Syntax error in graph of relation " ^ rel) }
@@ -62,7 +65,7 @@
   | OPENSQ
       elems = separated_list (COMMA, ID)
     MID
-    rels = separated_list (SEMICOLON, rel_expr)
+    rels = separated_list (SEMICOLON, rel_or_const_expr)
     MID
     funs = separated_list (SEMICOLON, fun_expr)
     CLOSESQ
@@ -71,12 +74,12 @@
   | OPENSQ
       elems = separated_list (COMMA, ID)
     MID
-    rels = separated_list (SEMICOLON, rel_expr)
+    rels = separated_list (SEMICOLON, rel_or_const_expr)
     MID MINUS CLOSESQ
     { fun struc -> create_from_lists_position ~struc elems rels }
   | OPENSQ n = INT MINUS k = INT
     MID
-    rels = separated_list (SEMICOLON, rel_expr)
+    rels = separated_list (SEMICOLON, rel_or_const_expr)
     MID
     funs = separated_list (SEMICOLON, fun_expr)
     CLOSESQ
@@ -85,7 +88,7 @@
       fun struc -> create_from_lists ~struc elems rels funs }
   | OPENSQ n = INT MINUS k = INT
     MID
-    rels = separated_list (SEMICOLON, rel_expr)
+    rels = separated_list (SEMICOLON, rel_or_const_expr)
     MID MINUS CLOSESQ
     { let elems = 
 	List.map (fun i -> "e" ^ (string_of_int i)) (Aux.range ~from:n (k+1)) in
@@ -94,7 +97,7 @@
   | OPENSQ
       separated_list (COMMA, ID)
     MID
-    separated_list (SEMICOLON, rel_expr)
+    separated_list (SEMICOLON, rel_or_const_expr)
     MID err = error
     { ignore err;
       Lexer.report_parsing_error $startpos(err) $endpos(err)