X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2Focaml%2Fmathql%2FmQueryTParser.mly;h=1ebadd29a53ea356fe8f283a4a3d26c18e35b208;hb=89262281b6e83bd2321150f81f1a0583645eb0c8;hp=7bc2f97bf2162389d5433e8942b6333c5b9d2e1a;hpb=856dc227c9781439a31d03f5b68d32a41db63ab9;p=helm.git diff --git a/helm/ocaml/mathql/mQueryTParser.mly b/helm/ocaml/mathql/mQueryTParser.mly index 7bc2f97bf..1ebadd29a 100644 --- a/helm/ocaml/mathql/mQueryTParser.mly +++ b/helm/ocaml/mathql/mQueryTParser.mly @@ -44,12 +44,12 @@ | s1 :: tl1, s2 :: tl2 -> s1 :: join tl1 tl2 in let rec an_val = function - | M.Const _ -> [] - | M.VVar _ -> [] - | M.Record (rv, _) -> [rv] - | M.Fun (_, x) -> an_val x - | M.Attribute (_, _, _, x) -> an_val x - | M.RefOf x -> an_set x + | M.Const _ -> [] + | M.VVar _ -> [] + | M.Record (rv, _) -> [rv] + | M.Fun (_, x) -> an_val x + | M.Property (_, _, _, x) -> an_val x + | M.RefOf x -> an_set x and an_boole = function | M.False -> [] | M.True -> [] @@ -74,15 +74,17 @@ | M.Select (_, x, y) -> join (an_set x) (an_boole y) in an_boole x + + let path_of_vvar v = (v, []) %} %token ID STR - %token SL IS LC RC CM SC LP RP AT PC DL FS DQ EOF - %token AND ATTR ATTRIB BE DIFF EQ EX FALSE FUN IN INTER INV LET MEET NOT - %token OR PAT REF REFOF REL SELECT SUB SUPER TRUE UNION WHERE + %token SL IS LC RC CM SC LP RP AT PC DL FS DQ GETS EOF + %token AND ATTR BE DIFF EQ EX FALSE FUN IN INTER INV LET MEET NOT OR PAT + %token PROP REF REFOF REL SELECT SUB SUPER TRUE UNION WHERE %left DIFF WHERE REFOF %left OR UNION %left AND INTER - %nonassoc REL + %nonassoc REL %nonassoc NOT EX IN ATTR %start qstr query result @@ -124,16 +126,23 @@ | SUPER { MathQL.RefineSuper } | { MathQL.RefineExact } ; + assign: + | vvar GETS path { (path_of_vvar $1, $3) } + ; + assigns: + | assign CM assigns { $1 :: $3 } + | assign { [$1] } + ; val_exp: - | STR { MathQL.Const [$1] } - | FUN STR val_exp { MathQL.Fun ($2, $3) } - | ATTRIB inv ref path val_exp { MathQL.Attribute ($2, $3, $4, $5) } - | rvar FS path { MathQL.Record ($1, $3) } - | vvar { MathQL.VVar $1 } - | LC strs RC { MathQL.Const $2 } - | LC RC { MathQL.Const [] } - | REFOF set_exp { MathQL.RefOf $2 } - | LP val_exp RP { $2 } + | STR { MathQL.Const [$1] } + | FUN STR val_exp { MathQL.Fun ($2, $3) } + | PROP inv ref path val_exp { MathQL.Property ($2, $3, $4, $5) } + | rvar FS vvar { MathQL.Record ($1, path_of_vvar $3) } + | vvar { MathQL.VVar $1 } + | LC strs RC { MathQL.Const $2 } + | LC RC { MathQL.Const [] } + | REFOF set_exp { MathQL.RefOf $2 } + | LP val_exp RP { $2 } ; boole_exp: | TRUE { MathQL.True } @@ -152,8 +161,8 @@ | PAT val_exp { MathQL.Pattern $2 } | LP set_exp RP { $2 } | SELECT rvar IN set_exp WHERE boole_exp { MathQL.Select ($2, $4, $6) } - | REL inv ref path set_exp ATTR strs { MathQL.Relation ($2, $3, $4, $5, $7) } - | REL inv ref path set_exp { MathQL.Relation ($2, $3, $4, $5, []) } + | REL inv ref path val_exp ATTR assigns { MathQL.Relation ($2, $3, $4, MathQL.Ref $5, $7) } + | REL inv ref path val_exp { MathQL.Relation ($2, $3, $4, MathQL.Ref $5, []) } | svar { MathQL.SVar $1 } | rvar { MathQL.RVar $1 } | set_exp UNION set_exp { MathQL.Union ($1, $3) } @@ -166,8 +175,8 @@ | set_exp EOF { $1 } ; attr: - | path IS strs { ($1, $3) } - | path { ($1, []) } + | vvar IS strs { (path_of_vvar $1, $3) } + | vvar { (path_of_vvar $1, []) } ; attrs: | attr SC attrs { $1 :: $3 }