packages feed

HXQ 0.17.2 → 0.18.0

raw patch · 26 files changed

+5276/−3281 lines, 26 filesdep +HTTPPVP ok

version bump matches the API change (PVP)

Dependencies added: HTTP

API changes (from Hackage documentation)

- Text.XML.HXQ.XQuery: type AttList = [(Name, String)]
- Text.XML.HXQ.XQuery: type Name = String
+ Text.XML.HXQ.XQuery: Column :: String -> Path -> Int -> Table
+ Text.XML.HXQ.XQuery: QName :: Prefix -> URI -> LocalName -> QName
+ Text.XML.HXQ.XQuery: TAny :: Type
+ Text.XML.HXQ.XQuery: TAttribute :: String -> Type -> Type
+ Text.XML.HXQ.XQuery: TBase :: QName -> Type
+ Text.XML.HXQ.XQuery: TChoice :: Type -> Type -> Type
+ Text.XML.HXQ.XQuery: TElement :: String -> Type -> Type
+ Text.XML.HXQ.XQuery: TEmpty :: Type
+ Text.XML.HXQ.XQuery: TInterleaving :: Type -> Type -> Type
+ Text.XML.HXQ.XQuery: TItem :: String -> Type
+ Text.XML.HXQ.XQuery: TNamed :: QName -> Type
+ Text.XML.HXQ.XQuery: TQualified :: Type -> TQualifier -> Type
+ Text.XML.HXQ.XQuery: TSequence :: Type -> Type -> Type
+ Text.XML.HXQ.XQuery: TVariable :: TVar -> Type
+ Text.XML.HXQ.XQuery: Table :: String -> Path -> Bool -> [Table] -> Table
+ Text.XML.HXQ.XQuery: data QName
+ Text.XML.HXQ.XQuery: data Table
+ Text.XML.HXQ.XQuery: data Type
+ Text.XML.HXQ.XQuery: localName :: QName -> LocalName
+ Text.XML.HXQ.XQuery: prefix :: QName -> Prefix
+ Text.XML.HXQ.XQuery: type Attributes = [(QName, String)]
+ Text.XML.HXQ.XQuery: type LocalName = String
+ Text.XML.HXQ.XQuery: type Path = [String]
+ Text.XML.HXQ.XQuery: type Prefix = String
+ Text.XML.HXQ.XQuery: type TQualifier = Char
+ Text.XML.HXQ.XQuery: type TVar = Int
+ Text.XML.HXQ.XQuery: type URI = String
+ Text.XML.HXQ.XQuery: uri :: QName -> URI
+ Text.XML.HXQ.XQuery: validateFile :: FilePath -> FilePath -> IO Bool
- Text.XML.HXQ.XQuery: XAttr :: !Name -> !String -> XTree
+ Text.XML.HXQ.XQuery: XAttr :: !QName -> !String -> XTree
- Text.XML.HXQ.XQuery: XElem :: !Name -> !AttList -> !Int -> XTree -> [XTree] -> XTree
+ Text.XML.HXQ.XQuery: XElem :: !QName -> !Attributes -> !Int -> XTree -> [XTree] -> XTree
- Text.XML.HXQ.XQuery: XPI :: Name -> String -> XTree
+ Text.XML.HXQ.XQuery: XPI :: String -> String -> XTree
- Text.XML.HXQ.XQuery: XType :: Ast -> XTree
+ Text.XML.HXQ.XQuery: XType :: Type -> XTree

Files

HXQ.cabal view
@@ -1,6 +1,6 @@ Cabal-Version:       >= 1.2 Name:                HXQ-Version:             0.17.2+Version:             0.18.0 Synopsis:            A Compiler from XQuery to Haskell Description:                  HXQ is a fast and space-efficient compiler from XQuery (the standard@@ -42,6 +42,8 @@   release.html   hxq-manual.pdf   data/cs.xml+  data/department.xsd+  data/dblp.xsd   data/a.xml   data/c.xml   data/q1.xq@@ -69,11 +71,11 @@ Library   Exposed-Modules:     Text.XML.HXQ.XQuery   Other-Modules:       HXML, DeepSeq, ETree, Misc, Tree, AssocList, PrintXML, XML, TreeBuild, DTD, XMLScanner, LLParsing, XMLParse,-                       Text.XML.HXQ.XTree, Text.XML.HXQ.Types,+                       Text.XML.HXQ.XTree, Text.XML.HXQ.Types, Text.XML.HXQ.TypeInference,                        Text.XML.HXQ.Functions, Text.XML.HXQ.Compiler, Text.XML.HXQ.Interpreter,                        Text.XML.HXQ.Optimizer, Text.XML.HXQ.OptionalDB, Text.XML.HXQ.Parser   hs-source-dirs:      . src src/hxml-0.2-  Build-Depends:       base >= 3 && < 5, haskell98, array, regex-base, regex-compat, template-haskell, mtl, haskeline+  Build-Depends:       base >= 3 && < 5, haskell98, array, regex-base, regex-compat, template-haskell, mtl, haskeline, HTTP   ghc-options:         -funfolding-use-threshold=16   if flag(mysql)      Other-Modules:    Text.XML.HXQ.DB, Connect
LICENSE view
@@ -1,5 +1,4 @@-Copyright (c) 2008 by Leonidas Fegaras, the University of Texas at Arlington. All rights reserved.+Copyright (c) 2008, 2009 by Leonidas Fegaras, the University of Texas at Arlington. All rights reserved. This material is provided as is, with absolutely no warranty expressed or implied. Any use is at your own risk. Permission is hereby granted to use or copy this program for any purpose, provided the above notices are retained on all copies.-
Main.hs view
@@ -16,11 +16,12 @@ import qualified Control.Exception as C import Text.XML.HXQ.XQuery import Text.XML.HXQ.Functions+import Text.XML.HXQ.XTree import Text.XML.HXQ.Types import Text.XML.HXQ.Interpreter(evalInput,xqueryE,xfileDB)  -version = "0.17.2"+version = "0.18.0"   parseEnv :: [String] -> [(String,String)]@@ -30,6 +31,7 @@ parseEnv ("-o":file:xs) = ("o",file):(parseEnv xs) parseEnv ("-db":file:xs) = ("db",file):(parseEnv xs) parseEnv ("-v":xs) = ("v",""):(parseEnv xs)+parseEnv ("-tp":xs) = ("tp",""):(parseEnv xs) parseEnv ("-t":xs) = ("t",""):(parseEnv xs) parseEnv ("-p":query:file:xs) = ("p","doc('"++file++"')"++query):(parseEnv xs) parseEnv (('-':x):_) = error ("Unrecognized option -"++x++". Use -help.")@@ -43,6 +45,7 @@           let env = parseEnv senv               verbose = case lookup "v" env of Nothing -> False; _ -> True               timing = case lookup "t" env of Nothing -> False; _ -> True+              typecheck = case lookup "tp" env of Nothing -> False; _ -> True               putTime t = if timing then putStrLn $ "Evaluation time: "++show (div t (10^9))++" milliseconds" else return ()           case lookup "help" env of             Just _ -> do putStrLn ("HXQ: XQuery Interpreter version "++version)@@ -55,10 +58,11 @@                          putStrLn "   -p XPath-query xml-file   interpret the XPath query against the xml-file"                          putStrLn "   -v                        print verbose information (AST and optimized plan)"                          putStrLn "   -t                        print timing information"+                         putStrLn "   -tp                       print typing information"                          putStrLn "Without an xquery-file, it reads and evaluates the input using the HXQ interpreter."                          putStrLn "   The input may be an XQuery or a 'declare variable' or a 'declare function'."                          putStrLn "   To write an XQuery in multiple lines, wrap it in {}."-                         putStrLn $ "Functions (name/arity):  " ++ (unwords $ sort $ map (\(f,c,_,_) -> f++"/"++show c) systemFunctions)+                         putStrLn $ "Functions (name/arity):  " ++ (unwords $ sort $ map (\(f,c,_,_,_) -> f++"/"++show c) systemFunctions)                          putStrLn $ "Path Steps:  " ++ (unwords $ map fst pathFunctions)                          putStrLn $ "Build-in Types:  xs:anyAtomicType " ++ (unwords $ map fst buildInTypes)             _ -> case lookup "c" env of@@ -77,20 +81,20 @@                                          Just filepath -> do db <- connect filepath                                                              t1 <- getCPUTime                                                              query <- readFile file-                                                             (result,_,_,_) <- xqueryE query [] [] [] db verbose+                                                             (result,_,_,_,_) <- xqueryE query [] [] initialNS [] db verbose typecheck                                                              putXSeq result                                                              t2 <- getCPUTime                                                              putTime (t2-t1)                                                              commit db                                          _ -> do query <- readFile file                                                  t1 <- getCPUTime-                                                 (result,_,_,_) <- xqueryE query [] [] [] noDBerror verbose+                                                 (result,_,_,_,_) <- xqueryE query [] [] initialNS [] noDBerror verbose typecheck                                                  putXSeq result                                                  t2 <- getCPUTime                                                  putTime (t2-t1)                           _ -> case lookup "p" env of                                  Just query -> do t1 <- getCPUTime-                                                  (result,_,_,_) <- xqueryE query [] [] [] noDBerror verbose+                                                  (result,_,_,_,_) <- xqueryE query [] [] initialNS [] noDBerror verbose typecheck                                                   putXSeq result                                                   t2 <- getCPUTime                                                   putTime (t2-t1)@@ -98,22 +102,24 @@                                          case lookup "db" env of                                            Just filepath                                                -> do db <- connect filepath-                                                     evalInput (\s es fs vs -> C.catch-                                                                          (do t1 <- getCPUTime-                                                                              (result,nes,nfs,nvs) <- xqueryE s es fs vs db verbose-                                                                              putXSeq result-                                                                              t2 <- getCPUTime-                                                                              putTime (t2-t1)-                                                                              commit db-                                                                              return (nes,nfs,nvs))-                                                                          (\e -> do putStrLn (show (e::C.SomeException)); return (es,fs,vs))) [] [] [] "> " []+                                                     evalInput (\s es fs ns vs -> C.catch+                                                                    (do t1 <- getCPUTime+                                                                        (result,nes,nfs,nns,nvs) <- xqueryE s es fs ns vs db verbose typecheck+                                                                        putXSeq result+                                                                        t2 <- getCPUTime+                                                                        putTime (t2-t1)+                                                                        commit db+                                                                        return (nes,nfs,nns,nvs))+                                                                      (\e -> do putStrLn (show (e::C.SomeException))+                                                                                return (es,fs,ns,vs))) [] [] initialNS [] "> " []                                                      return ()-                                           _ -> do evalInput (\s es fs vs -> C.catch+                                           _ -> do evalInput (\s es fs ns vs -> C.catch                                                                       (do t1 <- getCPUTime-                                                                          (result,nes,nfs,nvs) <- xqueryE s es fs vs noDBerror verbose+                                                                          (result,nes,nfs,nns,nvs) <- xqueryE s es fs ns vs noDBerror verbose typecheck                                                                           putXSeq result                                                                           t2 <- getCPUTime                                                                           putTime (t2-t1)-                                                                          return (nes,nfs,nvs))-                                                                      (\e -> do putStrLn (show (e::C.SomeException)); return (es,fs,vs))) [] [] [] "> " []+                                                                          return (nes,nfs,nns,nvs))+                                                                      (\e -> do putStrLn (show (e::C.SomeException))+                                                                                return (es,fs,ns,vs))) [] [] initialNS [] "> " []                                                    return ()
Makefile view
@@ -13,7 +13,7 @@ endif  parser = src/Text/XML/HXQ/Parser.hs-ghc = ghc-6.8.3 -O2 -funfolding-use-threshold=16 ${args}+ghc = ghc -O2 -funfolding-use-threshold=16 ${args} src = * src/hxml-0.2/* src/noDB/Text/XML/HXQ/* src/withDB/Text/XML/HXQ/* \       src/* src/Text/XML/HXQ/* src/mysql/* src/sqlite/* @@ -47,6 +47,11 @@ 	$(ghc) --make TestDB2.hs -o a.out 	./a.out +# validate dblp.xml against dblp.xsd+validate: $(parser) Validate.hs+	$(ghc) --make Validate.hs -o a.out+	time ./a.out +RTS -H2m -s+ xmark:  $(parser) TestXMark.hs 	$(ghc) --make TestXMark.hs -o a.out 	time ./a.out +RTS -H2m -s@@ -58,7 +63,7 @@  # run in the ghci interpreter and load HXQ ghci:   $(parser)-	ghci -XTemplateHaskell ${args} Main.hs+	ghci -XTemplateHaskell -XQuasiQuotes ${args} Main.hs  # run multiple tests test:   $(parser) data/test.xq@@ -75,7 +80,7 @@  # create the cabal distribution cabal:	$(parser)-	runhaskell Setup.lhs configure+	runhaskell Setup.lhs configure --user 	runhaskell Setup.lhs build 	runhaskell Setup.lhs haddock 	runhaskell Setup.lhs sdist
Test2.hs view
@@ -14,7 +14,6 @@  import Text.XML.HXQ.XQuery - main = do a <- $(xq "<result>{                                                                \                  \       for $x at $i in doc('data/dblp.xml')//inproceedings                  \                  \       where $x/author = 'Leonidas Fegaras'                                 \
XQueryParser.y view
@@ -94,6 +94,7 @@ 	'insert'        { INSERT } 	'delete'	{ DELETE } 	'replace'	{ REPLACE }+        'type'	        { TYPE } 	'into'		{ INTO } 	'from'		{ FROM} 	'with'		{ WITH }@@ -105,6 +106,10 @@         'case'          { CASE }         'default'       { DEFAULT }         'typeswitch'    { TYPESWITCH }+        'import'        { IMPORT }+        'namespace'     { NAMESPACE }+        'schema'        { SCHEMA }+        'validate'      { VALIDATE } 	'Variable' 	{ Variable $$ } 	'XMLtext' 	{ XMLtext $$ } 	'Integer' 	{ TInteger $$ }@@ -139,36 +144,58 @@  def            :: { Ast } def             :   expr                                { $1 }-                |   'declare' 'variable' var ':=' expr  { Ast "variable" [$3,$5] }+                |   'declare' 'variable' var ':=' expr  { Ast "variable" [$3,Avar "any",$5] }                 |   'declare' 'variable' var 'as' type-                      ':=' expr                         { Ast "variable" [$3,$7] }+                      ':=' expr                         { Ast "variable" [$3,$5,$7] }                 |   'declare' 'function' qname 		    '(' opt_params ')' '{' expr '}'     { if (null $5)                                                           then parseError [TError ("Nullary functions are not supported: "++$3)]-                                                          else Ast "function" ([Avar $3,$8]++$5) }+                                                          else Ast "function" ([Avar $3,$8,Avar "any"]++mkPairs $5) }                 |   'declare' 'function' qname                       '(' opt_params ')' 'as' type 		      '{' expr '}'                      { if (null $5)                                                           then parseError [TError ("Nullary functions are not supported: "++$3)]-                                                          else Ast "function" ([Avar $3,$10]++$5) }+                                                          else Ast "function" ([Avar $3,$10,$8]++mkPairs $5) }                 |   'declare' 'view' qname                       '(' opt_params ')' '{' expr '}'   { if (null $5)                                                           then parseError [TError ("Nullary views are not supported: "++$3)]-                                                          else Ast "view" ([Avar $3,$8]++$5) }+                                                          else Ast "view" ([Avar $3,$8]++map fst $5) }+                |   'function' qname '(' opt_params ')'+                    'as' type                           { Ast "signature" ([Avar $2,$7]++map snd $4) }+                |   'declare' 'element' qname+                    'of' 'type' type                    { Ast "element" [Avar $3,$6] }+                |   'declare' 'type' qname '=' type     { Ast "type" [Avar $3,$5] }+                |   'import' 'schema' prefix+                             string opt_slist           { Ast "import" ($3:$4:$5) }+                |   'declare' prefix string             { Ast "schema" [$2,$3] } +prefix        ::  { Ast }+prefix         :    'namespace' 'QName' '='             { Avar $2 }+               |    'default' 'element' 'namespace'     { Avar "default-element" }+               |    'default' 'function' 'namespace'    { Avar "default-function" }+               |                                        { Avar "" }++opt_slist     ::  { [ Ast ] }+opt_slist      :    'at' string slist                   { $2:$3 }+               |                                        { [] }++slist         ::  { [ Ast ] }+slist          :    ',' string slist                    { $3++[$2] }+               |                                        { [] }+ qname          :: { String } qname          :    'QName'                             { $1 }                |    'QName' ':' 'QName'                 { $1++":"++$3 } -opt_params     :: { [ Ast ] }+opt_params     :: { [ (Ast,Ast) ] } opt_params      : params                                { $1 }                 |                                       { [] } -params         :: { [ Ast ] }-params          :   var                                 { [$1] }-                |   var 'as' type                       { [$1] }-                |   params ',' var                      { $1++[$3] }-                |   params ',' var 'as' type            { $1++[$3] }+params         :: { [ (Ast,Ast) ] }+params          :   var                                 { [($1,Avar "any")] }+                |   var 'as' type                       { [($1,$3)] }+                |   params ',' var                      { $1++[($3,Avar "any")] }+                |   params ',' var 'as' type            { $1++[($3,$5)] }  type           ::  { Ast } type            :  qname               %prec 'case'     { Avar $1 }@@ -247,6 +274,7 @@ 		|   string				{ $1 } 		|   'Integer'				{ Aint $1 } 		|   'Double'				{ Afloat $1 }+                |   'validate' '{' expr '}'             { Ast "validate" [$3] } 		|   'insert' expr 'into' expr		{ Ast "insert" [$2,Ast "destination" [$4]] } 		|   'delete' 'from' expr		{ Ast "delete" [$3] } 		|   'replace' expr 'with' expr		{ Ast "replace" [$2,$4] }@@ -462,6 +490,9 @@ concatAll _ = call "empty" []  +mkPairs = map (\(x,y) -> Ast "pair" [x,y])++ path_steps = ["child", "descendant", "attribute", "self", "descendant-or-self", "following-sibling", "following",               "attribute-descendant", "parent", "ancestor", "preceding-sibling", "preceding", "ancestor-or-self" ] @@ -474,8 +505,8 @@   | ASSIGN | WHERE | ORDER | BY | ASCENDING | DESCENDING | ELEMENT   | ATTRIBUTE | STAG | ETAG | SATISFIES | ATSIGN | SLASH | DECLARE | SEMI | COLON   | FUNCTION | VARIABLE | VIEW | AT | DOT | DOTS | TokenEOF | PRE | POST | IS-  | INSERT | INTO | DELETE | FROM | REPLACE | WITH | INSTANCE | OF-  | CAST | CASTABLE | CASE | DEFAULT | TYPESWITCH+  | INSERT | INTO | DELETE | FROM | REPLACE | TYPE | WITH | INSTANCE | OF+  | CAST | CASTABLE | CASE | DEFAULT | TYPESWITCH | IMPORT | NAMESPACE | SCHEMA | VALIDATE   | QName String | Variable String | XMLtext String | TInteger Int   | TFloat Double | TString String | TError String     deriving Eq@@ -518,8 +549,9 @@              (ATTRIBUTE,"attribute"),(STAG,"</"),(ETAG,"/>"),(SATISFIES,"satisfies"),(ATSIGN,"@"),              (SLASH,"/"),(DECLARE,"declare"),(FUNCTION,"function"),(VARIABLE,"variable"),(VIEW,"view"),   	     (INSERT,"insert"),(INTO,"into"),(DELETE,"delete"),(FROM,"from"),(REPLACE,"replace"),(WITH,"with"),-             (AT,"at"),(DOTS,".."),(DOT,"."),(SEMI,";"),(COLON,":"),(INSTANCE,"instance"),(OF,"of"),-             (CAST,"cast"),(CASTABLE,"castable"),(CASE,"case"),(DEFAULT,"default"),(TYPESWITCH,"typeswitch")]+             (TYPE,"type"),(AT,"at"),(DOTS,".."),(DOT,"."),(SEMI,";"),(COLON,":"),(INSTANCE,"instance"),(OF,"of"),+             (CAST,"cast"),(CASTABLE,"castable"),(CASE,"case"),(DEFAULT,"default"),(TYPESWITCH,"typeswitch"),+             (VALIDATE,"validate")]   parseError tk = error (case tk of@@ -542,6 +574,7 @@ xml ('{':cs) text n = (xmlText text)++(LSB : lexer cs ('{':n)) xml ('<':'/':cs) text n = (xmlText text)++(STAG : lexer cs ('<':'/':n)) xml ('<':'!':'-':cs) text n = xmlComment cs (text++"<!-") n+xml ('<':'?':cs) text n = xmlComment cs (text++"<?") n xml ('<':cs) text n = (xmlText text)++(TLT : lexer cs ('<':n)) xml ('(':':':cs) text n = xqComment cs text n xml (c:cs) text n = xml cs (text++[c]) n@@ -555,7 +588,8 @@   xmlComment :: String -> String -> String -> [Token]-xmlComment ('-':'>':cs) text n = xml cs (text++"->") n+xmlComment ('-':'!':'>':cs) text n = xml cs (text++"-!>") n+xmlComment ('?':'>':cs) text n = xml cs (text++"?>") n xmlComment (c:cs) text n = xmlComment cs (text++[c]) n xmlComment [] text _ = xmlText text @@ -596,6 +630,7 @@                          _ -> [ TError "Unexpected token: '/>'" ] lexer ('(':':':cs) n = lexComment cs n lexer ('<':'!':'-':cs) n = lexXmlComment cs "<!-" n+lexer ('<':'?':cs) n = lexXmlComment cs "<?" n lexer ('.':'.':cs) n = DOTS : lexer cs n lexer ('.':cs) n = DOT : lexer cs n lexer ('!':'=':cs) n = TNE : lexer cs n@@ -677,7 +712,8 @@   lexXmlComment :: String -> String -> String -> [Token]-lexXmlComment ('-':'>':cs) text n = (xmlText (text++"->"))++(lexer cs n)+lexXmlComment ('-':'!':'>':cs) text n = (xmlText (text++"-!>"))++(lexer cs n)+lexXmlComment ('?':'>':cs) text n = (xmlText (text++"?>"))++(lexer cs n) lexXmlComment (c:cs) text n = lexXmlComment cs (text++[c]) n lexXmlComment [] text _ = xmlText text @@ -717,6 +753,7 @@           "declare" -> DECLARE           "function" -> FUNCTION           "variable" -> VARIABLE+          "namespace" -> NAMESPACE           "view" -> VIEW           "at" -> AT           "eq" -> SEQ@@ -731,6 +768,7 @@ 	  "delete" -> DELETE 	  "from" -> FROM 	  "replace" -> REPLACE+	  "type" -> TYPE 	  "with" -> WITH           "instance" -> INSTANCE           "of" -> OF@@ -739,6 +777,9 @@           "case" -> CASE           "default" -> DEFAULT           "typeswitch" -> TYPESWITCH+          "schema" -> SCHEMA+          "import" -> IMPORT+          "validate" -> VALIDATE           var -> QName var     in case token of          QName v1 -> case rest of
data/cs.xml view
@@ -93,16 +93,16 @@       <lastname>Galanis</lastname>       <firstname>Leonidas</firstname>     </name>-    <gpa>3.5</gpa>     <phone>2625596</phone>     <email>lgalanis@cs.wisc.edu</email>     <address>       <city>Madison</city>-      <zip>53705</zip>           <state>WI</state>   +      <zip>53705</zip>         </address>     <office>1343</office>     <url>www.cs.wisc.edu/~lgalanis</url>+    <gpa>3.5</gpa>   </gradstudent>      <gradstudent>@@ -291,7 +291,6 @@   </gradstudent>    <gradstudent>-    <gpa>3.5</gpa>     <name>       <lastname>Finton</lastname>       <firstname>David</firstname>@@ -305,6 +304,7 @@     </address>     <office>5384</office>     <url>www.cs.wisc.edu/~finton</url>+    <gpa>3.5</gpa>   </gradstudent>     <gradstudent>
data/dblp.xq view
@@ -2,5 +2,7 @@      for $x at $i in doc('data/dblp.xml')//inproceedings      where $x/author = 'Leonidas Fegaras'      order by $x/year descending-     return <paper>{$i}) {$x/booktitle/text()}: {$x/title/text()}</paper>+     return <paper>{ $i, ') ', $x/booktitle/text(),+                     ': ', $x/title/text()+            }</paper>   }</result>
+ data/dblp.xsd view
@@ -0,0 +1,435 @@+<?xml version="1.0" encoding="UTF-8" ?>+ +<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">++  <xs:element name="dblp">+    <xs:complexType>+      <xs:choice minOccurs="0" maxOccurs="unbounded">+        <xs:element ref="article" />+        <xs:element ref="inproceedings" />+        <xs:element ref="proceedings" />+        <xs:element ref="book" />+        <xs:element ref="incollection" />+        <xs:element ref="phdthesis" />+        <xs:element ref="mastersthesis" />+        <xs:element ref="www" />+      </xs:choice>+    </xs:complexType>+  </xs:element>++  <xs:element name="address">+    <xs:complexType mixed="true" />+  </xs:element>+ +  <xs:element name="article">+    <xs:complexType>+      <xs:choice minOccurs="0" maxOccurs="unbounded">+        <xs:element ref="author" />+        <xs:element ref="editor" />+        <xs:element ref="title" />+        <xs:element ref="booktitle" />+        <xs:element ref="pages" />+        <xs:element ref="year" />+        <xs:element ref="address" />+        <xs:element ref="journal" />+        <xs:element ref="volume" />+        <xs:element ref="number" />+        <xs:element ref="month" />+        <xs:element ref="url" />+        <xs:element ref="ee" />+        <xs:element ref="cdrom" />+        <xs:element ref="cite" />+        <xs:element ref="publisher" />+        <xs:element ref="note" />+        <xs:element ref="crossref" />+        <xs:element ref="isbn" />+        <xs:element ref="series" />+        <xs:element ref="school" />+        <xs:element ref="chapter" />+      </xs:choice>+      <xs:attribute name="key" type="xs:string" use="required" />+      <xs:attribute name="rating" type="xs:string" use="optional" />+      <xs:attribute name="mdate" type="xs:string" use="optional" />+      <xs:attribute name="reviewid" type="xs:string" use="optional" />+    </xs:complexType>+  </xs:element>+ +  <xs:element name="author">+    <xs:complexType mixed="true" />+  </xs:element>+ +  <xs:element name="book">+    <xs:complexType>+      <xs:choice minOccurs="0" maxOccurs="unbounded">+        <xs:element ref="author" />+        <xs:element ref="editor" />+        <xs:element ref="title" />+        <xs:element ref="booktitle" />+        <xs:element ref="pages" />+        <xs:element ref="year" />+        <xs:element ref="address" />+        <xs:element ref="journal" />+        <xs:element ref="volume" />+        <xs:element ref="number" />+        <xs:element ref="month" />+        <xs:element ref="url" />+        <xs:element ref="ee" />+        <xs:element ref="cdrom" />+        <xs:element ref="cite" />+        <xs:element ref="publisher" />+        <xs:element ref="note" />+        <xs:element ref="crossref" />+        <xs:element ref="isbn" />+        <xs:element ref="series" />+        <xs:element ref="school" />+        <xs:element ref="chapter" />+      </xs:choice>+      <xs:attribute name="key" type="xs:string" use="required" />+      <xs:attribute name="mdate" type="xs:string" use="optional" />+    </xs:complexType>+  </xs:element>+ +  <xs:element name="booktitle">+    <xs:complexType mixed="true" />+  </xs:element>+ +  <xs:element name="cdrom">+    <xs:complexType mixed="true" />+  </xs:element>+ +  <xs:element name="chapter">+    <xs:complexType mixed="true" />+  </xs:element>+ +  <xs:element name="cite">+    <xs:complexType mixed="true">+      <xs:attribute name="label" type="xs:string" use="optional" />+    </xs:complexType>+  </xs:element>+ +  <xs:element name="crossref">+    <xs:complexType mixed="true" />+  </xs:element>+ +  <xs:element name="editor">+    <xs:complexType mixed="true" />+  </xs:element>+ +  <xs:element name="ee">+    <xs:complexType mixed="true" />+  </xs:element>+ +  <xs:element name="i">+    <xs:complexType mixed="true">+      <xs:choice minOccurs="0" maxOccurs="unbounded">+        <xs:element name="i1" type="xs:string" />+        <xs:element name="i2" type="xs:string" />+        <xs:element name="i3" type="xs:string" />+        <xs:element name="i4" type="xs:string" />+        <xs:element name="i5" type="xs:string" />+      </xs:choice>+    </xs:complexType>+  </xs:element>+ +  <xs:element name="incollection">+    <xs:complexType>+      <xs:choice minOccurs="0" maxOccurs="unbounded">+        <xs:element ref="author" />+        <xs:element ref="editor" />+        <xs:element ref="title" />+        <xs:element ref="booktitle" />+        <xs:element ref="pages" />+        <xs:element ref="year" />+        <xs:element ref="address" />+        <xs:element ref="journal" />+        <xs:element ref="volume" />+        <xs:element ref="number" />+        <xs:element ref="month" />+        <xs:element ref="url" />+        <xs:element ref="ee" />+        <xs:element ref="cdrom" />+        <xs:element ref="cite" />+        <xs:element ref="publisher" />+        <xs:element ref="note" />+        <xs:element ref="crossref" />+        <xs:element ref="isbn" />+        <xs:element ref="series" />+        <xs:element ref="school" />+        <xs:element ref="chapter" />+      </xs:choice>+      <xs:attribute name="key" type="xs:string" use="required" />+      <xs:attribute name="mdate" type="xs:string" use="optional" />+    </xs:complexType>+  </xs:element>+ +  <xs:element name="inproceedings">+    <xs:complexType>+      <xs:choice minOccurs="0" maxOccurs="unbounded">+        <xs:element ref="author" />+        <xs:element ref="editor" />+        <xs:element ref="title" />+        <xs:element ref="booktitle" />+        <xs:element ref="pages" />+        <xs:element ref="year" />+        <xs:element ref="address" />+        <xs:element ref="journal" />+        <xs:element ref="volume" />+        <xs:element ref="number" />+        <xs:element ref="month" />+        <xs:element ref="url" />+        <xs:element ref="ee" />+        <xs:element ref="cdrom" />+        <xs:element ref="cite" />+        <xs:element ref="publisher" />+        <xs:element ref="note" />+        <xs:element ref="crossref" />+        <xs:element ref="isbn" />+        <xs:element ref="series" />+        <xs:element ref="school" />+        <xs:element ref="chapter" />+      </xs:choice>+      <xs:attribute name="key" type="xs:string" use="required" />+      <xs:attribute name="mdate" type="xs:string" use="optional" />+    </xs:complexType>+  </xs:element>+ +  <xs:element name="isbn">+    <xs:complexType mixed="true" />+  </xs:element>+ +  <xs:element name="journal">+    <xs:complexType mixed="true" />+  </xs:element>+ +  <xs:element name="layout">+    <xs:complexType>+      <xs:sequence>+        <xs:any namespace="http://www.w3.org/namespace/" />+      </xs:sequence>+      <xs:attribute name="logo" type="xs:string" use="optional" />+    </xs:complexType>+  </xs:element>+ +  <xs:element name="mastersthesis">+    <xs:complexType>+      <xs:choice minOccurs="0" maxOccurs="unbounded">+        <xs:element ref="author" />+        <xs:element ref="editor" />+        <xs:element ref="title" />+        <xs:element ref="booktitle" />+        <xs:element ref="pages" />+        <xs:element ref="year" />+        <xs:element ref="address" />+        <xs:element ref="journal" />+        <xs:element ref="volume" />+        <xs:element ref="number" />+        <xs:element ref="month" />+        <xs:element ref="url" />+        <xs:element ref="ee" />+        <xs:element ref="cdrom" />+        <xs:element ref="cite" />+        <xs:element ref="publisher" />+        <xs:element ref="note" />+        <xs:element ref="crossref" />+        <xs:element ref="isbn" />+        <xs:element ref="series" />+        <xs:element ref="school" />+        <xs:element ref="chapter" />+      </xs:choice>+      <xs:attribute name="key" type="xs:string" use="required" />+      <xs:attribute name="mdate" type="xs:string" use="optional" />+    </xs:complexType>+  </xs:element>+ +  <xs:element name="month">+    <xs:complexType mixed="true" />+  </xs:element>+ +  <xs:element name="note">+    <xs:complexType mixed="true" />+  </xs:element>+ +  <xs:element name="number">+    <xs:complexType mixed="true" />+  </xs:element>+ +  <xs:element name="pages">+    <xs:complexType mixed="true" />+  </xs:element>+ +  <xs:element name="phdthesis">+    <xs:complexType>+      <xs:choice minOccurs="0" maxOccurs="unbounded">+        <xs:element ref="author" />+        <xs:element ref="editor" />+        <xs:element ref="title" />+        <xs:element ref="booktitle" />+        <xs:element ref="pages" />+        <xs:element ref="year" />+        <xs:element ref="address" />+        <xs:element ref="journal" />+        <xs:element ref="volume" />+        <xs:element ref="number" />+        <xs:element ref="month" />+        <xs:element ref="url" />+        <xs:element ref="ee" />+        <xs:element ref="cdrom" />+        <xs:element ref="cite" />+        <xs:element ref="publisher" />+        <xs:element ref="note" />+        <xs:element ref="crossref" />+        <xs:element ref="isbn" />+        <xs:element ref="series" />+        <xs:element ref="school" />+        <xs:element ref="chapter" />+      </xs:choice>+      <xs:attribute name="key" type="xs:string" use="required" />+      <xs:attribute name="mdate" type="xs:string" use="optional" />+    </xs:complexType>+  </xs:element>+ +  <xs:element name="proceedings">+    <xs:complexType>+      <xs:choice minOccurs="0" maxOccurs="unbounded">+        <xs:element ref="author" />+        <xs:element ref="editor" />+        <xs:element ref="title" />+        <xs:element ref="booktitle" />+        <xs:element ref="pages" />+        <xs:element ref="year" />+        <xs:element ref="address" />+        <xs:element ref="journal" />+        <xs:element ref="volume" />+        <xs:element ref="number" />+        <xs:element ref="month" />+        <xs:element ref="url" />+        <xs:element ref="ee" />+        <xs:element ref="cdrom" />+        <xs:element ref="cite" />+        <xs:element ref="publisher" />+        <xs:element ref="note" />+        <xs:element ref="crossref" />+        <xs:element ref="isbn" />+        <xs:element ref="series" />+        <xs:element ref="school" />+        <xs:element ref="chapter" />+      </xs:choice>+      <xs:attribute name="key" type="xs:string" use="required" />+      <xs:attribute name="mdate" type="xs:string" use="optional" />+    </xs:complexType>+  </xs:element>+ +  <xs:element name="publisher">+    <xs:complexType mixed="true">+      <xs:attribute name="href" type="xs:string" use="optional" />+    </xs:complexType>+  </xs:element>+ +  <xs:element name="ref">+    <xs:complexType mixed="true">+      <xs:attribute name="href" type="xs:string" use="required" />+    </xs:complexType>+  </xs:element>+ +  <xs:element name="school">+    <xs:complexType mixed="true" />+  </xs:element>+ +  <xs:element name="series">+    <xs:complexType mixed="true">+      <xs:attribute name="href" type="xs:string" use="optional" />+    </xs:complexType>+  </xs:element>+ +  <xs:element name="sub">+    <xs:complexType mixed="true">+      <xs:choice minOccurs="0" maxOccurs="unbounded">+        <xs:element name="sub1" type="xs:string" />+        <xs:element name="sub2" type="xs:string" />+        <xs:element name="sub3" type="xs:string" />+        <xs:element name="sub4" type="xs:string" />+        <xs:element name="sub5" type="xs:string" />+      </xs:choice>+    </xs:complexType>+  </xs:element>+ +  <xs:element name="sup">+    <xs:complexType mixed="true">+      <xs:choice minOccurs="0" maxOccurs="unbounded">+        <xs:element name="sup1" type="xs:string" />+        <xs:element name="sup2" type="xs:string" />+        <xs:element name="sup3" type="xs:string" />+        <xs:element name="sup4" type="xs:string" />+        <xs:element name="sup5" type="xs:string" />+      </xs:choice>+    </xs:complexType>+  </xs:element>+ +  <xs:element name="title">+    <xs:complexType mixed="true">+      <xs:choice minOccurs="0" maxOccurs="unbounded">+        <xs:element ref="sub" />+        <xs:element ref="sup" />+        <xs:element ref="i" />+        <xs:element ref="tt" />+        <xs:element ref="ref" />+      </xs:choice>+    </xs:complexType>+  </xs:element>+ +  <xs:element name="tt">+    <xs:complexType mixed="true">+      <xs:choice minOccurs="0" maxOccurs="unbounded">+        <xs:element name="tt1" type="xs:string" />+        <xs:element name="tt2" type="xs:string" />+        <xs:element name="tt3" type="xs:string" />+        <xs:element name="tt4" type="xs:string" />+        <xs:element name="tt5" type="xs:string" />+      </xs:choice>+    </xs:complexType>+  </xs:element>+ +  <xs:element name="url">+    <xs:complexType mixed="true" />+  </xs:element>+ +  <xs:element name="volume">+    <xs:complexType mixed="true" />+  </xs:element>+ +  <xs:element name="www">+    <xs:complexType>+      <xs:choice minOccurs="0" maxOccurs="unbounded">+        <xs:element ref="author" />+        <xs:element ref="editor" />+        <xs:element ref="title" />+        <xs:element ref="booktitle" />+        <xs:element ref="pages" />+        <xs:element ref="year" />+        <xs:element ref="address" />+        <xs:element ref="journal" />+        <xs:element ref="volume" />+        <xs:element ref="number" />+        <xs:element ref="month" />+        <xs:element ref="url" />+        <xs:element ref="ee" />+        <xs:element ref="cdrom" />+        <xs:element ref="cite" />+        <xs:element ref="publisher" />+        <xs:element ref="note" />+        <xs:element ref="crossref" />+        <xs:element ref="isbn" />+        <xs:element ref="series" />+        <xs:element ref="school" />+        <xs:element ref="chapter" />+      </xs:choice>+      <xs:attribute name="key" type="xs:string" use="required" />+      <xs:attribute name="mdate" type="xs:string" use="optional" />+    </xs:complexType>+  </xs:element>+ +  <xs:element name="year">+    <xs:complexType mixed="true" />+  </xs:element>+ +</xs:schema>
+ data/department.xsd view
@@ -0,0 +1,75 @@+<?xml version="1.0"?>+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">++<xs:complexType name="address">+    <xs:sequence>+        <xs:element name="city" type="xs:string"/>+        <xs:element name="state" type="xs:string"/>+        <xs:element name="zip" type="xs:string"/>+    </xs:sequence>+</xs:complexType>++<xs:complexType name="person">+    <xs:sequence>+        <xs:element name="name">+            <xs:complexType>+                <xs:sequence>+                    <xs:element name="lastname" minOccurs="0" maxOccurs="1" type="xs:string"/>+                    <xs:element name="firstname" type="xs:string"/>+                </xs:sequence>+            </xs:complexType>+        </xs:element>+        <xs:element name="phone" type="xs:string"/>+        <xs:element name="email" type="xs:string"/>+    </xs:sequence>+</xs:complexType>++<xs:complexType name="undergradstudent">+    <xs:complexContent>+        <xs:extension base="person">+            <xs:sequence>+                <xs:element name="address" type="address"/>+                <xs:element name="gpa" type="xs:string"/>+            </xs:sequence>+        </xs:extension>+    </xs:complexContent>+</xs:complexType>++<xs:complexType name="gradstudent">+    <xs:complexContent>+        <xs:extension base="person">+            <xs:sequence>+                <xs:element name="address" type="address"/>+                <xs:element name="office" minOccurs="0" maxOccurs="1" type="xs:string"/>+                <xs:element name="url" minOccurs="0" maxOccurs="1" type="xs:string"/>+                <xs:element name="gpa" type="xs:string"/>+            </xs:sequence>+        </xs:extension>+    </xs:complexContent>+</xs:complexType>++<xs:complexType name="staff">+    <xs:complexContent>+        <xs:extension base="person">+            <xs:sequence>+                <xs:element name="office" minOccurs="0" maxOccurs="1" type="xs:string"/>+            </xs:sequence>+        </xs:extension>+    </xs:complexContent>+</xs:complexType>++<xs:element name="department">+    <xs:complexType>+        <xs:sequence>+            <xs:element name="deptname" type="xs:string"/>+            <xs:choice minOccurs="0" maxOccurs="unbounded">+                <xs:element name="gradstudent" type="gradstudent"/>+                <xs:element name="staff" type="staff"/>+                <xs:element name="faculty" type="staff"/>+                <xs:element name="undergradstudent" type="undergradstudent"/>+            </xs:choice>+        </xs:sequence>+    </xs:complexType>+</xs:element>++</xs:schema>
data/test.xq view
@@ -235,11 +235,11 @@ ; declare variable $xxx := doc('data/cs.xml') ;-declare function x:f ($d) { $xxx//gradstudent[.//lastname=$d]/gpa }+declare function f ($d) { $xxx//gradstudent[.//lastname=$d]/gpa } ; declare function g ($x) { ($x,for $z in $x/* return g($z)) } ;-q(86,(x:f("Galanis"),count(g($xxx))))+q(86,(f("Galanis"),count(g($xxx)))) ; declare function local:copy($element) {    element {name($element)}
db.html view
@@ -7,7 +7,7 @@ <body> <center> <h1>HXQ with Database Connectivity</h1>-<h3>Download <a href="/HXQ-0.17.2.tar.gz">HXQ-0.17.2.tar.gz</a></h3>+<h3>Download <a href="/HXQ-0.18.0.tar.gz">HXQ-0.18.0.tar.gz</a></h3> </center> <p> <h2>Installation Instructions (HXQ with database connectivity)</h2>@@ -205,4 +205,4 @@ <p> <hr> <p>-<address>Last modified: 06/14/09 by <a href="http://lambda.uta.edu/">Leonidas Fegaras</a></address>+<address>Last modified: 09/29/09 by <a href="http://lambda.uta.edu/">Leonidas Fegaras</a></address>
index.html view
@@ -7,7 +7,7 @@ <body> <center> <h1>HXQ: A Compiler from XQuery to Haskell</h1>-<h3>Download <a href="/HXQ-0.17.2.tar.gz">HXQ-0.17.2.tar.gz</a></h3>+<h3>Download <a href="/HXQ-0.18.0.tar.gz">HXQ-0.18.0.tar.gz</a></h3> </center> <p> <h2>Description</h2>@@ -110,7 +110,7 @@ which will automatically download and install all required packages. <p> Alternatively, you can download and install all required packages one-by-one:-First download <a href="/HXQ-0.17.2.tar.gz">HXQ version 0.17.2</a> and untar+First download <a href="/HXQ-0.18.0.tar.gz">HXQ version 0.18.0</a> and untar it (using <tt>tar xfz</tt> on Linux/Mac or <a href="http://www.7-zip.org/">7z x</a> on Windows).  Then, you execute the following commands inside the HXQ directory:@@ -144,22 +144,17 @@ supported system functions, run <tt>xquery -help</tt>. Here are some important differences between HXQ and the W3C specs: <ul>-<li> HXQ does not do static typechecking and ignores function types,-although it supports type testing and casting using-the XQuery expressions: typeswitch, instance-of, cast-as, etc.-<li> HXQ provides very little support for namespaces. For example, two QNames,-<tt>s1:tag</tt> and <tt>s2:tag</tt>, are different in HXQ-even when <tt>s1</tt> and <tt>s2</tt> are different prefixes-of the same namespace.+<li> Currently, all namespaces in HXQ XQueries must be defined using <tt>import schema</tt> or <tt>declare namespace</tt>.+Although HXQ recognizes <tt>xmlns:</tt> attributes in XML files and XQuery constructions, these namespaces are not imported. <li> The XQuery semantics requires duplicate elimination and sorting by document order for every XPath step, which is very expensive and unnecessary in most cases.  This is not currently supported by HXQ but will be addressed in the future (needs a static analysis to determine when duplicate elimination is necessary).  For example, <tt>e//*//*</tt> may return duplicate elements in HXQ.-<li> Currently, the <tt>doc</tt> function works on local-XML documents only, rather than general URIs. This can be easily fixed-by using the Haskell Network.HTTP.Simple library.+<li> Attributes in constructed elements must be either embedded in the start-tag, and/or,+if the element content is a sequence, they+must appear at the <em>beginning</em> of the sequence as constructed attributes. </ul> <p> <h2>XQuery Documentation</h2>@@ -171,7 +166,6 @@ and <a href="http://lambda.uta.edu/cse5335/xquery.pdf">XQuery</a>. Here are two relevant courses on XML and databases at <a href="http://www.stanford.edu/class/cs345b/">Stanford</a> and <a href="http://www.dbis.ethz.ch/education/ws0708/xml_db_ws2007">ETH</a>.-A nice <a href="http://www.ics.uci.edu/community/events/carey/index.php">video lecture on XQuery</a> by Michael Carey. <p> <h2>Using the Compiler</h2> <p>@@ -247,8 +241,24 @@ With <tt>xquery -help</tt> you get the list of system functions and usage information. <p>+<h2>XML Schema Validation and Type Inference</h2>+<p>+Currently, HXQ supports type testing and casting using the XQuery expressions: typeswitch, instance-of, cast-as, etc. +The validation and type inference systems are still a work in progress.+To use type inference, use the option <tt>-tp</tt> in <tt>xquery</tt>.+To associate an XML document with an XML Schema, use the XQuery <tt>import schema</tt> statement. For example:+<pre>+import schema default element namespace "dept" at "data/department.xsd";+validate {doc("data/cs.xml")//gradstudent};+(doc("data/cs.xml")//gradstudent[.//lastname='Galanis']//address) instance of element(address)*+</pre>+For a faster validation of a document, use the Haskell function <tt>validateFile</tt>:+<pre>+validateFile "data/dblp.xml" "data/dblp.xsd"+</pre>+<p> <h3><a href="release.html">Release Notes</a></h3> <p> <hr> <p>-<address>Last modified: 06/14/09 by <a href="http://lambda.uta.edu/">Leonidas Fegaras</a></address>+<address>Last modified: 09/29/09 by <a href="http://lambda.uta.edu/">Leonidas Fegaras</a></address>
release.html view
@@ -10,6 +10,9 @@ </center> <p> <dl>+<dt> HXQ-0.18.0 (released on 09/29/09)</dt>+<dd> Added namespaces, XML Schema validation, and type inference. Added general URL for doc files based on the HTTP package.+<p> <dt> HXQ-0.17.2 (released on 06/17/09)</dt> <dd> Replaced editline/readline with haskeline. Fixed HXQ.cabal. <p>@@ -37,4 +40,4 @@ <p> <hr> <p>-<address>Last modified: 06/17/09 by <a href="http://lambda.uta.edu/">Leonidas Fegaras</a></address>+<address>Last modified: 09/29/09 by <a href="http://lambda.uta.edu/">Leonidas Fegaras</a></address>
src/Text/XML/HXQ/Compiler.hs view
@@ -4,7 +4,7 @@ - Programmer: Leonidas Fegaras - Email: fegaras@cse.uta.edu - Web: http://lambda.uta.edu/-- Creation: 02/15/08, last update: 03/27/09+- Creation: 02/15/08, last update: 09/12/09 -  - Copyright (c) 2008 by Leonidas Fegaras, the University of Texas at Arlington. All rights reserved. - This material is provided as is, with absolutely no warranty expressed or implied.@@ -18,7 +18,7 @@   module Text.XML.HXQ.Compiler-    ( xe, xq, xqdb, maxPosition, containsLast, qName, qx,+    ( xe, xq, xqdb, maxPosition, containsLast, qName, makeAttribute, qx,       parent_error, pathPosition, liftIOSources, downloadFile, expandViews ) where  import Text.XML.HXQ.Parser@@ -32,15 +32,17 @@ import Text.XML.HXQ.Functions import Text.XML.HXQ.Types import Language.Haskell.TH+import Network.HTTP #if __GLASGOW_HASKELL__ >= 609 import Language.Haskell.TH.Quote #endif  --- need to handle URIs too downloadFile :: String -> IO String downloadFile path-    = readFile path+    = if elem ':' path+      then simpleHTTP (getRequest path) >>= getResponseBody+      else readFile path   undef1 = [| error "Undefined XQuery context (.)" |]@@ -106,8 +108,7 @@ expandViews views exp     = expand exp       where expand (Ast "call" xs@(Avar fname:args))-                = case filter (\(n,params,_) -> (n == fname || ("fn:"++n) == fname)-                                                && length args == length params) views of+                = case filter (\(n,params,_) -> n == fname && length args == length params) views of                     [] -> Ast "call" (map expand xs)                     (_,params,body):_ -> expand $ subst body (zip params args)             expand (Ast n xs) = Ast n (map expand xs)@@ -123,15 +124,16 @@             subst x binds = x  --- extract the QName-qName :: XSeq -> String-qName [XText s] = s-qName e = error ("Invalid QName: "++(show e))+-- Construct a QName+qName :: XSeq -> NS -> QName+qName [XText s] ns = tag s ns+qName e _ = error ("Invalid QName: "++show e)  -makeAttribute :: XSeq -> XSeq -> [(String,String)]-makeAttribute ac vc-    = if vc==[XNull] then [] else [(qName ac,showXS vc)]+makeAttribute :: XSeq -> XSeq -> NS -> [(QName,String)]+makeAttribute [XText s] vc ns+    = if vc==[XNull] then [] else [(attributeTag s ns,showXS vc)]+makeAttribute e _ _ = error ("Invalid attribute name: "++show e)   -- true, if it is a function in the IO monad@@ -149,7 +151,7 @@ -- make a function call callF :: String -> [Q Exp] -> Q Exp callF fname args-    = case filter (\(n,_,_,_) -> n == fname || ("fn:"++n)==fname) systemFunctions of+    = case filter (\(n,_,_,_,_) -> n == fname) systemFunctions of         [] ->     -- must be a Haskell function of type (XSeq,...,XSeq) -> IO XSeq              let itp = case args of                          [] -> [t| () |]@@ -159,49 +161,50 @@                  fn = sigE (varE (mkName fname))                            (appT (appT arrowT itp) [t| IO XSeq |])              in appE fn (tupE args)-        fs -> case filter (\(_,len,_,_) -> len < 0 || length args == len) fs of+        fs -> case filter (\(_,len,_,_,_) -> len < 0 || length args == len) fs of                 [] -> error ("wrong number of arguments in function call: " ++ fname)-                (_,_,_,f):_ -> f args+                (_,_,_,_,f):_ -> f args   -- Each XPath predicate must calculate position() and last() from its input XSeq -- if last() is used, then the evaluation is blocking (need to store the whole input XSeq)-compilePredicates :: [Ast] -> Q Exp -> Bool -> Q Exp-compilePredicates [] xs _ = xs-compilePredicates ((Aint n):preds) xs _   -- shortcut that improves laziness+compilePredicates :: [Ast] -> Q Exp -> Q Exp -> Bool -> Q Exp+compilePredicates [] xs _ _ = xs+compilePredicates ((Aint n):preds) xs ns _   -- shortcut that improves laziness     = compilePredicates preds-            [| index $xs $(litE (IntegerL (toInteger (n-1)))) |] True-compilePredicates ((Ast "call" [Avar "last"]):preds) xs _-    = compilePredicates preds [| let s = $xs in if null s then [] else [ last s ] |] True-compilePredicates (pred:preds) xs True    -- top-k like+            [| index $xs $(litE (IntegerL (toInteger (n-1)))) |] ns True+compilePredicates ((Ast "call" [Avar "last"]):preds) xs ns _+    = compilePredicates preds [| let s = $xs in if null s then [] else [ last s ] |] ns True+compilePredicates (pred:preds) xs ns True    -- top-k like     | pos > 0-    = compilePredicates (pred:preds) [| take $(litE (IntegerL (toInteger pos))) $xs |] False+    = compilePredicates (pred:preds) [| take $(litE (IntegerL (toInteger pos))) $xs |] ns False       where pos = maxPosition pathPosition pred-compilePredicates (pred:preds) xs _+compilePredicates (pred:preds) xs ns _     | containsLast pred         -- blocking: use only when last() is used in the predicate     = compilePredicates preds             [| let bl = $xs                    len = length bl-               in foldir (\x i r -> if case $(compile pred [| x |] [| [XInt i] |] [| [XInt len] |] "") of+               in foldir (\x i r -> if case $(compile pred [| x |] [| [XInt i] |] [| [XInt len] |] ns "") of                                          [XInt k] -> k == i               -- indexing                                          b -> conditionTest b-                                    then x:r else r) [] bl 1 |] True-compilePredicates (pred:preds) xs _+                                    then x:r else r) [] bl 1 |] ns True+compilePredicates (pred:preds) xs ns _     = compilePredicates preds-            [| foldir (\x i r -> if case $(compile pred [| x |] [| [XInt i] |] undef3 "") of+            [| foldir (\x i r -> if case $(compile pred [| x |] [| [XInt i] |] undef3 ns "") of                                       [XInt k] -> k == i               -- indexing                                       b -> conditionTest b-                                 then x:r else r) [] $xs 1 |] True+                                 then x:r else r) [] $xs 1 |] ns True   -- Compile the AST e into Haskell code -- context: context node (XPath .) -- position: the element position in the parent sequence (XPath position()) -- last: the length of the parent sequence (XPath last())+-- ns: namespaces -- effective_axis: the XPath axis in /axis::tag(exp) --        eg, the effective axis of //(A | B) is descendant-compile :: Ast -> Q Exp -> Q Exp -> Q Exp -> String -> Q Exp-compile e context position last effective_axis+compile :: Ast -> Q Exp -> Q Exp -> Q Exp -> Q Exp -> String -> Q Exp+compile e context position last ns effective_axis   = case e of       Avar "." -> [| [ $context :: XTree ] |]       Avar v -> let x = varE (mkName v)@@ -212,104 +215,108 @@                   in [| [ XFloat $x ] |]       Astring s -> let x = litE (StringL s)                    in [| [ XText $x ] |]-      Ast "nonIO" [u] -> compile u context position last effective_axis+      Ast "nonIO" [u] -> compile u context position last ns effective_axis       Ast "context" [v,Astring dp,body]-          -> [| foldr (\x r -> $(compile body [| x |] position last dp)++r)-                      [] $(compile v context position last effective_axis) |]+          -> [| foldr (\x r -> $(compile body [| x |] position last ns dp)++r)+                      [] $(compile v context position last ns effective_axis) |]       Ast "call" [Avar "position"]           -> position       Ast "call" [Avar "last"]           -> last       Ast "step" (Avar "child":tag:Avar ".":preds)           | effective_axis /= ""-          -> compile (Ast "step" (Avar effective_axis:tag:Avar ".":preds)) context position last ""+          -> compile (Ast "step" (Avar effective_axis:tag:Avar ".":preds)) context position last ns ""       Ast "step" (Avar "descendant_any":Ast "tags" tags:e:preds)-          -> let bc = compile e context position last effective_axis-                 ts = listE (map (\(Avar tag) -> litE (stringL tag)) tags)-             in [| let v = $bc-                   in if v==[XNull]-                      then v-                      else foldr (\x r -> $(compilePredicates preds [| descendant_any_with_tagged_children $ts x |] True)++r)-                                 [] v |]-      Ast "step" (Avar step:Astring tag:e:preds)-          -> let bc = compile e context position last effective_axis-                 tc = litE (stringL tag)-             in [| let v = $bc-                   in if v==[XNull]-                      then v-                      else foldr (\x r -> $(compilePredicates preds [| $(findV step paths) $tc x |] True)++r)-                           [] v |]+          -> let bc = compile e context position last ns effective_axis+                 ts = listE (map (\(Avar n) -> [| tag $(litE (stringL n)) $ns |]) tags)+             in [| case $bc of+                     v@[XNull] -> v+                     v -> foldr (\x r -> $(compilePredicates preds [| descendant_any_with_tagged_children $ts x |] ns True)++r)+                                [] v |]+      Ast "step" (Avar step:Astring n:e:preds)+          -> let bc = compile e context position last ns effective_axis+                 tc = litE (stringL n)+             in [| case $bc of+                     v@[XNull] -> v+                     v -> foldr (\x r -> $(compilePredicates preds [| $(findV step paths) (tag $tc $ns) x |] ns True)++r)+                                [] v |]       Ast "filter" (e:preds)-          -> compilePredicates preds (compile e context position last effective_axis) True+          -> compilePredicates preds (compile e context position last ns effective_axis) ns True       Ast "predicate" [condition,body]-          -> [| if conditionTest $(compile condition undef1 undef2 undef3 "")-                then $(compile body context position last effective_axis)+          -> [| if conditionTest $(compile condition undef1 undef2 undef3 ns "")+                then $(compile body context position last ns effective_axis)                 else [] |]       Ast "append" args-          -> [| appendText $(listE (map (\x -> compile x context position last effective_axis) args)) |]+          -> [| appendText $(listE (map (\x -> compile x context position last ns effective_axis) args)) |]       Ast "if" [c,t,e]-          -> let ce = compile c context position last effective_axis-                 te = compile t context position last effective_axis-                 ee = compile e context position last effective_axis+          -> let ce = compile c context position last ns effective_axis+                 te = compile t context position last ns effective_axis+                 ee = compile e context position last ns effective_axis              in [| if conditionTest $ce then $te else $ee |]+      Ast "validate" [e]                 -- blocking+          -> let vs = compile e context position last ns effective_axis+             in [| let x = $vs+                   in case validateXSeq x $! $ns of+                        Success xs -> x+                        Failure ts -> error ("Failed to validate the XML element: "++show ts) |]       Ast f _           | elem f ["insert","delete","replace"]           -> error "Updates must be over XML data stored in databases"+      Ast "call" ((Avar f):args)+          | elem f system_functions+          -> callF f (map (\x -> compile x context position last ns effective_axis) args)       Ast "call" [Avar fname,a]           | isBuildInType fname-          -> let ac = compile a context position last effective_axis-             in [| castAs $ac (Avar fname) |]+          -> let ac = compile a context position last ns effective_axis+             in [| castAs $ac (TBase (tag fname $ns)) |]       Ast "call" ((Avar f):_)-          | not (elem f system_functions)           -> error "External function calls must be within the IO monad"-      Ast "call" ((Avar f):args)-          -> callF f (map (\x -> compile x context position last effective_axis) args)       Ast "construction" [tag,id,parent,Ast "attributes" al,body]           -> let alc = foldr (\(Ast "pair" [a,v]) r-                                  -> let ac = compile a context position last effective_axis-                                         vc = compile v context position last effective_axis-                                     in [| (makeAttribute $ac $vc) ++ $r |]) [| [] |] al-                 ct = compile tag context position last effective_axis-                 bc = compile body context position last effective_axis-                 cid = compile id context position last effective_axis-                 cparent = compile parent context position last effective_axis+                                  -> let ac = compile a context position last ns effective_axis+                                         vc = compile v context position last ns effective_axis+                                     in [| (makeAttribute $ac $vc $ns) ++ $r |]) [| [] |] al+                 ct = compile tag context position last ns effective_axis+                 bc = compile body context position last ns effective_axis+                 cid = compile id context position last ns effective_axis+                 cparent = compile parent context position last ns effective_axis              in [| let vid = case $cid of                                [XText vid] -> (read vid)::Int                                _ -> 0                        vparent = $cparent                        (as,bs) = span (\x -> case x of XAttr _ _ -> True; _ -> False) $bc                        atts = $alc ++ [ (n,v) | XAttr n v <- as ]-                   in [ XElem (qName $ct) atts vid (if null vparent then parent_error else head vparent) bs ] |]+                   in [ XElem (qName $ct $ns) atts vid (if null vparent then parent_error else head vparent) bs ] |]       Ast "attribute_construction" [name,value]-          -> let ns = compile name context position last effective_axis-                 vs = compile value context position last effective_axis-             in [| [ XAttr (qName $ns) (showXS $vs) ] |]+          -> let nm = compile name context position last ns effective_axis+                 vs = compile value context position last ns effective_axis+             in [| [ XAttr (attributeTag $nm $ns) (showXS $vs) ] |]       Ast "let" [Avar var,source,body]-          -> do s <- compile source context position last effective_axis-                b <- compile body context position last effective_axis+          -> do s <- compile source context position last ns effective_axis+                b <- compile body context position last ns effective_axis                 return $! (AppE (LamE [VarP (mkName var)] b) s)       Ast "for" [Avar var,Avar "$",source,body]      -- a for-loop without an index-          -> let b = compile body [| head $(varE (mkName var)) |] undef2 undef3 ""+          -> let b = compile body [| head $(varE (mkName var)) |] undef2 undef3 ns ""                  f = lamE [varP (mkName var)] [| \r -> $b ++ r |]-                 s = compile source context position last effective_axis+                 s = compile source context position last ns effective_axis              in [| foldr (\x -> $f [x]) [] $s |]       Ast "for" [Avar var,Avar ivar,source,body]     -- a for-loop with an index           -> let b = compile body [| head $(varE (mkName var)) |]-                             [| $(varE (mkName ivar)) |] undef3 ""+                             [| $(varE (mkName ivar)) |] undef3 ns ""                  f = lamE [varP (mkName var)] (lamE [varP (mkName ivar)] [| \r -> $b ++ r |])                  p = maxPosition (Avar ivar) body-                 ns = if p > 0              -- there is a top-k like restriction+                 ts = if p > 0              -- there is a top-k like restriction                       then Ast "step" [source,Ast "call" [Avar "<=",pathPosition,Aint p]]                       else source-                 s = compile ns context position last effective_axis+                 s = compile ts context position last ns effective_axis              in [| foldir (\x i -> $f [x] [XInt i]) [] $s 1 |]       Ast "sortTuple" (exp:orderBys)             -- prepare each FLWOR tuple for sorting-          -> let res = foldl (\r a -> let ac = compile a context position last effective_axis+          -> let res = foldl (\r a -> let ac = compile a context position last ns effective_axis                                       in [| $r++[toData $ac] |] )-                             [| [ $(compile exp context position last effective_axis) ] |] orderBys+                             [| [ $(compile exp context position last ns effective_axis) ] |] orderBys              in [| [ $res ] |]       Ast "sort" (exp:ordList)                   -- blocking-          -> let ce = compile exp context position last effective_axis+          -> let ce = compile exp context position last ns effective_axis                  ordering = foldr (\(Avar ord) r                                        -> let asc = if ord == "ascending"                                                     then [| True |]@@ -320,49 +327,49 @@                                   [| \xs ys -> EQ |] ordList              in [| concatMap head (sortBy (\(_:xs) (_:ys) -> $ordering xs ys) ($ce::[[XSeq]])) |]       Ast "type" [tp]-          -> [| [ XType $(liftAst tp) ] |]-      _ -> error ("Illegal XQuery: "++(show e))+          -> [| [ XType (toType $(liftAst tp) $ns) ] |]+      _ -> error ("Illegal XQuery: "++show e)   -- The monadic compilePredicates that propagates IO state-compilePredicatesM :: [Ast] -> Q Exp -> Bool -> Q Exp-compilePredicatesM [] xs _+compilePredicatesM :: [Ast] -> Q Exp -> Q Exp -> Bool -> Q Exp+compilePredicatesM [] xs _ _     = [| return $xs |]-compilePredicatesM ((Aint n):preds) xs _   -- shortcut that improves laziness+compilePredicatesM ((Aint n):preds) xs ns _   -- shortcut that improves laziness     = compilePredicatesM preds-            [| index $xs $(litE (IntegerL (toInteger (n-1)))) |] True-compilePredicatesM ((Ast "call" [Avar "last"]):preds) xs _-    = compilePredicatesM preds [| let s = $xs in if null s then [] else [ last s ] |] True-compilePredicatesM (pred:preds) xs True    -- top-k like+            [| index $xs $(litE (IntegerL (toInteger (n-1)))) |] ns True+compilePredicatesM ((Ast "call" [Avar "last"]):preds) xs ns _+    = compilePredicatesM preds [| let s = $xs in if null s then [] else [ last s ] |] ns True+compilePredicatesM (pred:preds) xs ns True    -- top-k like     | pos > 0-    = compilePredicatesM (pred:preds) [| take $(litE (IntegerL (toInteger pos))) $xs |] False+    = compilePredicatesM (pred:preds) [| take $(litE (IntegerL (toInteger pos))) $xs |] ns False       where pos = maxPosition pathPosition pred-compilePredicatesM (pred:preds) xs _+compilePredicatesM (pred:preds) xs ns _     | containsLast pred         -- blocking: use only when last() is used in the predicate     = [| do let bl = $xs                 last = length bl-            vs <- foldir (\x i r -> do vs <- $(compileM pred [| x |] [| [XInt i] |] [| [XInt last] |] "")+            vs <- foldir (\x i r -> do vs <- $(compileM pred [| x |] [| [XInt i] |] [| [XInt last] |] ns "")                                        s <- r                                        return (if case vs of                                                     [XInt k] -> k == i               -- indexing                                                     b -> conditionTest b                                                then x:s else s))                          (return []) $xs 1-            $(compilePredicatesM preds [| vs |] True) |]-compilePredicatesM (pred:preds) xs _-    = [| do vs <- foldir (\x i r -> do vs <- $(compileM pred [| x |] [| [XInt i] |] undef3 "")+            $(compilePredicatesM preds [| vs |] ns True) |]+compilePredicatesM (pred:preds) xs ns _+    = [| do vs <- foldir (\x i r -> do vs <- $(compileM pred [| x |] [| [XInt i] |] undef3 ns "")                                        s <- r                                        return (if case vs of                                                     [XInt k] -> k == i               -- indexing                                                     b -> conditionTest b                                                then x:s else s))                          (return []) $xs 1-            $(compilePredicatesM preds [| vs |] True) |]+            $(compilePredicatesM preds [| vs |] ns True) |]   -- The monadic XQuery compiler; it is like compile but has plumbing to propagate IO state-compileM :: Ast -> Q Exp -> Q Exp -> Q Exp -> String -> Q Exp-compileM e context position last effective_axis+compileM :: Ast -> Q Exp -> Q Exp -> Q Exp -> Q Exp -> String -> Q Exp+compileM e context position last ns effective_axis   = case e of       Avar "." -> [| return [ $context :: XTree ] |]       Avar v -> let x = varE (mkName v)@@ -374,10 +381,10 @@       Astring s -> let x = litE (StringL s)                    in [| return [ XText $x ] |]       -- for non-IO XQuery, use the regular compile-      Ast "nonIO" [u] -> [| return $(compile u context position last effective_axis) |]+      Ast "nonIO" [u] -> [| return $(compile u context position last ns effective_axis) |]       Ast "context" [v,Astring dp,body]-          -> [| do vs <- $(compileM v context position last effective_axis)-                   foldr (\x r -> (liftM2 (++)) $(compileM body [| x |] position last dp) r)+          -> [| do vs <- $(compileM v context position last ns effective_axis)+                   foldr (\x r -> (liftM2 (++)) $(compileM body [| x |] position last ns dp) r)                          (return []) vs |]       Ast "call" [Avar "position"]           -> [| return $position |]@@ -389,87 +396,93 @@                    return [materialize False (parseDocument doc)] |]       Ast "step" (Avar "child":tag:Avar ".":preds)           | effective_axis /= ""-          -> compileM (Ast "step" (Avar effective_axis:tag:Avar ".":preds)) context position last ""+          -> compileM (Ast "step" (Avar effective_axis:tag:Avar ".":preds)) context position last ns ""       Ast "step" (Avar "descendant_any":Ast "tags" tags:e:preds)-          -> let bc = compileM e context position last effective_axis-                 ts = listE (map (\(Avar tag) -> litE (stringL tag)) tags)+          -> let bc = compileM e context position last ns effective_axis+                 ts = listE (map (\(Avar n) -> [| tag $(litE (stringL n)) $ns |]) tags)              in [| do vs <- $bc-                      if vs==[XNull]-                         then return vs-                         else foldr (\x r -> (liftM2 (++)) $(compilePredicatesM preds-                                                               [| descendant_any_with_tagged_children $ts x |] True) r)-                                    (return []) vs |]-      Ast "step" (Avar step:Astring tag:e:preds)-          -> let bc = compileM e context position last effective_axis-                 tc = litE (stringL tag)+                      case vs of+                        [XNull] -> return vs+                        _ -> foldr (\x r -> (liftM2 (++)) $(compilePredicatesM preds+                                                               [| descendant_any_with_tagged_children $ts x |] ns True) r)+                                   (return []) vs |]+      Ast "step" (Avar step:Astring n:e:preds)+          -> let bc = compileM e context position last ns effective_axis+                 tc = litE (stringL n)              in [| do vs <- $bc-                      if vs==[XNull]-                         then return vs-                         else foldr (\x r -> (liftM2 (++)) $(compilePredicatesM preds-                                                               [| $(findV step paths) $tc x |] True) r)-                                    (return []) vs |]+                      case vs of+                        [XNull] -> return vs+                        _ -> foldr (\x r -> (liftM2 (++)) $(compilePredicatesM preds+                                                               [| $(findV step paths) (tag $tc $ns) x |] ns True) r)+                                   (return []) vs |]       Ast "filter" (e:preds)-          ->[| do vs <- $(compileM e context position last effective_axis)-                  $(compilePredicatesM preds [| vs |] True) |]+          ->[| do vs <- $(compileM e context position last ns effective_axis)+                  $(compilePredicatesM preds [| vs |] ns True) |]       Ast "predicate" [condition,body]-          -> [| do eb <- $(compileM condition undef1 undef2 undef3 "")+          -> [| do eb <- $(compileM condition undef1 undef2 undef3 ns "")                    if conditionTest eb-                      then $(compileM body context position last effective_axis)+                      then $(compileM body context position last ns effective_axis)                       else return [] |]       Ast "executeSQL" [Avar stmt,args]-          -> [| do as <- $(compileM args context position last effective_axis)+          -> [| do as <- $(compileM args context position last ns effective_axis)                    $(varE (mkName "executeSQL")) $(varE (mkName stmt)) as |]       Ast "append" args           -> let binds = zipWith (\i x -> (mkName ("x"++(show i)),x)) [1..(length args)] args-             in foldr (\(n,x) r -> [| $(compileM x context position last effective_axis) >>= $(lamE [varP n] r) |])+             in foldr (\(n,x) r -> [| $(compileM x context position last ns effective_axis) >>= $(lamE [varP n] r) |])                       [| return (appendText $(listE (map (\(n,_) -> varE n) binds))) |] binds       Ast "if" [c,t,e]-          -> let ce = compileM c context position last effective_axis-                 te = compileM t context position last effective_axis-                 ee = compileM e context position last effective_axis+          -> let ce = compileM c context position last ns effective_axis+                 te = compileM t context position last ns effective_axis+                 ee = compileM e context position last ns effective_axis              in [| do cond <- $ce                       if conditionTest cond then $te else $ee |]+      Ast "validate" [e]+          -> let es = compileM e context position last ns effective_axis+             in [| do vs <- $es+                      case validateXSeq vs $ns of+                        Success xs -> return vs+                        Failure ts -> error ("Failed to validate the XML element: "++show ts) |]       Ast "insert" [e1,e2]-          -> let vc1 = compileM e1 context position last effective_axis-                 vc2 = compileM e2 context position last effective_axis+          -> let vc1 = compileM e1 context position last ns effective_axis+                 vc2 = compileM e2 context position last ns effective_axis                  db = varE (mkName "_db")              in [| do v1 <- $vc1                       v2 <- $vc2                       insertDB $db v1 v2 |]       Ast "delete" [e]-          -> let vc = compileM e context position last effective_axis+          -> let vc = compileM e context position last ns effective_axis                  db = varE (mkName "_db")              in [| do v <- $vc                       deleteDB $db v |]       Ast "replace" [e1,e2]-          -> let vc1 = compileM e1 context position last effective_axis-                 vc2 = compileM e2 context position last effective_axis+          -> let vc1 = compileM e1 context position last ns effective_axis+                 vc2 = compileM e2 context position last ns effective_axis                  db = varE (mkName "_db")              in [| do v1 <- $vc1                       v2 <- $vc2                       replaceDB $db v1 v2 |]       Ast "call" [Avar fname,a]-          | isBuildInType fname-          -> let ac = compileM a context position last effective_axis+          | isBuildInType fname && not (elem fname system_functions)+          -> let ac = compileM a context position last ns effective_axis              in [| do a <- $ac-                      return $! castAs a (Avar fname) |]+                      return $! castAs a (TBase (tag fname $ns)) |]       Ast "call" ((Avar f):args)           -- Note: strict function application           -> let binds = zipWith (\i x -> (mkName ("x"++(show i)),x)) [1..(length args)] args                  call = if elem f system_functions                         then [| return $(callF f (map (\(n,_) -> varE n) binds)) |]                         else callF f (map (\(n,_) -> varE n) binds)-             in foldr (\(n,x) r -> [| $(compileM x context position last effective_axis) >>= $(lamE [varP n] r) |])+             in foldr (\(n,x) r -> [| $(compileM x context position last ns effective_axis) >>= $(lamE [varP n] r) |])                       call binds       Ast "construction" [tag,id,parent,Ast "attributes" al,body]           -> let alc = foldr (\(Ast "pair" [a,v]) r-                                  -> [| do ac <- $(compileM a context position last effective_axis)-                                           vc <- $(compileM v context position last effective_axis)+                                  -> [| do ac <- $(compileM a context position last ns effective_axis)+                                           vc <- $(compileM v context position last ns effective_axis)                                            s <- $r-                                           return ((makeAttribute ac vc)++s) |]) [| return [] |] al-                 ct = compileM tag context position last effective_axis-                 bc = compileM body context position last effective_axis-                 cid = compile id context position last effective_axis-                 cparent = compile parent context position last effective_axis+                                           return ((makeAttribute ac vc $ns)++s) |]) [| return [] |] al+                 ct = compileM tag context position last ns effective_axis+                 bc = compileM body context position last ns effective_axis+                 cid = compile id context position last ns effective_axis+                 cparent = compile parent context position last ns effective_axis              in [| do a <- $alc                       c <- $ct                       b <- $bc@@ -479,42 +492,42 @@                                   [XText vid] -> (read vid)::Int                                   _ -> 0                           vparent = $cparent-                      return [ XElem (qName c) atts vid (if null vparent then parent_error else head vparent) bs ] |]+                      return [ XElem (qName c $ns) atts vid (if null vparent then parent_error else head vparent) bs ] |]       Ast "attribute_construction" [name,value]-          -> let ns = compileM name context position last effective_axis-                 vs = compileM value context position last effective_axis+          -> let ns = compileM name context position last ns effective_axis+                 vs = compileM value context position last ns effective_axis              in [| do n <- $ns                       v <- $vs-                      return $! [ XAttr (qName n) (showXS v) ] |]+                      return $! [ XAttr (attributeTag n $ns) (showXS v) ] |]       Ast "let" [Avar var,source,body]-          -> [|  $(compileM source context position last effective_axis)-                 >>= $(lamE [varP (mkName var)] (compileM body context position last effective_axis)) |]+          -> [|  $(compileM source context position last ns effective_axis)+                 >>= $(lamE [varP (mkName var)] (compileM body context position last ns effective_axis)) |]       Ast "for" [Avar var,Avar "$",source,body]      -- a for-loop without an index-          -> let b = compileM body [| head $(varE (mkName var)) |] undef2 undef3 ""+          -> let b = compileM body [| head $(varE (mkName var)) |] undef2 undef3 ns ""                  f = lamE [varP (mkName var)] [| (liftM2 (++)) $b |]-                 s = compileM source context position last effective_axis+                 s = compileM source context position last ns effective_axis              in [| do vs <- $s                       foldr (\x -> $f [x]) (return []) vs |]       Ast "for" [Avar var,Avar ivar,source,body]     -- a for-loop with an index           -> let b = compileM body [| head $(varE (mkName var)) |]-                             [| $(varE (mkName ivar)) |] undef3 ""+                             [| $(varE (mkName ivar)) |] undef3 ns ""                  f = lamE [varP (mkName var)] (lamE [varP (mkName ivar)] [| (liftM2 (++)) $b |])                  p = maxPosition (Avar ivar) body-                 ns = if p > 0              -- there is a top-k like restriction+                 ts = if p > 0              -- there is a top-k like restriction                       then Ast "step" [source,Ast "call" [Avar "<=",pathPosition,Aint p]]                       else source-                 s = compileM ns context position last effective_axis+                 s = compileM ts context position last ns effective_axis              in [| do vs <- $s                       foldir (\x i -> $f [x] [XInt i]) (return []) vs 1 |]       Ast "sortTuple" (exp:orderBys)             -- prepare each FLWOR tuple for sorting-          -> let vs = compileM exp context position last effective_axis-                 res = foldl (\r a -> [| do ac <- $(compileM a context position last effective_axis)+          -> let vs = compileM exp context position last ns effective_axis+                 res = foldl (\r a -> [| do ac <- $(compileM a context position last ns effective_axis)                                             s <- $r                                             return (s++[toData ac]) |] )                              [| do v <- $vs; return [ v ] |] orderBys              in [| do r <- $res; return [r] |]       Ast "sort" (exp:ordList)                   -- blocking-          -> let ce = compileM exp context position last effective_axis+          -> let ce = compileM exp context position last ns effective_axis                  ordering = foldr (\(Avar ord) r                                        -> let asc = if ord == "ascending"                                                     then [| True |]@@ -526,8 +539,8 @@              in [| do c <- $ce                       return (concatMap head (sortBy (\(_:xs) (_:ys) -> $ordering xs ys) (c::[[XSeq]]))) |]       Ast "type" [tp]-          -> [| return [ XType $(liftAst tp) ] |]-      _ -> error ("Illegal XQuery: "++(show e))+          -> [| return [ XType (toType $(liftAst tp) $ns) ] |]+      _ -> error ("Illegal XQuery: "++show e)   -- functions that need IO interaction (document reader, DB access, etc)@@ -603,12 +616,14 @@  -- optimize and compile an AST  compileAst :: Ast -> Q Exp-compileAst ast = compile (optimize ast) undef1 undef2 undef3 ""+compileAst ast = compile (optimize ast) undef1 undef2 undef3 [| initialNS |] "" -compileAstM :: Ast -> [(String,[String],Ast)] -> Q Exp-compileAstM ast views = compileM (optimize (expandViews views ast)) undef1 undef2 undef3 "" +compileAstM :: Ast -> Q Exp -> [(String,[String],Ast)] -> Q Exp+compileAstM ast ns views+    = compileM (optimize (expandViews views ast)) undef1 undef2 undef3 ns "" + -- Compile an XQuery AST that does not perform IO (unlifted). -- When evaluated, it returns XSeq. compileQuery :: [Ast] -> Q Exp@@ -626,34 +641,82 @@  -- Compile an XQuery AST that may read XML documents or use databases (IO lifted). -- When evaluated, it returns IO XSeq.-compileQueryM :: [Ast] -> [(String,[String],Ast)] -> Q Exp-compileQueryM ((Ast "function" ((Avar f):b:args)):xs) views-    = let lvars = case args of-                    [Astring a] -> [varP (mkName a)]-                    _ -> [tupP (map (\(Avar a) -> varP (mkName a)) args)]-      in letE [valD (varP (mkName f)) (normalB (lamE lvars (compileAstM b views))) []]-              (compileQueryM xs views)-compileQueryM ((Ast "view" ((Avar f):b:args)):xs) views-    = compileQueryM xs ((f,map (\(Avar v) -> v) args,b):views)-compileQueryM ((Ast "variable" [Avar v,u]):xs) views-    = [| $(compileAstM u views) >>= $(lamE [varP (mkName v)] (compileQueryM xs views)) |]-compileQueryM (query:xs) views-    = let (ast,ns) = liftIOSources (optimize (expandViews views query))-          code = compileM ast undef1 undef2 undef3 ""-          rest = compileQueryM xs views-      in foldl (\r (n,b,e) -> let d = lamE [varP (mkName n)] r-                                  bc = if b then [| True |] else [| False |]  -- needed due to a bug in template haskell-                              in case e of-                                   Avar m -> [| $d $(varE (mkName m)) |]-                                   Ast "prepareSQL" [Astring sql]-                                       -> [| ($(varE (mkName "prepareSQL"))-                                                     $(varE (mkName "_db"))-                                                     $(litE (StringL sql))) >>= $d |]-                                   _ -> [| do let [XText f] = $(compileAst e)-                                              doc <- downloadFile f-                                              $d [materialize $bc (parseDocument doc)] |])-               [| (liftM2 (++)) $code $rest |] ns-compileQueryM [] _ = [| return [] |]+compileQueryM :: [Ast] -> Q Exp -> [(String,[String],Ast)] -> Q Exp+compileQueryM [] _ _ = [| return [] |]+compileQueryM (query:xs) ns views+    = case query of+        Ast "function" ((Avar f):b:_:args)+            -> let params = map (\(Ast "pair" [Avar v,pt]) -> v) args+                   sig = map (\(Ast "pair" [Avar v,pt]) -> pt) args+                   lvars = [tupP (map (\a -> varP (mkName a)) params)]+               in letE [valD (varP (mkName f)) (normalB (lamE lvars (compileAstM b ns views))) []]+                       (compileQueryM xs ns views)+        Ast "view" ((Avar f):b:args)+            -> compileQueryM xs ns ((f,map (\(Avar v) -> v) args,b):views)+        Ast "schema" [Avar "default-element",Astring uri]+            -> compileQueryM xs [| $ns {defaultElementNS=uri} |] views+        Ast "schema" [Avar "default-function",Astring uri]+            -> compileQueryM xs [| $ns {defaultFunctionNS=uri} |] views+        Ast "schema" [Avar p,Astring v]+            -> let cd = case lookup p predefinedNamespaces of+                          Just uri+                              -> if uri == v+                                 then ()+                                 else error ("You cannot redefine the system namespace "++p)+                          _ -> ()+                   ns' = [| let ns' = $ns in ns' { prefixes = (p,v):prefixes ns' } |]+               in compileQueryM xs ns' views+        Ast "import" (Avar "default-element":Astring uri:xschemas)+            -> let f ns = foldr (\(Astring t) r -> [| do x <- $r+                                                         s <- parseSchema t $ns+                                                         return (x++s) |])+                                [| return [] |] xschemas+                   g x ns = [| $ns { defaultElementNS=uri, schemas=(uri,$x):(schemas $ns) } |]+               in [| do let ns' = $ns+                        x <- $(f [|ns'|])+                        putStrLn (show x)+                        $(compileQueryM xs (g [|x|] [|ns'|]) views) |]+        Ast "import" (Avar "default-function":Astring uri:xschemas)+            -> let f ns = foldr (\(Astring t) r -> [| do x <- $r+                                                         s <- parseSchema t $ns+                                                         return (x++s) |])+                                [| return [] |] xschemas+                   g x ns = [| $ns { defaultFunctionNS=uri, schemas=(uri,$x):(schemas $ns) } |]+               in [| do let ns' = $ns+                        x <- $(f [|ns'|])+                        $(compileQueryM xs (g [|x|] [|ns'|]) views) |]+        Ast "import" (Avar p:Astring v:xschemas)+            -> let f ns = foldr (\(Astring t) r -> [| do x <- $r+                                                         s <- parseSchema t $ns+                                                         return (x++s) |])+                                [| return [] |] xschemas+                   g x ns = [| $ns { prefixes = case lookup p predefinedNamespaces of+                                                  Just uri+                                                      -> if uri == v+                                                         then (p,v):prefixes $ns+                                                         else error ("You cannot redefine the system namespace "++p)+                                                  _ -> (p,v):prefixes $ns,+                                     schemas=(v,$x):(schemas $ns) } |]+               in [| do let ns' = $ns+                        x <- $(f [|ns'|])+                        $(compileQueryM xs (g [|x|] [|ns'|]) views) |]+        Ast "variable" [Avar v,tp,u]+            -> [| $(compileAstM u ns views) >>= $(lamE [varP (mkName v)] (compileQueryM xs ns views)) |]+        query -> let (ast,ts) = liftIOSources (optimize (expandViews views query))+                     code = compileM ast undef1 undef2 undef3 ns ""+                     rest = compileQueryM xs ns views+                 in foldl (\r (n,b,e) -> let d = lamE [varP (mkName n)] r+                                             bc = if b then [| True |] else [| False |]+                                         in case e of+                                              Avar m -> [| $d $(varE (mkName m)) |]+                                              Ast "prepareSQL" [Astring sql]+                                                  -> [| ($(varE (mkName "prepareSQL"))+                                                         $(varE (mkName "_db"))+                                                         $(litE (StringL sql))) >>= $d |]+                                              _ -> [| do let [XText f] = $(compileAst e)+                                                         doc <- downloadFile f+                                                         $d [materialize $bc (parseDocument doc)] |])+                          [| (liftM2 (++)) $code $rest |] ts   -- | Compile an XQuery expression that does not perform IO.@@ -665,13 +728,13 @@ -- | Compile an XQuery that may perform IO (such as reading an XML document or calling a user function). -- When the compiled code is evaluated, it returns a value of type @IO XSeq@. xq :: String -> Q Exp-xq query = compileQueryM (parse (scan query)) []+xq query = compileQueryM (parse (scan query)) [| initialNS |] []   -- | Compile an XQuery that may perform IO and/or queries a database. -- When the compiled code is evaluated, it returns @Connection -> IO XSeq@. xqdb :: String -> Q Exp-xqdb query = lamE [varP (mkName "_db")] (compileQueryM (parse (scan query)) [])+xqdb query = lamE [varP (mkName "_db")] (compileQueryM (parse (scan query)) [| initialNS |] [])   #if __GLASGOW_HASKELL__ < 609
src/Text/XML/HXQ/Functions.hs view
@@ -4,7 +4,7 @@ - Programmer: Leonidas Fegaras - Email: fegaras@cse.uta.edu - Web: http://lambda.uta.edu/-- Creation: 08/15/08, last update: 01/17/09+- Creation: 08/15/08, last update: 09/15/09 -  - Copyright (c) 2008 by Leonidas Fegaras, the University of Texas at Arlington. All rights reserved. - This material is provided as is, with absolutely no warranty expressed or implied.@@ -24,7 +24,7 @@ import Char import Text.XML.HXQ.XTree import Text.XML.HXQ.Types-import Language.Haskell.TH+import Language.Haskell.TH(Q,Exp) import Text.Regex import Text.Regex.Base.RegexLike import qualified GHC.Arr as A@@ -35,28 +35,31 @@   -- XPath step self /.-self_step :: String -> XTree -> XSeq+self_step :: QName -> XTree -> XSeq self_step tag x     = case x of-        XElem t _ _ _ _ -> if t==tag || tag=="*" then [x] else []+        XElem t _ _ _ _+            -> if matchQName t tag then [x] else []         _ -> []   -- XPath step /tag or / *-child_step :: String -> XTree -> XSeq+child_step :: QName -> XTree -> XSeq child_step tag x     = case x of         XElem _ _ _ _ bs             -> foldr (\b s -> case b of-                                 XElem t _ _ _ _ | (t==tag || tag=="*") -> b:s+                                 XElem t _ _ _ _+                                     | matchQName t tag+                                     -> b:s                                  _ -> s) [] bs         _ -> []   -- XPath step descendant-or-self-descendant_or_self_step :: String -> XTree -> XSeq+descendant_or_self_step :: QName -> XTree -> XSeq descendant_or_self_step tag (x@(XElem t _ _ _ cs))-    | tag==t || tag=="*"+    | matchQName t tag     = x:(concatMap (descendant_or_self_step tag) cs) descendant_or_self_step tag (XElem t _ _ _ cs)     = concatMap (descendant_or_self_step tag) cs@@ -64,7 +67,7 @@   -- XPath step //tag or // *-descendant_step :: String -> XTree -> XSeq+descendant_step :: QName -> XTree -> XSeq descendant_step tag (XElem t _ _ _ cs)     = concatMap (descendant_or_self_step tag) cs descendant_step _ _ = []@@ -72,7 +75,7 @@  -- It's like //* but has tagged children, which are derived statically -- After examining 100 children it gives up: this avoids space leaks-descendant_any_with_tagged_children :: [String] -> XTree -> XSeq+descendant_any_with_tagged_children :: [QName] -> XTree -> XSeq descendant_any_with_tagged_children tags (XElem t _ _ _ cs)     = concatMap (ca tags) cs       where ca tags (x@(XElem t _ _ _ cs))@@ -88,19 +91,20 @@   -- XPath step /@attr or /@*-attribute_step :: String -> XTree -> XSeq+attribute_step :: QName -> XTree -> XSeq attribute_step attr x     = case x of-        XElem _ al _ _ _ -> foldr (\(a,v) s -> if a==attr || attr=="*"-                                               then (XAttr a v):s-                                               else s) [] al+        XElem _ al _ _ _+            -> foldr (\(a,v) s -> if matchQName a attr+                                  then (XAttr a v):s+                                  else s) [] al         _ -> []   -- XPath step //@attr or //@*-attribute_descendant_step :: String -> XTree -> XSeq+attribute_descendant_step :: QName -> XTree -> XSeq attribute_descendant_step attr (x@(XElem _ al _ _ cs))-    = foldr (\(a,v) s -> if a==attr || attr=="*"+    = foldr (\(a,v) s -> if matchQName a attr                          then (XAttr a v):s                          else s)             (concatMap (attribute_descendant_step attr) cs) al@@ -108,20 +112,22 @@   -- XPath step parent /..-parent_step :: String -> XTree -> XSeq+parent_step :: QName -> XTree -> XSeq parent_step tag (XElem _ _ _ p _)  = case p of-     XElem t _ _ _ _ | (t==tag || tag=="*") -> [p]+     XElem t _ _ _ _+         | matchQName t tag+         -> [p]      _ -> [] parent_step _ _ = []   -- XPath step ancestor-ancestor_step :: String -> XTree -> XSeq+ancestor_step :: QName -> XTree -> XSeq ancestor_step tag (XElem _ _ _ p _)  = case p of      XElem t _ _ _ _-         -> if t==tag || tag=="*"+         -> if matchQName t tag             then p:(ancestor_step tag p)             else ancestor_step tag p      _ -> []@@ -129,18 +135,18 @@   -- XPath step ancestor-or-self-ancestor_or_self_step :: String -> XTree -> XSeq+ancestor_or_self_step :: QName -> XTree -> XSeq ancestor_or_self_step tag e  = case e of      XElem t _ _ _ _-         -> if t==tag || tag=="*"+         -> if matchQName t tag             then e:(ancestor_step tag e)             else ancestor_step tag e      _ -> []   -- XPath step following-sibling-following_sibling_step :: String -> XTree -> XSeq+following_sibling_step :: QName -> XTree -> XSeq following_sibling_step tag (XElem _ _ order (XElem _ _ _ _ cs) _)  = concatMap (self_step tag)              (tail (dropWhile filter cs))@@ -150,7 +156,7 @@   -- XPath step following-following_step :: String -> XTree -> XSeq+following_step :: QName -> XTree -> XSeq following_step tag (XElem _ _ order p _)  = case p of      XElem _ _ _ _ cs@@ -164,7 +170,7 @@   -- XPath step preceding-sibling-preceding_sibling_step :: String -> XTree -> XSeq+preceding_sibling_step :: QName -> XTree -> XSeq preceding_sibling_step tag (XElem _ _ order (XElem _ _ _ _ cs) _)  = concatMap (self_step tag)              (takeWhile filter cs)@@ -174,7 +180,7 @@   -- XPath step preceding-preceding_step :: String -> XTree -> XSeq+preceding_step :: QName -> XTree -> XSeq preceding_step tag (XElem _ _ order p _)  = case p of      XElem t _ _ _ cs@@ -205,7 +211,7 @@   -- XPath steps to be used by the interpreter-pathFunctions :: [(String,String->XTree->XSeq)]+pathFunctions :: [(String,QName->XTree->XSeq)] pathFunctions     = [ ( "child", child_step ),         ( "descendant", descendant_step ),@@ -255,8 +261,8 @@ falseXT = XBool False  -toBool :: Bool -> XSeq-toBool b = if b then [trueXT] else [falseXT]+toBoolean :: Bool -> XSeq+toBoolean b = if b then [trueXT] else [falseXT]   -- data()@@ -292,8 +298,8 @@  getNames :: XSeq -> XSeq getNames xs = foldr (\x r -> case x of -                               XElem tag _ _ _ _ -> (XText tag):r-                               XAttr tag _ -> (XText tag):r+                               XElem tag _ _ _ _ -> (XText $ show tag):r+                               XAttr tag _ -> (XText $ show tag):r                                _ -> r) [] xs  @@ -464,297 +470,298 @@   system_functions :: [String]-system_functions = map (\(nm,_,_,_) -> nm) systemFunctions ++ map (\(nm,_,_,_) -> "fn:"++nm) systemFunctions+system_functions = map (\(nm,_,_,_,_) -> nm) systemFunctions   -- System functions systemFunctions :: [(String,                -- function name                      Int,                   -- arity (-1 means any number of arguments)+                     [Type],                -- output_type:input_types                      [XSeq]->XSeq,          -- function to be used by the interpreter                      [Q Exp] -> Q Exp)]     -- function to be used by the compiler systemFunctions     = [ --  general comparisons-        ( "=", 2,-          \[xs,ys] -> toBool $ or [ compareXTrees x y == EQ | x <- toData xs, y <- toData ys ],-          \[xs,ys] -> [| toBool $ or [ compareXTrees x y == EQ | x <- toData $xs, y <- toData $ys ] |] ),-        ( "!=", 2,-          \[xs,ys] -> toBool $ strictCompare xs ys /= EQ,-          \[xs,ys] -> [| toBool $ strictCompare $xs $ys /= EQ |] ),-        ( ">", 2,-          \[xs,ys] -> toBool $ or [ compareXTrees x y == GT | x <- toData xs, y <- toData ys ],-          \[xs,ys] -> [| toBool $ or [ compareXTrees x y == GT | x <- toData $xs, y <- toData $ys ] |] ),-        ( "<", 2,-          \[xs,ys] -> toBool $ or [ compareXTrees x y == LT | x <- toData xs, y <- toData ys ],-          \[xs,ys] -> [| toBool $ or [ compareXTrees x y == LT | x <- toData $xs, y <- toData $ys ] |] ),-        ( ">=", 2,-          \[xs,ys] -> toBool $ or [ compareXTrees x y `elem` [GT,EQ] | x <- toData xs, y <- toData ys ],-          \[xs,ys] -> [| toBool $ or [ compareXTrees x y `elem` [GT,EQ] | x <- toData $xs, y <- toData $ys ] |] ),-        ( "<=", 2,-          \[xs,ys] -> toBool $ or [ compareXTrees x y `elem` [LT,EQ] | x <- toData xs, y <- toData ys ],-          \[xs,ys] -> [| toBool $ or [ compareXTrees x y `elem` [LT,EQ] | x <- toData $xs, y <- toData $ys ] |] ),-        ( "deep-equal", 2,-          \[xs,ys] -> toBool $ or [ deep_equal x y | x <- xs, y <- ys ],-          \[xs,ys] -> [| toBool $ or [ deep_equal x y | x <- $xs, y <- $ys ] |] ),+        ( "=", 2, [tBool,tStar TAny,tStar TAny],+          \[xs,ys] -> toBoolean $ or [ compareXTrees x y == EQ | x <- toData xs, y <- toData ys ],+          \[xs,ys] -> [| toBoolean $ or [ compareXTrees x y == EQ | x <- toData $xs, y <- toData $ys ] |] ),+        ( "!=", 2, [tBool,tStar TAny,tStar TAny],+          \[xs,ys] -> toBoolean $ strictCompare xs ys /= EQ,+          \[xs,ys] -> [| toBoolean $ strictCompare $xs $ys /= EQ |] ),+        ( ">", 2, [tBool,tStar TAny,tStar TAny],+          \[xs,ys] -> toBoolean $ or [ compareXTrees x y == GT | x <- toData xs, y <- toData ys ],+          \[xs,ys] -> [| toBoolean $ or [ compareXTrees x y == GT | x <- toData $xs, y <- toData $ys ] |] ),+        ( "<", 2, [tBool,tStar TAny,tStar TAny],+          \[xs,ys] -> toBoolean $ or [ compareXTrees x y == LT | x <- toData xs, y <- toData ys ],+          \[xs,ys] -> [| toBoolean $ or [ compareXTrees x y == LT | x <- toData $xs, y <- toData $ys ] |] ),+        ( ">=", 2, [tBool,tStar TAny,tStar TAny],+          \[xs,ys] -> toBoolean $ or [ compareXTrees x y `elem` [GT,EQ] | x <- toData xs, y <- toData ys ],+          \[xs,ys] -> [| toBoolean $ or [ compareXTrees x y `elem` [GT,EQ] | x <- toData $xs, y <- toData $ys ] |] ),+        ( "<=", 2, [tBool,tStar TAny,tStar TAny],+          \[xs,ys] -> toBoolean $ or [ compareXTrees x y `elem` [LT,EQ] | x <- toData xs, y <- toData ys ],+          \[xs,ys] -> [| toBoolean $ or [ compareXTrees x y `elem` [LT,EQ] | x <- toData $xs, y <- toData $ys ] |] ),+        ( "deep-equal", 2, [tBool,tStar TAny,tStar TAny],+          \[xs,ys] -> toBoolean $ or [ deep_equal x y | x <- xs, y <- ys ],+          \[xs,ys] -> [| toBoolean $ or [ deep_equal x y | x <- $xs, y <- $ys ] |] ), --  strict comparisons-        ( "eq", 2,-          \[xs,ys] -> toBool $ strictCompare xs ys == EQ,-          \[xs,ys] -> [| toBool $ strictCompare $xs $ys == EQ |] ),-        ( "neq", 2,-          \[xs,ys] -> toBool $ strictCompare xs ys /= EQ,-          \[xs,ys] -> [| toBool $ strictCompare $xs $ys /= EQ |] ),-        ( "lt", 2,-          \[xs,ys] -> toBool $ strictCompare xs ys == LT,-          \[xs,ys] -> [| toBool $ strictCompare $xs $ys == LT |] ),-        ( "gt", 2,-          \[xs,ys] -> toBool $ strictCompare xs ys == GT,-          \[xs,ys] -> [| toBool $ strictCompare $xs $ys == GT |] ),-        ( "le", 2,-          \[xs,ys] -> toBool $ strictCompare xs ys `elem` [LT,EQ],-          \[xs,ys] -> [| toBool $ strictCompare $xs $ys `elem` [LT,EQ] |] ),-        ( "ge", 2,-          \[xs,ys] -> toBool $ strictCompare xs ys `elem` [GT,EQ],-          \[xs,ys] -> [| toBool $ strictCompare $xs $ys `elem` [GT,EQ] |] ),+        ( "eq", 2, [tBool,tAtomic,tAtomic],+          \[xs,ys] -> toBoolean $ strictCompare xs ys == EQ,+          \[xs,ys] -> [| toBoolean $ strictCompare $xs $ys == EQ |] ),+        ( "neq", 2, [tBool,tAtomic,tAtomic],+          \[xs,ys] -> toBoolean $ strictCompare xs ys /= EQ,+          \[xs,ys] -> [| toBoolean $ strictCompare $xs $ys /= EQ |] ),+        ( "lt", 2, [tBool,tAtomic,tAtomic],+          \[xs,ys] -> toBoolean $ strictCompare xs ys == LT,+          \[xs,ys] -> [| toBoolean $ strictCompare $xs $ys == LT |] ),+        ( "gt", 2, [tBool,tAtomic,tAtomic],+          \[xs,ys] -> toBoolean $ strictCompare xs ys == GT,+          \[xs,ys] -> [| toBoolean $ strictCompare $xs $ys == GT |] ),+        ( "le", 2, [tBool,tAtomic,tAtomic],+          \[xs,ys] -> toBoolean $ strictCompare xs ys `elem` [LT,EQ],+          \[xs,ys] -> [| toBoolean $ strictCompare $xs $ys `elem` [LT,EQ] |] ),+        ( "ge", 2, [tBool,tAtomic,tAtomic],+          \[xs,ys] -> toBoolean $ strictCompare xs ys `elem` [GT,EQ],+          \[xs,ys] -> [| toBoolean $ strictCompare $xs $ys `elem` [GT,EQ] |] ), -- document order comparisons-        ( "<<", 2,-          \[xs,ys] -> toBool $ or [ ox < oy | XElem _ _ ox _ _ <- xs, XElem _ _ oy _ _ <- ys ],-          \[xs,ys] -> [| toBool $ or [ ox < oy | XElem _ _ ox _ _ <- $xs, XElem _ _ oy _ _ <- $ys ] |] ),-        ( ">>", 2,-          \[xs,ys] -> toBool $ or [ ox > oy | XElem _ _ ox _ _ <- xs, XElem _ _ oy _ _ <- ys ],-          \[xs,ys] -> [| toBool $ or [ ox > oy | XElem _ _ ox _ _ <- $xs, XElem _ _ oy _ _ <- $ys ] |] ),-        ( "is", 2,-          \[xs,ys] -> toBool $ or [ ox == oy | XElem _ _ ox _ _ <- xs, XElem _ _ oy _ _ <- ys ],-          \[xs,ys] -> [| toBool $ or [ ox == oy | XElem _ _ ox _ _ <- $xs, XElem _ _ oy _ _ <- $ys ] |] ),+        ( "<<", 2, [tBool,tNode,tNode],+          \[xs,ys] -> toBoolean $ or [ ox < oy | XElem _ _ ox _ _ <- xs, XElem _ _ oy _ _ <- ys ],+          \[xs,ys] -> [| toBoolean $ or [ ox < oy | XElem _ _ ox _ _ <- $xs, XElem _ _ oy _ _ <- $ys ] |] ),+        ( ">>", 2, [tBool,tNode,tNode],+          \[xs,ys] -> toBoolean $ or [ ox > oy | XElem _ _ ox _ _ <- xs, XElem _ _ oy _ _ <- ys ],+          \[xs,ys] -> [| toBoolean $ or [ ox > oy | XElem _ _ ox _ _ <- $xs, XElem _ _ oy _ _ <- $ys ] |] ),+        ( "is", 2, [tBool,tNode,tNode],+          \[xs,ys] -> toBoolean $ or [ ox == oy | XElem _ _ ox _ _ <- xs, XElem _ _ oy _ _ <- ys ],+          \[xs,ys] -> [| toBoolean $ or [ ox == oy | XElem _ _ ox _ _ <- $xs, XElem _ _ oy _ _ <- $ys ] |] ), -- arithmetic operations-        ( "+", 2,+        ( "+", 2, [tNumeric,tNumeric,tNumeric],           \[xs,ys] -> [ arithmetic (+) x y | x <- toNums xs, y <- toNums ys ],           \[xs,ys] -> [| [ arithmetic (+) x y | x <- toNums $xs, y <- toNums $ys ] |] ),-        ( "-", 2,+        ( "-", 2, [tNumeric,tNumeric,tNumeric],           \[xs,ys] -> [ arithmetic (-) x y | x <- toNums xs, y <- toNums ys ],           \[xs,ys] -> [| [ arithmetic (-) x y | x <- toNums $xs, y <- toNums $ys ] |] ),-        ( "*", 2,+        ( "*", 2, [tNumeric,tNumeric,tNumeric],           \[xs,ys] -> [ arithmetic (*) x y | x <- toNums xs, y <- toNums ys ],           \[xs,ys] -> [| [ arithmetic (*) x y | x <- toNums $xs, y <- toNums $ys ] |] ),-        ( "div", 2,+        ( "div", 2, [tNumeric,tNumeric,tNumeric],           \[xs,ys] -> [ arithmetic (/) x y | x <- toNums xs, y <- toNums ys ],           \[xs,ys] -> [| [ arithmetic (/) x y | x <- toNums $xs, y <- toNums $ys ] |] ),-        ( "idiv", 2,+        ( "idiv", 2, [tNumeric,tNumeric,tNumeric],           \[xs,ys] -> [ case arithmetic (/) x y of XFloat n -> XInt (floor n); x -> x                       | x <- toNums xs, y <- toNums ys ],           \[xs,ys] -> [| [ case arithmetic (/) x y of XFloat n -> XInt (floor n); x -> x                          | x <- toNums $xs, y <- toNums $ys ] |] ),-        ( "mod", 2,+        ( "mod", 2, [tNumeric,tNumeric,tNumeric],           \[xs,ys] -> [ arithmetic modulo x y | x <- toNums xs, y <- toNums ys ],           \[xs,ys] -> [| [ arithmetic modulo x y | x <- toNums $xs, y <- toNums $ys ] |] ),-        ( "uplus", 1,+        ( "uplus", 1, [tNumeric,tNumeric],           \[xs] -> [ x | x <- toNums xs ],           \[xs] -> [| [ x | x <- toNums $xs ] |] ),-        ( "uminus", 1,+        ( "uminus", 1, [tNumeric,tNumeric],           \[xs] -> [ case x of XInt n -> XInt (-n); XFloat n -> XFloat (-n) | x <- toNums xs ],           \[xs] -> [| [ case x of XInt n -> XInt (-n); XFloat n -> XFloat (-n) | x <- toNums $xs ] |] ),-        ( "abs", 1,+        ( "abs", 1, [tNumeric,tNumeric],           \[xs] -> [ case x of XInt n -> XInt (abs n); XFloat n -> XFloat (abs n) | x <- toNums xs ],           \[xs] -> [| [ case x of XInt n -> XInt (abs n); XFloat n -> XFloat (abs n) | x <- toNums $xs ] |] ),-        ( "ceiling", 1,+        ( "ceiling", 1, [tNumeric,tNumeric],           \[xs] -> [ case x of XInt n -> XInt n; XFloat n -> XInt (ceiling n) | x <- toNums xs ],           \[xs] -> [| [ case x of XInt n -> XInt n; XFloat n -> XInt (ceiling n) | x <- toNums $xs ] |] ),-        ( "round", 1,+        ( "round", 1, [tNumeric,tNumeric],           \[xs] -> [ case x of XInt n -> XInt n; XFloat n -> XInt (round n) | x <- toNums xs ],           \[xs] -> [| [ case x of XInt n -> XInt n; XFloat n -> XInt (round n) | x <- toNums $xs ] |] ),-        ( "floor", 1,+        ( "floor", 1, [tNumeric,tNumeric],           \[xs] -> [ case x of XInt n -> XInt n; XFloat n -> XInt (floor n) | x <- toNums xs ],           \[xs] -> [| [ case x of XInt n -> XInt n; XFloat n -> XInt (floor n) | x <- toNums $xs ] |] ), -- boolean operations-        ( "true", 0,+        ( "true", 0, [tBool],           \[] -> [trueXT],           \[] -> [| [trueXT] |] ),-        ( "false", 0,+        ( "false", 0, [tBool],           \[] -> [falseXT],           \[] -> [| [falseXT] |] ),-        ( "if", 3,+        ( "if", 3, [tBool,TAny,TAny],           \[cs,xs,ys] -> if conditionTest cs then xs else ys,           \[cs,xs,ys] -> [| if conditionTest $cs then $xs else $ys |] ),-        ( "and", 2,-          \[xs,ys] -> toBool $ (conditionTest xs) && (conditionTest ys),-          \[xs,ys] -> [| toBool $ (conditionTest $xs) && (conditionTest $ys) |] ),-        ( "or", 2,-          \[xs,ys] -> toBool $ (conditionTest xs) || (conditionTest ys),-          \[xs,ys] -> [| toBool $ (conditionTest $xs) || (conditionTest $ys) |] ),-        ( "not", 1,-          \[xs] -> toBool $ not $ conditionTest xs,-          \[xs] -> [| toBool $ not $ conditionTest $xs |] ),-        ( "some", 1,-          \[xs] -> toBool $ or [ conditionTest [x] | x <- xs ],-          \[xs] -> [| toBool $ or [ conditionTest [x] | x <- $xs ] |] ),+        ( "and", 2, [tBool,tBool,tBool],+          \[xs,ys] -> toBoolean $ (conditionTest xs) && (conditionTest ys),+          \[xs,ys] -> [| toBoolean $ (conditionTest $xs) && (conditionTest $ys) |] ),+        ( "or", 2, [tBool,tBool,tBool],+          \[xs,ys] -> toBoolean $ (conditionTest xs) || (conditionTest ys),+          \[xs,ys] -> [| toBoolean $ (conditionTest $xs) || (conditionTest $ys) |] ),+        ( "not", 1, [tBool,tBool],+          \[xs] -> toBoolean $ not $ conditionTest xs,+          \[xs] -> [| toBoolean $ not $ conditionTest $xs |] ),+        ( "some", 1, [tBool,tStar TAny],+          \[xs] -> toBoolean $ or [ conditionTest [x] | x <- xs ],+          \[xs] -> [| toBoolean $ or [ conditionTest [x] | x <- $xs ] |] ), -- aggregations-        ( "count", 1,+        ( "count", 1, [tInt,tStar TAny],           \[xs] -> [ XInt (length xs) ],           \[xs] -> [| [ XInt (length $xs) ] |] ),-        ( "sum", 1,+        ( "sum", 1, [tNumeric,tStar tNumeric],           \[xs] -> sumSeq xs,           \[xs] -> [| sumSeq $xs |] ),-        ( "avg", 1,+        ( "avg", 1, [tNumeric,tStar tNumeric],           \[xs] -> [ XFloat (mean [ getFloat x | x <- toNums xs ]) ],           \[xs] -> [| [ XFloat (mean [ getFloat x | x <- toNums $xs ]) ] |] ),-        ( "min", 1,+        ( "min", 1, [tNumeric,tStar tNumeric],           \[xs] -> minSeq xs,           \[xs] -> [| minSeq $xs |] ),-        ( "max", 1,+        ( "max", 1, [tNumeric,tStar tNumeric],           \[xs] -> maxSeq xs,           \[xs] -> [| maxSeq $xs |] ), -- string operations-        ( "concat", -1,+        ( "concat", -1, [tString],           \ss -> [ XText $ foldr (\s r -> concat [ x | x <- strings s ] ++ r) "" ss ],           \ss -> [| [ XText $ $(foldr (\s r -> [| concat [ x | x <- strings $s ] ++ $r |]) [| "" |] ss) ] |] ),-        ( "substring", 3,+        ( "substring", 3, [tString,tString,tNumeric,tNumeric],           \[xs,n1,n2] -> [ XText (take m2 (drop (m1-1) x))                          | x <- strings xs, XInt m1 <- toNums n1, XInt m2 <- toNums n2 ],           \[xs,n1,n2] -> [| [ XText (take m2 (drop (m1-1) x))                             | x <- strings $xs, XInt m1 <- toNums $n1, XInt m2 <- toNums $n2 ] |] ),-        ( "substring", 2,+        ( "substring", 2, [tString,tString,tNumeric],           \[xs,n] -> [ XText (drop (m-1) x) | x <- strings xs, XInt m <- toNums n ],           \[xs,n] -> [| [ XText (drop (m-1) x) | x <- strings $xs, XInt m <- toNums $n ] |] ),-        ( "substring-before", 2,+        ( "substring-before", 2, [tString,tString,tString],           \[xs,ys] -> [ XText (substring_before x y)  | x <- strings xs, y <- strings ys ],           \[xs,ys] -> [| [ XText (substring_before x y)  | x <- strings $xs, y <- strings $ys ] |] ),-        ( "substring-after", 2,+        ( "substring-after", 2, [tString,tString,tString],           \[xs,ys] -> [ XText (substring_after x y)  | x <- strings xs, y <- strings ys ],           \[xs,ys] -> [| [ XText (substring_after x y)  | x <- strings $xs, y <- strings $ys ] |] ),-        ( "starts-with", 2,-          \[xs,ys] -> toBool $ or [ x == "" || isPrefixOf y x  | x <- strings xs, y <- strings ys ],-          \[xs,ys] -> [| toBool $ or [ x == "" || isPrefixOf y x  | x <- strings $xs, y <- strings $ys ] |] ),-        ( "ends-with", 2,-          \[xs,ys] -> toBool $ or [ x == "" || isSuffixOf y x  | x <- strings xs, y <- strings ys ],-          \[xs,ys] -> [| toBool $ or [ x == "" || isSuffixOf y x  | x <- strings $xs, y <- strings $ys ] |] ),-        ( "string-join", 2,+        ( "starts-with", 2, [tString,tString,tString],+          \[xs,ys] -> toBoolean $ or [ x == "" || isPrefixOf y x  | x <- strings xs, y <- strings ys ],+          \[xs,ys] -> [| toBoolean $ or [ x == "" || isPrefixOf y x  | x <- strings $xs, y <- strings $ys ] |] ),+        ( "ends-with", 2, [tString,tString,tString],+          \[xs,ys] -> toBoolean $ or [ x == "" || isSuffixOf y x  | x <- strings xs, y <- strings ys ],+          \[xs,ys] -> [| toBoolean $ or [ x == "" || isSuffixOf y x  | x <- strings $xs, y <- strings $ys ] |] ),+        ( "string-join", 2, [tString,tString,tString],           \[xs,ys] -> [ XText $ intercalate y (strings xs) | y <- strings ys ],           \[xs,ys] -> [| [ XText $ intercalate y (strings $xs) | y <- strings $ys ] |] ),-        ( "string-length", 1,+        ( "string-length", 1, [tInt,tString],           \[xs] -> [ XInt $ length x | x <- strings xs ],           \[xs] -> [| [ XInt $ length x | x <- strings $xs ] |] ),-        ( "translate", 3,+        ( "translate", 3, [tString,tString,tString,tString],           \[xs,ys,zs] -> [ XText $ translate_string x y z  | x <- strings xs, y <- strings ys, z <- strings zs ],           \[xs,ys,zs] -> [| [ XText $ translate_string x y z  | x <- strings $xs, y <- strings $ys, z <- strings $zs ] |] ),-        ( "matches", 2,-          \[xs,ys] -> toBool $ or [ matchTest (mkRegex y) x | x <- strings xs, y <- strings ys ],-          \[xs,ys] -> [| toBool $ or [ matchTest (mkRegex y) x | x <- strings $xs, y <- strings $ys ] |] ),-        ( "replace", 3,+        ( "matches", 2, [tBool,tString,tString],+          \[xs,ys] -> toBoolean $ or [ matchTest (mkRegex y) x | x <- strings xs, y <- strings ys ],+          \[xs,ys] -> [| toBoolean $ or [ matchTest (mkRegex y) x | x <- strings $xs, y <- strings $ys ] |] ),+        ( "replace", 3, [tString,tString,tString,tString],           \[xs,ys,zs] -> [ XText $ replaceString x z (map snd $ concatMap A.elems $ matchAllText (mkRegex y) x)                          | x <- strings xs, y <- strings ys, z <- strings zs ],           \[xs,ys,zs] -> [| [ XText $ replaceString x z (map snd $ concatMap A.elems $ matchAllText (mkRegex y) x)                             | x <- strings $xs, y <- strings $ys, z <- strings $zs ] |] ),-        ( "contains", 2,-          \[xs,text] -> toBool $ or [ contains x t | x <- strings xs, t <- strings text ],-          \[xs,text] -> [| toBool $ or [ contains x t | x <- strings $xs, t <- strings $text ] |] ),-        ( "compare", 2,+        ( "contains", 2, [tBool,tString,tString],+          \[xs,text] -> toBoolean $ or [ contains x t | x <- strings xs, t <- strings text ],+          \[xs,text] -> [| toBoolean $ or [ contains x t | x <- strings $xs, t <- strings $text ] |] ),+        ( "compare", 2, [tInt,tString,tString],           \[xs,ys] -> [ XInt $ case compare x y of EQ -> 0; LT -> -1; GT -> 1 | x <- strings xs, y <- strings ys ],           \[xs,ys] -> [| [ XInt $ case compare x y of EQ -> 0; LT -> -1; GT -> 1 | x <- strings $xs, y <- strings $ys ] |] ),-        ( "upper-case", 1,+        ( "upper-case", 1, [tString,tString],           \[xs] -> [ XText $ map toUpper x | x <- strings xs ],           \[xs] -> [| [ XText $ map toUpper x | x <- strings $xs ] |] ),-        ( "lower-case", 1,+        ( "lower-case", 1, [tString,tString],           \[xs] -> [ XText $ map toLower x | x <- strings xs ],           \[xs] -> [| [ XText $ map toLower x | x <- strings $xs ] |] ),-        ( "normalize-space", 1,+        ( "normalize-space", 1, [tString,tString],           \[xs] -> [ XText $ unwords $ words x  | x <- strings xs ],           \[xs] -> [| [ XText $ unwords $ words x  | x <- strings $xs ] |] ), -- sequence operations-        ( "empty", 0,+        ( "empty", 0, [TAny],           \[] -> [],           \[] -> [| [] |] ),-        ( "empty", 1,-          \[xs] -> toBool $ null xs,-          \[xs] -> [| toBool $ null $xs |] ),-        ( "exists", 1,-          \[xs] -> toBool $ (not (null xs)),-          \[xs] -> [| toBool $ (not (null $xs)) |] ),-        ( "to", 2,+        ( "empty", 1, [tBool,tStar TAny],+          \[xs] -> toBoolean $ null xs,+          \[xs] -> [| toBoolean $ null $xs |] ),+        ( "exists", 1, [tBool,tStar TAny],+          \[xs] -> toBoolean $ (not (null xs)),+          \[xs] -> [| toBoolean $ (not (null $xs)) |] ),+        ( "to", 2, [tStar tInt,tInt,tInt],           \[xs,ys] -> [ XInt i | XInt n <- toNums xs, XInt m <- toNums ys, i <- [n..m] ],           \[xs,ys] -> [| [ XInt i | XInt n <- toNums $xs, XInt m <- toNums $ys, i <- [n..m] ] |] ),-        ( "concatenate", 2,+        ( "concatenate", 2, [tStar TAny,tStar TAny,tStar TAny],           \[xs,ys] -> xs ++ ys,           \[xs,ys] -> [| $xs ++ $ys |] ),-        ( "distinct-values", 1,+        ( "distinct-values", 1, [tStar TAny,tStar TAny],           \[xs] -> distinct xs,           \[xs] -> [| distinct $xs |] ),-        ( "union", 2,+        ( "union", 2, [tStar TAny,tStar TAny,tStar TAny],           \[xs,ys] -> distinct (xs ++ ys),           \[xs,ys] -> [| distinct ($xs ++ $ys) |] ),-        ( "intersect", 2,+        ( "intersect", 2, [tStar TAny,tStar TAny,tStar TAny],           \[xs,ys] -> intersect xs ys,           \[xs,ys] -> [| intersect $xs $ys |] ),-        ( "except", 2,+        ( "except", 2, [tStar TAny,tStar TAny,tStar TAny],           \[xs,ys] -> xs \\ ys,           \[xs,ys] -> [| $xs \\ $ys |] ),-        ( "reverse", 1,+        ( "reverse", 1, [tStar TAny,tStar TAny],           \[xs] -> reverse xs,           \[xs] -> [| reverse $xs |] ),-        ( "subsequence", 2,+        ( "subsequence", 2, [tStar TAny,tStar TAny,tInt],           \[xs,n] -> concat [ drop (m-1) xs | XInt m <- toNums n ],           \[xs,n] -> [| concat [ drop (m-1) $xs | XInt m <- toNums $n ] |] ),-        ( "subsequence", 3,+        ( "subsequence", 3, [tStar TAny,tStar TAny,tInt,tInt],           \[xs,n1,n2] -> concat [ take m2 (drop (m1-1) xs) | XInt m1 <- toNums n1, XInt m2 <- toNums n2 ],           \[xs,n1,n2] -> [| concat [ take m2 (drop (m1-1) $xs) | XInt m1 <- toNums $n1, XInt m2 <- toNums $n2 ] |] ),-        ( "insert-before", 3,+        ( "insert-before", 3, [tStar TAny,tStar TAny,tStar TAny,tInt],           \[xs,n,ys] -> concat [ (take (i-1) xs)++ys++(drop (i-1) xs) | XInt i <- toNums n ],           \[xs,n,ys] -> [| let x = $xs in concat [ (take (i-1) x) ++ $ys ++ (drop (i-1) x) | XInt i <- toNums $n ] |] ),-        ( "index-of", 2,+        ( "index-of", 2, [tInt,tStar TAny,TAny,tInt],           \[xs,ys] -> [ XInt (i+1) | y <- ys, i <- elemIndices y xs ],           \[xs,ys] -> [| [ XInt (i+1) | y <- $ys, i <- elemIndices y $xs ] |] ),-        ( "remove", 2,+        ( "remove", 2, [tStar TAny,tStar TAny,tInt],           \[xs,ys] -> concat [ (take (i-1) xs)++(drop i xs) | XInt i <- toNums ys ],           \[xs,ys] -> [| let x = $xs in concat [ (take (i-1) x)++(drop i x) | XInt i <- toNums $ys ] |] ), -- type testing and casting-        ( "data", 1,+        ( "data", 1, [TAny,TAny],           \[xs] -> toData xs,           \[xs] -> [| toData $xs |] ),-        ( "text", 1,+        ( "text", 1, [tString,tNode],           \[xs] -> [ w | XElem _ _ _ _ ts <- xs, w <- toData ts ],           \[xs] -> [| [ w | XElem _ _ _ _ ts <- $xs, w <- toData ts ] |] ),-        ( "string", 1,+        ( "string", 1, [tString,TAny],           \[xs] -> string xs,           \[xs] -> [| string $xs |] ),-        ( "name", 1,+        ( "name", 1, [tString,TAny],           \[xs] -> getNames xs,           \[xs] -> [| getNames $xs |] ),-        ( "local-name", 1,+        ( "local-name", 1, [tString,TAny],           \[xs] -> getNames xs,           \[xs] -> [| getNames $xs |] ),-        ( "number", 1,+        ( "number", 1, [tNumeric,TAny],           \[xs] -> toNums xs,           \[xs] -> [| toNums $xs |] ),-        ( "boolean", 1,-          \[xs] -> toBool $ or [ conditionTest [x] | x <- xs ],-          \[xs] -> [| toBool $ or [ conditionTest [x] | x <- $xs ] |] ),-        ( "node", 1,+        ( "boolean", 1, [tBool,TAny],+          \[xs] -> toBoolean $ or [ conditionTest [x] | x <- xs ],+          \[xs] -> [| toBoolean $ or [ conditionTest [x] | x <- $xs ] |] ),+        ( "node", 1, [tNode,TAny],           \[xs] -> [ w | XElem _ _ _ _ ts <- xs, w <- ts ],           \[xs] -> [| [ w | XElem _ _ _ _ ts <- $xs, w <- ts ] |] ),-        ( "instance-of", 2,+        ( "instance-of", 2, [tBool,TAny,TAny],           \[e,[XType tp]] -> [ XBool $ instanceOf e tp ],           \[e,tp] -> [| case $tp of [XType t] -> [ XBool $ instanceOf $e t ] |] ),-        ( "cast-as", 2,+        ( "cast-as", 2, [TAny,TAny,TAny],           \[e,[XType tp]] -> castAs e tp,           \[e,tp] -> [| case $tp of [XType t] -> castAs $e t |] ),-        ( "castable-as", 2,+        ( "castable-as", 2, [tBool,TAny,TAny],           \[e,[XType tp]] -> [ XBool $ castableAs e tp ],           \[e,tp] -> [| case $tp of [XType t] -> [ XBool $ castableAs $e t ] |] ), -- miscellaneous operations-        ( "trace", 2,+        ( "trace", 2, [TAny,TAny,TAny],           \[xs,ys] -> trace ("*** trace: "++show xs) ys,           \[xs,ys] -> [| trace ("*** trace: "++show $xs) $ys |] ),-        ( "debug", 1,+        ( "debug", 1, [TAny,TAny],           \_ -> error "the debug() call must be handled separately",           \_ -> error "Debugging is not permitted at compile-time." ),-        ( "error", 0,+        ( "error", 0, [TAny],           \[] -> error "XQuery error" ,           \[] -> [| error "XQuery error" |] ),-        ( "error", 2,+        ( "error", 2, [TAny,TAny,TAny],           \[xs,ys] -> error (showXS xs++": "++show ys),           \[xs,ys] -> [| error (showXS $xs++": "++show $ys) |] ),-        ( "last", 0,+        ( "last", 0, [tInt],           \[] -> error "the 'last()' call must be handled separately",           \[] -> error "the 'last()' call must be handled separately" ),-        ( "position", 0,+        ( "position", 0, [tInt],           \[] -> error "the 'position()' call must be handled separately",           \[] -> error "the 'position()' call must be handled separately" )    ]
src/Text/XML/HXQ/Interpreter.hs view
@@ -4,7 +4,7 @@ - Programmer: Leonidas Fegaras - Email: fegaras@cse.uta.edu - Web: http://lambda.uta.edu/-- Creation: 03/22/08, last update: 06/14/09+- Creation: 03/22/08, last update: 09/29/09 -  - Copyright (c) 2008 by Leonidas Fegaras, the University of Texas at Arlington. All rights reserved. - This material is provided as is, with absolutely no warranty expressed or implied.@@ -29,6 +29,7 @@ import Text.XML.HXQ.Functions import Text.XML.HXQ.Compiler import Text.XML.HXQ.Types+import Text.XML.HXQ.TypeInference import System.Console.Haskeline import System.Console.Haskeline.History import Control.Monad.Trans(liftIO)@@ -39,8 +40,9 @@ type Environment = [(String,XSeq)]  --- a user-defined function is (fname,parameters,body)-type Functions = [(String,[String],Ast)]+-- a user-defined function is (fname,parameters,body,signature)+type Functions = [(QName,[String],Ast,([Type],Type))]+type Views = [(String,[String],Ast)]   undefv1 = error "Undefined XQuery context (.)"@@ -50,8 +52,8 @@  -- Each XPath predicate must calculate position() and last() from its input XSeq -- if last() is used, then the evaluation is blocking (need to store the whole input XSeq)-applyPredicates :: [Ast] -> XSeq -> Environment -> Functions -> XSeq-applyPredicates preds xs env fncs+applyPredicates :: [Ast] -> XSeq -> Environment -> Functions -> NS -> XSeq+applyPredicates preds xs env fncs ns     = foldl' (\s p -> applyPred s p True) xs preds       where applyPred [] _ _ = []             applyPred xs (Aint n) _           -- shortcut that improves laziness@@ -65,11 +67,11 @@             applyPred xs pred _                 | containsLast pred           -- blocking: use only when last() is used in the predicate                 = let last = length xs-                  in foldir (\x i r -> case eval pred x i last "" env fncs of+                  in foldir (\x i r -> case eval pred x i last "" env fncs ns of                                          [XInt k] -> if k == i then x:r else r               -- indexing                                          b -> if conditionTest b then x:r else r) [] xs 1             applyPred xs pred _-                = foldir (\x i r -> case eval pred x i undefv3 "" env fncs of+                = foldir (\x i r -> case eval pred x i undefv3 "" env fncs ns of                                       [XInt k] -> if k == i then x:r else r                  -- indexing                                       b -> if conditionTest b then x:r else r) [] xs 1 @@ -82,97 +84,108 @@ --        eg, the effective axis of //(A | B) is descendant -- env: contains FLOWR variable bindings -- fncs: user-defined functions-eval :: Ast -> XTree -> Int -> Int -> String -> Environment -> Functions -> XSeq-eval e context position last effective_axis env fncs+-- ns: namespaces+eval :: Ast -> XTree -> Int -> Int -> String -> Environment -> Functions -> NS -> XSeq+eval e context position last effective_axis env fncs ns   = case e of       Avar "." -> [ context ]       Avar v -> findV v env+      Ast "global" [Avar v] -> findV v env       Aint n -> [ XInt n ]       Afloat n -> [ XFloat n ]       Astring s -> [ XText s ]       Ast "context" [v,Astring dp,body]-          -> foldr (\x r -> (eval body x position last dp env fncs)++r)-                   [] (eval v context position last effective_axis env fncs)+          -> foldr (\x r -> (eval body x position last dp env fncs ns)++r)+                   [] (eval v context position last effective_axis env fncs ns)       Ast "call" [Avar "position"] -> [XInt position]       Ast "call" [Avar "last"] -> [XInt last]       Ast "step" (Avar "child":tag:Avar ".":preds)           | effective_axis /= ""-          -> eval (Ast "step" (Avar effective_axis:tag:Avar ".":preds)) context position last "" env fncs+          -> eval (Ast "step" (Avar effective_axis:tag:Avar ".":preds)) context position last "" env fncs ns       Ast "step" (Avar "descendant_any":Ast "tags" tags:e:preds)-          -> let ts = map (\(Avar tag) -> tag) tags-                 v = eval e context position last effective_axis env fncs-             in if v==[XNull]-                then v-                else foldr (\x r -> (applyPredicates preds (descendant_any_with_tagged_children ts x) env fncs)++r) [] v-      Ast "step" (Avar step:Astring tag:e:preds)+          -> let ts = map (\(Avar n) -> tag n ns) tags+             in case eval e context position last effective_axis env fncs ns of+                  v@[XNull] -> v+                  v -> foldr (\x r -> (applyPredicates preds (descendant_any_with_tagged_children ts x) env fncs ns)++r) [] v+      Ast "step" (Avar step:Astring n:e:preds)           -> let step_fnc = findV step pathFunctions-                 v = eval e context position last effective_axis env fncs-             in if v==[XNull]-                then v-                else foldr (\x r -> (applyPredicates preds (step_fnc tag x) env fncs)++r) [] v+                 tagname = tag n ns+             in case eval e context position last effective_axis env fncs ns of+                  v@[XNull] -> v+                  v ->  foldr (\x r -> (applyPredicates preds (step_fnc tagname x) env fncs ns)++r) [] v       Ast "filter" (e:preds)-          -> applyPredicates preds (eval e context position last effective_axis env fncs) env fncs+          -> applyPredicates preds (eval e context position last effective_axis env fncs ns) env fncs ns       Ast "predicate" [condition,body]-          -> if conditionTest (eval condition undefv1 undefv2 undefv3 "" env fncs)-             then eval body context position last effective_axis env fncs+          -> if conditionTest (eval condition undefv1 undefv2 undefv3 "" env fncs ns)+             then eval body context position last effective_axis env fncs ns              else []       Ast "append" args-          -> appendText (map (\x -> eval x context position last effective_axis env fncs) args)+          -> appendText (map (\x -> eval x context position last effective_axis env fncs ns) args)       Ast "if" [c,t,e]-          -> if conditionTest (eval c context position last effective_axis env fncs)-             then eval t context position last effective_axis env fncs-             else eval e context position last effective_axis env fncs+          -> if conditionTest (eval c context position last effective_axis env fncs ns)+             then eval t context position last effective_axis env fncs ns+             else eval e context position last effective_axis env fncs ns+      Ast "validate" [e]      -- blocking+          -> let vs = eval e context position last effective_axis env fncs ns+             in case validateXSeq vs ns of+                  Success xs -> vs+                  Failure ts -> error ("Failed to validate the XML element: "++show ts)       Ast f _           | elem f ["insert","delete","replace"]           -> error "Updates must be over XML data stored in databases"       Ast "call" (v@(Avar fname):args)-          -> let vs = map (\x -> eval x context position last effective_axis env fncs) args-             in case filter (\(n,_,_,_) -> n == fname || ("fn:"++n) == fname) systemFunctions of-                  [] -> if isBuildInType fname  && length vs == 1-                        then castAs (head vs) v-                        else error "External function calls must be within the IO monad"-                  fs -> case filter (\(_,len,_,_) -> len < 0 || length args == len) fs of+          -> let vs = map (\x -> eval x context position last effective_axis env fncs ns) args+                 fn = functionTag fname ns+                 t = tag fname ns+             in if uri t == xsNamespace && isBuildInType (localName t)  && length vs == 1+                then castAs (head vs) (TBase t)+                else case filter (\(n,_,_,_,_) -> n == localName fn) systemFunctions of+                  [] -> error "External function calls must be within the IO monad"+                  fs -> case filter (\(_,len,_,_,_) -> len < 0 || length args == len) fs of                           [] -> error ("wrong number of arguments in function call: " ++ fname)-                          (_,_,f,_):_ -> f vs+                          (_,_,_,f,_):_ -> f vs       Ast "construction" [tag,id,parent,Ast "attributes" al,body]-             -> let ct = eval tag context position last effective_axis env fncs-                    bc = eval body context position last effective_axis env fncs+             -> let ct = eval tag context position last effective_axis env fncs ns+                    bc = eval body context position last effective_axis env fncs ns                     (as,bs) = span (\x -> case x of XAttr _ _ -> True; _ -> False) bc                     alc = concatMap (\(Ast "pair" [a,v])-                                     -> let ac = eval a context position last effective_axis env fncs-                                            vc = eval v context position last effective_axis env fncs-                                        in if vc==[XNull] then [] else [(qName ac,showXS vc)]) al+                                     -> let ac = eval a context position last effective_axis env fncs ns+                                            vc = eval v context position last effective_axis env fncs ns+                                        in makeAttribute ac vc ns) al                           ++ [ (n,v) | XAttr n v <- as ]-                    vid = case eval id context position last effective_axis env fncs of+                    vid = case eval id context position last effective_axis env fncs ns of                             [XText vid] -> (read vid)::Int                             _ -> 0-                    vparent = eval parent context position last effective_axis env fncs-                in [ XElem (qName ct) alc vid (if null vparent then parent_error else head vparent) bs ]+                    vparent = eval parent context position last effective_axis env fncs ns+                in [ XElem (qName ct ns) alc vid (if null vparent then parent_error else head vparent) bs ]       Ast "attribute_construction" [name,value]-          -> let ns = eval name context position last effective_axis env fncs-                 vs = eval value context position last effective_axis env fncs-             in [ XAttr (qName ns) (showXS vs) ]+          -> let nms = eval name context position last effective_axis env fncs ns+                 vs = eval value context position last effective_axis env fncs ns+             in case nms of+                  [XText s] -> [ XAttr (attributeTag s ns) (showXS vs) ]+                  _ -> error ("Illegal attribute: "++show e)       Ast "let" [Avar var,source,body]-          -> eval body context position last effective_axis-                  ((var,eval source context position last effective_axis env fncs):env) fncs+          -> let es = eval source context position last effective_axis env fncs ns+             in eval body context position last effective_axis ((var,es):env) fncs ns       Ast "for" [Avar var,Avar "$",source,body]      -- a for-loop without an index-          -> foldr (\a r -> (eval body a undefv2 undefv3 "" ((var,[a]):env) fncs)++r)-                   [] (eval source context position last effective_axis env fncs)+          -> foldr (\a r -> (eval body a undefv2 undefv3 "" ((var,[a]):env) fncs ns)++r)+                   [] (eval source context position last effective_axis env fncs ns)       Ast "for" [Avar var,Avar ivar,source,body]     -- a for-loop with an index           -> let p = maxPosition (Avar ivar) body-                 ns = if p > 0              -- there is a top-k like restriction+                 ts = if p > 0              -- there is a top-k like restriction                       then Ast "step" [source,Ast "call" [Avar "<=",pathPosition,Aint p]]                       else source -             in foldir (\a i r -> (eval body a i undefv3 "" ((var,[a]):(ivar,[XInt i]):env) fncs)++r)-                       [] (eval ns context position last effective_axis env fncs) 1+             in foldir (\a i r -> (eval body a i undefv3 "" ((var,[a]):(ivar,[XInt i]):env) fncs ns)++r)+                       [] (eval ts context position last effective_axis env fncs ns) 1       Ast "sortTuple" (exp:orderBys)             -- prepare each FLWOR tuple for sorting-          -> let ee = eval exp context position last effective_axis env fncs-             in [ XElem "" [] 0 parent_error-                     (foldl (\r a -> r++[XElem "" [] 0 parent_error (toData (eval a context position last effective_axis env fncs))])-                            [XElem "" [] 0 parent_error ee] orderBys) ]+          -> let ee = eval exp context position last effective_axis env fncs ns+             in [ XElem (QName "" "" "") [] 0 parent_error+                     (foldl (\r a -> r++[XElem (QName "" "" "") [] 0 parent_error+                                               (toData (eval a context position last effective_axis env fncs ns))])+                            [XElem (QName "" "" "") [] 0 parent_error ee] orderBys) ]       Ast "sort" (exp:ordList)                   -- blocking           -> let ce = map (\(XElem _ _ _ _ xs) -> map (\(XElem _ _ _ _ ys) -> ys) xs)-                          (eval exp context position last effective_axis env fncs)+                          (eval exp context position last effective_axis env fncs ns)                  ordering = foldr (\(Avar ord) r (x:xs) (y:ys)                                        -> case compareXSeqs (ord == "ascending") x y of                                             EQ -> r xs ys@@ -180,16 +193,16 @@                                   (\xs ys -> EQ) ordList              in concatMap head (sortBy (\(_:xs) (_:ys) -> ordering xs ys) ce)       Ast "type" [tp]-          -> [ XType tp ]-      _ -> error ("Illegal XQuery: "++(show e))+          -> [ XType (toType tp ns) ]+      _ -> error ("Illegal XQuery: "++show e)   type Statements = [(String,Statement)]   -- The monadic applyPredicates that propagates IO state-applyPredicatesM :: [Ast] -> XSeq -> Environment -> Functions -> Connection -> Statements -> IO XSeq-applyPredicatesM preds xs env fncs db stmts+applyPredicatesM :: [Ast] -> XSeq -> Environment -> Functions -> NS -> Connection -> Statements -> IO XSeq+applyPredicatesM preds xs env fncs ns db stmts     = foldl' (\s p -> s >>= \r -> applyPred r p True) (return xs) preds       where applyPred [] _ _ = return []             applyPred xs (Aint n) _           -- shortcut that improves laziness@@ -203,7 +216,7 @@             applyPred xs pred _                 | containsLast pred           -- blocking: use only when last() is used in the predicate                 = let last = length xs-                  in foldir (\x i r -> do vs <- evalM pred x i last "" env fncs db stmts+                  in foldir (\x i r -> do vs <- evalM pred x i last "" env fncs ns db stmts                                           s <- r                                           return $! (if case vs of                                                           [XInt k] -> k == i            -- indexing@@ -211,7 +224,7 @@                                                      then x:s else s))                             (return []) xs 1             applyPred xs pred _-                = foldir (\x i r -> do vs <- evalM pred x i undefv3 "" env fncs db stmts+                = foldir (\x i r -> do vs <- evalM pred x i undefv3 "" env fncs ns db stmts                                        s <- r                                        return $! (if case vs of                                                        [XInt k] -> k == i               -- indexing@@ -221,19 +234,20 @@   -- The monadic XQuery interpreter; it is like eval but has plumbing to propagate IO state-evalM :: Ast -> XTree -> Int -> Int -> String -> Environment -> Functions -> Connection -> Statements -> IO XSeq-evalM e context position last effective_axis env fncs db stmts+evalM :: Ast -> XTree -> Int -> Int -> String -> Environment -> Functions -> NS -> Connection -> Statements -> IO XSeq+evalM e context position last effective_axis env fncs ns db stmts   = case e of       Avar "." -> return $! [ context ]       Avar v -> return $! (findV v env)+      Ast "global" [Avar v] -> return $! (findV v env)       Aint n -> return $! [ XInt n ]       Afloat n -> return $! [ XFloat n ]       Astring s -> return $! [ XText s ]       -- for non-IO XQuery, use the regular eval-      Ast "nonIO" [u] -> return $! (eval u context position last effective_axis env fncs)+      Ast "nonIO" [u] -> return $! (eval u context position last effective_axis env fncs ns)       Ast "context" [v,Astring dp,body]-          -> do vs <- evalM v context position last effective_axis env fncs db stmts-                foldr (\x r -> (liftM2 (++)) (evalM body x position last dp env fncs db stmts) r)+          -> do vs <- evalM v context position last effective_axis env fncs ns db stmts+                foldr (\x r -> (liftM2 (++)) (evalM body x position last dp env fncs ns db stmts) r)                       (return []) vs       Ast "call" [Avar "position"] -> return $! [XInt position]       Ast "call" [Avar "last"] -> return $! [XInt last]@@ -242,120 +256,125 @@           -> do doc <- downloadFile file                 return $! [materialize False (parseDocument doc)]       Ast "call" [Avar "debug",c]-          -> do ec <- evalM c context position last effective_axis env fncs db stmts-                debugSession ec env fncs [] db+          -> do ec <- evalM c context position last effective_axis env fncs ns db stmts+                debugSession ec env fncs ns [] db       Ast "call" [Avar "eval",x]-          -> do xc <- evalM x context position last effective_axis env fncs db stmts+          -> do xc <- evalM x context position last effective_axis env fncs ns db stmts                 case xc of-                  [ XText q ] -> do (res,_,_,_) <- evalQueryM (parse (scan q)) env fncs [] db False+                  [ XText q ] -> do (res,_,_,_,_) <- evalQueryM (parse (scan q)) env fncs ns [] db False False                                     return res                   _ -> error $ "The eval argument must be a string: " ++ show xc       Ast "step" (Avar "child":tag:Avar ".":preds)           | effective_axis /= ""-          -> evalM (Ast "step" (Avar effective_axis:tag:Avar ".":preds)) context position last "" env fncs db stmts+          -> evalM (Ast "step" (Avar effective_axis:tag:Avar ".":preds)) context position last "" env fncs ns db stmts       Ast "step" (Avar "descendant_any":Ast "tags" tags:e:preds)-          -> do vs <- evalM e context position last effective_axis env fncs db stmts-                let ts = map (\(Avar tag) -> tag) tags-                if vs==[XNull]-                      then return vs-                      else foldr (\x r -> (liftM2 (++)) (applyPredicatesM preds (descendant_any_with_tagged_children ts x)-                                                                          env fncs db stmts) r)-                                 (return []) vs-      Ast "step" (Avar step:Astring tag:e:preds)+          -> do vs <- evalM e context position last effective_axis env fncs ns db stmts+                let ts = map (\(Avar n) -> tag n ns) tags+                case vs of+                  [XNull] -> return vs+                  _ -> foldr (\x r -> (liftM2 (++)) (applyPredicatesM preds (descendant_any_with_tagged_children ts x)+                                                                      env fncs ns db stmts) r)+                             (return []) vs+      Ast "step" (Avar step:Astring n:e:preds)           -> let step_fnc = findV step pathFunctions-             in do vs <- evalM e context position last effective_axis env fncs db stmts-                   if vs==[XNull]-                      then return vs-                      else foldr (\x r -> (liftM2 (++)) (applyPredicatesM preds (step_fnc tag x)-                                                                          env fncs db stmts) r)-                                 (return []) vs+                 tagname = tag n ns+             in do vs <- evalM e context position last effective_axis env fncs ns db stmts+                   case vs of+                     [XNull] -> return vs+                     _ -> foldr (\x r -> (liftM2 (++)) (applyPredicatesM preds (step_fnc tagname x)+                                                                         env fncs ns db stmts) r)+                                (return []) vs       Ast "filter" (e:preds)-          -> do vs <- evalM e context position last effective_axis env fncs db stmts-                applyPredicatesM preds vs env fncs db stmts+          -> do vs <- evalM e context position last effective_axis env fncs ns db stmts+                applyPredicatesM preds vs env fncs ns db stmts       Ast "predicate" [condition,body]-          -> do eb <- evalM condition undefv1 undefv2 undefv3 "" env fncs db stmts+          -> do eb <- evalM condition undefv1 undefv2 undefv3 "" env fncs ns db stmts                 if conditionTest eb-                   then evalM body context position last effective_axis env fncs db stmts+                   then evalM body context position last effective_axis env fncs ns db stmts                    else return []       Ast "executeSQL" [Avar var,args]-          -> do as <- evalM args context position last effective_axis env fncs db stmts+          -> do as <- evalM args context position last effective_axis env fncs ns db stmts                 executeSQL (findV var stmts) as       Ast "append" args-          -> (liftM appendText) (mapM (\x -> evalM x context position last effective_axis env fncs db stmts) args)+          -> (liftM appendText) (mapM (\x -> evalM x context position last effective_axis env fncs ns db stmts) args)       Ast "if" [c,t,e]     -- this is the only lazy function-          -> do ce <- evalM c context position last effective_axis env fncs db stmts-                evalM (if conditionTest ce then t else e) context position last effective_axis env fncs db stmts+          -> do ce <- evalM c context position last effective_axis env fncs ns db stmts+                evalM (if conditionTest ce then t else e) context position last effective_axis env fncs ns db stmts+      Ast "validate" [e]+          -> do vs <- evalM e context position last effective_axis env fncs ns db stmts+                case validateXSeq vs ns of+                  Success xs -> return vs+                  Failure ts -> error ("Failed to validate the XML element: "++show ts)       Ast "insert" [e1,e2]-          -> do v1 <- evalM e1 context position last effective_axis env fncs db stmts-                v2 <- evalM e2 context position last effective_axis env fncs db stmts+          -> do v1 <- evalM e1 context position last effective_axis env fncs ns db stmts+                v2 <- evalM e2 context position last effective_axis env fncs ns db stmts                 insertDB db v1 v2       Ast "delete" [e]-          -> do v <- evalM e context position last effective_axis env fncs db stmts+          -> do v <- evalM e context position last effective_axis env fncs ns db stmts                 deleteDB db v       Ast "replace" [e1,e2]-          -> do v1 <- evalM e1 context position last effective_axis env fncs db stmts-                v2 <- evalM e2 context position last effective_axis env fncs db stmts+          -> do v1 <- evalM e1 context position last effective_axis env fncs ns db stmts+                v2 <- evalM e2 context position last effective_axis env fncs ns db stmts                 replaceDB db v1 v2       Ast "call" (v@(Avar fname):args)        -- Note: strict function application-          -> case filter (\(n,_,_,_) -> n == fname || ("fn:"++n) == fname) systemFunctions of-               [] -> do vs <- mapM (\a -> evalM a context position last effective_axis env fncs db stmts) args-                        if isBuildInType fname  && length vs == 1-                           then return $! castAs (head vs) v-                           else case filter (\(n,_,_) -> n == fname) fncs of-                                  (_,params,body):_+          -> do vs <- mapM (\a -> evalM a context position last effective_axis env fncs ns db stmts) args+                let fn = functionTag fname ns+                    t = tag fname ns+                if uri t == xsNamespace && isBuildInType (localName t)  && length vs == 1+                   then return $! castAs (head vs) (TBase t)+                   else case filter (\(n,_,_,_,_) -> n == localName fn) systemFunctions of+                          [] -> case filter (\(n,_,_,_) -> n == fn) fncs of+                                  (_,params,body,_):_                                       -> if (length params) == (length args)                                          then let is = show $ length env-                                                  nparams = map (\p -> p++"_"++is) params-                                                  nbody = foldr (\p r -> subst p (Avar (p++"_"++is)) r) body params-                                              in evalM nbody context undefv2 undefv3 ""    -- alpha coercion-                                                    ((zip nparams vs)++env) fncs db stmts+                                              in evalM body context undefv2 undefv3 ""+                                                    ((zip params vs)++env) fncs ns db stmts                                          else error ("Wrong number of arguments in function call: "++fname)                                   _ -> error ("Undefined function: "++fname)-               fs -> case filter (\(_,len,_,_) -> len < 0 || length args == len) fs of-                       [] -> error ("wrong number of arguments in function call: " ++ fname)-                       (_,_,f,_):_ -> do vs <- mapM (\x -> evalM x context position last effective_axis env fncs db stmts) args-                                         return $ f vs+                          fs -> case filter (\(_,len,_,_,_) -> len < 0 || length args == len) fs of+                                  [] -> error ("wrong number of arguments in function call: " ++ fname)+                                  (_,_,_,f,_):_ -> return $ f vs       Ast "construction" [tag,id,parent,Ast "attributes" al,body]-             -> do ct <- evalM tag context position last effective_axis env fncs db stmts-                   bc <- evalM body context position last effective_axis env fncs db stmts+             -> do ct <- evalM tag context position last effective_axis env fncs ns db stmts+                   bc <- evalM body context position last effective_axis env fncs ns db stmts                    let (as,bs) = span (\x -> case x of XAttr _ _ -> True; _ -> False) bc                    alc <- foldM (\r (Ast "pair" [a,v])-                                     -> do ac <- evalM a context position last effective_axis env fncs db stmts-                                           vc <- evalM v context position last effective_axis env fncs db stmts-                                           if vc==[XNull] then return r else return $! (qName ac,showXS vc):r) [] al-                   vidm <- evalM id context position last effective_axis env fncs db stmts+                                     -> do ac <- evalM a context position last effective_axis env fncs ns db stmts+                                           vc <- evalM v context position last effective_axis env fncs ns db stmts+                                           return $ (makeAttribute ac vc ns)++r) [] al+                   vidm <- evalM id context position last effective_axis env fncs ns db stmts                    let vid = case vidm of                                [XText vid] -> (read vid)::Int                                _ -> 0-                   vparent <- evalM parent context position last effective_axis env fncs db stmts-                   return $! [ XElem (qName ct) (alc ++ [ (n,v) | XAttr n v <- as ])+                   vparent <- evalM parent context position last effective_axis env fncs ns db stmts+                   return $! [ XElem (qName ct ns) (alc ++ [ (n,v) | XAttr n v <- as ])                                          vid (if null vparent then parent_error else head vparent) bs ]       Ast "attribute_construction" [name,value]-          -> do n <- evalM name context position last effective_axis env fncs db stmts-                v <- evalM value context position last effective_axis env fncs db stmts-                return $! [ XAttr (qName n) (showXS v) ]+          -> do n <- evalM name context position last effective_axis env fncs ns db stmts+                v <- evalM value context position last effective_axis env fncs ns db stmts+                return $! map (\(s,v) -> XAttr s v) (makeAttribute n v ns)       Ast "let" [Avar var,source,body]-          -> do s <- evalM source context position last effective_axis env fncs db stmts-                evalM body context position last effective_axis ((var,s):env) fncs db stmts+          -> do s <- evalM source context position last effective_axis env fncs ns db stmts+                evalM body context position last effective_axis ((var,s):env) fncs ns db stmts       Ast "for" [Avar var,Avar "$",source,body]      -- a for-loop without an index-          -> do vs <- evalM source context position last effective_axis env fncs db stmts-                foldr (\a r -> (liftM2 (++)) (evalM body a undefv2 undefv3 "" ((var,[a]):env) fncs db stmts) r)+          -> do vs <- evalM source context position last effective_axis env fncs ns db stmts+                foldr (\a r -> (liftM2 (++)) (evalM body a undefv2 undefv3 "" ((var,[a]):env) fncs ns db stmts) r)                       (return []) vs       Ast "for" [Avar var,Avar ivar,source,body]     -- a for-loop with an index           -> do let p = maxPosition (Avar ivar) body-                    ns = if p > 0              -- there is a top-k like restriction+                    ts = if p > 0              -- there is a top-k like restriction                             then Ast "step" [source,Ast "call" [Avar "<=",pathPosition,Aint p]]                             else source -                vs <- evalM ns context position last effective_axis env fncs db stmts-                foldir (\a i r -> (liftM2 (++)) (evalM body a i undefv3 "" ((var,[a]):(ivar,[XInt i]):env) fncs db stmts) r)+                vs <- evalM ts context position last effective_axis env fncs ns db stmts+                foldir (\a i r -> (liftM2 (++)) (evalM body a i undefv3 "" ((var,[a]):(ivar,[XInt i]):env) fncs ns db stmts) r)                        (return []) vs 1       Ast "sortTuple" (exp:orderBys)             -- prepare each FLWOR tuple for sorting-          -> do vs <- evalM exp context position last effective_axis env fncs db stmts-                os <- mapM (\a -> evalM a context position last effective_axis env fncs db stmts) orderBys-                return $! [ XElem "" [] 0 parent_error (foldl (\r a -> r++[XElem "" [] 0 parent_error (toData a)])-                                                              [XElem "" [] 0 parent_error vs] os) ]+          -> do vs <- evalM exp context position last effective_axis env fncs ns db stmts+                os <- mapM (\a -> evalM a context position last effective_axis env fncs ns db stmts) orderBys+                return $! [ XElem (QName "" "" "") [] 0 parent_error (foldl (\r a -> r++[XElem (QName "" "" "") [] 0 parent_error (toData a)])+                                                                            [XElem (QName "" "" "") [] 0 parent_error vs] os) ]       Ast "sort" (exp:ordList)                   -- blocking-          -> do vs <- evalM exp context position last effective_axis env fncs db stmts+          -> do vs <- evalM exp context position last effective_axis env fncs ns db stmts                 let ce = map (\(XElem _ _ _ _ xs) -> map (\(XElem _ _ _ _ ys) -> ys) xs) vs                     ordering = foldr (\(Avar ord) r (x:xs) (y:ys)                                        -> case compareXSeqs (ord == "ascending") x y of@@ -364,19 +383,22 @@                                   (\xs ys -> EQ) ordList                 return $! (concatMap head (sortBy (\(_:xs) (_:ys) -> ordering xs ys) ce))       Ast "type" [tp]-          -> return [ XType tp ]-      _ -> error ("Illegal XQuery: "++(show e))+          -> return [ XType (toType tp ns) ]+      _ -> error ("Illegal XQuery: "++show e)   -- Haskeline settings-interactionSettings = defaultSettings { autoAddHistory = False }+interactionSettings+    = defaultSettings {+        autoAddHistory = False,+        historyFile = Just ".xquery_history.txt" }   -- evaluate from input continuously-evalInput :: (String -> Environment -> Functions -> Functions -> IO (Environment,Functions,Functions))-                 -> Environment -> Functions -> Functions -> String -> XSeq -> IO XSeq-evalInput eval es fs vs prompt dvalue-    = runInputT interactionSettings $ loop es fs vs+evalInput :: (String -> Environment -> Functions -> NS -> Views -> IO (Environment,Functions,NS,Views))+                 -> Environment -> Functions -> NS -> Views -> String -> XSeq -> IO XSeq+evalInput eval es fs ns vs prompt dvalue+    = runInputT interactionSettings $ loop es fs ns vs       where bracs s = (length $ filter (== '{') s) - (length $ filter (== '}') s)             oneline prompt = do line <- System.Console.Haskeline.catch                                               (withInterrupt (getInputLine prompt))@@ -392,7 +414,7 @@                                   else if line == "quit"                                        then return $! (line,0)                                        else readlines (x++" "++line) (bs+c)-            loop es fs vs+            loop es fs ns vs                 = do (line,c) <- oneline prompt                      (stmt,_) <- if head line == '{'                                  then if last line == '}' && c==0@@ -403,57 +425,126 @@                         then do outputStrLn $ if prompt == "> " then "Bye!" else ""                                 return dvalue                         else if all isSpace stmt-                             then loop es fs vs+                             then loop es fs ns vs                              else if take 7 stmt == "return "-                                  then do (result,_,_,_) <- liftIO $ handleInterrupt-                                                                        (xqueryE (drop 7 stmt) es fs vs-                                                                            (error "Cannot use database operations here") False)-                                                                        (return ([],es,fs,vs))+                                  then do (result,_,_,_,_) <- liftIO $ handleInterrupt+                                                                        (xqueryE (drop 7 stmt) es fs ns vs+                                                                            (error "Cannot use database operations here") False False)+                                                                        (return ([],es,fs,ns,vs))                                           return result                                   else do h <- get                                           put $ addHistory stmt h-                                          (nes,nfs,nvs) <- liftIO $ eval stmt es fs vs-                                          loop nes nfs nvs+                                          (nes,nfs,nns,nvs) <- liftIO $ eval stmt es fs ns vs+                                          loop nes nfs nns nvs  -debugSession :: XSeq -> Environment -> Functions -> Functions -> Connection -> IO XSeq-debugSession e env fncs views db+debugSession :: XSeq -> Environment -> Functions -> NS -> Views -> Connection -> IO XSeq+debugSession e env fncs ns views db     = do let se = show e          putStrLn $ "*** HXQ debugger: " ++ if null(index se 20) then se else (take 20 se) ++ " ..."          putStr $ "Local variables:"          mapM putStr (distinct $ map (\(v,_) -> " $"++v) env)          putStrLn "\nYou may evaluate any XQuery. Type ctr-D to exit and return the argument; type 'return exp' to exit and return exp."-         evalInput (\s es fs vs -> do (result,evs,nfs,nvs) <- xqueryE s es fs vs db False-                                      putXSeq result-                                      return $ (evs,nfs,nvs)) env fncs views "debug> " e+         evalInput (\s es fs ns vs -> do (result,evs,nfs,nns,nvs) <- xqueryE s es fs ns vs db False False+                                         putXSeq result+                                         return $ (evs,nfs,nns,nvs)) env fncs ns views "debug> " e  -evalQueryM :: [Ast] -> Environment -> Functions -> Functions -> Connection -> Bool -> IO (XSeq,Environment,Functions,Functions)-evalQueryM [] variables functions views db verbose-    = return $! ([],variables,functions,views)-evalQueryM (query:xs) variables functions views db verbose+identify_globals :: Ast -> [String] -> Environment -> Ast+identify_globals body vars variables+    = g body vars+      where g e vars+                = case e of+                    Avar v+                        -> if elem v vars+                           then e+                           else if memV ('_':v) variables+                                then Ast "global" [Avar ('_':v)]+                                else e+                    Ast "let" [Avar var,source,body]+                        -> Ast "let" [Avar var,g source vars,g body (var:vars)]+                    Ast "for" [Avar var,Avar ivar,source,body]+                        -> Ast "for" [Avar var,Avar ivar,g source vars,g body (var:ivar:vars)]+                    Ast "call" (f:args)+                        -> Ast "call" (f:map (\x -> g x vars) args)+                    Ast f args+                        -> Ast f (map (\x -> g x vars) args)+                    _ -> e+++evalQueryM :: [Ast] -> Environment -> Functions -> NS -> Views -> Connection -> Bool -> Bool+              -> IO (XSeq,Environment,Functions,NS,Views)+evalQueryM [] variables functions ns views db verbose typecheck+    = return $! ([],variables,functions,ns,views)+evalQueryM (query:xs) variables functions ns views db verbose typecheck     = case query of-        Ast "function" ((Avar f):body:args)-            -> do let opt = optimize (expandViews views body)+        Ast "function" ((Avar f):body:ot:args)+            -> do let params = map (\(Ast "pair" [Avar v,pt]) -> v) args+                      sig = map (\(Ast "pair" [Avar v,pt]) -> pt) args+                      nbody = identify_globals body params variables+                      opt = optimize (expandViews views nbody)                   if verbose                      then do putStrLn "Abstract Syntax Tree (AST):"-                             putStrLn (ppAst body)+                             putStrLn (ppAst nbody)                              putStrLn "Optimized AST:"                              putStrLn (ppAst opt)                      else return ()-                  evalQueryM xs variables ((f,map (\(Avar v) -> v) args,opt):functions) views db verbose+                  evalQueryM xs variables ((functionTag f ns,params,opt,(map (\x -> toType x ns) sig,toType ot ns)):functions)+                             ns views db verbose typecheck         Ast "view" ((Avar f):body:args)-            -> evalQueryM xs variables functions ((f,map (\(Avar v) -> v) args,body):views) db verbose-        Ast "variable" [Avar v,u]-            -> do uv <- evalM (optimize u) undefv1 undefv2 undefv3 "" variables functions db []-                  evalQueryM xs ((v,uv):variables) functions views db verbose-        _ -> do let opt = optimize (expandViews views query)-                    (ast,ns) = liftIOSources opt+            -> let params = map (\(Avar v) -> v) args+                   nbody = identify_globals body params variables+               in evalQueryM xs variables functions ns ((f,params,nbody):views) db verbose typecheck+        Ast "schema" [Avar "default-element",Astring uri]+            -> evalQueryM xs variables functions ns{defaultElementNS=uri} views db verbose typecheck+        Ast "schema" [Avar "default-function",Astring uri]+            -> evalQueryM xs variables functions ns{defaultFunctionNS=uri} views db verbose typecheck+        Ast "schema" [Avar p,Astring v]+            -> let ns' = ns { prefixes = case lookup p predefinedNamespaces of+                                           Just uri+                                               -> if uri == v+                                                  then (p,v):prefixes ns+                                                  else error ("You cannot redefine the system namespace "++p)+                                           _ -> (p,v):prefixes ns }+               in evalQueryM xs variables functions ns' views db verbose typecheck+        Ast "import" (Avar "default-element":Astring uri:xschemas)+            -> do ss <- mapM (\(Astring t) -> parseSchema t ns) xschemas+                  evalQueryM xs variables functions+                             ns { defaultElementNS=uri,+                                  prefixes=(uri,uri):(prefixes ns),+                                  schemas=(uri,concat ss):(schemas ns) }+                             views db verbose typecheck+        Ast "import" (Avar "default-function":Astring uri:xschemas)+            -> do ss <- mapM (\(Astring t) -> parseSchema t ns) xschemas+                  evalQueryM xs variables functions+                             ns { defaultFunctionNS=uri,+                                  prefixes=(uri,uri):(prefixes ns),+                                  schemas=(uri,concat ss):(schemas ns) }+                             views db verbose typecheck+        Ast "import" (Avar p:Astring v:xschemas)+            -> do ss <- mapM (\(Astring t) -> parseSchema t ns) xschemas+                  let ns' = ns { prefixes = case lookup p predefinedNamespaces of+                                              Just uri+                                                  -> if uri == v+                                                     then (p,v):prefixes ns+                                                     else error ("You cannot redefine the system namespace "++p)+                                              _ -> (p,v):prefixes ns,+                                 schemas=(v,concat ss):(schemas ns) }+                  evalQueryM xs variables functions ns' views db verbose typecheck+        Ast "variable" [Avar v,tp,u]+            -> do uv <- evalM (optimize (identify_globals u [] variables))+                              undefv1 undefv2 undefv3 "" variables functions ns db []+                  if typeCheck u (toType tp ns) [] [] ns+                     then evalQueryM xs (('_':v,uv):variables) functions ns views db verbose typecheck+                     else error("Value does not match type in "++show query)+        _ -> do let opt = optimize (expandViews views (identify_globals query [] variables))+                    (ast,nss) = liftIOSources opt                 if verbose                    then do putStrLn "Abstract Syntax Tree (AST):"                            putStrLn (ppAst query)                            putStrLn "Optimized AST:"-                           putStrLn (ppAst (foldl (\r (n,_,e) -> Ast "let" [Avar n,case e of Astring _ -> Ast "doc" [e]; _ -> e,r]) ast ns))+                           putStrLn (ppAst (foldl (\r (n,_,e) -> Ast "let" [Avar n,+                                                        case e of Astring _ -> Ast "doc" [e]; _ -> e,r]) ast nss))                            putStrLn "Result:"                    else return ()                 env <- foldr (\(n,b,s) r -> case s of@@ -465,34 +556,39 @@                                                         env <- r                                                         return $! ((n,[materialize b (parseDocument doc)]):env)                                               _ -> r)-                             (return []) ns+                             (return []) nss                 stmts <- foldr (\(n,_,s) r -> case s of                                                 Ast "prepareSQL" [Astring sql]                                                     -> do stmts <- r                                                           t <- prepareSQL db sql                                                           return $! ((n,t):stmts)                                                 _ -> r)-                               (return []) ns-                result <- evalM ast undefv1 undefv2 undefv3 "" (env++variables) functions db stmts-                (rest,renv,rfuns,rviews) <- evalQueryM xs variables functions views db verbose-                return $! (result++rest,renv,rfuns,rviews)+                               (return []) nss+                if typecheck+                   then do let tp = typeInference opt [] (map (\(n,_,_,s) -> (show n,s)) functions) ns+                           putStrLn $ "Type: " ++ show tp+                   else return ()+                result <- evalM ast undefv1 undefv2 undefv3 "" (env++variables) functions ns db stmts+                (rest,renv,rfuns,ns',rviews) <- evalQueryM xs variables functions ns views db verbose typecheck+                return $! (result++rest,renv,rfuns,ns',rviews)  -xqueryE :: String -> Environment -> Functions -> Functions -> Connection -> Bool-                -> IO (XSeq,Environment,Functions,Functions)-xqueryE query variables functions views db verbose-    = evalQueryM (parse (scan query)) variables functions views db verbose+xqueryE :: String -> Environment -> Functions -> NS -> Views -> Connection -> Bool -> Bool+                -> IO (XSeq,Environment,Functions,NS,Views)+xqueryE query variables functions ns views db verbose typecheck+    = evalQueryM (parse (scan query)) variables functions ns views db verbose typecheck   -- | Evaluate the XQuery using the interpreter. xquery :: String -> IO XSeq-xquery query = do (u,_,_,_) <- xqueryE query [] [] [] (error "No database connectivity") False+xquery query = do (u,_,_,_,_) <- xqueryE query [] [] initialNS []+                                         (error "No database connectivity") False False                   return $! u   -- | Evaluate the XQuery with database connectivity using the interpreter. xqueryDB :: String -> Connection -> IO XSeq-xqueryDB query db = do (u,_,_,_) <- xqueryE query [] [] [] db False+xqueryDB query db = do (u,_,_,_,_) <- xqueryE query [] [] initialNS [] db False False                        return $! u  
src/Text/XML/HXQ/Optimizer.hs view
@@ -233,6 +233,8 @@             -> (elem v tables) && (all (sqlPredicate tables) preds)         Ast "construction" [_,_,_,_,Ast "append" xs]             -> all (sqlPredicate tables) xs+        Ast "call" [Avar "data",x]+            -> sqlPredicate tables x         Ast "call" [Avar "text",x]             -> sqlPredicate tables x         Ast "call" [Avar cmp,x,y]@@ -250,6 +252,8 @@                         -> elem v tables                     Ast "construction" [_,_,_,_,Ast "append" xs]                         -> all (sqlExpr tables) xs+                    Ast "call" [Avar "data",x]+                        -> sqlExpr tables x                     Ast "call" [Avar "text",x]                         -> sqlExpr tables x                     Ast "for" [Avar v,_,Ast "call" ((Avar "SQL"):_),x]@@ -273,6 +277,8 @@                else error ("Cannot convert to an SQL predicate: "++show e)         Ast "construction" [_,_,_,_,Ast "append" xs]             -> orAll (map (predToSQL tables) xs)+        Ast "call" [Avar "data",x]+            -> predToSQL tables x         Ast "call" [Avar "text",x]             -> predToSQL tables x         Ast "call" [Avar cmp,Ast "for" [Avar v,i,Ast "call" [Avar "SQL",_,Ast "call" ((Avar "tables"):t),pred],x],y]@@ -323,6 +329,8 @@                               else ("?",e:ps,[p],ts)                     Ast "construction" [_,_,_,_,Ast "append" [x]]                         -> expToSQL tables x+                    Ast "call" [Avar "data",x]+                        -> expToSQL tables x                     Ast "call" [Avar "text",x]                         -> expToSQL tables x                     _ -> ("?",[e],[],[])@@ -499,6 +507,8 @@ -- path steps over constants always give ()         Ast "step" (step:tag:c:_)             | is_constant c+            -> (empty,True,count)+        Ast "step" (step:tag:Ast "call" [Avar "data",_]:_)             -> (empty,True,count)         Ast "step" (step:tag:Ast "call" [Avar "text",_]:_)             -> (empty,True,count)
src/Text/XML/HXQ/Parser.hs view
@@ -38,2445 +38,2637 @@ happyOut6 :: (HappyAbsSyn ) -> (Ast) happyOut6 x = unsafeCoerce# x {-# INLINE happyOut6 #-}-happyIn7 :: (String) -> (HappyAbsSyn )-happyIn7 x = unsafeCoerce# x-{-# INLINE happyIn7 #-}-happyOut7 :: (HappyAbsSyn ) -> (String)-happyOut7 x = unsafeCoerce# x-{-# INLINE happyOut7 #-}-happyIn8 :: ([ Ast ]) -> (HappyAbsSyn )-happyIn8 x = unsafeCoerce# x-{-# INLINE happyIn8 #-}-happyOut8 :: (HappyAbsSyn ) -> ([ Ast ])-happyOut8 x = unsafeCoerce# x-{-# INLINE happyOut8 #-}-happyIn9 :: ([ Ast ]) -> (HappyAbsSyn )-happyIn9 x = unsafeCoerce# x-{-# INLINE happyIn9 #-}-happyOut9 :: (HappyAbsSyn ) -> ([ Ast ])-happyOut9 x = unsafeCoerce# x-{-# INLINE happyOut9 #-}-happyIn10 :: (Ast) -> (HappyAbsSyn )-happyIn10 x = unsafeCoerce# x-{-# INLINE happyIn10 #-}-happyOut10 :: (HappyAbsSyn ) -> (Ast)-happyOut10 x = unsafeCoerce# x-{-# INLINE happyOut10 #-}-happyIn11 :: (Ast) -> (HappyAbsSyn )-happyIn11 x = unsafeCoerce# x-{-# INLINE happyIn11 #-}-happyOut11 :: (HappyAbsSyn ) -> (Ast)-happyOut11 x = unsafeCoerce# x-{-# INLINE happyOut11 #-}-happyIn12 :: ([ Ast ]) -> (HappyAbsSyn )-happyIn12 x = unsafeCoerce# x-{-# INLINE happyIn12 #-}-happyOut12 :: (HappyAbsSyn ) -> ([ Ast ])-happyOut12 x = unsafeCoerce# x-{-# INLINE happyOut12 #-}-happyIn13 :: (Ast) -> (HappyAbsSyn )-happyIn13 x = unsafeCoerce# x-{-# INLINE happyIn13 #-}-happyOut13 :: (HappyAbsSyn ) -> (Ast)-happyOut13 x = unsafeCoerce# x-{-# INLINE happyOut13 #-}-happyIn14 :: (Ast) -> (HappyAbsSyn )-happyIn14 x = unsafeCoerce# x-{-# INLINE happyIn14 #-}-happyOut14 :: (HappyAbsSyn ) -> (Ast)-happyOut14 x = unsafeCoerce# x-{-# INLINE happyOut14 #-}-happyIn15 :: ([ Ast ]) -> (HappyAbsSyn )-happyIn15 x = unsafeCoerce# x-{-# INLINE happyIn15 #-}-happyOut15 :: (HappyAbsSyn ) -> ([ Ast ])-happyOut15 x = unsafeCoerce# x-{-# INLINE happyOut15 #-}-happyIn16 :: (Ast -> Ast) -> (HappyAbsSyn )-happyIn16 x = unsafeCoerce# x-{-# INLINE happyIn16 #-}-happyOut16 :: (HappyAbsSyn ) -> (Ast -> Ast)-happyOut16 x = unsafeCoerce# x-{-# INLINE happyOut16 #-}-happyIn17 :: (Ast -> Ast) -> (HappyAbsSyn )-happyIn17 x = unsafeCoerce# x-{-# INLINE happyIn17 #-}-happyOut17 :: (HappyAbsSyn ) -> (Ast -> Ast)-happyOut17 x = unsafeCoerce# x-{-# INLINE happyOut17 #-}-happyIn18 :: (Ast -> Ast) -> (HappyAbsSyn )-happyIn18 x = unsafeCoerce# x-{-# INLINE happyIn18 #-}-happyOut18 :: (HappyAbsSyn ) -> (Ast -> Ast)-happyOut18 x = unsafeCoerce# x-{-# INLINE happyOut18 #-}-happyIn19 :: (Ast -> Ast) -> (HappyAbsSyn )-happyIn19 x = unsafeCoerce# x-{-# INLINE happyIn19 #-}-happyOut19 :: (HappyAbsSyn ) -> (Ast -> Ast)-happyOut19 x = unsafeCoerce# x-{-# INLINE happyOut19 #-}-happyIn20 :: (( Ast -> Ast, Ast -> Ast )) -> (HappyAbsSyn )-happyIn20 x = unsafeCoerce# x-{-# INLINE happyIn20 #-}-happyOut20 :: (HappyAbsSyn ) -> (( Ast -> Ast, Ast -> Ast ))-happyOut20 x = unsafeCoerce# x-{-# INLINE happyOut20 #-}-happyIn21 :: (( [ Ast ], [ Ast ] )) -> (HappyAbsSyn )-happyIn21 x = unsafeCoerce# x-{-# INLINE happyIn21 #-}-happyOut21 :: (HappyAbsSyn ) -> (( [ Ast ], [ Ast ] ))-happyOut21 x = unsafeCoerce# x-{-# INLINE happyOut21 #-}-happyIn22 :: (Ast) -> (HappyAbsSyn )-happyIn22 x = unsafeCoerce# x-{-# INLINE happyIn22 #-}-happyOut22 :: (HappyAbsSyn ) -> (Ast)-happyOut22 x = unsafeCoerce# x-{-# INLINE happyOut22 #-}-happyIn23 :: (Ast) -> (HappyAbsSyn )-happyIn23 x = unsafeCoerce# x-{-# INLINE happyIn23 #-}-happyOut23 :: (HappyAbsSyn ) -> (Ast)-happyOut23 x = unsafeCoerce# x-{-# INLINE happyOut23 #-}-happyIn24 :: (Ast) -> (HappyAbsSyn )-happyIn24 x = unsafeCoerce# x-{-# INLINE happyIn24 #-}-happyOut24 :: (HappyAbsSyn ) -> (Ast)-happyOut24 x = unsafeCoerce# x-{-# INLINE happyOut24 #-}-happyIn25 :: ([ Ast ]) -> (HappyAbsSyn )-happyIn25 x = unsafeCoerce# x-{-# INLINE happyIn25 #-}-happyOut25 :: (HappyAbsSyn ) -> ([ Ast ])-happyOut25 x = unsafeCoerce# x-{-# INLINE happyOut25 #-}-happyIn26 :: ([ Ast ]) -> (HappyAbsSyn )-happyIn26 x = unsafeCoerce# x-{-# INLINE happyIn26 #-}-happyOut26 :: (HappyAbsSyn ) -> ([ Ast ])-happyOut26 x = unsafeCoerce# x-{-# INLINE happyOut26 #-}-happyIn27 :: (Ast) -> (HappyAbsSyn )-happyIn27 x = unsafeCoerce# x-{-# INLINE happyIn27 #-}-happyOut27 :: (HappyAbsSyn ) -> (Ast)-happyOut27 x = unsafeCoerce# x-{-# INLINE happyOut27 #-}-happyIn28 :: ([Ast]) -> (HappyAbsSyn )-happyIn28 x = unsafeCoerce# x-{-# INLINE happyIn28 #-}-happyOut28 :: (HappyAbsSyn ) -> ([Ast])-happyOut28 x = unsafeCoerce# x-{-# INLINE happyOut28 #-}-happyIn29 :: ([ Ast ]) -> (HappyAbsSyn )-happyIn29 x = unsafeCoerce# x-{-# INLINE happyIn29 #-}-happyOut29 :: (HappyAbsSyn ) -> ([ Ast ])-happyOut29 x = unsafeCoerce# x-{-# INLINE happyOut29 #-}-happyIn30 :: (Ast) -> (HappyAbsSyn )-happyIn30 x = unsafeCoerce# x-{-# INLINE happyIn30 #-}-happyOut30 :: (HappyAbsSyn ) -> (Ast)-happyOut30 x = unsafeCoerce# x-{-# INLINE happyOut30 #-}-happyIn31 :: (Ast -> Ast) -> (HappyAbsSyn )-happyIn31 x = unsafeCoerce# x-{-# INLINE happyIn31 #-}-happyOut31 :: (HappyAbsSyn ) -> (Ast -> Ast)-happyOut31 x = unsafeCoerce# x-{-# INLINE happyOut31 #-}-happyIn32 :: (Ast -> Ast) -> (HappyAbsSyn )-happyIn32 x = unsafeCoerce# x-{-# INLINE happyIn32 #-}-happyOut32 :: (HappyAbsSyn ) -> (Ast -> Ast)-happyOut32 x = unsafeCoerce# x-{-# INLINE happyOut32 #-}-happyIn33 :: ([ Ast ]) -> (HappyAbsSyn )-happyIn33 x = unsafeCoerce# x-{-# INLINE happyIn33 #-}-happyOut33 :: (HappyAbsSyn ) -> ([ Ast ])-happyOut33 x = unsafeCoerce# x-{-# INLINE happyOut33 #-}-happyIn34 :: (String -> Ast -> [ Ast ] -> Ast) -> (HappyAbsSyn )-happyIn34 x = unsafeCoerce# x-{-# INLINE happyIn34 #-}-happyOut34 :: (HappyAbsSyn ) -> (String -> Ast -> [ Ast ] -> Ast)-happyOut34 x = unsafeCoerce# x-{-# INLINE happyOut34 #-}-happyIn35 :: (String -> Ast -> Ast) -> (HappyAbsSyn )-happyIn35 x = unsafeCoerce# x-{-# INLINE happyIn35 #-}-happyOut35 :: (HappyAbsSyn ) -> (String -> Ast -> Ast)-happyOut35 x = unsafeCoerce# x-{-# INLINE happyOut35 #-}-happyIn36 :: (String -> Ast) -> (HappyAbsSyn )-happyIn36 x = unsafeCoerce# x-{-# INLINE happyIn36 #-}-happyOut36 :: (HappyAbsSyn ) -> (String -> Ast)-happyOut36 x = unsafeCoerce# x-{-# INLINE happyOut36 #-}-happyInTok :: (Token) -> (HappyAbsSyn )-happyInTok x = unsafeCoerce# x-{-# INLINE happyInTok #-}-happyOutTok :: (HappyAbsSyn ) -> (Token)-happyOutTok x = unsafeCoerce# x-{-# INLINE happyOutTok #-}---happyActOffsets :: HappyAddr-happyActOffsets = HappyA# "\x01\x01\x01\x01\x30\x00\x91\x02\xd8\x02\x00\x00\x70\x04\x58\x00\x00\x00\x00\x00\x5e\x00\x00\x00\x06\x00\x00\x00\x00\x00\x00\x00\x90\x02\x90\x02\x57\x01\xab\x00\x57\x01\x57\x01\x57\x01\x00\x00\xa1\x02\x57\x01\x88\x02\x88\x02\x12\x00\x11\x00\x51\x00\x94\x02\x40\x01\x00\x00\x57\x01\x8e\x02\x57\x01\xcd\x02\x00\x00\x00\x00\x00\x00\x00\x00\x3d\x02\x57\x01\xce\x03\x57\x01\xb2\x03\x9a\x02\x42\x02\x58\x02\x40\x00\x00\x00\x87\x02\x56\x02\x57\x01\x4c\x02\x80\x02\x54\x02\x57\x01\x5e\x02\x5d\x02\xee\xff\x5b\x02\x00\x00\x4a\x02\x00\x00\x00\x00\x70\x04\x71\x00\x22\x00\x00\x00\xa2\x01\xea\xff\xe9\xff\x0d\x00\x57\x01\x00\x00\x15\x00\x00\x00\x51\x02\x2d\x02\x2d\x02\x57\x01\x57\x01\x57\x01\x57\x01\x57\x01\x57\x01\x57\x01\x57\x01\x57\x01\x57\x01\x57\x01\x57\x01\x57\x01\x57\x01\x57\x01\x57\x01\x57\x01\x57\x01\x57\x01\x57\x01\x57\x01\x57\x01\x57\x01\x57\x01\x57\x01\x57\x01\x57\x01\x57\x01\x57\x01\x32\x02\x53\x02\x50\x02\x55\x00\x00\x00\xff\xff\x00\x00\x29\x02\x02\x00\x00\x00\x7d\x00\x7d\x00\x7d\x00\xdd\x0a\xdd\x0a\xdd\x0a\x0f\x0b\xdd\x0a\xf6\x0a\xd9\x00\xd9\x00\xd9\x00\xd9\x00\xd9\x00\xd9\x00\xd9\x00\xd9\x00\xd9\x00\xd9\x00\xd9\x00\xd9\x00\xd9\x00\xd9\x00\xd9\x00\x00\x00\x00\x00\x00\x00\x00\x00\x83\x01\x83\x01\x27\x0b\x70\x04\x48\x02\x47\x02\x52\x02\x21\x02\x00\x00\xfc\xff\x57\x01\x13\x00\x08\x00\xf6\x01\x00\x00\x00\x00\x6c\x00\xf5\x01\x00\x00\x57\x01\x2d\x00\xbf\x01\x57\x01\x57\x01\x57\x01\x00\x00\x57\x01\x00\x00\xfd\x01\xd5\x01\x57\x01\x9c\x01\x9c\x01\x57\x01\x51\x03\x05\x02\x57\x01\xb3\x01\x0d\x03\xe2\x01\x57\x01\x0d\x00\x00\x00\x62\x00\xe0\x01\x57\x00\xdf\x01\x57\x01\x2d\x04\x57\x01\x28\x02\x9a\x01\x2d\x04\x2d\x04\x92\x01\x7d\x00\x57\x01\x92\x01\x00\x00\x00\x00\xaa\x01\x6b\x00\x00\x00\xd8\x01\x69\x00\x00\x00\xd6\x01\x11\x04\xac\x01\xae\x01\x11\x04\xca\x01\x05\x00\x11\x04\xe5\x01\x11\x04\x11\x04\xed\xff\x00\x00\x51\x00\x52\x00\x00\x00\x06\x02\x00\x00\x00\x00\xc0\x01\x65\x00\x00\x00\x57\x01\x94\x01\x00\x00\x00\x00\x57\x01\x57\x01\xfb\xff\x00\x00\x27\x00\xce\x01\xcd\x01\x00\x00\x00\x00\x00\x00\x00\x00\x32\x00\x2f\x00\x00\x00\x00\x00\x00\x00\xc6\x01\x00\x00\x00\x00\x00\x00\x11\x04\x6f\x03\xa8\x01\xb5\x01\x64\x00\x00\x00\x00\x00\x00\x00\x00\x00\x51\x00\x00\x00\xc5\x01\x57\x01\x7b\x01\x57\x01\x00\x00\x05\x00\x57\x01\x57\x01\x57\x01\x00\x00\x57\x01\x00\x00\xa1\x01\x79\x01\x7c\x01\x11\x04\x77\x01\x99\x01\x00\x00\x7d\x00\xa3\x01\x14\x00\x57\x01\x7d\x00\x4f\x01\x96\x01\xfa\xff\xf9\xff\x11\x04\x11\x04\x00\x00\xc1\x0a\x75\x01\x11\x04\x98\x01\x00\x00\x98\x01\x00\x00\x00\x00\x57\x01\x00\x00\x00\x00\x00\x00\x00\x00\x6e\x01\x8e\x01\x00\x00\x6d\x01\x8d\x01\x00\x00\x00\x00\x56\x01\x00\x00\x56\x01\x6f\x03\x88\x01\x57\x01\x00\x00\x00\x00\x57\x01\x5e\x01\x00\x00\x11\x04\x57\x01\x7d\x00\x57\x01\x49\x02\x7a\x01\xf0\x02\x7d\x00\xac\x02\x11\x04\x00\x00\x3b\x01\x28\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x57\x01\x00\x00\x73\x01\x57\x01\x8f\x02\x00\x00\x11\x04\x00\x00"#--happyGotoOffsets :: HappyAddr-happyGotoOffsets = HappyA# "\xc3\x00\x19\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x6b\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x51\x01\x00\x00\x05\x01\xfe\x00\xae\x0a\xde\x04\xc6\x04\x96\x0a\x7e\x0a\x00\x00\x66\x01\x66\x0a\xed\x00\xe5\x00\x65\x01\x61\x01\x4c\x01\x00\x00\x00\x00\x00\x00\x4e\x0a\x00\x00\x36\x0a\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x1e\x0a\x00\x00\x06\x0a\x00\x00\x60\x01\x58\x01\x5c\x01\x00\x00\x2e\x01\x00\x00\x4d\x01\xee\x09\x00\x00\x00\x00\x47\x01\xd6\x09\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x76\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03\x01\xae\x04\x00\x00\x48\x01\x00\x00\x32\x01\xb3\x00\x1c\x00\xbe\x09\xa6\x09\x8e\x09\x76\x09\x5e\x09\x46\x09\x2e\x09\x16\x09\xfe\x08\xe6\x08\xce\x08\xb6\x08\x9e\x08\x86\x08\x6e\x08\x56\x08\x3e\x08\x26\x08\x0e\x08\xf6\x07\xde\x07\xc6\x07\xae\x07\x96\x07\x7e\x07\x66\x07\x4e\x07\x36\x07\x1e\x07\x00\x00\x00\x00\x00\x00\x96\x04\x00\x00\x6f\x01\x00\x00\x00\x00\x00\x00\x00\x00\x70\x01\x69\x01\x4b\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xf4\x00\x58\x04\x3d\x01\x36\x01\x31\x01\x00\x00\x00\x00\x00\x00\xea\x00\x00\x00\x06\x07\x0a\x01\x29\x01\xee\x06\xd6\x06\xbe\x06\x00\x00\xa6\x06\x00\x00\x00\x00\x2c\x01\x8e\x06\x1e\x01\x1b\x01\x76\x06\x00\x00\x00\x00\xfc\x03\x00\x00\x00\x00\x00\x00\x9a\x03\xfd\x00\x00\x00\x13\x01\x00\x00\x00\x00\x00\x00\x5e\x06\x00\x00\x46\x06\x00\x00\xd5\x00\x00\x00\x00\x00\xc5\x00\x46\x01\x2e\x06\x9d\x00\x00\x00\x00\x00\xc0\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xe4\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xd2\x00\xf6\x00\xb4\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x37\x03\xce\x00\x00\x00\x00\x00\xd6\x02\x16\x06\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xd6\x00\xbf\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xb6\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xc8\x00\xa0\x00\xc6\x00\x00\x00\xfe\x05\xc2\x00\xe6\x05\x00\x00\x88\x00\xce\x05\xb6\x05\x6f\x02\x00\x00\xc8\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x3e\x01\x00\x00\x00\x00\x9e\x05\x38\x01\xaa\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x93\x00\x00\x00\x00\x00\x00\x00\x86\x05\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x83\x00\x00\x00\x79\x00\x2c\x00\x00\x00\x6e\x05\x00\x00\x00\x00\x56\x05\x00\x00\x00\x00\x00\x00\x3e\x05\x1a\x01\x26\x05\x03\x00\x00\x00\x00\x00\xf1\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0e\x05\x00\x00\x00\x00\xf6\x04\x00\x00\x00\x00\x00\x00\x00\x00"#--happyDefActions :: HappyAddr-happyDefActions = HappyA# "\x00\x00\x00\x00\x00\x00\xfd\xff\x69\xff\x66\xff\xf9\xff\x9a\xff\xd1\xff\xd2\xff\x00\x00\xad\xff\x7f\xff\xd3\xff\x6c\xff\x6b\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x6a\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xf3\xff\x00\x00\x65\xff\x00\x00\x00\x00\x00\x00\x00\x00\xd8\xff\xac\xff\xab\xff\x7e\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x6c\xff\x00\x00\x00\x00\x00\x00\xf3\xff\x00\x00\x00\x00\x00\x00\x00\x00\xa4\xff\x00\x00\xa5\xff\xae\xff\x89\xff\xaf\xff\xb0\xff\xa7\xff\x00\x00\x00\x00\x63\xff\x00\x00\x00\x00\x00\x00\x78\xff\x00\x00\x7c\xff\x00\x00\x8e\xff\x98\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xfc\xff\x00\x00\xfe\xff\xfb\xff\x00\x00\x61\xff\x00\x00\x00\x00\x00\x00\xb5\xff\xb6\xff\xb7\xff\xb8\xff\xb9\xff\xba\xff\xbb\xff\xbc\xff\xbd\xff\xbe\xff\xbf\xff\xc0\xff\xc1\xff\xc2\xff\xc3\xff\xc4\xff\xc5\xff\xc6\xff\xc7\xff\xc8\xff\xc9\xff\xca\xff\xcb\xff\xcc\xff\xcd\xff\xce\xff\xcf\xff\xd0\xff\x9b\xff\xa2\xff\xa3\xff\x00\x00\x00\x00\x84\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x85\xff\x86\xff\x00\x00\x76\xff\x74\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x64\xff\x00\x00\x7d\xff\x00\x00\x88\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x77\xff\xf2\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xa9\xff\x00\x00\x00\x00\x00\x00\xa8\xff\xaa\xff\xf0\xff\x00\x00\x00\x00\xf0\xff\x68\xff\x67\xff\x75\xff\x00\x00\x91\xff\x00\x00\x00\x00\x92\xff\x00\x00\x9d\xff\x00\x00\x00\x00\xa1\xff\x00\x00\x00\x00\xa6\xff\x00\x00\xd5\xff\xd6\xff\x00\x00\x6c\xff\x00\x00\x00\x00\x6e\xff\x00\x00\x73\xff\x7b\xff\x00\x00\x00\x00\x80\xff\x00\x00\x00\x00\x81\xff\x82\xff\x00\x00\x00\x00\xeb\xff\xb4\xff\xe7\xff\x00\x00\x00\x00\xb3\xff\xb2\xff\x62\xff\xfa\xff\x00\x00\x00\x00\xe6\xff\xe5\xff\xe4\xff\x00\x00\xea\xff\xe9\xff\xe8\xff\xd7\xff\x93\xff\x99\xff\x00\x00\x00\x00\x87\xff\x8f\xff\x6d\xff\x6c\xff\x00\x00\x6c\xff\x72\xff\x00\x00\x00\x00\x00\x00\x7a\xff\x00\x00\x00\x00\x00\x00\x00\x00\x8b\xff\x00\x00\x8a\xff\x00\x00\xf1\xff\xef\xff\xf8\xff\x00\x00\x00\x00\xb1\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x9c\xff\xa0\xff\x79\xff\xd4\xff\x00\x00\x9f\xff\x71\xff\x6c\xff\x70\xff\x83\xff\x90\xff\x00\x00\x97\xff\x95\xff\x94\xff\xe1\xff\xdd\xff\x00\x00\xe3\xff\xde\xff\x00\x00\xe2\xff\xdf\xff\x00\x00\xe0\xff\x00\x00\x93\xff\x6f\xff\x00\x00\x8d\xff\x8c\xff\x00\x00\xed\xff\xee\xff\xf7\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x9e\xff\x96\xff\xdb\xff\xdc\xff\xda\xff\xd9\xff\xf4\xff\xec\xff\xf6\xff\x00\x00\x5f\xff\x00\x00\x00\x00\x00\x00\xf5\xff\x60\xff"#--happyCheck :: HappyAddr-happyCheck = HappyA# "\xff\xff\x02\x00\x03\x00\x04\x00\x09\x00\x0c\x00\x0c\x00\x0b\x00\x09\x00\x0e\x00\x0b\x00\x10\x00\x0a\x00\x0e\x00\x0f\x00\x10\x00\x0b\x00\x0b\x00\x16\x00\x0b\x00\x07\x00\x16\x00\x2d\x00\x2d\x00\x2b\x00\x2b\x00\x09\x00\x09\x00\x0b\x00\x0b\x00\x0b\x00\x0b\x00\x0b\x00\x38\x00\x38\x00\x20\x00\x25\x00\x09\x00\x2d\x00\x2d\x00\x29\x00\x2a\x00\x0e\x00\x16\x00\x0a\x00\x40\x00\x40\x00\x2d\x00\x34\x00\x35\x00\x36\x00\x34\x00\x35\x00\x0e\x00\x09\x00\x10\x00\x39\x00\x0a\x00\x3b\x00\x3c\x00\x0a\x00\x10\x00\x12\x00\x10\x00\x2c\x00\x42\x00\x10\x00\x3b\x00\x45\x00\x46\x00\x47\x00\x3a\x00\x4d\x00\x34\x00\x35\x00\x36\x00\x3b\x00\x3b\x00\x3b\x00\x2d\x00\x54\x00\x52\x00\x53\x00\x57\x00\x55\x00\x56\x00\x57\x00\x02\x00\x03\x00\x04\x00\x09\x00\x09\x00\x57\x00\x57\x00\x09\x00\x0a\x00\x0b\x00\x10\x00\x10\x00\x0e\x00\x0f\x00\x10\x00\x39\x00\x3a\x00\x3b\x00\x54\x00\x3b\x00\x16\x00\x57\x00\x3b\x00\x41\x00\x42\x00\x0c\x00\x0c\x00\x10\x00\x43\x00\x4d\x00\x0c\x00\x18\x00\x0c\x00\x0c\x00\x03\x00\x25\x00\x3b\x00\x03\x00\x0c\x00\x29\x00\x2a\x00\x53\x00\x29\x00\x2a\x00\x2c\x00\x44\x00\x2e\x00\x03\x00\x2f\x00\x58\x00\x34\x00\x35\x00\x39\x00\x3b\x00\x3b\x00\x39\x00\x19\x00\x3b\x00\x2d\x00\x2d\x00\x42\x00\x42\x00\x37\x00\x2d\x00\x42\x00\x2d\x00\x2d\x00\x45\x00\x46\x00\x47\x00\x3b\x00\x2d\x00\x17\x00\x18\x00\x04\x00\x05\x00\x03\x00\x53\x00\x53\x00\x09\x00\x52\x00\x53\x00\x09\x00\x55\x00\x56\x00\x57\x00\x02\x00\x03\x00\x04\x00\x1d\x00\x34\x00\x35\x00\x09\x00\x09\x00\x0a\x00\x0b\x00\x03\x00\x3b\x00\x0e\x00\x0f\x00\x10\x00\x09\x00\x09\x00\x1e\x00\x1f\x00\x0d\x00\x16\x00\x03\x00\x00\x00\x01\x00\x02\x00\x03\x00\x08\x00\x12\x00\x04\x00\x05\x00\x09\x00\x09\x00\x0a\x00\x09\x00\x0c\x00\x25\x00\x03\x00\x1e\x00\x1f\x00\x29\x00\x2a\x00\x13\x00\x14\x00\x15\x00\x03\x00\x17\x00\x18\x00\x1c\x00\x1a\x00\x08\x00\x34\x00\x35\x00\x1e\x00\x1f\x00\x1d\x00\x39\x00\x1d\x00\x3b\x00\x0e\x00\x0f\x00\x10\x00\x11\x00\x12\x00\x13\x00\x42\x00\x09\x00\x1d\x00\x45\x00\x46\x00\x47\x00\x0e\x00\x03\x00\x20\x00\x09\x00\x06\x00\x07\x00\x03\x00\x0d\x00\x17\x00\x18\x00\x52\x00\x53\x00\x09\x00\x55\x00\x56\x00\x57\x00\x02\x00\x03\x00\x04\x00\x1c\x00\x09\x00\x14\x00\x15\x00\x09\x00\x0d\x00\x0b\x00\x03\x00\x09\x00\x0e\x00\x0f\x00\x10\x00\x0d\x00\x09\x00\x1e\x00\x1f\x00\x03\x00\x16\x00\x1b\x00\x1c\x00\x01\x00\x02\x00\x03\x00\x03\x00\x1b\x00\x1c\x00\x06\x00\x07\x00\x09\x00\x0a\x00\x09\x00\x0c\x00\x25\x00\x09\x00\x1e\x00\x1f\x00\x29\x00\x2a\x00\x13\x00\x14\x00\x15\x00\x03\x00\x17\x00\x18\x00\x09\x00\x1a\x00\x03\x00\x34\x00\x35\x00\x1e\x00\x1f\x00\x03\x00\x39\x00\x03\x00\x3b\x00\x3c\x00\x06\x00\x07\x00\x03\x00\x03\x00\x10\x00\x42\x00\x06\x00\x07\x00\x45\x00\x46\x00\x47\x00\x03\x00\x03\x00\x1d\x00\x06\x00\x07\x00\x03\x00\x03\x00\x03\x00\x06\x00\x07\x00\x52\x00\x53\x00\x09\x00\x55\x00\x56\x00\x57\x00\x02\x00\x03\x00\x04\x00\x14\x00\x15\x00\x16\x00\x03\x00\x09\x00\x09\x00\x0b\x00\x03\x00\x03\x00\x0e\x00\x0f\x00\x10\x00\x03\x00\x03\x00\x1e\x00\x1f\x00\x03\x00\x16\x00\x1d\x00\x06\x00\x07\x00\x02\x00\x03\x00\x03\x00\x01\x00\x4d\x00\x06\x00\x07\x00\x09\x00\x0a\x00\x0f\x00\x0c\x00\x25\x00\x3d\x00\x3e\x00\x3f\x00\x29\x00\x2a\x00\x13\x00\x14\x00\x15\x00\x0b\x00\x17\x00\x18\x00\x4d\x00\x1a\x00\x2c\x00\x34\x00\x35\x00\x1e\x00\x1f\x00\x07\x00\x39\x00\x3b\x00\x3b\x00\x10\x00\x11\x00\x12\x00\x13\x00\x0a\x00\x0a\x00\x42\x00\x2d\x00\x2d\x00\x45\x00\x46\x00\x47\x00\x07\x00\x2b\x00\x0b\x00\x53\x00\x0a\x00\x01\x00\x2e\x00\x2d\x00\x05\x00\x2c\x00\x52\x00\x53\x00\x0a\x00\x55\x00\x56\x00\x57\x00\x0d\x00\x0e\x00\x0f\x00\x10\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x19\x00\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x1f\x00\x20\x00\x21\x00\x22\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\x28\x00\x03\x00\x07\x00\x18\x00\x53\x00\x3b\x00\x0a\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x2d\x00\x09\x00\x09\x00\x18\x00\x2b\x00\x2e\x00\x13\x00\x14\x00\x15\x00\x14\x00\x17\x00\x18\x00\x0b\x00\x1a\x00\x0b\x00\x3a\x00\x53\x00\x1e\x00\x1f\x00\x09\x00\x09\x00\x50\x00\x06\x00\x0a\x00\x4b\x00\x3b\x00\x53\x00\x4e\x00\x4f\x00\x0d\x00\x0e\x00\x0f\x00\x10\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x19\x00\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x1f\x00\x20\x00\x21\x00\x22\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\x28\x00\x08\x00\x0a\x00\x3b\x00\x14\x00\x53\x00\x0d\x00\x0e\x00\x0f\x00\x10\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x19\x00\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x1f\x00\x20\x00\x21\x00\x22\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\x28\x00\x3a\x00\x4b\x00\x3b\x00\x0a\x00\x4e\x00\x4f\x00\x0d\x00\x0e\x00\x0f\x00\x10\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x19\x00\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x1f\x00\x20\x00\x21\x00\x22\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\x28\x00\x4b\x00\x31\x00\x01\x00\x4e\x00\x4f\x00\x0d\x00\x0e\x00\x0f\x00\x10\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x19\x00\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x1f\x00\x20\x00\x21\x00\x22\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\x28\x00\x03\x00\x4b\x00\x2d\x00\x2d\x00\x4e\x00\x4f\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x2c\x00\x54\x00\x4c\x00\x2c\x00\x53\x00\x30\x00\x13\x00\x14\x00\x15\x00\x3b\x00\x17\x00\x18\x00\x2d\x00\x1a\x00\x2d\x00\x0b\x00\x2e\x00\x1e\x00\x1f\x00\x3b\x00\x44\x00\x3b\x00\x0b\x00\x3b\x00\x4b\x00\x53\x00\x59\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x0c\x00\x0d\x00\x0e\x00\x0f\x00\x10\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x19\x00\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x1f\x00\x20\x00\x21\x00\x22\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\x28\x00\x0c\x00\x0d\x00\x0e\x00\x0f\x00\x10\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x19\x00\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x1f\x00\x20\x00\x21\x00\x22\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\x28\x00\x3b\x00\x09\x00\x49\x00\x44\x00\x03\x00\x4b\x00\x53\x00\x3b\x00\x4e\x00\x4f\x00\x09\x00\x0a\x00\x09\x00\x0c\x00\x53\x00\xff\xff\x54\x00\xff\xff\x11\x00\xff\xff\x13\x00\x14\x00\x15\x00\xff\xff\x17\x00\x18\x00\xff\xff\x1a\x00\xff\xff\xff\xff\xff\xff\x1e\x00\x1f\x00\xff\xff\x4b\x00\xff\xff\xff\xff\x4e\x00\x4f\x00\x0c\x00\x0d\x00\x0e\x00\x0f\x00\x10\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x19\x00\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x1f\x00\x20\x00\x21\x00\x22\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\x28\x00\x0c\x00\x0d\x00\x0e\x00\x0f\x00\x10\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x19\x00\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x1f\x00\x20\x00\x21\x00\x22\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\x28\x00\xff\xff\xff\xff\xff\xff\xff\xff\x03\x00\x4b\x00\xff\xff\xff\xff\x4e\x00\x4f\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x13\x00\x14\x00\x15\x00\xff\xff\x17\x00\x18\x00\xff\xff\x1a\x00\xff\xff\xff\xff\xff\xff\x1e\x00\x1f\x00\xff\xff\x4b\x00\xff\xff\xff\xff\x4e\x00\x4f\x00\x0c\x00\x0d\x00\x0e\x00\x0f\x00\x10\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x19\x00\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x1f\x00\x20\x00\x21\x00\x22\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\x28\x00\xff\xff\xff\xff\x0d\x00\x0e\x00\x0f\x00\x10\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x19\x00\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x1f\x00\x20\x00\x21\x00\x22\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\x28\x00\xff\xff\xff\xff\xff\xff\xff\xff\x4b\x00\x03\x00\xff\xff\x4e\x00\x4f\x00\x32\x00\x33\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x13\x00\x14\x00\x15\x00\xff\xff\x17\x00\x18\x00\xff\xff\x1a\x00\xff\xff\xff\xff\xff\xff\x1e\x00\x1f\x00\x4b\x00\xff\xff\xff\xff\x4e\x00\x4f\x00\x0d\x00\x0e\x00\x0f\x00\x10\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x19\x00\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x1f\x00\x20\x00\x21\x00\x22\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\x28\x00\x0d\x00\x0e\x00\x0f\x00\x10\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x19\x00\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x1f\x00\x20\x00\x21\x00\x22\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\x28\x00\xff\xff\xff\xff\xff\xff\x48\x00\xff\xff\xff\xff\x4b\x00\xff\xff\x03\x00\x4e\x00\x4f\x00\xff\xff\xff\xff\xff\xff\x09\x00\x0a\x00\x0b\x00\x0c\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x13\x00\x14\x00\x15\x00\xff\xff\x17\x00\x18\x00\xff\xff\x1a\x00\xff\xff\x4a\x00\x4b\x00\x1e\x00\x1f\x00\x4e\x00\x4f\x00\x0d\x00\x0e\x00\x0f\x00\x10\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x19\x00\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x1f\x00\x20\x00\x21\x00\x22\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\x28\x00\x0d\x00\x0e\x00\x0f\x00\x10\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x19\x00\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x1f\x00\x20\x00\x21\x00\x22\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\x28\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x03\x00\x4b\x00\xff\xff\xff\xff\x4e\x00\x4f\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x13\x00\x14\x00\x15\x00\xff\xff\x17\x00\x18\x00\xff\xff\x1a\x00\xff\xff\xff\xff\xff\xff\x1e\x00\x1f\x00\x4b\x00\xff\xff\xff\xff\x4e\x00\x4f\x00\x0d\x00\x0e\x00\x0f\x00\x10\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x19\x00\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x1f\x00\x20\x00\x21\x00\x22\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\x28\x00\x03\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x09\x00\x0a\x00\x0b\x00\x0c\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x13\x00\x14\x00\x15\x00\xff\xff\x17\x00\x18\x00\xff\xff\x1a\x00\x03\x00\xff\xff\xff\xff\x1e\x00\x1f\x00\xff\xff\x09\x00\x0a\x00\x0b\x00\x0c\x00\x4b\x00\xff\xff\xff\xff\x4e\x00\x4f\x00\xff\xff\x13\x00\x14\x00\x15\x00\xff\xff\x17\x00\x18\x00\xff\xff\x1a\x00\x03\x00\xff\xff\xff\xff\x1e\x00\x1f\x00\xff\xff\x09\x00\x0a\x00\x0b\x00\x0c\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x13\x00\x14\x00\x15\x00\xff\xff\x17\x00\x18\x00\xff\xff\x1a\x00\x03\x00\xff\xff\xff\xff\x1e\x00\x1f\x00\xff\xff\x09\x00\x0a\x00\x0b\x00\x0c\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x13\x00\x14\x00\x15\x00\xff\xff\x17\x00\x18\x00\xff\xff\x1a\x00\x03\x00\xff\xff\xff\xff\x1e\x00\x1f\x00\xff\xff\x09\x00\x0a\x00\xff\xff\x0c\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x13\x00\x14\x00\x15\x00\xff\xff\x17\x00\x18\x00\xff\xff\x1a\x00\x03\x00\xff\xff\xff\xff\x1e\x00\x1f\x00\xff\xff\x09\x00\x0a\x00\xff\xff\x0c\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x13\x00\x14\x00\x15\x00\xff\xff\x17\x00\x18\x00\xff\xff\x1a\x00\x03\x00\xff\xff\xff\xff\x1e\x00\x1f\x00\xff\xff\x09\x00\x0a\x00\xff\xff\x0c\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x13\x00\x14\x00\x15\x00\xff\xff\x17\x00\x18\x00\xff\xff\x1a\x00\x03\x00\xff\xff\xff\xff\x1e\x00\x1f\x00\xff\xff\x09\x00\x0a\x00\xff\xff\x0c\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x13\x00\x14\x00\x15\x00\xff\xff\x17\x00\x18\x00\xff\xff\x1a\x00\x03\x00\xff\xff\xff\xff\x1e\x00\x1f\x00\xff\xff\x09\x00\x0a\x00\xff\xff\x0c\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x13\x00\x14\x00\x15\x00\xff\xff\x17\x00\x18\x00\xff\xff\x1a\x00\x03\x00\xff\xff\xff\xff\x1e\x00\x1f\x00\xff\xff\x09\x00\x0a\x00\xff\xff\x0c\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x13\x00\x14\x00\x15\x00\xff\xff\x17\x00\x18\x00\xff\xff\x1a\x00\x03\x00\xff\xff\xff\xff\x1e\x00\x1f\x00\xff\xff\x09\x00\x0a\x00\xff\xff\x0c\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x13\x00\x14\x00\x15\x00\xff\xff\x17\x00\x18\x00\xff\xff\x1a\x00\x03\x00\xff\xff\xff\xff\x1e\x00\x1f\x00\xff\xff\x09\x00\x0a\x00\xff\xff\x0c\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x13\x00\x14\x00\x15\x00\xff\xff\x17\x00\x18\x00\xff\xff\x1a\x00\x03\x00\xff\xff\xff\xff\x1e\x00\x1f\x00\xff\xff\x09\x00\x0a\x00\xff\xff\x0c\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x13\x00\x14\x00\x15\x00\xff\xff\x17\x00\x18\x00\xff\xff\x1a\x00\x03\x00\xff\xff\xff\xff\x1e\x00\x1f\x00\xff\xff\x09\x00\x0a\x00\xff\xff\x0c\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x13\x00\x14\x00\x15\x00\xff\xff\x17\x00\x18\x00\xff\xff\x1a\x00\x03\x00\xff\xff\xff\xff\x1e\x00\x1f\x00\xff\xff\x09\x00\x0a\x00\xff\xff\x0c\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x13\x00\x14\x00\x15\x00\xff\xff\x17\x00\x18\x00\xff\xff\x1a\x00\x03\x00\xff\xff\xff\xff\x1e\x00\x1f\x00\xff\xff\x09\x00\x0a\x00\xff\xff\x0c\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x13\x00\x14\x00\x15\x00\xff\xff\x17\x00\x18\x00\xff\xff\x1a\x00\x03\x00\xff\xff\xff\xff\x1e\x00\x1f\x00\xff\xff\x09\x00\x0a\x00\xff\xff\x0c\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x13\x00\x14\x00\x15\x00\xff\xff\x17\x00\x18\x00\xff\xff\x1a\x00\x03\x00\xff\xff\xff\xff\x1e\x00\x1f\x00\xff\xff\x09\x00\x0a\x00\xff\xff\x0c\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x13\x00\x14\x00\x15\x00\xff\xff\x17\x00\x18\x00\xff\xff\x1a\x00\x03\x00\xff\xff\xff\xff\x1e\x00\x1f\x00\xff\xff\x09\x00\x0a\x00\xff\xff\x0c\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x13\x00\x14\x00\x15\x00\xff\xff\x17\x00\x18\x00\xff\xff\x1a\x00\x03\x00\xff\xff\xff\xff\x1e\x00\x1f\x00\xff\xff\x09\x00\x0a\x00\xff\xff\x0c\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x13\x00\x14\x00\x15\x00\xff\xff\x17\x00\x18\x00\xff\xff\x1a\x00\x03\x00\xff\xff\xff\xff\x1e\x00\x1f\x00\xff\xff\x09\x00\x0a\x00\xff\xff\x0c\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x13\x00\x14\x00\x15\x00\xff\xff\x17\x00\x18\x00\xff\xff\x1a\x00\x03\x00\xff\xff\xff\xff\x1e\x00\x1f\x00\xff\xff\x09\x00\x0a\x00\xff\xff\x0c\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x13\x00\x14\x00\x15\x00\xff\xff\x17\x00\x18\x00\xff\xff\x1a\x00\x03\x00\xff\xff\xff\xff\x1e\x00\x1f\x00\xff\xff\x09\x00\x0a\x00\xff\xff\x0c\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x13\x00\x14\x00\x15\x00\xff\xff\x17\x00\x18\x00\xff\xff\x1a\x00\x03\x00\xff\xff\xff\xff\x1e\x00\x1f\x00\xff\xff\x09\x00\x0a\x00\xff\xff\x0c\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x13\x00\x14\x00\x15\x00\xff\xff\x17\x00\x18\x00\xff\xff\x1a\x00\x03\x00\xff\xff\xff\xff\x1e\x00\x1f\x00\xff\xff\x09\x00\x0a\x00\xff\xff\x0c\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x13\x00\x14\x00\x15\x00\xff\xff\x17\x00\x18\x00\xff\xff\x1a\x00\x03\x00\xff\xff\xff\xff\x1e\x00\x1f\x00\xff\xff\x09\x00\x0a\x00\xff\xff\x0c\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x13\x00\x14\x00\x15\x00\xff\xff\x17\x00\x18\x00\xff\xff\x1a\x00\x03\x00\xff\xff\xff\xff\x1e\x00\x1f\x00\xff\xff\x09\x00\x0a\x00\xff\xff\x0c\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x13\x00\x14\x00\x15\x00\xff\xff\x17\x00\x18\x00\xff\xff\x1a\x00\x03\x00\xff\xff\xff\xff\x1e\x00\x1f\x00\xff\xff\x09\x00\x0a\x00\xff\xff\x0c\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x13\x00\x14\x00\x15\x00\xff\xff\x17\x00\x18\x00\xff\xff\x1a\x00\x03\x00\xff\xff\xff\xff\x1e\x00\x1f\x00\xff\xff\x09\x00\x0a\x00\xff\xff\x0c\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x13\x00\x14\x00\x15\x00\xff\xff\x17\x00\x18\x00\xff\xff\x1a\x00\x03\x00\xff\xff\xff\xff\x1e\x00\x1f\x00\xff\xff\x09\x00\x0a\x00\xff\xff\x0c\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x13\x00\x14\x00\x15\x00\xff\xff\x17\x00\x18\x00\xff\xff\x1a\x00\x03\x00\xff\xff\xff\xff\x1e\x00\x1f\x00\xff\xff\x09\x00\x0a\x00\xff\xff\x0c\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x13\x00\x14\x00\x15\x00\xff\xff\x17\x00\x18\x00\xff\xff\x1a\x00\x03\x00\xff\xff\xff\xff\x1e\x00\x1f\x00\xff\xff\x09\x00\x0a\x00\xff\xff\x0c\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x13\x00\x14\x00\x15\x00\xff\xff\x17\x00\x18\x00\xff\xff\x1a\x00\x03\x00\xff\xff\xff\xff\x1e\x00\x1f\x00\xff\xff\x09\x00\x0a\x00\xff\xff\x0c\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x13\x00\x14\x00\x15\x00\xff\xff\x17\x00\x18\x00\xff\xff\x1a\x00\x03\x00\xff\xff\xff\xff\x1e\x00\x1f\x00\xff\xff\x09\x00\x0a\x00\xff\xff\x0c\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x13\x00\x14\x00\x15\x00\xff\xff\x17\x00\x18\x00\xff\xff\x1a\x00\x03\x00\xff\xff\xff\xff\x1e\x00\x1f\x00\xff\xff\x09\x00\x0a\x00\xff\xff\x0c\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x13\x00\x14\x00\x15\x00\xff\xff\x17\x00\x18\x00\xff\xff\x1a\x00\x03\x00\xff\xff\xff\xff\x1e\x00\x1f\x00\xff\xff\x09\x00\x0a\x00\xff\xff\x0c\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x13\x00\x14\x00\x15\x00\xff\xff\x17\x00\x18\x00\xff\xff\x1a\x00\x03\x00\xff\xff\xff\xff\x1e\x00\x1f\x00\xff\xff\x09\x00\x0a\x00\xff\xff\x0c\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x13\x00\x14\x00\x15\x00\xff\xff\x17\x00\x18\x00\xff\xff\x1a\x00\x03\x00\xff\xff\xff\xff\x1e\x00\x1f\x00\xff\xff\x09\x00\x0a\x00\xff\xff\x0c\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x13\x00\x14\x00\x15\x00\xff\xff\x17\x00\x18\x00\xff\xff\x1a\x00\x03\x00\xff\xff\xff\xff\x1e\x00\x1f\x00\xff\xff\x09\x00\x0a\x00\xff\xff\x0c\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x13\x00\x14\x00\x15\x00\xff\xff\x17\x00\x18\x00\xff\xff\x1a\x00\x03\x00\xff\xff\xff\xff\x1e\x00\x1f\x00\xff\xff\x09\x00\x0a\x00\xff\xff\x0c\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x13\x00\x14\x00\x15\x00\xff\xff\x17\x00\x18\x00\xff\xff\x1a\x00\x03\x00\xff\xff\xff\xff\x1e\x00\x1f\x00\xff\xff\x09\x00\x0a\x00\xff\xff\x0c\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x13\x00\x14\x00\x15\x00\xff\xff\x17\x00\x18\x00\xff\xff\x1a\x00\x03\x00\xff\xff\xff\xff\x1e\x00\x1f\x00\xff\xff\x09\x00\x0a\x00\xff\xff\x0c\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x13\x00\x14\x00\x15\x00\xff\xff\x17\x00\x18\x00\xff\xff\x1a\x00\x03\x00\xff\xff\xff\xff\x1e\x00\x1f\x00\xff\xff\x09\x00\x0a\x00\xff\xff\x0c\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x13\x00\x14\x00\x15\x00\xff\xff\x17\x00\x18\x00\xff\xff\x1a\x00\x03\x00\xff\xff\xff\xff\x1e\x00\x1f\x00\xff\xff\x09\x00\x0a\x00\xff\xff\x0c\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x13\x00\x14\x00\x15\x00\xff\xff\x17\x00\x18\x00\xff\xff\x1a\x00\x03\x00\xff\xff\xff\xff\x1e\x00\x1f\x00\xff\xff\x09\x00\x0a\x00\xff\xff\x0c\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x13\x00\x14\x00\x15\x00\xff\xff\x17\x00\x18\x00\xff\xff\x1a\x00\x03\x00\xff\xff\xff\xff\x1e\x00\x1f\x00\xff\xff\x09\x00\x0a\x00\xff\xff\x0c\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x13\x00\x14\x00\x15\x00\xff\xff\x17\x00\x18\x00\xff\xff\x1a\x00\x03\x00\xff\xff\xff\xff\x1e\x00\x1f\x00\xff\xff\x09\x00\x0a\x00\xff\xff\x0c\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x13\x00\x14\x00\x15\x00\xff\xff\x17\x00\x18\x00\xff\xff\x1a\x00\x03\x00\xff\xff\xff\xff\x1e\x00\x1f\x00\xff\xff\x09\x00\x0a\x00\xff\xff\x0c\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x13\x00\x14\x00\x15\x00\xff\xff\x17\x00\x18\x00\xff\xff\x1a\x00\x03\x00\xff\xff\xff\xff\x1e\x00\x1f\x00\xff\xff\x09\x00\x0a\x00\xff\xff\x0c\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x13\x00\x14\x00\x15\x00\xff\xff\x17\x00\x18\x00\xff\xff\x1a\x00\x03\x00\xff\xff\xff\xff\x1e\x00\x1f\x00\xff\xff\x09\x00\x0a\x00\xff\xff\x0c\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x13\x00\x14\x00\x15\x00\xff\xff\x17\x00\x18\x00\xff\xff\x1a\x00\x03\x00\xff\xff\xff\xff\x1e\x00\x1f\x00\xff\xff\x09\x00\x0a\x00\xff\xff\x0c\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x13\x00\x14\x00\x15\x00\xff\xff\x17\x00\x18\x00\xff\xff\x1a\x00\x03\x00\xff\xff\xff\xff\x1e\x00\x1f\x00\xff\xff\x09\x00\x0a\x00\xff\xff\x0c\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x13\x00\x14\x00\x15\x00\xff\xff\x17\x00\x18\x00\xff\xff\x1a\x00\x03\x00\xff\xff\xff\xff\x1e\x00\x1f\x00\xff\xff\x09\x00\x0a\x00\xff\xff\x0c\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x13\x00\x14\x00\x15\x00\xff\xff\x17\x00\x18\x00\xff\xff\x1a\x00\x03\x00\xff\xff\xff\xff\x1e\x00\x1f\x00\xff\xff\x09\x00\x0a\x00\xff\xff\x0c\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x13\x00\x14\x00\x15\x00\xff\xff\x17\x00\x18\x00\xff\xff\x1a\x00\x03\x00\xff\xff\xff\xff\x1e\x00\x1f\x00\xff\xff\x09\x00\x0a\x00\xff\xff\x0c\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x13\x00\x14\x00\x15\x00\xff\xff\x17\x00\x18\x00\xff\xff\x1a\x00\x03\x00\xff\xff\xff\xff\x1e\x00\x1f\x00\xff\xff\x09\x00\x0a\x00\xff\xff\x0c\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x13\x00\x14\x00\x15\x00\xff\xff\x17\x00\x18\x00\xff\xff\x1a\x00\x03\x00\xff\xff\xff\xff\x1e\x00\x1f\x00\xff\xff\x09\x00\x0a\x00\xff\xff\x0c\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x13\x00\x14\x00\x15\x00\xff\xff\x17\x00\x18\x00\xff\xff\x1a\x00\x03\x00\xff\xff\xff\xff\x1e\x00\x1f\x00\xff\xff\x09\x00\x0a\x00\xff\xff\x0c\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x13\x00\x14\x00\x15\x00\xff\xff\x17\x00\x18\x00\xff\xff\x1a\x00\x03\x00\xff\xff\xff\xff\x1e\x00\x1f\x00\xff\xff\x09\x00\x0a\x00\xff\xff\x0c\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x13\x00\x14\x00\x15\x00\xff\xff\x17\x00\x18\x00\xff\xff\x1a\x00\x03\x00\xff\xff\xff\xff\x1e\x00\x1f\x00\xff\xff\x09\x00\x0a\x00\xff\xff\x0c\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x13\x00\x14\x00\x15\x00\xff\xff\x17\x00\x18\x00\xff\xff\x1a\x00\x03\x00\xff\xff\xff\xff\x1e\x00\x1f\x00\xff\xff\x09\x00\x0a\x00\xff\xff\x0c\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x13\x00\x14\x00\x15\x00\xff\xff\x17\x00\x18\x00\xff\xff\x1a\x00\x03\x00\xff\xff\xff\xff\x1e\x00\x1f\x00\xff\xff\x09\x00\x0a\x00\xff\xff\x0c\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x13\x00\x14\x00\x15\x00\xff\xff\x17\x00\x18\x00\xff\xff\x1a\x00\x03\x00\xff\xff\xff\xff\x1e\x00\x1f\x00\xff\xff\x09\x00\x0a\x00\xff\xff\x0c\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x13\x00\x14\x00\x15\x00\xff\xff\x17\x00\x18\x00\xff\xff\x1a\x00\x03\x00\xff\xff\xff\xff\x1e\x00\x1f\x00\xff\xff\x09\x00\x0a\x00\xff\xff\x0c\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x13\x00\x14\x00\x15\x00\xff\xff\x17\x00\x18\x00\xff\xff\x1a\x00\x03\x00\xff\xff\xff\xff\x1e\x00\x1f\x00\xff\xff\x09\x00\x0a\x00\xff\xff\x0c\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x13\x00\x14\x00\x15\x00\xff\xff\x17\x00\x18\x00\xff\xff\x1a\x00\x03\x00\xff\xff\xff\xff\x1e\x00\x1f\x00\xff\xff\x09\x00\x0a\x00\xff\xff\x0c\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x13\x00\x14\x00\x15\x00\xff\xff\x17\x00\x18\x00\xff\xff\x1a\x00\xff\xff\xff\xff\xff\xff\x1e\x00\x1f\x00\x0d\x00\x0e\x00\x0f\x00\x10\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x19\x00\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x1f\x00\x20\x00\x21\x00\x22\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\x28\x00\x0d\x00\x0e\x00\x0f\x00\x10\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x19\x00\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x1f\x00\x20\x00\x21\x00\x22\x00\x23\x00\x24\x00\x25\x00\x0d\x00\x0e\x00\x0f\x00\x10\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x19\x00\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x1f\x00\x20\x00\x21\x00\x22\x00\x23\x00\xff\xff\x25\x00\x0d\x00\x0e\x00\x0f\x00\x10\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x19\x00\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x1f\x00\x20\x00\x21\x00\x22\x00\xff\xff\xff\xff\x25\x00\x0e\x00\x0f\x00\x10\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x19\x00\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x1f\x00\x20\x00\x21\x00\x22\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff"#--happyTable :: HappyAddr-happyTable = HappyA# "\x00\x00\x11\x00\x12\x00\x13\x00\x02\x01\x4a\x01\x4b\x01\xee\x00\x14\x00\x03\x01\x15\x00\x04\x01\xfb\x00\x16\x00\x17\x00\x18\x00\x15\x00\x4c\x00\x19\x00\x37\x00\xa9\x00\x19\x00\xab\x00\xab\x00\x12\x01\xb4\x00\x36\x00\x3a\x00\x37\x00\x3b\x00\x3b\x00\x50\x01\xa0\x00\xac\x00\xad\x00\x61\x01\x1a\x00\x3b\x00\xb0\x00\xb0\x00\x1b\x00\x1c\x00\x99\x00\x19\x00\xaf\x00\x13\x01\xb5\x00\xb0\x00\xa1\x00\xa2\x00\xef\x00\x1d\x00\x1e\x00\xff\x00\x14\x00\x00\x01\x1f\x00\x3f\x01\x20\x00\x21\x00\x42\x01\x18\x00\x58\x01\x40\x01\x51\x01\x22\x00\x40\x01\x38\x00\x23\x00\x24\x00\x25\x00\xaa\x00\x05\x01\xa1\x00\xa2\x00\xa3\x00\x38\x00\x38\x00\x38\x00\xb0\x00\xf0\x00\x26\x00\x27\x00\xf1\x00\x28\x00\x29\x00\x2a\x00\x11\x00\x12\x00\x13\x00\x14\x00\x14\x00\x2a\x00\x4d\x00\x14\x00\x79\x00\x15\x00\x18\x00\x18\x00\x16\x00\x17\x00\x18\x00\xe5\x00\xe6\x00\x20\x00\xa4\x00\x38\x00\x19\x00\xa5\x00\x38\x00\xe7\x00\x22\x00\x36\x01\x0b\x01\xd1\x00\x75\x00\x01\x01\x1a\x01\x4e\x00\x1c\x01\xea\x00\xb1\x00\x1a\x00\xc0\x00\x59\x01\xb1\x00\x1b\x00\x1c\x00\x27\x00\x51\x00\x52\x00\xcd\x00\xc1\x00\xce\x00\x5a\x01\x53\x00\x76\x00\x1d\x00\x1e\x00\x0f\x01\x20\x00\x20\x00\x1f\x00\xb2\x00\x20\x00\xb0\x00\xb0\x00\x22\x00\x22\x00\x4f\x00\xb0\x00\x22\x00\xb0\x00\xb0\x00\x23\x00\x24\x00\x25\x00\x38\x00\xb0\x00\x2e\x01\x0c\x00\x1c\x01\x1d\x01\x04\x00\x27\x00\x27\x00\x1e\x01\x26\x00\x27\x00\x05\x00\x28\x00\x29\x00\x2a\x00\x11\x00\x12\x00\x13\x00\x47\x01\xf7\x00\xf8\x00\x4c\x01\x14\x00\x47\x00\x15\x00\x04\x00\x38\x00\x16\x00\x17\x00\x18\x00\x3d\x00\x05\x00\x33\x01\x0f\x00\x9a\x00\x19\x00\x3c\x01\x2a\x00\x02\x00\x03\x00\x04\x00\x3d\x01\x38\x01\x21\x01\x1d\x01\x30\x01\x05\x00\x06\x00\x1e\x01\x07\x00\x1a\x00\x08\x01\x0d\x01\x0f\x00\x1b\x00\x1c\x00\x08\x00\x09\x00\x0a\x00\x3c\x01\x0b\x00\x0c\x00\xe8\x00\x0d\x00\x40\x01\x1d\x00\x1e\x00\x0e\x00\x0f\x00\x32\x01\x1f\x00\x34\x01\x20\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x22\x00\x3b\x00\x10\x01\x23\x00\x24\x00\x25\x00\x3c\x00\xf3\x00\x22\x01\x3d\x00\x5e\x01\xf5\x00\x04\x00\x3e\x00\x14\x01\x0c\x00\x26\x00\x27\x00\x05\x00\x28\x00\x29\x00\x2a\x00\x11\x00\x12\x00\x13\x00\xe8\x00\x3d\x00\xec\x00\x0a\x00\x14\x00\x48\x00\x15\x00\x04\x00\x3d\x00\x16\x00\x17\x00\x18\x00\x49\x00\x05\x00\x0f\x01\x0f\x00\xcf\x00\x19\x00\xd1\x00\xa7\x00\x02\x00\x03\x00\x04\x00\xf3\x00\xa6\x00\xa7\x00\x53\x01\xf5\x00\x05\x00\x06\x00\xd9\x00\x07\x00\x1a\x00\xda\x00\xe3\x00\x0f\x00\x1b\x00\x1c\x00\x08\x00\x09\x00\x0a\x00\xdc\x00\x0b\x00\x0c\x00\xe2\x00\x0d\x00\xea\x00\x1d\x00\x1e\x00\x0e\x00\x0f\x00\x34\x00\x1f\x00\xf3\x00\x20\x00\x21\x00\x4d\x01\xf5\x00\x38\x00\xf3\x00\x9b\x00\x22\x00\x24\x01\xf5\x00\x23\x00\x24\x00\x25\x00\xf3\x00\xb8\x00\xbe\x00\x20\x01\xf5\x00\xf3\x00\x04\x00\xbc\x00\xf4\x00\xf5\x00\x26\x00\x27\x00\x05\x00\x28\x00\x29\x00\x2a\x00\x11\x00\x12\x00\x13\x00\x9d\x00\x0a\x00\x9e\x00\xc1\x00\x14\x00\xc2\x00\x15\x00\xc3\x00\x34\x00\x16\x00\x17\x00\x18\x00\x38\x00\x40\x00\x33\x00\x0f\x00\xf3\x00\x19\x00\x4a\x00\xf8\x00\xf5\x00\x76\x00\x04\x00\xf3\x00\x64\x01\x5c\x01\xf9\x00\xf5\x00\x05\x00\x06\x00\x4f\x00\x07\x00\x1a\x00\x30\x00\x31\x00\x32\x00\x1b\x00\x1c\x00\x08\x00\x09\x00\x0a\x00\x61\x01\x0b\x00\x0c\x00\x5d\x01\x0d\x00\x56\x01\x1d\x00\x1e\x00\x0e\x00\x0f\x00\xa9\x00\x1f\x00\x38\x00\x20\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x43\x01\x45\x01\x22\x00\x44\x01\x46\x01\x23\x00\x24\x00\x25\x00\xa9\x00\x49\x01\x4c\x01\x27\x00\x26\x01\x52\x01\x27\x01\x29\x01\xae\x00\x28\x01\x26\x00\x27\x00\x2a\x01\x28\x00\x29\x00\x2a\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x04\x00\xa9\x00\x37\x01\x27\x00\x38\x00\x3c\x01\x05\x00\x43\x00\x2a\x01\x07\x00\x38\x01\xfd\x00\xfe\x00\x0c\x01\x17\x01\x18\x01\x08\x00\x09\x00\x0a\x00\x16\x01\x0b\x00\x0c\x00\x19\x01\x0d\x00\x1b\x01\xaa\x00\x27\x00\x0e\x00\x0f\x00\xcc\x00\xcf\x00\x24\x01\x14\x01\xd4\x00\x70\x00\xc0\x00\x27\x00\x71\x00\x72\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x0d\x01\xd7\x00\x38\x00\xde\x00\x27\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\xaa\x00\x70\x00\x38\x00\xc9\x00\x71\x00\x72\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\xf2\x00\xf3\x00\x71\x00\x72\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x04\x00\x70\x00\xab\x00\xb6\x00\x71\x00\x72\x00\x05\x00\x43\x00\x2b\x01\x07\x00\x7a\x00\xfc\x00\x7c\x00\x7b\x00\x27\x00\x9d\x00\x08\x00\x09\x00\x0a\x00\x38\x00\x0b\x00\x0c\x00\xab\x00\x0d\x00\xb6\x00\xba\x00\xb7\x00\x0e\x00\x0f\x00\x38\x00\xbb\x00\x38\x00\xbe\x00\x38\x00\x70\x00\x27\x00\xff\xff\x71\x00\x72\x00\x24\x01\x63\x01\x66\x01\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x5e\x01\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x38\x00\x2c\x00\x2e\x00\x33\x00\x04\x00\x70\x00\x27\x00\x38\x00\x71\x00\x72\x00\x05\x00\x06\x01\x73\x00\x07\x00\x27\x00\x00\x00\x74\x00\x00\x00\x07\x01\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x00\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x70\x00\x00\x00\x00\x00\x71\x00\x72\x00\x60\x01\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\xd5\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x70\x00\x00\x00\x00\x00\x71\x00\x72\x00\x05\x00\x43\x00\x09\x01\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x00\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x70\x00\x00\x00\x00\x00\x71\x00\x72\x00\xd8\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x00\x00\x00\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x70\x00\x04\x00\x00\x00\x71\x00\x72\x00\x3a\x01\x3b\x01\x05\x00\x43\x00\xd2\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x00\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x70\x00\x00\x00\x00\x00\x71\x00\x72\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x00\x00\x00\x00\x00\x00\xc5\x00\x00\x00\x00\x00\x70\x00\x00\x00\x04\x00\x71\x00\x72\x00\x00\x00\x00\x00\x00\x00\x05\x00\x43\x00\xd5\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x00\x00\xc7\x00\x70\x00\x0e\x00\x0f\x00\x71\x00\x72\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x70\x00\x00\x00\x00\x00\x71\x00\x72\x00\x05\x00\x43\x00\xeb\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x00\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x05\x00\x43\x00\x77\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\x43\x00\xa5\x00\x07\x00\x70\x00\x00\x00\x00\x00\x71\x00\x72\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\x43\x00\x44\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\x43\x00\x45\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\x66\x01\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\x64\x01\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\x52\x01\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\x54\x01\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\x56\x01\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\x57\x01\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\x46\x01\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\x4e\x01\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\x2c\x01\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\x2d\x01\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\x2f\x01\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\x31\x01\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\x05\x01\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\x1f\x01\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\xc9\x00\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\xca\x00\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\xd8\x00\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\xdb\x00\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\xde\x00\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\xdf\x00\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\xe0\x00\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\xe1\x00\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\xe7\x00\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\x7c\x00\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\x7d\x00\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\x7e\x00\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\x7f\x00\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\x80\x00\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\x81\x00\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\x82\x00\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\x83\x00\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\x84\x00\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\x85\x00\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\x86\x00\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\x87\x00\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\x88\x00\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\x89\x00\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\x8a\x00\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\x8b\x00\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\x8c\x00\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\x8d\x00\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\x8e\x00\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\x8f\x00\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\x90\x00\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\x91\x00\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\x92\x00\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\x93\x00\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\x94\x00\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\x95\x00\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\x96\x00\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\x97\x00\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\x98\x00\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\xb7\x00\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\xbb\x00\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\xc5\x00\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\xc7\x00\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\x2c\x00\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\x2e\x00\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\x3f\x00\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\x41\x00\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\x42\x00\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\x47\x00\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x00\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x00\x00\x6c\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x00\x00\x00\x00\x00\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"#--happyReduceArr = array (1, 160) [-	(1 , happyReduce_1),-	(2 , happyReduce_2),-	(3 , happyReduce_3),-	(4 , happyReduce_4),-	(5 , happyReduce_5),-	(6 , happyReduce_6),-	(7 , happyReduce_7),-	(8 , happyReduce_8),-	(9 , happyReduce_9),-	(10 , happyReduce_10),-	(11 , happyReduce_11),-	(12 , happyReduce_12),-	(13 , happyReduce_13),-	(14 , happyReduce_14),-	(15 , happyReduce_15),-	(16 , happyReduce_16),-	(17 , happyReduce_17),-	(18 , happyReduce_18),-	(19 , happyReduce_19),-	(20 , happyReduce_20),-	(21 , happyReduce_21),-	(22 , happyReduce_22),-	(23 , happyReduce_23),-	(24 , happyReduce_24),-	(25 , happyReduce_25),-	(26 , happyReduce_26),-	(27 , happyReduce_27),-	(28 , happyReduce_28),-	(29 , happyReduce_29),-	(30 , happyReduce_30),-	(31 , happyReduce_31),-	(32 , happyReduce_32),-	(33 , happyReduce_33),-	(34 , happyReduce_34),-	(35 , happyReduce_35),-	(36 , happyReduce_36),-	(37 , happyReduce_37),-	(38 , happyReduce_38),-	(39 , happyReduce_39),-	(40 , happyReduce_40),-	(41 , happyReduce_41),-	(42 , happyReduce_42),-	(43 , happyReduce_43),-	(44 , happyReduce_44),-	(45 , happyReduce_45),-	(46 , happyReduce_46),-	(47 , happyReduce_47),-	(48 , happyReduce_48),-	(49 , happyReduce_49),-	(50 , happyReduce_50),-	(51 , happyReduce_51),-	(52 , happyReduce_52),-	(53 , happyReduce_53),-	(54 , happyReduce_54),-	(55 , happyReduce_55),-	(56 , happyReduce_56),-	(57 , happyReduce_57),-	(58 , happyReduce_58),-	(59 , happyReduce_59),-	(60 , happyReduce_60),-	(61 , happyReduce_61),-	(62 , happyReduce_62),-	(63 , happyReduce_63),-	(64 , happyReduce_64),-	(65 , happyReduce_65),-	(66 , happyReduce_66),-	(67 , happyReduce_67),-	(68 , happyReduce_68),-	(69 , happyReduce_69),-	(70 , happyReduce_70),-	(71 , happyReduce_71),-	(72 , happyReduce_72),-	(73 , happyReduce_73),-	(74 , happyReduce_74),-	(75 , happyReduce_75),-	(76 , happyReduce_76),-	(77 , happyReduce_77),-	(78 , happyReduce_78),-	(79 , happyReduce_79),-	(80 , happyReduce_80),-	(81 , happyReduce_81),-	(82 , happyReduce_82),-	(83 , happyReduce_83),-	(84 , happyReduce_84),-	(85 , happyReduce_85),-	(86 , happyReduce_86),-	(87 , happyReduce_87),-	(88 , happyReduce_88),-	(89 , happyReduce_89),-	(90 , happyReduce_90),-	(91 , happyReduce_91),-	(92 , happyReduce_92),-	(93 , happyReduce_93),-	(94 , happyReduce_94),-	(95 , happyReduce_95),-	(96 , happyReduce_96),-	(97 , happyReduce_97),-	(98 , happyReduce_98),-	(99 , happyReduce_99),-	(100 , happyReduce_100),-	(101 , happyReduce_101),-	(102 , happyReduce_102),-	(103 , happyReduce_103),-	(104 , happyReduce_104),-	(105 , happyReduce_105),-	(106 , happyReduce_106),-	(107 , happyReduce_107),-	(108 , happyReduce_108),-	(109 , happyReduce_109),-	(110 , happyReduce_110),-	(111 , happyReduce_111),-	(112 , happyReduce_112),-	(113 , happyReduce_113),-	(114 , happyReduce_114),-	(115 , happyReduce_115),-	(116 , happyReduce_116),-	(117 , happyReduce_117),-	(118 , happyReduce_118),-	(119 , happyReduce_119),-	(120 , happyReduce_120),-	(121 , happyReduce_121),-	(122 , happyReduce_122),-	(123 , happyReduce_123),-	(124 , happyReduce_124),-	(125 , happyReduce_125),-	(126 , happyReduce_126),-	(127 , happyReduce_127),-	(128 , happyReduce_128),-	(129 , happyReduce_129),-	(130 , happyReduce_130),-	(131 , happyReduce_131),-	(132 , happyReduce_132),-	(133 , happyReduce_133),-	(134 , happyReduce_134),-	(135 , happyReduce_135),-	(136 , happyReduce_136),-	(137 , happyReduce_137),-	(138 , happyReduce_138),-	(139 , happyReduce_139),-	(140 , happyReduce_140),-	(141 , happyReduce_141),-	(142 , happyReduce_142),-	(143 , happyReduce_143),-	(144 , happyReduce_144),-	(145 , happyReduce_145),-	(146 , happyReduce_146),-	(147 , happyReduce_147),-	(148 , happyReduce_148),-	(149 , happyReduce_149),-	(150 , happyReduce_150),-	(151 , happyReduce_151),-	(152 , happyReduce_152),-	(153 , happyReduce_153),-	(154 , happyReduce_154),-	(155 , happyReduce_155),-	(156 , happyReduce_156),-	(157 , happyReduce_157),-	(158 , happyReduce_158),-	(159 , happyReduce_159),-	(160 , happyReduce_160)-	]--happy_n_terms = 90 :: Int-happy_n_nonterms = 33 :: Int--happyReduce_1 = happySpecReduce_2  0# happyReduction_1-happyReduction_1 happy_x_2-	happy_x_1-	 =  case happyOut5 happy_x_1 of { happy_var_1 -> -	happyIn4-		 (happy_var_1-	)}--happyReduce_2 = happySpecReduce_1  1# happyReduction_2-happyReduction_2 happy_x_1-	 =  case happyOut6 happy_x_1 of { happy_var_1 -> -	happyIn5-		 ([happy_var_1]-	)}--happyReduce_3 = happySpecReduce_2  1# happyReduction_3-happyReduction_3 happy_x_2-	happy_x_1-	 =  case happyOut6 happy_x_1 of { happy_var_1 -> -	happyIn5-		 ([happy_var_1]-	)}--happyReduce_4 = happySpecReduce_3  1# happyReduction_4-happyReduction_4 happy_x_3-	happy_x_2-	happy_x_1-	 =  case happyOut5 happy_x_1 of { happy_var_1 -> -	case happyOut6 happy_x_3 of { happy_var_3 -> -	happyIn5-		 (happy_var_1++[happy_var_3]-	)}}--happyReduce_5 = happyReduce 4# 1# happyReduction_5-happyReduction_5 (happy_x_4 `HappyStk`-	happy_x_3 `HappyStk`-	happy_x_2 `HappyStk`-	happy_x_1 `HappyStk`-	happyRest)-	 = case happyOut5 happy_x_1 of { happy_var_1 -> -	case happyOut6 happy_x_3 of { happy_var_3 -> -	happyIn5-		 (happy_var_1++[happy_var_3]-	) `HappyStk` happyRest}}--happyReduce_6 = happySpecReduce_1  2# happyReduction_6-happyReduction_6 happy_x_1-	 =  case happyOut14 happy_x_1 of { happy_var_1 -> -	happyIn6-		 (happy_var_1-	)}--happyReduce_7 = happyReduce 5# 2# happyReduction_7-happyReduction_7 (happy_x_5 `HappyStk`-	happy_x_4 `HappyStk`-	happy_x_3 `HappyStk`-	happy_x_2 `HappyStk`-	happy_x_1 `HappyStk`-	happyRest)-	 = case happyOut13 happy_x_3 of { happy_var_3 -> -	case happyOut14 happy_x_5 of { happy_var_5 -> -	happyIn6-		 (Ast "variable" [happy_var_3,happy_var_5]-	) `HappyStk` happyRest}}--happyReduce_8 = happyReduce 7# 2# happyReduction_8-happyReduction_8 (happy_x_7 `HappyStk`-	happy_x_6 `HappyStk`-	happy_x_5 `HappyStk`-	happy_x_4 `HappyStk`-	happy_x_3 `HappyStk`-	happy_x_2 `HappyStk`-	happy_x_1 `HappyStk`-	happyRest)-	 = case happyOut13 happy_x_3 of { happy_var_3 -> -	case happyOut14 happy_x_7 of { happy_var_7 -> -	happyIn6-		 (Ast "variable" [happy_var_3,happy_var_7]-	) `HappyStk` happyRest}}--happyReduce_9 = happyReduce 9# 2# happyReduction_9-happyReduction_9 (happy_x_9 `HappyStk`-	happy_x_8 `HappyStk`-	happy_x_7 `HappyStk`-	happy_x_6 `HappyStk`-	happy_x_5 `HappyStk`-	happy_x_4 `HappyStk`-	happy_x_3 `HappyStk`-	happy_x_2 `HappyStk`-	happy_x_1 `HappyStk`-	happyRest)-	 = case happyOut7 happy_x_3 of { happy_var_3 -> -	case happyOut8 happy_x_5 of { happy_var_5 -> -	case happyOut14 happy_x_8 of { happy_var_8 -> -	happyIn6-		 (if (null happy_var_5)-                                                          then parseError [TError ("Nullary functions are not supported: "++happy_var_3)]-                                                          else Ast "function" ([Avar happy_var_3,happy_var_8]++happy_var_5)-	) `HappyStk` happyRest}}}--happyReduce_10 = happyReduce 11# 2# happyReduction_10-happyReduction_10 (happy_x_11 `HappyStk`-	happy_x_10 `HappyStk`-	happy_x_9 `HappyStk`-	happy_x_8 `HappyStk`-	happy_x_7 `HappyStk`-	happy_x_6 `HappyStk`-	happy_x_5 `HappyStk`-	happy_x_4 `HappyStk`-	happy_x_3 `HappyStk`-	happy_x_2 `HappyStk`-	happy_x_1 `HappyStk`-	happyRest)-	 = case happyOut7 happy_x_3 of { happy_var_3 -> -	case happyOut8 happy_x_5 of { happy_var_5 -> -	case happyOut14 happy_x_10 of { happy_var_10 -> -	happyIn6-		 (if (null happy_var_5)-                                                          then parseError [TError ("Nullary functions are not supported: "++happy_var_3)]-                                                          else Ast "function" ([Avar happy_var_3,happy_var_10]++happy_var_5)-	) `HappyStk` happyRest}}}--happyReduce_11 = happyReduce 9# 2# happyReduction_11-happyReduction_11 (happy_x_9 `HappyStk`-	happy_x_8 `HappyStk`-	happy_x_7 `HappyStk`-	happy_x_6 `HappyStk`-	happy_x_5 `HappyStk`-	happy_x_4 `HappyStk`-	happy_x_3 `HappyStk`-	happy_x_2 `HappyStk`-	happy_x_1 `HappyStk`-	happyRest)-	 = case happyOut7 happy_x_3 of { happy_var_3 -> -	case happyOut8 happy_x_5 of { happy_var_5 -> -	case happyOut14 happy_x_8 of { happy_var_8 -> -	happyIn6-		 (if (null happy_var_5)-                                                          then parseError [TError ("Nullary views are not supported: "++happy_var_3)]-                                                          else Ast "view" ([Avar happy_var_3,happy_var_8]++happy_var_5)-	) `HappyStk` happyRest}}}--happyReduce_12 = happySpecReduce_1  3# happyReduction_12-happyReduction_12 happy_x_1-	 =  case happyOutTok happy_x_1 of { (QName happy_var_1) -> -	happyIn7-		 (happy_var_1-	)}--happyReduce_13 = happySpecReduce_3  3# happyReduction_13-happyReduction_13 happy_x_3-	happy_x_2-	happy_x_1-	 =  case happyOutTok happy_x_1 of { (QName happy_var_1) -> -	case happyOutTok happy_x_3 of { (QName happy_var_3) -> -	happyIn7-		 (happy_var_1++":"++happy_var_3-	)}}--happyReduce_14 = happySpecReduce_1  4# happyReduction_14-happyReduction_14 happy_x_1-	 =  case happyOut9 happy_x_1 of { happy_var_1 -> -	happyIn8-		 (happy_var_1-	)}--happyReduce_15 = happySpecReduce_0  4# happyReduction_15-happyReduction_15  =  happyIn8-		 ([]-	)--happyReduce_16 = happySpecReduce_1  5# happyReduction_16-happyReduction_16 happy_x_1-	 =  case happyOut13 happy_x_1 of { happy_var_1 -> -	happyIn9-		 ([happy_var_1]-	)}--happyReduce_17 = happySpecReduce_3  5# happyReduction_17-happyReduction_17 happy_x_3-	happy_x_2-	happy_x_1-	 =  case happyOut13 happy_x_1 of { happy_var_1 -> -	happyIn9-		 ([happy_var_1]-	)}--happyReduce_18 = happySpecReduce_3  5# happyReduction_18-happyReduction_18 happy_x_3-	happy_x_2-	happy_x_1-	 =  case happyOut9 happy_x_1 of { happy_var_1 -> -	case happyOut13 happy_x_3 of { happy_var_3 -> -	happyIn9-		 (happy_var_1++[happy_var_3]-	)}}--happyReduce_19 = happyReduce 5# 5# happyReduction_19-happyReduction_19 (happy_x_5 `HappyStk`-	happy_x_4 `HappyStk`-	happy_x_3 `HappyStk`-	happy_x_2 `HappyStk`-	happy_x_1 `HappyStk`-	happyRest)-	 = case happyOut9 happy_x_1 of { happy_var_1 -> -	case happyOut13 happy_x_3 of { happy_var_3 -> -	happyIn9-		 (happy_var_1++[happy_var_3]-	) `HappyStk` happyRest}}--happyReduce_20 = happySpecReduce_1  6# happyReduction_20-happyReduction_20 happy_x_1-	 =  case happyOut7 happy_x_1 of { happy_var_1 -> -	happyIn10-		 (Avar happy_var_1-	)}--happyReduce_21 = happySpecReduce_2  6# happyReduction_21-happyReduction_21 happy_x_2-	happy_x_1-	 =  case happyOut7 happy_x_1 of { happy_var_1 -> -	happyIn10-		 (Ast "+" [Avar happy_var_1]-	)}--happyReduce_22 = happySpecReduce_2  6# happyReduction_22-happyReduction_22 happy_x_2-	happy_x_1-	 =  case happyOut7 happy_x_1 of { happy_var_1 -> -	happyIn10-		 (Ast "*" [Avar happy_var_1]-	)}--happyReduce_23 = happySpecReduce_2  6# happyReduction_23-happyReduction_23 happy_x_2-	happy_x_1-	 =  case happyOut7 happy_x_1 of { happy_var_1 -> -	happyIn10-		 (Ast "?" [Avar happy_var_1]-	)}--happyReduce_24 = happySpecReduce_1  6# happyReduction_24-happyReduction_24 happy_x_1-	 =  case happyOut11 happy_x_1 of { happy_var_1 -> -	happyIn10-		 (happy_var_1-	)}--happyReduce_25 = happySpecReduce_2  6# happyReduction_25-happyReduction_25 happy_x_2-	happy_x_1-	 =  case happyOut11 happy_x_1 of { happy_var_1 -> -	happyIn10-		 (Ast "+" [happy_var_1]-	)}--happyReduce_26 = happySpecReduce_2  6# happyReduction_26-happyReduction_26 happy_x_2-	happy_x_1-	 =  case happyOut11 happy_x_1 of { happy_var_1 -> -	happyIn10-		 (Ast "*" [happy_var_1]-	)}--happyReduce_27 = happySpecReduce_2  6# happyReduction_27-happyReduction_27 happy_x_2-	happy_x_1-	 =  case happyOut11 happy_x_1 of { happy_var_1 -> -	happyIn10-		 (Ast "?" [happy_var_1]-	)}--happyReduce_28 = happySpecReduce_3  7# happyReduction_28-happyReduction_28 happy_x_3-	happy_x_2-	happy_x_1-	 =  happyIn11-		 (Ast "element" []-	)--happyReduce_29 = happySpecReduce_3  7# happyReduction_29-happyReduction_29 happy_x_3-	happy_x_2-	happy_x_1-	 =  happyIn11-		 (Ast "attribute" []-	)--happyReduce_30 = happySpecReduce_3  7# happyReduction_30-happyReduction_30 happy_x_3-	happy_x_2-	happy_x_1-	 =  case happyOut7 happy_x_1 of { happy_var_1 -> -	happyIn11-		 (Ast happy_var_1 []-	)}--happyReduce_31 = happyReduce 4# 7# happyReduction_31-happyReduction_31 (happy_x_4 `HappyStk`-	happy_x_3 `HappyStk`-	happy_x_2 `HappyStk`-	happy_x_1 `HappyStk`-	happyRest)-	 = case happyOut12 happy_x_3 of { happy_var_3 -> -	happyIn11-		 (Ast "element" happy_var_3-	) `HappyStk` happyRest}--happyReduce_32 = happyReduce 4# 7# happyReduction_32-happyReduction_32 (happy_x_4 `HappyStk`-	happy_x_3 `HappyStk`-	happy_x_2 `HappyStk`-	happy_x_1 `HappyStk`-	happyRest)-	 = case happyOut12 happy_x_3 of { happy_var_3 -> -	happyIn11-		 (Ast "attribute" happy_var_3-	) `HappyStk` happyRest}--happyReduce_33 = happySpecReduce_1  8# happyReduction_33-happyReduction_33 happy_x_1-	 =  happyIn12-		 ([Avar "*"]-	)--happyReduce_34 = happySpecReduce_1  8# happyReduction_34-happyReduction_34 happy_x_1-	 =  case happyOut7 happy_x_1 of { happy_var_1 -> -	happyIn12-		 ([Avar happy_var_1]-	)}--happyReduce_35 = happySpecReduce_3  8# happyReduction_35-happyReduction_35 happy_x_3-	happy_x_2-	happy_x_1-	 =  case happyOut7 happy_x_3 of { happy_var_3 -> -	happyIn12-		 ([Avar "*",Avar happy_var_3]-	)}--happyReduce_36 = happySpecReduce_3  8# happyReduction_36-happyReduction_36 happy_x_3-	happy_x_2-	happy_x_1-	 =  case happyOut7 happy_x_1 of { happy_var_1 -> -	case happyOut7 happy_x_3 of { happy_var_3 -> -	happyIn12-		 ([Avar happy_var_1,Avar happy_var_3]-	)}}--happyReduce_37 = happyReduce 4# 8# happyReduction_37-happyReduction_37 (happy_x_4 `HappyStk`-	happy_x_3 `HappyStk`-	happy_x_2 `HappyStk`-	happy_x_1 `HappyStk`-	happyRest)-	 = case happyOut7 happy_x_3 of { happy_var_3 -> -	happyIn12-		 ([Avar "*",Ast "?" [Avar happy_var_3]]-	) `HappyStk` happyRest}--happyReduce_38 = happyReduce 4# 8# happyReduction_38-happyReduction_38 (happy_x_4 `HappyStk`-	happy_x_3 `HappyStk`-	happy_x_2 `HappyStk`-	happy_x_1 `HappyStk`-	happyRest)-	 = case happyOut7 happy_x_1 of { happy_var_1 -> -	case happyOut7 happy_x_3 of { happy_var_3 -> -	happyIn12-		 ([Avar happy_var_1,Ast "?" [Avar happy_var_3]]-	) `HappyStk` happyRest}}--happyReduce_39 = happySpecReduce_1  9# happyReduction_39-happyReduction_39 happy_x_1-	 =  case happyOutTok happy_x_1 of { (Variable happy_var_1) -> -	happyIn13-		 (Avar happy_var_1-	)}--happyReduce_40 = happyReduce 5# 10# happyReduction_40-happyReduction_40 (happy_x_5 `HappyStk`-	happy_x_4 `HappyStk`-	happy_x_3 `HappyStk`-	happy_x_2 `HappyStk`-	happy_x_1 `HappyStk`-	happyRest)-	 = case happyOut16 happy_x_1 of { happy_var_1 -> -	case happyOut19 happy_x_2 of { happy_var_2 -> -	case happyOut20 happy_x_3 of { happy_var_3 -> -	case happyOut14 happy_x_5 of { happy_var_5 -> -	happyIn14-		 ((snd happy_var_3) (happy_var_1 (happy_var_2 ((fst happy_var_3) happy_var_5)))-	) `HappyStk` happyRest}}}}--happyReduce_41 = happyReduce 4# 10# happyReduction_41-happyReduction_41 (happy_x_4 `HappyStk`-	happy_x_3 `HappyStk`-	happy_x_2 `HappyStk`-	happy_x_1 `HappyStk`-	happyRest)-	 = case happyOut17 happy_x_2 of { happy_var_2 -> -	case happyOut14 happy_x_4 of { happy_var_4 -> -	happyIn14-		 (call "some" [happy_var_2 happy_var_4]-	) `HappyStk` happyRest}}--happyReduce_42 = happyReduce 4# 10# happyReduction_42-happyReduction_42 (happy_x_4 `HappyStk`-	happy_x_3 `HappyStk`-	happy_x_2 `HappyStk`-	happy_x_1 `HappyStk`-	happyRest)-	 = case happyOut17 happy_x_2 of { happy_var_2 -> -	case happyOut14 happy_x_4 of { happy_var_4 -> -	happyIn14-		 (call "not" [call "some" [happy_var_2 (call "not" [happy_var_4])]]-	) `HappyStk` happyRest}}--happyReduce_43 = happyReduce 6# 10# happyReduction_43-happyReduction_43 (happy_x_6 `HappyStk`-	happy_x_5 `HappyStk`-	happy_x_4 `HappyStk`-	happy_x_3 `HappyStk`-	happy_x_2 `HappyStk`-	happy_x_1 `HappyStk`-	happyRest)-	 = case happyOut14 happy_x_2 of { happy_var_2 -> -	case happyOut14 happy_x_4 of { happy_var_4 -> -	case happyOut14 happy_x_6 of { happy_var_6 -> -	happyIn14-		 (Ast "if" [happy_var_2,happy_var_4,happy_var_6]-	) `HappyStk` happyRest}}}--happyReduce_44 = happySpecReduce_1  10# happyReduction_44-happyReduction_44 happy_x_1-	 =  case happyOut30 happy_x_1 of { happy_var_1 -> -	happyIn14-		 (happy_var_1-	)}--happyReduce_45 = happySpecReduce_1  10# happyReduction_45-happyReduction_45 happy_x_1-	 =  case happyOut24 happy_x_1 of { happy_var_1 -> -	happyIn14-		 (happy_var_1-	)}--happyReduce_46 = happySpecReduce_1  10# happyReduction_46-happyReduction_46 happy_x_1-	 =  case happyOut23 happy_x_1 of { happy_var_1 -> -	happyIn14-		 (happy_var_1-	)}--happyReduce_47 = happySpecReduce_3  10# happyReduction_47-happyReduction_47 happy_x_3-	happy_x_2-	happy_x_1-	 =  case happyOut14 happy_x_1 of { happy_var_1 -> -	case happyOut14 happy_x_3 of { happy_var_3 -> -	happyIn14-		 (call "to" [happy_var_1,happy_var_3]-	)}}--happyReduce_48 = happySpecReduce_3  10# happyReduction_48-happyReduction_48 happy_x_3-	happy_x_2-	happy_x_1-	 =  case happyOut14 happy_x_1 of { happy_var_1 -> -	case happyOut14 happy_x_3 of { happy_var_3 -> -	happyIn14-		 (call "+" [happy_var_1,happy_var_3]-	)}}--happyReduce_49 = happySpecReduce_3  10# happyReduction_49-happyReduction_49 happy_x_3-	happy_x_2-	happy_x_1-	 =  case happyOut14 happy_x_1 of { happy_var_1 -> -	case happyOut14 happy_x_3 of { happy_var_3 -> -	happyIn14-		 (call "-" [happy_var_1,happy_var_3]-	)}}--happyReduce_50 = happySpecReduce_3  10# happyReduction_50-happyReduction_50 happy_x_3-	happy_x_2-	happy_x_1-	 =  case happyOut14 happy_x_1 of { happy_var_1 -> -	case happyOut14 happy_x_3 of { happy_var_3 -> -	happyIn14-		 (call "*" [happy_var_1,happy_var_3]-	)}}--happyReduce_51 = happySpecReduce_3  10# happyReduction_51-happyReduction_51 happy_x_3-	happy_x_2-	happy_x_1-	 =  case happyOut14 happy_x_1 of { happy_var_1 -> -	case happyOut14 happy_x_3 of { happy_var_3 -> -	happyIn14-		 (call "div" [happy_var_1,happy_var_3]-	)}}--happyReduce_52 = happySpecReduce_3  10# happyReduction_52-happyReduction_52 happy_x_3-	happy_x_2-	happy_x_1-	 =  case happyOut14 happy_x_1 of { happy_var_1 -> -	case happyOut14 happy_x_3 of { happy_var_3 -> -	happyIn14-		 (call "idiv" [happy_var_1,happy_var_3]-	)}}--happyReduce_53 = happySpecReduce_3  10# happyReduction_53-happyReduction_53 happy_x_3-	happy_x_2-	happy_x_1-	 =  case happyOut14 happy_x_1 of { happy_var_1 -> -	case happyOut14 happy_x_3 of { happy_var_3 -> -	happyIn14-		 (call "mod" [happy_var_1,happy_var_3]-	)}}--happyReduce_54 = happySpecReduce_3  10# happyReduction_54-happyReduction_54 happy_x_3-	happy_x_2-	happy_x_1-	 =  case happyOut14 happy_x_1 of { happy_var_1 -> -	case happyOut14 happy_x_3 of { happy_var_3 -> -	happyIn14-		 (call "=" [happy_var_1,happy_var_3]-	)}}--happyReduce_55 = happySpecReduce_3  10# happyReduction_55-happyReduction_55 happy_x_3-	happy_x_2-	happy_x_1-	 =  case happyOut14 happy_x_1 of { happy_var_1 -> -	case happyOut14 happy_x_3 of { happy_var_3 -> -	happyIn14-		 (call "!=" [happy_var_1,happy_var_3]-	)}}--happyReduce_56 = happySpecReduce_3  10# happyReduction_56-happyReduction_56 happy_x_3-	happy_x_2-	happy_x_1-	 =  case happyOut14 happy_x_1 of { happy_var_1 -> -	case happyOut14 happy_x_3 of { happy_var_3 -> -	happyIn14-		 (call "<" [happy_var_1,happy_var_3]-	)}}--happyReduce_57 = happySpecReduce_3  10# happyReduction_57-happyReduction_57 happy_x_3-	happy_x_2-	happy_x_1-	 =  case happyOut14 happy_x_1 of { happy_var_1 -> -	case happyOut14 happy_x_3 of { happy_var_3 -> -	happyIn14-		 (call "<=" [happy_var_1,happy_var_3]-	)}}--happyReduce_58 = happySpecReduce_3  10# happyReduction_58-happyReduction_58 happy_x_3-	happy_x_2-	happy_x_1-	 =  case happyOut14 happy_x_1 of { happy_var_1 -> -	case happyOut14 happy_x_3 of { happy_var_3 -> -	happyIn14-		 (call ">" [happy_var_1,happy_var_3]-	)}}--happyReduce_59 = happySpecReduce_3  10# happyReduction_59-happyReduction_59 happy_x_3-	happy_x_2-	happy_x_1-	 =  case happyOut14 happy_x_1 of { happy_var_1 -> -	case happyOut14 happy_x_3 of { happy_var_3 -> -	happyIn14-		 (call ">=" [happy_var_1,happy_var_3]-	)}}--happyReduce_60 = happySpecReduce_3  10# happyReduction_60-happyReduction_60 happy_x_3-	happy_x_2-	happy_x_1-	 =  case happyOut14 happy_x_1 of { happy_var_1 -> -	case happyOut14 happy_x_3 of { happy_var_3 -> -	happyIn14-		 (call "<<" [happy_var_1,happy_var_3]-	)}}--happyReduce_61 = happySpecReduce_3  10# happyReduction_61-happyReduction_61 happy_x_3-	happy_x_2-	happy_x_1-	 =  case happyOut14 happy_x_1 of { happy_var_1 -> -	case happyOut14 happy_x_3 of { happy_var_3 -> -	happyIn14-		 (call ">>" [happy_var_1,happy_var_3]-	)}}--happyReduce_62 = happySpecReduce_3  10# happyReduction_62-happyReduction_62 happy_x_3-	happy_x_2-	happy_x_1-	 =  case happyOut14 happy_x_1 of { happy_var_1 -> -	case happyOut14 happy_x_3 of { happy_var_3 -> -	happyIn14-		 (call "is" [happy_var_1,happy_var_3]-	)}}--happyReduce_63 = happySpecReduce_3  10# happyReduction_63-happyReduction_63 happy_x_3-	happy_x_2-	happy_x_1-	 =  case happyOut14 happy_x_1 of { happy_var_1 -> -	case happyOut14 happy_x_3 of { happy_var_3 -> -	happyIn14-		 (call "eq" [happy_var_1,happy_var_3]-	)}}--happyReduce_64 = happySpecReduce_3  10# happyReduction_64-happyReduction_64 happy_x_3-	happy_x_2-	happy_x_1-	 =  case happyOut14 happy_x_1 of { happy_var_1 -> -	case happyOut14 happy_x_3 of { happy_var_3 -> -	happyIn14-		 (call "ne" [happy_var_1,happy_var_3]-	)}}--happyReduce_65 = happySpecReduce_3  10# happyReduction_65-happyReduction_65 happy_x_3-	happy_x_2-	happy_x_1-	 =  case happyOut14 happy_x_1 of { happy_var_1 -> -	case happyOut14 happy_x_3 of { happy_var_3 -> -	happyIn14-		 (call "lt" [happy_var_1,happy_var_3]-	)}}--happyReduce_66 = happySpecReduce_3  10# happyReduction_66-happyReduction_66 happy_x_3-	happy_x_2-	happy_x_1-	 =  case happyOut14 happy_x_1 of { happy_var_1 -> -	case happyOut14 happy_x_3 of { happy_var_3 -> -	happyIn14-		 (call "le" [happy_var_1,happy_var_3]-	)}}--happyReduce_67 = happySpecReduce_3  10# happyReduction_67-happyReduction_67 happy_x_3-	happy_x_2-	happy_x_1-	 =  case happyOut14 happy_x_1 of { happy_var_1 -> -	case happyOut14 happy_x_3 of { happy_var_3 -> -	happyIn14-		 (call "gt" [happy_var_1,happy_var_3]-	)}}--happyReduce_68 = happySpecReduce_3  10# happyReduction_68-happyReduction_68 happy_x_3-	happy_x_2-	happy_x_1-	 =  case happyOut14 happy_x_1 of { happy_var_1 -> -	case happyOut14 happy_x_3 of { happy_var_3 -> -	happyIn14-		 (call "ge" [happy_var_1,happy_var_3]-	)}}--happyReduce_69 = happySpecReduce_3  10# happyReduction_69-happyReduction_69 happy_x_3-	happy_x_2-	happy_x_1-	 =  case happyOut14 happy_x_1 of { happy_var_1 -> -	case happyOut14 happy_x_3 of { happy_var_3 -> -	happyIn14-		 (call "and" [happy_var_1,happy_var_3]-	)}}--happyReduce_70 = happySpecReduce_3  10# happyReduction_70-happyReduction_70 happy_x_3-	happy_x_2-	happy_x_1-	 =  case happyOut14 happy_x_1 of { happy_var_1 -> -	case happyOut14 happy_x_3 of { happy_var_3 -> -	happyIn14-		 (call "or" [happy_var_1,happy_var_3]-	)}}--happyReduce_71 = happySpecReduce_3  10# happyReduction_71-happyReduction_71 happy_x_3-	happy_x_2-	happy_x_1-	 =  case happyOut14 happy_x_1 of { happy_var_1 -> -	case happyOut14 happy_x_3 of { happy_var_3 -> -	happyIn14-		 (call "not" [happy_var_1,happy_var_3]-	)}}--happyReduce_72 = happySpecReduce_3  10# happyReduction_72-happyReduction_72 happy_x_3-	happy_x_2-	happy_x_1-	 =  case happyOut14 happy_x_1 of { happy_var_1 -> -	case happyOut14 happy_x_3 of { happy_var_3 -> -	happyIn14-		 (call "union" [happy_var_1,happy_var_3]-	)}}--happyReduce_73 = happySpecReduce_3  10# happyReduction_73-happyReduction_73 happy_x_3-	happy_x_2-	happy_x_1-	 =  case happyOut14 happy_x_1 of { happy_var_1 -> -	case happyOut14 happy_x_3 of { happy_var_3 -> -	happyIn14-		 (call "intersect" [happy_var_1,happy_var_3]-	)}}--happyReduce_74 = happySpecReduce_3  10# happyReduction_74-happyReduction_74 happy_x_3-	happy_x_2-	happy_x_1-	 =  case happyOut14 happy_x_1 of { happy_var_1 -> -	case happyOut14 happy_x_3 of { happy_var_3 -> -	happyIn14-		 (call "except" [happy_var_1,happy_var_3]-	)}}--happyReduce_75 = happyReduce 4# 10# happyReduction_75-happyReduction_75 (happy_x_4 `HappyStk`-	happy_x_3 `HappyStk`-	happy_x_2 `HappyStk`-	happy_x_1 `HappyStk`-	happyRest)-	 = case happyOut14 happy_x_1 of { happy_var_1 -> -	case happyOut10 happy_x_4 of { happy_var_4 -> -	happyIn14-		 (call "instance-of" [happy_var_1,Ast "type" [happy_var_4]]-	) `HappyStk` happyRest}}--happyReduce_76 = happyReduce 4# 10# happyReduction_76-happyReduction_76 (happy_x_4 `HappyStk`-	happy_x_3 `HappyStk`-	happy_x_2 `HappyStk`-	happy_x_1 `HappyStk`-	happyRest)-	 = case happyOut14 happy_x_1 of { happy_var_1 -> -	case happyOut10 happy_x_4 of { happy_var_4 -> -	happyIn14-		 (call "cast-as" [happy_var_1,Ast "type" [happy_var_4]]-	) `HappyStk` happyRest}}--happyReduce_77 = happyReduce 4# 10# happyReduction_77-happyReduction_77 (happy_x_4 `HappyStk`-	happy_x_3 `HappyStk`-	happy_x_2 `HappyStk`-	happy_x_1 `HappyStk`-	happyRest)-	 = case happyOut14 happy_x_1 of { happy_var_1 -> -	case happyOut10 happy_x_4 of { happy_var_4 -> -	happyIn14-		 (call "castable-as" [happy_var_1,Ast "type" [happy_var_4]]-	) `HappyStk` happyRest}}--happyReduce_78 = happyReduce 5# 10# happyReduction_78-happyReduction_78 (happy_x_5 `HappyStk`-	happy_x_4 `HappyStk`-	happy_x_3 `HappyStk`-	happy_x_2 `HappyStk`-	happy_x_1 `HappyStk`-	happyRest)-	 = case happyOut14 happy_x_3 of { happy_var_3 -> -	case happyOut36 happy_x_5 of { happy_var_5 -> -	happyIn14-		 (let v = "_tc" in Ast "let" [Avar v,happy_var_3,happy_var_5 v]-	) `HappyStk` happyRest}}--happyReduce_79 = happySpecReduce_2  10# happyReduction_79-happyReduction_79 happy_x_2-	happy_x_1-	 =  case happyOut14 happy_x_2 of { happy_var_2 -> -	happyIn14-		 (call "uplus" [happy_var_2]-	)}--happyReduce_80 = happySpecReduce_2  10# happyReduction_80-happyReduction_80 happy_x_2-	happy_x_1-	 =  case happyOut14 happy_x_2 of { happy_var_2 -> -	happyIn14-		 (call "uminus" [happy_var_2]-	)}--happyReduce_81 = happySpecReduce_2  10# happyReduction_81-happyReduction_81 happy_x_2-	happy_x_1-	 =  case happyOut14 happy_x_2 of { happy_var_2 -> -	happyIn14-		 (call "not" [happy_var_2]-	)}--happyReduce_82 = happySpecReduce_1  10# happyReduction_82-happyReduction_82 happy_x_1-	 =  case happyOut27 happy_x_1 of { happy_var_1 -> -	happyIn14-		 (happy_var_1-	)}--happyReduce_83 = happySpecReduce_1  10# happyReduction_83-happyReduction_83 happy_x_1-	 =  case happyOutTok happy_x_1 of { (TInteger happy_var_1) -> -	happyIn14-		 (Aint happy_var_1-	)}--happyReduce_84 = happySpecReduce_1  10# happyReduction_84-happyReduction_84 happy_x_1-	 =  case happyOutTok happy_x_1 of { (TFloat happy_var_1) -> -	happyIn14-		 (Afloat happy_var_1-	)}--happyReduce_85 = happyReduce 4# 10# happyReduction_85-happyReduction_85 (happy_x_4 `HappyStk`-	happy_x_3 `HappyStk`-	happy_x_2 `HappyStk`-	happy_x_1 `HappyStk`-	happyRest)-	 = case happyOut14 happy_x_2 of { happy_var_2 -> -	case happyOut14 happy_x_4 of { happy_var_4 -> -	happyIn14-		 (Ast "insert" [happy_var_2,Ast "destination" [happy_var_4]]-	) `HappyStk` happyRest}}--happyReduce_86 = happySpecReduce_3  10# happyReduction_86-happyReduction_86 happy_x_3-	happy_x_2-	happy_x_1-	 =  case happyOut14 happy_x_3 of { happy_var_3 -> -	happyIn14-		 (Ast "delete" [happy_var_3]-	)}--happyReduce_87 = happyReduce 4# 10# happyReduction_87-happyReduction_87 (happy_x_4 `HappyStk`-	happy_x_3 `HappyStk`-	happy_x_2 `HappyStk`-	happy_x_1 `HappyStk`-	happyRest)-	 = case happyOut14 happy_x_2 of { happy_var_2 -> -	case happyOut14 happy_x_4 of { happy_var_4 -> -	happyIn14-		 (Ast "replace" [happy_var_2,happy_var_4]-	) `HappyStk` happyRest}}--happyReduce_88 = happySpecReduce_1  11# happyReduction_88-happyReduction_88 happy_x_1-	 =  case happyOut14 happy_x_1 of { happy_var_1 -> -	happyIn15-		 ([happy_var_1]-	)}--happyReduce_89 = happySpecReduce_3  11# happyReduction_89-happyReduction_89 happy_x_3-	happy_x_2-	happy_x_1-	 =  case happyOut15 happy_x_1 of { happy_var_1 -> -	case happyOut14 happy_x_3 of { happy_var_3 -> -	happyIn15-		 (happy_var_1++[happy_var_3]-	)}}--happyReduce_90 = happySpecReduce_2  12# happyReduction_90-happyReduction_90 happy_x_2-	happy_x_1-	 =  case happyOut17 happy_x_2 of { happy_var_2 -> -	happyIn16-		 (happy_var_2-	)}--happyReduce_91 = happySpecReduce_2  12# happyReduction_91-happyReduction_91 happy_x_2-	happy_x_1-	 =  case happyOut18 happy_x_2 of { happy_var_2 -> -	happyIn16-		 (happy_var_2-	)}--happyReduce_92 = happySpecReduce_3  12# happyReduction_92-happyReduction_92 happy_x_3-	happy_x_2-	happy_x_1-	 =  case happyOut16 happy_x_1 of { happy_var_1 -> -	case happyOut17 happy_x_3 of { happy_var_3 -> -	happyIn16-		 (happy_var_1 . happy_var_3-	)}}--happyReduce_93 = happySpecReduce_3  12# happyReduction_93-happyReduction_93 happy_x_3-	happy_x_2-	happy_x_1-	 =  case happyOut16 happy_x_1 of { happy_var_1 -> -	case happyOut18 happy_x_3 of { happy_var_3 -> -	happyIn16-		 (happy_var_1 . happy_var_3-	)}}--happyReduce_94 = happySpecReduce_3  13# happyReduction_94-happyReduction_94 happy_x_3-	happy_x_2-	happy_x_1-	 =  case happyOut13 happy_x_1 of { happy_var_1 -> -	case happyOut14 happy_x_3 of { happy_var_3 -> -	happyIn17-		 (\x -> Ast "for" [happy_var_1,Avar "$",happy_var_3,x]-	)}}--happyReduce_95 = happyReduce 5# 13# happyReduction_95-happyReduction_95 (happy_x_5 `HappyStk`-	happy_x_4 `HappyStk`-	happy_x_3 `HappyStk`-	happy_x_2 `HappyStk`-	happy_x_1 `HappyStk`-	happyRest)-	 = case happyOut13 happy_x_1 of { happy_var_1 -> -	case happyOut13 happy_x_3 of { happy_var_3 -> -	case happyOut14 happy_x_5 of { happy_var_5 -> -	happyIn17-		 (\x -> Ast "for" [happy_var_1,happy_var_3,happy_var_5,x]-	) `HappyStk` happyRest}}}--happyReduce_96 = happyReduce 5# 13# happyReduction_96-happyReduction_96 (happy_x_5 `HappyStk`-	happy_x_4 `HappyStk`-	happy_x_3 `HappyStk`-	happy_x_2 `HappyStk`-	happy_x_1 `HappyStk`-	happyRest)-	 = case happyOut17 happy_x_1 of { happy_var_1 -> -	case happyOut13 happy_x_3 of { happy_var_3 -> -	case happyOut14 happy_x_5 of { happy_var_5 -> -	happyIn17-		 (\x -> happy_var_1(Ast "for" [happy_var_3,Avar "$",happy_var_5,x])-	) `HappyStk` happyRest}}}--happyReduce_97 = happyReduce 7# 13# happyReduction_97-happyReduction_97 (happy_x_7 `HappyStk`-	happy_x_6 `HappyStk`-	happy_x_5 `HappyStk`-	happy_x_4 `HappyStk`-	happy_x_3 `HappyStk`-	happy_x_2 `HappyStk`-	happy_x_1 `HappyStk`-	happyRest)-	 = case happyOut17 happy_x_1 of { happy_var_1 -> -	case happyOut13 happy_x_3 of { happy_var_3 -> -	case happyOut13 happy_x_5 of { happy_var_5 -> -	case happyOut14 happy_x_7 of { happy_var_7 -> -	happyIn17-		 (\x -> happy_var_1(Ast "for" [happy_var_3,happy_var_5,happy_var_7,x])-	) `HappyStk` happyRest}}}}--happyReduce_98 = happySpecReduce_3  14# happyReduction_98-happyReduction_98 happy_x_3-	happy_x_2-	happy_x_1-	 =  case happyOut13 happy_x_1 of { happy_var_1 -> -	case happyOut14 happy_x_3 of { happy_var_3 -> -	happyIn18-		 (\x -> Ast "let" [happy_var_1,happy_var_3,x]-	)}}--happyReduce_99 = happyReduce 5# 14# happyReduction_99-happyReduction_99 (happy_x_5 `HappyStk`-	happy_x_4 `HappyStk`-	happy_x_3 `HappyStk`-	happy_x_2 `HappyStk`-	happy_x_1 `HappyStk`-	happyRest)-	 = case happyOut18 happy_x_1 of { happy_var_1 -> -	case happyOut13 happy_x_3 of { happy_var_3 -> -	case happyOut14 happy_x_5 of { happy_var_5 -> -	happyIn18-		 (\x -> happy_var_1(Ast "let" [happy_var_3,happy_var_5,x])-	) `HappyStk` happyRest}}}--happyReduce_100 = happySpecReduce_2  15# happyReduction_100-happyReduction_100 happy_x_2-	happy_x_1-	 =  case happyOut14 happy_x_2 of { happy_var_2 -> -	happyIn19-		 (\x -> Ast "predicate" [happy_var_2,x]-	)}--happyReduce_101 = happySpecReduce_0  15# happyReduction_101-happyReduction_101  =  happyIn19-		 (id-	)--happyReduce_102 = happySpecReduce_3  16# happyReduction_102-happyReduction_102 happy_x_3-	happy_x_2-	happy_x_1-	 =  case happyOut21 happy_x_3 of { happy_var_3 -> -	happyIn20-		 ((\x -> Ast "sortTuple" (x:(fst happy_var_3)),-                                                           \x -> Ast "sort" (x:(snd happy_var_3)))-	)}--happyReduce_103 = happySpecReduce_0  16# happyReduction_103-happyReduction_103  =  happyIn20-		 ((id,id)-	)--happyReduce_104 = happySpecReduce_2  17# happyReduction_104-happyReduction_104 happy_x_2-	happy_x_1-	 =  case happyOut14 happy_x_1 of { happy_var_1 -> -	case happyOut22 happy_x_2 of { happy_var_2 -> -	happyIn21-		 (([happy_var_1],[happy_var_2])-	)}}--happyReduce_105 = happyReduce 4# 17# happyReduction_105-happyReduction_105 (happy_x_4 `HappyStk`-	happy_x_3 `HappyStk`-	happy_x_2 `HappyStk`-	happy_x_1 `HappyStk`-	happyRest)-	 = case happyOut21 happy_x_1 of { happy_var_1 -> -	case happyOut14 happy_x_3 of { happy_var_3 -> -	case happyOut22 happy_x_4 of { happy_var_4 -> -	happyIn21-		 (((fst happy_var_1)++[happy_var_3],(snd happy_var_1)++[happy_var_4])-	) `HappyStk` happyRest}}}--happyReduce_106 = happySpecReduce_1  18# happyReduction_106-happyReduction_106 happy_x_1-	 =  happyIn22-		 (Avar "ascending"-	)--happyReduce_107 = happySpecReduce_1  18# happyReduction_107-happyReduction_107 happy_x_1-	 =  happyIn22-		 (Avar "descending"-	)--happyReduce_108 = happySpecReduce_0  18# happyReduction_108-happyReduction_108  =  happyIn22-		 (Avar "ascending"-	)--happyReduce_109 = happyReduce 4# 19# happyReduction_109-happyReduction_109 (happy_x_4 `HappyStk`-	happy_x_3 `HappyStk`-	happy_x_2 `HappyStk`-	happy_x_1 `HappyStk`-	happyRest)-	 = case happyOut7 happy_x_3 of { happy_var_3 -> -	happyIn23-		 (call "element" [Avar happy_var_3]-	) `HappyStk` happyRest}--happyReduce_110 = happyReduce 4# 19# happyReduction_110-happyReduction_110 (happy_x_4 `HappyStk`-	happy_x_3 `HappyStk`-	happy_x_2 `HappyStk`-	happy_x_1 `HappyStk`-	happyRest)-	 = case happyOut7 happy_x_3 of { happy_var_3 -> -	happyIn23-		 (call "attribute" [Avar happy_var_3]-	) `HappyStk` happyRest}--happyReduce_111 = happyReduce 6# 20# happyReduction_111-happyReduction_111 (happy_x_6 `HappyStk`-	happy_x_5 `HappyStk`-	happy_x_4 `HappyStk`-	happy_x_3 `HappyStk`-	happy_x_2 `HappyStk`-	happy_x_1 `HappyStk`-	happyRest)-	 = case happyOut25 happy_x_1 of { happy_var_1 -> -	case happyOut26 happy_x_3 of { happy_var_3 -> -	case happyOut7 happy_x_5 of { happy_var_5 -> -	happyIn24-		 (if head happy_var_1 == Astring happy_var_5-                                                             then Ast "element_construction" (happy_var_1++[Ast "append" happy_var_3])-                                                          else parseError [TError ("Unmatched tags in element construction: "-                                                                                   ++(show (head happy_var_1))++" '"++happy_var_5++"'")]-	) `HappyStk` happyRest}}}--happyReduce_112 = happyReduce 5# 20# happyReduction_112-happyReduction_112 (happy_x_5 `HappyStk`-	happy_x_4 `HappyStk`-	happy_x_3 `HappyStk`-	happy_x_2 `HappyStk`-	happy_x_1 `HappyStk`-	happyRest)-	 = case happyOut25 happy_x_1 of { happy_var_1 -> -	case happyOut7 happy_x_4 of { happy_var_4 -> -	happyIn24-		 (if head happy_var_1 == Astring happy_var_4-                                                             then Ast "element_construction" (happy_var_1++[Ast "append" []])-                                                          else parseError [TError ("Unmatched tags in element construction: "-                                                                                   ++(show (head happy_var_1))++" '"++happy_var_4++"'")]-	) `HappyStk` happyRest}}--happyReduce_113 = happySpecReduce_2  20# happyReduction_113-happyReduction_113 happy_x_2-	happy_x_1-	 =  case happyOut25 happy_x_1 of { happy_var_1 -> -	happyIn24-		 (Ast "element_construction" (happy_var_1++[Ast "append" []])-	)}--happyReduce_114 = happyReduce 7# 20# happyReduction_114-happyReduction_114 (happy_x_7 `HappyStk`-	happy_x_6 `HappyStk`-	happy_x_5 `HappyStk`-	happy_x_4 `HappyStk`-	happy_x_3 `HappyStk`-	happy_x_2 `HappyStk`-	happy_x_1 `HappyStk`-	happyRest)-	 = case happyOut14 happy_x_3 of { happy_var_3 -> -	case happyOut15 happy_x_6 of { happy_var_6 -> -	happyIn24-		 (Ast "element_construction" [happy_var_3,Ast "attributes" [],concatenateAll happy_var_6]-	) `HappyStk` happyRest}}--happyReduce_115 = happyReduce 7# 20# happyReduction_115-happyReduction_115 (happy_x_7 `HappyStk`-	happy_x_6 `HappyStk`-	happy_x_5 `HappyStk`-	happy_x_4 `HappyStk`-	happy_x_3 `HappyStk`-	happy_x_2 `HappyStk`-	happy_x_1 `HappyStk`-	happyRest)-	 = case happyOut14 happy_x_3 of { happy_var_3 -> -	case happyOut15 happy_x_6 of { happy_var_6 -> -	happyIn24-		 (Ast "attribute_construction" [happy_var_3,concatenateAll happy_var_6]-	) `HappyStk` happyRest}}--happyReduce_116 = happyReduce 5# 20# happyReduction_116-happyReduction_116 (happy_x_5 `HappyStk`-	happy_x_4 `HappyStk`-	happy_x_3 `HappyStk`-	happy_x_2 `HappyStk`-	happy_x_1 `HappyStk`-	happyRest)-	 = case happyOut7 happy_x_2 of { happy_var_2 -> -	case happyOut15 happy_x_4 of { happy_var_4 -> -	happyIn24-		 (Ast "element_construction" [Astring happy_var_2,Ast "attributes" [],concatenateAll happy_var_4]-	) `HappyStk` happyRest}}--happyReduce_117 = happyReduce 5# 20# happyReduction_117-happyReduction_117 (happy_x_5 `HappyStk`-	happy_x_4 `HappyStk`-	happy_x_3 `HappyStk`-	happy_x_2 `HappyStk`-	happy_x_1 `HappyStk`-	happyRest)-	 = case happyOut7 happy_x_2 of { happy_var_2 -> -	case happyOut15 happy_x_4 of { happy_var_4 -> -	happyIn24-		 (Ast "attribute_construction" [Astring happy_var_2,concatenateAll happy_var_4]-	) `HappyStk` happyRest}}--happyReduce_118 = happySpecReduce_2  21# happyReduction_118-happyReduction_118 happy_x_2-	happy_x_1-	 =  case happyOut7 happy_x_2 of { happy_var_2 -> -	happyIn25-		 ([Astring happy_var_2,Ast "attributes" []]-	)}--happyReduce_119 = happySpecReduce_3  21# happyReduction_119-happyReduction_119 happy_x_3-	happy_x_2-	happy_x_1-	 =  case happyOut7 happy_x_2 of { happy_var_2 -> -	case happyOut29 happy_x_3 of { happy_var_3 -> -	happyIn25-		 ([Astring happy_var_2,Ast "attributes" happy_var_3]-	)}}--happyReduce_120 = happySpecReduce_3  22# happyReduction_120-happyReduction_120 happy_x_3-	happy_x_2-	happy_x_1-	 =  case happyOut15 happy_x_2 of { happy_var_2 -> -	happyIn26-		 ([concatenateAll happy_var_2]-	)}--happyReduce_121 = happySpecReduce_1  22# happyReduction_121-happyReduction_121 happy_x_1-	 =  case happyOutTok happy_x_1 of { (TString happy_var_1) -> -	happyIn26-		 ([Astring happy_var_1]-	)}--happyReduce_122 = happySpecReduce_1  22# happyReduction_122-happyReduction_122 happy_x_1-	 =  case happyOutTok happy_x_1 of { (XMLtext happy_var_1) -> -	happyIn26-		 ([Astring happy_var_1]-	)}--happyReduce_123 = happySpecReduce_1  22# happyReduction_123-happyReduction_123 happy_x_1-	 =  case happyOut24 happy_x_1 of { happy_var_1 -> -	happyIn26-		 ([happy_var_1]-	)}--happyReduce_124 = happyReduce 4# 22# happyReduction_124-happyReduction_124 (happy_x_4 `HappyStk`-	happy_x_3 `HappyStk`-	happy_x_2 `HappyStk`-	happy_x_1 `HappyStk`-	happyRest)-	 = case happyOut26 happy_x_1 of { happy_var_1 -> -	case happyOut15 happy_x_3 of { happy_var_3 -> -	happyIn26-		 (happy_var_1++[concatenateAll happy_var_3]-	) `HappyStk` happyRest}}--happyReduce_125 = happySpecReduce_2  22# happyReduction_125-happyReduction_125 happy_x_2-	happy_x_1-	 =  case happyOut26 happy_x_1 of { happy_var_1 -> -	case happyOutTok happy_x_2 of { (TString happy_var_2) -> -	happyIn26-		 (happy_var_1++[Astring happy_var_2]-	)}}--happyReduce_126 = happySpecReduce_2  22# happyReduction_126-happyReduction_126 happy_x_2-	happy_x_1-	 =  case happyOut26 happy_x_1 of { happy_var_1 -> -	case happyOutTok happy_x_2 of { (XMLtext happy_var_2) -> -	happyIn26-		 (happy_var_1++[Astring happy_var_2]-	)}}--happyReduce_127 = happySpecReduce_2  22# happyReduction_127-happyReduction_127 happy_x_2-	happy_x_1-	 =  case happyOut26 happy_x_1 of { happy_var_1 -> -	case happyOut24 happy_x_2 of { happy_var_2 -> -	happyIn26-		 (happy_var_1++[happy_var_2]-	)}}--happyReduce_128 = happySpecReduce_1  23# happyReduction_128-happyReduction_128 happy_x_1-	 =  case happyOut28 happy_x_1 of { happy_var_1 -> -	happyIn27-		 (if length happy_var_1 == 0 then Astring ""-                                                          else if length happy_var_1 == 1 then head happy_var_1 else Ast "append" happy_var_1-	)}--happyReduce_129 = happySpecReduce_1  24# happyReduction_129-happyReduction_129 happy_x_1-	 =  case happyOutTok happy_x_1 of { (TString happy_var_1) -> -	happyIn28-		 (if happy_var_1=="" then [] else [Astring happy_var_1]-	)}--happyReduce_130 = happySpecReduce_3  24# happyReduction_130-happyReduction_130 happy_x_3-	happy_x_2-	happy_x_1-	 =  case happyOut15 happy_x_2 of { happy_var_2 -> -	happyIn28-		 ([concatAll happy_var_2]-	)}--happyReduce_131 = happySpecReduce_2  24# happyReduction_131-happyReduction_131 happy_x_2-	happy_x_1-	 =  case happyOut28 happy_x_1 of { happy_var_1 -> -	case happyOutTok happy_x_2 of { (TString happy_var_2) -> -	happyIn28-		 (if happy_var_2=="" then happy_var_1 else happy_var_1++[Astring happy_var_2]-	)}}--happyReduce_132 = happyReduce 4# 24# happyReduction_132-happyReduction_132 (happy_x_4 `HappyStk`-	happy_x_3 `HappyStk`-	happy_x_2 `HappyStk`-	happy_x_1 `HappyStk`-	happyRest)-	 = case happyOut28 happy_x_1 of { happy_var_1 -> -	case happyOut15 happy_x_3 of { happy_var_3 -> -	happyIn28-		 (happy_var_1++[concatAll happy_var_3]-	) `HappyStk` happyRest}}--happyReduce_133 = happySpecReduce_3  25# happyReduction_133-happyReduction_133 happy_x_3-	happy_x_2-	happy_x_1-	 =  case happyOut7 happy_x_1 of { happy_var_1 -> -	case happyOut27 happy_x_3 of { happy_var_3 -> -	happyIn29-		 ([Ast "pair" [Astring happy_var_1,happy_var_3]]-	)}}--happyReduce_134 = happyReduce 4# 25# happyReduction_134-happyReduction_134 (happy_x_4 `HappyStk`-	happy_x_3 `HappyStk`-	happy_x_2 `HappyStk`-	happy_x_1 `HappyStk`-	happyRest)-	 = case happyOut29 happy_x_1 of { happy_var_1 -> -	case happyOut7 happy_x_2 of { happy_var_2 -> -	case happyOut27 happy_x_4 of { happy_var_4 -> -	happyIn29-		 (happy_var_1++[Ast "pair" [Astring happy_var_2,happy_var_4]]-	) `HappyStk` happyRest}}}--happyReduce_135 = happySpecReduce_2  26# happyReduction_135-happyReduction_135 happy_x_2-	happy_x_1-	 =  case happyOut34 happy_x_1 of { happy_var_1 -> -	case happyOut33 happy_x_2 of { happy_var_2 -> -	happyIn30-		 (happy_var_1 "child" (Avar ".") happy_var_2-	)}}--happyReduce_136 = happySpecReduce_3  26# happyReduction_136-happyReduction_136 happy_x_3-	happy_x_2-	happy_x_1-	 =  case happyOut34 happy_x_2 of { happy_var_2 -> -	case happyOut33 happy_x_3 of { happy_var_3 -> -	happyIn30-		 (happy_var_2 "attribute" (Avar ".") happy_var_3-	)}}--happyReduce_137 = happySpecReduce_3  26# happyReduction_137-happyReduction_137 happy_x_3-	happy_x_2-	happy_x_1-	 =  case happyOut34 happy_x_1 of { happy_var_1 -> -	case happyOut33 happy_x_2 of { happy_var_2 -> -	case happyOut31 happy_x_3 of { happy_var_3 -> -	happyIn30-		 (happy_var_3 (happy_var_1 "child" (Avar ".") happy_var_2)-	)}}}--happyReduce_138 = happyReduce 4# 26# happyReduction_138-happyReduction_138 (happy_x_4 `HappyStk`-	happy_x_3 `HappyStk`-	happy_x_2 `HappyStk`-	happy_x_1 `HappyStk`-	happyRest)-	 = case happyOut34 happy_x_2 of { happy_var_2 -> -	case happyOut33 happy_x_3 of { happy_var_3 -> -	case happyOut31 happy_x_4 of { happy_var_4 -> -	happyIn30-		 (happy_var_4 (happy_var_2 "attribute" (Avar ".") happy_var_3)-	) `HappyStk` happyRest}}}--happyReduce_139 = happySpecReduce_1  27# happyReduction_139-happyReduction_139 happy_x_1-	 =  case happyOut32 happy_x_1 of { happy_var_1 -> -	happyIn31-		 (happy_var_1-	)}--happyReduce_140 = happySpecReduce_2  27# happyReduction_140-happyReduction_140 happy_x_2-	happy_x_1-	 =  case happyOut31 happy_x_1 of { happy_var_1 -> -	case happyOut32 happy_x_2 of { happy_var_2 -> -	happyIn31-		 (happy_var_2 . happy_var_1-	)}}--happyReduce_141 = happySpecReduce_3  28# happyReduction_141-happyReduction_141 happy_x_3-	happy_x_2-	happy_x_1-	 =  case happyOut34 happy_x_2 of { happy_var_2 -> -	case happyOut33 happy_x_3 of { happy_var_3 -> -	happyIn32-		 (\e -> happy_var_2 "child" e happy_var_3-	)}}--happyReduce_142 = happyReduce 4# 28# happyReduction_142-happyReduction_142 (happy_x_4 `HappyStk`-	happy_x_3 `HappyStk`-	happy_x_2 `HappyStk`-	happy_x_1 `HappyStk`-	happyRest)-	 = case happyOut34 happy_x_3 of { happy_var_3 -> -	case happyOut33 happy_x_4 of { happy_var_4 -> -	happyIn32-		 (\e -> happy_var_3 "attribute" e happy_var_4-	) `HappyStk` happyRest}}--happyReduce_143 = happyReduce 4# 28# happyReduction_143-happyReduction_143 (happy_x_4 `HappyStk`-	happy_x_3 `HappyStk`-	happy_x_2 `HappyStk`-	happy_x_1 `HappyStk`-	happyRest)-	 = case happyOut34 happy_x_3 of { happy_var_3 -> -	case happyOut33 happy_x_4 of { happy_var_4 -> -	happyIn32-		 (\e -> happy_var_3 "descendant" e happy_var_4-	) `HappyStk` happyRest}}--happyReduce_144 = happyReduce 5# 28# happyReduction_144-happyReduction_144 (happy_x_5 `HappyStk`-	happy_x_4 `HappyStk`-	happy_x_3 `HappyStk`-	happy_x_2 `HappyStk`-	happy_x_1 `HappyStk`-	happyRest)-	 = case happyOut34 happy_x_4 of { happy_var_4 -> -	case happyOut33 happy_x_5 of { happy_var_5 -> -	happyIn32-		 (\e -> happy_var_4 "attribute-descendant" e happy_var_5-	) `HappyStk` happyRest}}--happyReduce_145 = happySpecReduce_2  28# happyReduction_145-happyReduction_145 happy_x_2-	happy_x_1-	 =  happyIn32-		 (\e -> Ast "step" [Avar "parent",Astring "*",e]-	)--happyReduce_146 = happyReduce 4# 29# happyReduction_146-happyReduction_146 (happy_x_4 `HappyStk`-	happy_x_3 `HappyStk`-	happy_x_2 `HappyStk`-	happy_x_1 `HappyStk`-	happyRest)-	 = case happyOut33 happy_x_1 of { happy_var_1 -> -	case happyOut14 happy_x_3 of { happy_var_3 -> -	happyIn33-		 (happy_var_1 ++ [happy_var_3]-	) `HappyStk` happyRest}}--happyReduce_147 = happySpecReduce_0  29# happyReduction_147-happyReduction_147  =  happyIn33-		 ([]-	)--happyReduce_148 = happySpecReduce_1  30# happyReduction_148-happyReduction_148 happy_x_1-	 =  case happyOut35 happy_x_1 of { happy_var_1 -> -	happyIn34-		 (\t e ps -> if null ps-								     then happy_var_1 t e-                                                                     else Ast "filter" (happy_var_1 t e:ps)-	)}--happyReduce_149 = happySpecReduce_1  30# happyReduction_149-happyReduction_149 happy_x_1-	 =  happyIn34-		 (\t e ps -> Ast "step" ((Avar t):(Astring "*"):e:ps)-	)--happyReduce_150 = happySpecReduce_1  30# happyReduction_150-happyReduction_150 happy_x_1-	 =  case happyOut7 happy_x_1 of { happy_var_1 -> -	happyIn34-		 (\t e ps -> if elem happy_var_1 path_steps-                                                                     then parseError [TError ("Axis "++happy_var_1++" is missing a node step")]-                                                                     else Ast "step" ((Avar t):(Astring happy_var_1):e:ps)-	)}--happyReduce_151 = happyReduce 4# 30# happyReduction_151-happyReduction_151 (happy_x_4 `HappyStk`-	happy_x_3 `HappyStk`-	happy_x_2 `HappyStk`-	happy_x_1 `HappyStk`-	happyRest)-	 = case happyOutTok happy_x_1 of { (QName happy_var_1) -> -	case happyOut7 happy_x_4 of { happy_var_4 -> -	happyIn34-		 (\t e ps -> if elem happy_var_1 path_steps-                                                                     then if t == "child"-                                                                          then Ast "step" ((Avar happy_var_1):(Astring happy_var_4):e:ps)-                                                                          else parseError [TError ("The navigation step must be /"++happy_var_1++"::"++happy_var_4)]-                                                                     else parseError [TError ("Not a valid axis name: "++happy_var_1)]-	) `HappyStk` happyRest}}--happyReduce_152 = happyReduce 4# 30# happyReduction_152-happyReduction_152 (happy_x_4 `HappyStk`-	happy_x_3 `HappyStk`-	happy_x_2 `HappyStk`-	happy_x_1 `HappyStk`-	happyRest)-	 = case happyOutTok happy_x_1 of { (QName happy_var_1) -> -	happyIn34-		 (\t e ps -> if elem happy_var_1 path_steps-                                                                     then if t == "child"-                                                                          then Ast "step" ((Avar happy_var_1):(Astring "*"):e:ps)-                                                                          else parseError [TError ("The navigation step must be /"++happy_var_1++"::*")]-                                                                     else parseError [TError ("Not a valid axis name: "++happy_var_1)]-	) `HappyStk` happyRest}--happyReduce_153 = happySpecReduce_1  31# happyReduction_153-happyReduction_153 happy_x_1-	 =  case happyOut13 happy_x_1 of { happy_var_1 -> -	happyIn35-		 (\_ _ -> happy_var_1-	)}--happyReduce_154 = happySpecReduce_1  31# happyReduction_154-happyReduction_154 happy_x_1-	 =  happyIn35-		 (\_ e -> e-	)--happyReduce_155 = happySpecReduce_3  31# happyReduction_155-happyReduction_155 happy_x_3-	happy_x_2-	happy_x_1-	 =  case happyOut15 happy_x_2 of { happy_var_2 -> -	happyIn35-		 (\t e -> if e == Avar "."-                                                                  then concatenateAll happy_var_2-	                                                          else Ast "context" [e,Astring t,concatenateAll happy_var_2]-	)}--happyReduce_156 = happySpecReduce_2  31# happyReduction_156-happyReduction_156 happy_x_2-	happy_x_1-	 =  happyIn35-		 (\_ _ -> call "empty" []-	)--happyReduce_157 = happyReduce 4# 31# happyReduction_157-happyReduction_157 (happy_x_4 `HappyStk`-	happy_x_3 `HappyStk`-	happy_x_2 `HappyStk`-	happy_x_1 `HappyStk`-	happyRest)-	 = case happyOut7 happy_x_1 of { happy_var_1 -> -	case happyOut15 happy_x_3 of { happy_var_3 -> -	happyIn35-		 (\t e -> if e == Avar "."-                                                                     then call happy_var_1 happy_var_3-                                                                  else Ast "context" [e,Astring t,call happy_var_1 happy_var_3]-	) `HappyStk` happyRest}}--happyReduce_158 = happySpecReduce_3  31# happyReduction_158-happyReduction_158 happy_x_3-	happy_x_2-	happy_x_1-	 =  case happyOut7 happy_x_1 of { happy_var_1 -> -	happyIn35-		 (\_ e -> if elem happy_var_1 ["last","position","true","false","empty","select"]-                                                                  then call happy_var_1 []-                                                                  else call happy_var_1 [e]-	)}--happyReduce_159 = happyReduce 7# 32# happyReduction_159-happyReduction_159 (happy_x_7 `HappyStk`-	happy_x_6 `HappyStk`-	happy_x_5 `HappyStk`-	happy_x_4 `HappyStk`-	happy_x_3 `HappyStk`-	happy_x_2 `HappyStk`-	happy_x_1 `HappyStk`-	happyRest)-	 = case happyOut10 happy_x_2 of { happy_var_2 -> -	case happyOut14 happy_x_4 of { happy_var_4 -> -	case happyOut14 happy_x_7 of { happy_var_7 -> -	happyIn36-		 (\v -> Ast "if" [call "instance-of" [Avar v,Ast "type" [happy_var_2]],happy_var_4,happy_var_7]-	) `HappyStk` happyRest}}}--happyReduce_160 = happyReduce 5# 32# happyReduction_160-happyReduction_160 (happy_x_5 `HappyStk`-	happy_x_4 `HappyStk`-	happy_x_3 `HappyStk`-	happy_x_2 `HappyStk`-	happy_x_1 `HappyStk`-	happyRest)-	 = case happyOut10 happy_x_2 of { happy_var_2 -> -	case happyOut14 happy_x_4 of { happy_var_4 -> -	case happyOut36 happy_x_5 of { happy_var_5 -> -	happyIn36-		 (\v -> Ast "if" [call "instance-of" [Avar v,Ast "type" [happy_var_2]],happy_var_4,happy_var_5 v]-	) `HappyStk` happyRest}}}--happyNewToken action sts stk [] =-	happyDoAction 89# notHappyAtAll action sts stk []--happyNewToken action sts stk (tk:tks) =-	let cont i = happyDoAction i tk action sts stk tks in-	case tk of {-	RETURN -> cont 1#;-	SOME -> cont 2#;-	EVERY -> cont 3#;-	IF -> cont 4#;-	THEN -> cont 5#;-	ELSE -> cont 6#;-	LB -> cont 7#;-	RB -> cont 8#;-	LP -> cont 9#;-	RP -> cont 10#;-	LSB -> cont 11#;-	RSB -> cont 12#;-	TO -> cont 13#;-	PLUS -> cont 14#;-	MINUS -> cont 15#;-	TIMES -> cont 16#;-	DIV -> cont 17#;-	IDIV -> cont 18#;-	MOD -> cont 19#;-	TEQ -> cont 20#;-	TNE -> cont 21#;-	TLT -> cont 22#;-	TLE -> cont 23#;-	TGT -> cont 24#;-	TGE -> cont 25#;-	PRE -> cont 26#;-	POST -> cont 27#;-	IS -> cont 28#;-	SEQ -> cont 29#;-	SNE -> cont 30#;-	SLT -> cont 31#;-	SLE -> cont 32#;-	SGT -> cont 33#;-	SGE -> cont 34#;-	AND -> cont 35#;-	OR -> cont 36#;-	NOT -> cont 37#;-	UNION -> cont 38#;-	INTERSECT -> cont 39#;-	EXCEPT -> cont 40#;-	FOR -> cont 41#;-	LET -> cont 42#;-	IN -> cont 43#;-	AS -> cont 44#;-	COMMA -> cont 45#;-	ASSIGN -> cont 46#;-	WHERE -> cont 47#;-	ORDER -> cont 48#;-	BY -> cont 49#;-	ASCENDING -> cont 50#;-	DESCENDING -> cont 51#;-	ELEMENT -> cont 52#;-	ATTRIBUTE -> cont 53#;-	STAG -> cont 54#;-	ETAG -> cont 55#;-	SATISFIES -> cont 56#;-	ATSIGN -> cont 57#;-	SLASH -> cont 58#;-	QName happy_dollar_dollar -> cont 59#;-	DECLARE -> cont 60#;-	FUNCTION -> cont 61#;-	VARIABLE -> cont 62#;-	VIEW -> cont 63#;-	AT -> cont 64#;-	DOTS -> cont 65#;-	DOT -> cont 66#;-	SEMI -> cont 67#;-	COLON -> cont 68#;-	INSERT -> cont 69#;-	DELETE -> cont 70#;-	REPLACE -> cont 71#;-	INTO -> cont 72#;-	FROM -> cont 73#;-	WITH -> cont 74#;-	INSTANCE -> cont 75#;-	OF -> cont 76#;-	QMARK -> cont 77#;-	CAST -> cont 78#;-	CASTABLE -> cont 79#;-	CASE -> cont 80#;-	DEFAULT -> cont 81#;-	TYPESWITCH -> cont 82#;-	Variable happy_dollar_dollar -> cont 83#;-	XMLtext happy_dollar_dollar -> cont 84#;-	TInteger happy_dollar_dollar -> cont 85#;-	TFloat happy_dollar_dollar -> cont 86#;-	TString happy_dollar_dollar -> cont 87#;-	TokenEOF -> cont 88#;-	_ -> happyError' (tk:tks)-	}--happyError_ tk tks = happyError' (tk:tks)--newtype HappyIdentity a = HappyIdentity a-happyIdentity = HappyIdentity-happyRunIdentity (HappyIdentity a) = a--instance Monad HappyIdentity where-    return = HappyIdentity-    (HappyIdentity p) >>= q = q p--happyThen :: () => HappyIdentity a -> (a -> HappyIdentity b) -> HappyIdentity b-happyThen = (>>=)-happyReturn :: () => a -> HappyIdentity a-happyReturn = (return)-happyThen1 m k tks = (>>=) m (\a -> k a tks)-happyReturn1 :: () => a -> b -> HappyIdentity a-happyReturn1 = \a tks -> (return) a-happyError' :: () => [(Token)] -> HappyIdentity a-happyError' = HappyIdentity . parseError--parse tks = happyRunIdentity happySomeParser where-  happySomeParser = happyThen (happyParse 0# tks) (\x -> happyReturn (happyOut4 x))--happySeq = happyDontSeq----- Abstract Syntax Tree for XQueries-data Ast = Ast String [Ast]-         | Avar String-         | Aint Int-         | Afloat Double-         | Astring String-         deriving Eq---instance Show Ast-  where show (Ast s []) = s ++ "()"-        show (Ast s (x:xs)) = s ++ "(" ++ show x-                              ++ foldr (\a r -> ","++show a++r) "" xs-                              ++ ")"-        show (Avar s) = s-        show (Aint n) = show n-        show (Afloat n) = show n-        show (Astring s) = "\'" ++ s ++ "\'"---screenSize = 80::Int--prettyAst :: Ast -> Int -> (String,Int)-prettyAst (Avar s) p = (s,(length s)+p)-prettyAst (Aint n) p = let s = show n in (s,(length s)+p)-prettyAst (Afloat n) p = let s = show n in (s,(length s)+p)-prettyAst (Astring s) p = ("\'" ++ s ++ "\'",(length s)+p+2)-prettyAst (Ast s args) p-    = let (ps,np) = prettyArgs args-      in (s++"("++ps++")",np+1)-    where prettyArgs [] = ("",p+1)-          prettyArgs xs = let ss = show (head xs) ++ foldr (\a r -> ","++show a++r) "" (tail xs)-                              np = (length s)+p+1-                          in if (length ss)+p < screenSize-                             then (ss,(length ss)+p)-                             else let ds = map (\x -> let (s,ep) = prettyAst x np-                                                      in (s ++ ",\n" ++ space np,ep)) (init xs)-                                      (ls,lp) = prettyAst (last xs) np-                                  in (concatMap fst ds ++ ls,lp)-          space n = replicate n ' '---ppAst :: Ast -> String-ppAst e = let (s,_) = prettyAst e 0 in s---call :: String -> [Ast] -> Ast-call name args = Ast "call" ((Avar name):args)---concatenateAll :: [Ast] -> Ast-concatenateAll [x] = x-concatenateAll (x:xs) = foldl (\a r -> call "concatenate" [a,r]) x xs-concatenateAll _ = call "empty" []---concatAll :: [Ast] -> Ast-concatAll [x] = call "string" [x]-concatAll (x:xs) = foldl (\a r -> call "concatenate" [call "string" [a],r]) x xs-concatAll _ = call "empty" []---path_steps = ["child", "descendant", "attribute", "self", "descendant-or-self", "following-sibling", "following",-              "attribute-descendant", "parent", "ancestor", "preceding-sibling", "preceding", "ancestor-or-self" ]---data Token-  = RETURN | SOME | EVERY | IF | THEN | ELSE | LB | RB | LP | RP | LSB | RSB-  | TO | PLUS | MINUS | TIMES | DIV | IDIV | MOD | AS | QMARK-  | TEQ | TNE | TLT | TLE | TGT | TGE | SEQ | SNE | SLT | SLE | SGT | SGE-  | AND | OR | NOT | UNION | INTERSECT | EXCEPT | FOR | LET | IN | COMMA-  | ASSIGN | WHERE | ORDER | BY | ASCENDING | DESCENDING | ELEMENT-  | ATTRIBUTE | STAG | ETAG | SATISFIES | ATSIGN | SLASH | DECLARE | SEMI | COLON-  | FUNCTION | VARIABLE | VIEW | AT | DOT | DOTS | TokenEOF | PRE | POST | IS-  | INSERT | INTO | DELETE | FROM | REPLACE | WITH | INSTANCE | OF-  | CAST | CASTABLE | CASE | DEFAULT | TYPESWITCH-  | QName String | Variable String | XMLtext String | TInteger Int-  | TFloat Double | TString String | TError String-    deriving Eq---instance Show Token-    where show (QName s) = "QName("++s++")"-	  show (Variable s) = "Variable("++s++")"-	  show (XMLtext s) = "XMLtext("++s++")"-	  show (TInteger n) = "Integer("++(show n)++")"-	  show (TFloat n) = "Double("++(show n)++")"-	  show (TString s) = "String("++s++")"-	  show (TError s) = "'"++s++"'"-          show t = case filter (\(n,_) -> n==t) tokenList of-                     (_,b):_ -> b-                     _ -> "Illegal token"---printToken (QName s) = s-printToken (Variable s) = "$"++s-printToken (XMLtext s) = "'"++s++"'"-printToken (TInteger n) = show n-printToken (TFloat n) = show n-printToken (TString s) = "\""++s++"\""-printToken (TError s) = "error("++s++")"-printToken t = case filter (\(n,_) -> n==t) tokenList of-           (_,b):_ -> b-           _ -> "Illegal token"---tokenList :: [(Token,String)]-tokenList = [(TokenEOF,"EOF"),(RETURN,"return"),(SOME,"some"),(EVERY,"every"),(IF,"if"),(THEN,"then"),(ELSE,"else"),-             (LB,"["),(RB,"]"),(LP,"("),(RP,")"),(LSB,"{"),(RSB,"}"),(QMARK,"?"),-             (TO,"to"),(PLUS,"+"),(MINUS,"-"),(TIMES,"*"),(DIV,"div"),(IDIV,"idiv"),(MOD,"mod"),-             (TEQ,"="),(TNE,"!="),(TLT,"<"),(TLE,"<="),(TGT,">"),(TGE,">="),(PRE,"<<"),(POST,">>"),-             (IS,"is"),(SEQ,"eq"),(SNE,"ne"),(SLT,"lt"),(SLE,"le"),(SGT,"gt"),(SGE,"ge"),(AND,"and"),-             (OR,"or"),(NOT,"not"),(UNION,"|"),(INTERSECT,"intersect"),(EXCEPT,"except"),-             (FOR,"for"),(LET,"let"),(IN,"in"),(AS,"as"),(COMMA,"','"),(ASSIGN,":="),(WHERE,"where"),(ORDER,"order"),-             (BY,"by"),(ASCENDING,"ascending"),(DESCENDING,"descending"),(ELEMENT,"element"),-             (ATTRIBUTE,"attribute"),(STAG,"</"),(ETAG,"/>"),(SATISFIES,"satisfies"),(ATSIGN,"@"),-             (SLASH,"/"),(DECLARE,"declare"),(FUNCTION,"function"),(VARIABLE,"variable"),(VIEW,"view"),-  	     (INSERT,"insert"),(INTO,"into"),(DELETE,"delete"),(FROM,"from"),(REPLACE,"replace"),(WITH,"with"),-             (AT,"at"),(DOTS,".."),(DOT,"."),(SEMI,";"),(COLON,":"),(INSTANCE,"instance"),(OF,"of"),-             (CAST,"cast"),(CASTABLE,"castable"),(CASE,"case"),(DEFAULT,"default"),(TYPESWITCH,"typeswitch")]---parseError tk = error (case tk of-                         ((TError s):_) -> "Parse error: "++s-                         (TokenEOF:_) -> "Parse error: Unexpected end of file"-		         _ -> "Parse error: "++(foldr (\a r -> (printToken a)++" "++r) "" (init (take 11 tk))))---scan :: String -> [Token]-scan cs = lexer cs ""---xmlText :: String -> [Token]-xmlText "" = []-xmlText text = [XMLtext text]----- scans XML syntax and returns an XMLtext token with the text-xml :: String -> String -> String -> [Token]-xml ('{':cs) text n = (xmlText text)++(LSB : lexer cs ('{':n))-xml ('<':'/':cs) text n = (xmlText text)++(STAG : lexer cs ('<':'/':n))-xml ('<':'!':'-':cs) text n = xmlComment cs (text++"<!-") n-xml ('<':cs) text n = (xmlText text)++(TLT : lexer cs ('<':n))-xml ('(':':':cs) text n = xqComment cs text n-xml (c:cs) text n = xml cs (text++[c]) n-xml [] text _ = xmlText text---xqComment :: String -> String -> String -> [Token]-xqComment (':':')':cs) text n = xml cs text n-xqComment (_:cs) text n = xqComment cs text n-xqComment [] text _ = xmlText text---xmlComment :: String -> String -> String -> [Token]-xmlComment ('-':'>':cs) text n = xml cs (text++"->") n-xmlComment (c:cs) text n = xmlComment cs (text++[c]) n-xmlComment [] text _ = xmlText text---isQN :: Char -> Bool-isQN c = elem c "_-." || isDigit c || isAlpha c---isVar :: Char -> Bool-isVar c = elem c "_-." || isDigit c || isAlpha c---inXML :: String -> Bool-inXML ('>':'<':_) = True-inXML _ = False----- the XQuery scanner-lexer :: String -> String -> [Token]-lexer [] "" = [ TokenEOF ]-lexer [] _ = [ TError "Unexpected end of input" ]-lexer (' ':'>':' ':cs) n = TGT : lexer cs n-lexer (c:cs) n-      | isSpace c = lexer cs n-      | isAlpha c || c=='_' = lexVar (c:cs) n-      | isDigit c = lexNum (c:cs) n-lexer ('$':c:cs) n | isAlpha c-      = let (var,rest) = span isVar (c:cs)-        in (Variable var) : lexer rest n-lexer (':':'=':cs) n = ASSIGN : lexer cs n-lexer ('<':'/':cs) n = STAG : lexer cs ('<':'/':n)-lexer ('<':'=':cs) n = TLE : lexer cs n-lexer ('>':'=':cs) n = TGE : lexer cs n-lexer ('<':'<':cs) n = PRE : lexer cs n-lexer ('>':'>':cs) n = POST : lexer cs n-lexer ('/':'>':cs) m = case m of-                         '<':n -> ETAG : (if inXML n then xml cs "" n else lexer cs n)-                         _ -> [ TError "Unexpected token: '/>'" ]-lexer ('(':':':cs) n = lexComment cs n-lexer ('<':'!':'-':cs) n = lexXmlComment cs "<!-" n-lexer ('.':'.':cs) n = DOTS : lexer cs n-lexer ('.':cs) n = DOT : lexer cs n-lexer ('!':'=':cs) n = TNE : lexer cs n-lexer ('\'':cs) n = lexString cs "" ('\'':n)-lexer ('\"':cs) n = lexString cs "" ('\"': n)-lexer ('[':cs) n = LB : lexer cs n-lexer (']':cs) n = RB : lexer cs n-lexer ('(':cs) n = LP : lexer cs n-lexer (')':cs) n = RP : lexer cs n-lexer ('}':cs) m = case m of-                     '{':'\"':n -> RSB : lexString cs "" ('\"':n)-                     '{':'\'':n -> RSB : lexString cs "" ('\'':n)-                     '{':n -> RSB : (if inXML n then xml cs "" n else lexer cs n)-                     _ -> [ TError "Unexpected token: '}'" ]-lexer ('+':cs) n = PLUS : lexer cs n-lexer ('-':cs) n = MINUS : lexer cs n-lexer ('*':cs) n = TIMES : lexer cs n-lexer ('=':cs) n = TEQ : lexer cs n-lexer ('<':c:cs) n = TLT : (lexer (c:cs) (if isAlpha c then ('<':n) else n))-lexer ('>':cs) m = case m of-                     '<':'/':'>':'<':n -> TGT : (if inXML n then xml cs "" n else lexer cs n)-                     '<':n -> TGT : xml cs "" ('>':m) -                     _ -> TGT : lexer cs m-lexer (',':cs) n = COMMA : lexer cs n-lexer ('@':cs) n = ATSIGN : lexer cs n-lexer ('?':cs) n = QMARK : lexer cs n-lexer ('/':cs) n = SLASH : lexer cs n-lexer ('{':cs) n = LSB : lexer cs ('{':n)-lexer ('|':cs) n = UNION : lexer cs n-lexer (';':cs) n = SEMI : lexer cs n-lexer (':':cs) n = COLON : lexer cs n-lexer (c:cs) n = TError ("Illegal character: '"++[c,'\'']) : lexer cs n---lexExp :: String -> (String,String)-lexExp (e:cs)-    | e == 'e' || e == 'E'-    = case cs of-        '+':rest -> span isDigit rest-        '-':rest -> let (s,rest1) = span isDigit rest-                    in ('-':s,rest1)-        rest -> span isDigit rest-lexExp cs = ("",cs)---lexNum :: String -> String -> [Token]-lexNum cs n-    = let (si,rest) = span isDigit cs-      in case rest of-           '.':rest1-               -> let (sd,rest2) = span isDigit rest1-                  in case lexExp rest2 of-                       ("",_) -> (TFloat (read $ si ++ "." ++ sd)) : lexer rest2 n-                       (exp,rest3) -> (TFloat (read $ si ++ "." ++ sd ++ "e" ++ exp)) : lexer rest3 n-           _ -> case lexExp rest of-                  ("",_) -> (TInteger (read si)) : lexer rest n-                  (exp,rest3) -> (TFloat (read $ si ++ "e" ++ exp)) : lexer rest3 n---lexString :: String -> String -> String -> [Token]-lexString ('\"':cs) s m = case m of-                            '\"':n -> (TString s) : (lexer cs n)-                            _ -> lexString cs (s++"\"") m-lexString ('\'':cs) s m = case m of-                            '\'':n -> (TString s) : (lexer cs n)-                            _ -> lexString cs (s++"\'") m--- a string in an attribute value must evaluate between {}-lexString ('{':cs) s (c:'<':n) = (TString s) : LSB : (lexer cs ('{':c:'<':n))-lexString ('\\':'n':cs) s n = lexString cs (s++['\n']) n-lexString ('\\':'r':cs) s n = lexString cs (s++['\r']) n-lexString (c:cs) s n = lexString cs (s++[c]) n-lexString [] s n = [ TError "End of input while in string" ]---lexComment :: String -> String -> [Token]-lexComment (':':')':cs) n = lexer cs n-lexComment (_:cs) n = lexComment cs n-lexComment [] n = [ TError "End of input while in comment" ]---lexXmlComment :: String -> String -> String -> [Token]-lexXmlComment ('-':'>':cs) text n = (xmlText (text++"->"))++(lexer cs n)-lexXmlComment (c:cs) text n = lexXmlComment cs (text++[c]) n-lexXmlComment [] text _ = xmlText text---lexVar :: String -> String -> [Token]-lexVar cs n =-    let (nm,rest) = span isQN cs-        token = case nm of-          "return" -> RETURN-          "some" -> SOME-          "every" -> EVERY-          "if" -> IF-          "then" -> THEN-          "else" -> ELSE-          "to" -> TO-          "div" -> DIV-          "idiv" -> IDIV-          "mod" -> MOD-          "and" -> AND-          "or" -> OR-          "not" -> NOT-          "union" -> UNION-          "intersect" -> INTERSECT-          "except" -> EXCEPT-          "for" -> FOR-          "let" -> LET-          "in" -> IN-          "as" -> AS-          "where" -> WHERE-          "order" -> ORDER-          "by" -> BY-          "ascending" -> ASCENDING-          "descending" -> DESCENDING-          "element" -> ELEMENT-          "attribute" -> ATTRIBUTE-          "satisfies" -> SATISFIES-          "declare" -> DECLARE-          "function" -> FUNCTION-          "variable" -> VARIABLE-          "view" -> VIEW-          "at" -> AT-          "eq" -> SEQ-          "ne" -> SNE-          "lt" -> SLT-          "le" -> SLE-          "gt" -> SGT-          "ge" -> SGE-          "is" -> IS-	  "insert" -> INSERT-	  "into" -> INTO-	  "delete" -> DELETE-	  "from" -> FROM-	  "replace" -> REPLACE-	  "with" -> WITH-          "instance" -> INSTANCE-          "of" -> OF-          "cast" -> CAST-          "castable" -> CASTABLE-          "case" -> CASE-          "default" -> DEFAULT-          "typeswitch" -> TYPESWITCH+happyIn7 :: (Ast) -> (HappyAbsSyn )+happyIn7 x = unsafeCoerce# x+{-# INLINE happyIn7 #-}+happyOut7 :: (HappyAbsSyn ) -> (Ast)+happyOut7 x = unsafeCoerce# x+{-# INLINE happyOut7 #-}+happyIn8 :: ([ Ast ]) -> (HappyAbsSyn )+happyIn8 x = unsafeCoerce# x+{-# INLINE happyIn8 #-}+happyOut8 :: (HappyAbsSyn ) -> ([ Ast ])+happyOut8 x = unsafeCoerce# x+{-# INLINE happyOut8 #-}+happyIn9 :: ([ Ast ]) -> (HappyAbsSyn )+happyIn9 x = unsafeCoerce# x+{-# INLINE happyIn9 #-}+happyOut9 :: (HappyAbsSyn ) -> ([ Ast ])+happyOut9 x = unsafeCoerce# x+{-# INLINE happyOut9 #-}+happyIn10 :: (String) -> (HappyAbsSyn )+happyIn10 x = unsafeCoerce# x+{-# INLINE happyIn10 #-}+happyOut10 :: (HappyAbsSyn ) -> (String)+happyOut10 x = unsafeCoerce# x+{-# INLINE happyOut10 #-}+happyIn11 :: ([ (Ast,Ast) ]) -> (HappyAbsSyn )+happyIn11 x = unsafeCoerce# x+{-# INLINE happyIn11 #-}+happyOut11 :: (HappyAbsSyn ) -> ([ (Ast,Ast) ])+happyOut11 x = unsafeCoerce# x+{-# INLINE happyOut11 #-}+happyIn12 :: ([ (Ast,Ast) ]) -> (HappyAbsSyn )+happyIn12 x = unsafeCoerce# x+{-# INLINE happyIn12 #-}+happyOut12 :: (HappyAbsSyn ) -> ([ (Ast,Ast) ])+happyOut12 x = unsafeCoerce# x+{-# INLINE happyOut12 #-}+happyIn13 :: (Ast) -> (HappyAbsSyn )+happyIn13 x = unsafeCoerce# x+{-# INLINE happyIn13 #-}+happyOut13 :: (HappyAbsSyn ) -> (Ast)+happyOut13 x = unsafeCoerce# x+{-# INLINE happyOut13 #-}+happyIn14 :: (Ast) -> (HappyAbsSyn )+happyIn14 x = unsafeCoerce# x+{-# INLINE happyIn14 #-}+happyOut14 :: (HappyAbsSyn ) -> (Ast)+happyOut14 x = unsafeCoerce# x+{-# INLINE happyOut14 #-}+happyIn15 :: ([ Ast ]) -> (HappyAbsSyn )+happyIn15 x = unsafeCoerce# x+{-# INLINE happyIn15 #-}+happyOut15 :: (HappyAbsSyn ) -> ([ Ast ])+happyOut15 x = unsafeCoerce# x+{-# INLINE happyOut15 #-}+happyIn16 :: (Ast) -> (HappyAbsSyn )+happyIn16 x = unsafeCoerce# x+{-# INLINE happyIn16 #-}+happyOut16 :: (HappyAbsSyn ) -> (Ast)+happyOut16 x = unsafeCoerce# x+{-# INLINE happyOut16 #-}+happyIn17 :: (Ast) -> (HappyAbsSyn )+happyIn17 x = unsafeCoerce# x+{-# INLINE happyIn17 #-}+happyOut17 :: (HappyAbsSyn ) -> (Ast)+happyOut17 x = unsafeCoerce# x+{-# INLINE happyOut17 #-}+happyIn18 :: ([ Ast ]) -> (HappyAbsSyn )+happyIn18 x = unsafeCoerce# x+{-# INLINE happyIn18 #-}+happyOut18 :: (HappyAbsSyn ) -> ([ Ast ])+happyOut18 x = unsafeCoerce# x+{-# INLINE happyOut18 #-}+happyIn19 :: (Ast -> Ast) -> (HappyAbsSyn )+happyIn19 x = unsafeCoerce# x+{-# INLINE happyIn19 #-}+happyOut19 :: (HappyAbsSyn ) -> (Ast -> Ast)+happyOut19 x = unsafeCoerce# x+{-# INLINE happyOut19 #-}+happyIn20 :: (Ast -> Ast) -> (HappyAbsSyn )+happyIn20 x = unsafeCoerce# x+{-# INLINE happyIn20 #-}+happyOut20 :: (HappyAbsSyn ) -> (Ast -> Ast)+happyOut20 x = unsafeCoerce# x+{-# INLINE happyOut20 #-}+happyIn21 :: (Ast -> Ast) -> (HappyAbsSyn )+happyIn21 x = unsafeCoerce# x+{-# INLINE happyIn21 #-}+happyOut21 :: (HappyAbsSyn ) -> (Ast -> Ast)+happyOut21 x = unsafeCoerce# x+{-# INLINE happyOut21 #-}+happyIn22 :: (Ast -> Ast) -> (HappyAbsSyn )+happyIn22 x = unsafeCoerce# x+{-# INLINE happyIn22 #-}+happyOut22 :: (HappyAbsSyn ) -> (Ast -> Ast)+happyOut22 x = unsafeCoerce# x+{-# INLINE happyOut22 #-}+happyIn23 :: (( Ast -> Ast, Ast -> Ast )) -> (HappyAbsSyn )+happyIn23 x = unsafeCoerce# x+{-# INLINE happyIn23 #-}+happyOut23 :: (HappyAbsSyn ) -> (( Ast -> Ast, Ast -> Ast ))+happyOut23 x = unsafeCoerce# x+{-# INLINE happyOut23 #-}+happyIn24 :: (( [ Ast ], [ Ast ] )) -> (HappyAbsSyn )+happyIn24 x = unsafeCoerce# x+{-# INLINE happyIn24 #-}+happyOut24 :: (HappyAbsSyn ) -> (( [ Ast ], [ Ast ] ))+happyOut24 x = unsafeCoerce# x+{-# INLINE happyOut24 #-}+happyIn25 :: (Ast) -> (HappyAbsSyn )+happyIn25 x = unsafeCoerce# x+{-# INLINE happyIn25 #-}+happyOut25 :: (HappyAbsSyn ) -> (Ast)+happyOut25 x = unsafeCoerce# x+{-# INLINE happyOut25 #-}+happyIn26 :: (Ast) -> (HappyAbsSyn )+happyIn26 x = unsafeCoerce# x+{-# INLINE happyIn26 #-}+happyOut26 :: (HappyAbsSyn ) -> (Ast)+happyOut26 x = unsafeCoerce# x+{-# INLINE happyOut26 #-}+happyIn27 :: (Ast) -> (HappyAbsSyn )+happyIn27 x = unsafeCoerce# x+{-# INLINE happyIn27 #-}+happyOut27 :: (HappyAbsSyn ) -> (Ast)+happyOut27 x = unsafeCoerce# x+{-# INLINE happyOut27 #-}+happyIn28 :: ([ Ast ]) -> (HappyAbsSyn )+happyIn28 x = unsafeCoerce# x+{-# INLINE happyIn28 #-}+happyOut28 :: (HappyAbsSyn ) -> ([ Ast ])+happyOut28 x = unsafeCoerce# x+{-# INLINE happyOut28 #-}+happyIn29 :: ([ Ast ]) -> (HappyAbsSyn )+happyIn29 x = unsafeCoerce# x+{-# INLINE happyIn29 #-}+happyOut29 :: (HappyAbsSyn ) -> ([ Ast ])+happyOut29 x = unsafeCoerce# x+{-# INLINE happyOut29 #-}+happyIn30 :: (Ast) -> (HappyAbsSyn )+happyIn30 x = unsafeCoerce# x+{-# INLINE happyIn30 #-}+happyOut30 :: (HappyAbsSyn ) -> (Ast)+happyOut30 x = unsafeCoerce# x+{-# INLINE happyOut30 #-}+happyIn31 :: ([Ast]) -> (HappyAbsSyn )+happyIn31 x = unsafeCoerce# x+{-# INLINE happyIn31 #-}+happyOut31 :: (HappyAbsSyn ) -> ([Ast])+happyOut31 x = unsafeCoerce# x+{-# INLINE happyOut31 #-}+happyIn32 :: ([ Ast ]) -> (HappyAbsSyn )+happyIn32 x = unsafeCoerce# x+{-# INLINE happyIn32 #-}+happyOut32 :: (HappyAbsSyn ) -> ([ Ast ])+happyOut32 x = unsafeCoerce# x+{-# INLINE happyOut32 #-}+happyIn33 :: (Ast) -> (HappyAbsSyn )+happyIn33 x = unsafeCoerce# x+{-# INLINE happyIn33 #-}+happyOut33 :: (HappyAbsSyn ) -> (Ast)+happyOut33 x = unsafeCoerce# x+{-# INLINE happyOut33 #-}+happyIn34 :: (Ast -> Ast) -> (HappyAbsSyn )+happyIn34 x = unsafeCoerce# x+{-# INLINE happyIn34 #-}+happyOut34 :: (HappyAbsSyn ) -> (Ast -> Ast)+happyOut34 x = unsafeCoerce# x+{-# INLINE happyOut34 #-}+happyIn35 :: (Ast -> Ast) -> (HappyAbsSyn )+happyIn35 x = unsafeCoerce# x+{-# INLINE happyIn35 #-}+happyOut35 :: (HappyAbsSyn ) -> (Ast -> Ast)+happyOut35 x = unsafeCoerce# x+{-# INLINE happyOut35 #-}+happyIn36 :: ([ Ast ]) -> (HappyAbsSyn )+happyIn36 x = unsafeCoerce# x+{-# INLINE happyIn36 #-}+happyOut36 :: (HappyAbsSyn ) -> ([ Ast ])+happyOut36 x = unsafeCoerce# x+{-# INLINE happyOut36 #-}+happyIn37 :: (String -> Ast -> [ Ast ] -> Ast) -> (HappyAbsSyn )+happyIn37 x = unsafeCoerce# x+{-# INLINE happyIn37 #-}+happyOut37 :: (HappyAbsSyn ) -> (String -> Ast -> [ Ast ] -> Ast)+happyOut37 x = unsafeCoerce# x+{-# INLINE happyOut37 #-}+happyIn38 :: (String -> Ast -> Ast) -> (HappyAbsSyn )+happyIn38 x = unsafeCoerce# x+{-# INLINE happyIn38 #-}+happyOut38 :: (HappyAbsSyn ) -> (String -> Ast -> Ast)+happyOut38 x = unsafeCoerce# x+{-# INLINE happyOut38 #-}+happyIn39 :: (String -> Ast) -> (HappyAbsSyn )+happyIn39 x = unsafeCoerce# x+{-# INLINE happyIn39 #-}+happyOut39 :: (HappyAbsSyn ) -> (String -> Ast)+happyOut39 x = unsafeCoerce# x+{-# INLINE happyOut39 #-}+happyInTok :: (Token) -> (HappyAbsSyn )+happyInTok x = unsafeCoerce# x+{-# INLINE happyInTok #-}+happyOutTok :: (HappyAbsSyn ) -> (Token)+happyOutTok x = unsafeCoerce# x+{-# INLINE happyOutTok #-}+++happyActOffsets :: HappyAddr+happyActOffsets = HappyA# "\xff\xff\xff\xff\x09\x00\x12\x04\x5d\x04\x00\x00\x38\x04\xbe\x00\x00\x00\x00\x00\x0b\x00\x00\x00\x06\x00\x00\x00\x00\x00\x00\x00\x0d\x04\x0d\x04\x10\x01\xb5\x00\x10\x01\x10\x01\x10\x01\x00\x00\x29\x04\x10\x01\x0b\x04\x0b\x04\x13\x00\x12\x00\x30\x00\x1e\x04\xa3\x00\x06\x04\x00\x00\x10\x01\xf8\x03\x10\x01\x33\x04\xe7\x03\x30\x04\x00\x00\x00\x00\x00\x00\x00\x00\xdb\x03\x10\x01\xd6\x00\x10\x01\x94\x03\x10\x01\x78\x03\x26\x04\xee\x03\x05\x00\xfb\x03\xfb\x03\xd6\x03\xf6\x03\xf6\x03\x01\x00\xf5\x03\xde\xff\x00\x00\x22\x04\xeb\x03\x10\x01\x17\x04\xe6\x03\x10\x01\xf7\x03\xf3\x03\x62\x00\xf2\x03\x00\x00\xe3\x03\x00\x00\x00\x00\x38\x04\x7b\x00\x23\x00\x00\x00\x60\x01\x6d\x00\x51\x00\xfd\xff\x10\x01\x00\x00\x15\x00\x00\x00\xed\x03\x86\x03\x86\x03\x10\x01\x10\x01\x10\x01\x10\x01\x10\x01\x10\x01\x10\x01\x10\x01\x10\x01\x10\x01\x10\x01\x10\x01\x10\x01\x10\x01\x10\x01\x10\x01\x10\x01\x10\x01\x10\x01\x10\x01\x10\x01\x10\x01\x10\x01\x10\x01\x10\x01\x10\x01\x10\x01\x10\x01\x10\x01\x8f\x03\xad\x03\xa9\x03\x5a\x00\x00\x00\xff\xff\x00\x00\x7b\x03\x02\x00\x00\x00\x75\x00\x75\x00\x75\x00\xed\x0a\xed\x0a\xed\x0a\x1f\x0b\xed\x0a\x06\x0b\x3e\x01\x3e\x01\x3e\x01\x3e\x01\x3e\x01\x3e\x01\x3e\x01\x3e\x01\x3e\x01\x3e\x01\x3e\x01\x3e\x01\x3e\x01\x3e\x01\x3e\x01\x00\x00\x00\x00\x00\x00\x00\x00\xf9\x02\xf9\x02\x37\x0b\x38\x04\xa6\x03\xa5\x03\xd0\x03\x9a\x03\x00\x00\xfc\xff\x10\x01\x0c\x00\x08\x00\x95\x03\x00\x00\x00\x00\x7a\x00\x90\x03\x00\x00\x10\x01\x3f\x00\x71\x03\x10\x01\x10\x01\x10\x01\x00\x00\x10\x01\x00\x00\xb1\x03\x88\x03\x10\x01\x6a\x03\x6a\x03\x10\x01\x15\x03\xb6\x03\x10\x01\xd0\x02\xb5\x03\x10\x01\xfd\xff\x00\x00\x04\x00\xaa\x03\x68\x03\x2d\x03\x6d\x03\x76\x03\xea\xff\x73\x03\x2e\x03\x00\x00\x3f\x03\x1d\x03\x10\x01\xf4\x03\x10\x01\xc7\x01\x05\x00\xb3\x02\x00\x00\x38\x03\x20\x03\xf4\x03\xf4\x03\x64\x03\x42\x03\x41\x03\x24\x03\x12\x03\x75\x00\x10\x01\x12\x03\x75\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x29\x03\x79\x00\x00\x00\x55\x03\x76\x00\x00\x00\x54\x03\xd8\x03\x30\x03\x32\x03\xd8\x03\x2c\x03\x05\x00\xd8\x03\x83\x01\xd8\x03\xd8\x03\x4b\x00\x00\x00\x30\x00\x57\x00\x00\x00\xa5\x01\x00\x00\x00\x00\x27\x03\x70\x00\x00\x00\x10\x01\xe3\x02\x00\x00\x00\x00\x10\x01\x10\x01\x11\x00\x00\x00\x1e\x00\x35\x03\x14\x03\x00\x00\x00\x00\x00\x00\x00\x00\x63\x00\xfb\xff\x00\x00\x00\x00\x00\x00\x11\x03\x00\x00\x00\x00\x00\x00\xd8\x03\x34\x03\xeb\x02\xff\x02\x6b\x00\x00\x00\x00\x00\x00\x00\x00\x00\x30\x00\x00\x00\x0f\x03\x10\x01\xbc\x02\x10\x01\x00\x00\x05\x00\x10\x01\x10\x01\x10\x01\x00\x00\x10\x01\x00\x00\x00\x00\x07\x03\xd8\x03\xdf\x02\xfe\x02\x75\x00\x75\x00\xa9\x02\xd4\x02\x00\x00\x75\x00\x00\x00\x05\x00\xcd\x02\xfa\x02\x75\x00\x90\x02\x00\x00\x00\x00\xfe\xff\x10\x01\xb0\x02\x48\x00\xfa\xff\xd8\x03\xd8\x03\x00\x00\xd1\x0a\x8e\x02\xd8\x03\xad\x02\x00\x00\xad\x02\x00\x00\x00\x00\x10\x01\x00\x00\x00\x00\x00\x00\x00\x00\x82\x02\xa1\x02\x00\x00\x72\x02\x94\x02\x00\x00\x00\x00\x5e\x02\x00\x00\x5e\x02\x34\x03\x53\x02\x10\x01\x00\x00\x00\x00\x10\x01\xd8\x03\x10\x01\x75\x00\x75\x00\x00\x00\x10\x01\x00\x00\x05\x00\x2c\x02\xe9\x01\x00\x00\x4a\x02\x6e\x02\x51\x02\xd8\x03\x00\x00\x06\x02\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x10\x01\x00\x00\x48\x02\x00\x00\x10\x01\x0c\x02\x00\x00\xd8\x03\x00\x00"#++happyGotoOffsets :: HappyAddr+happyGotoOffsets = HappyA# "\xbb\x00\x16\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x33\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xf5\x01\x00\x00\xed\x00\xe3\x00\xbb\x0a\xd3\x04\xbb\x04\xa3\x0a\x8b\x0a\x00\x00\x3c\x02\x73\x0a\xc0\x00\xc8\x00\x3b\x02\x31\x02\x3b\x01\x00\x00\x0f\x02\x0e\x02\x00\x00\x5b\x0a\x00\x00\x43\x0a\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x2b\x0a\xed\x01\x13\x0a\x00\x00\xfb\x09\x00\x00\x00\x00\x00\x00\xd8\x01\xca\x01\xab\x01\xc2\x01\xa8\x01\x89\x01\x00\x00\x00\x00\x00\x00\x46\x01\x00\x00\x63\x01\xe3\x09\x00\x00\x5e\x01\xcb\x09\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x6e\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x6d\x01\xa3\x04\x00\x00\x41\x01\x00\x00\x4f\x01\xb6\x00\xa2\x00\xb3\x09\x9b\x09\x83\x09\x6b\x09\x53\x09\x3b\x09\x23\x09\x0b\x09\xf3\x08\xdb\x08\xc3\x08\xab\x08\x93\x08\x7b\x08\x63\x08\x4b\x08\x33\x08\x1b\x08\x03\x08\xeb\x07\xd3\x07\xbb\x07\xa3\x07\x8b\x07\x73\x07\x5b\x07\x43\x07\x2b\x07\x13\x07\x00\x00\x00\x00\x00\x00\x8b\x04\x00\x00\x96\x02\x00\x00\x00\x00\x00\x00\x00\x00\xf3\x02\xac\x02\xa0\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x49\x01\x73\x04\x44\x01\x42\x01\x40\x01\x00\x00\x00\x00\x00\x00\x1f\x01\x00\x00\xfb\x06\x1e\x01\x2f\x01\xe3\x06\xcb\x06\xb3\x06\x00\x00\x9b\x06\x00\x00\x00\x00\x2e\x01\x83\x06\x2a\x01\x26\x01\x6b\x06\x00\x00\x00\x00\x5b\x04\x00\x00\x00\x00\x1d\x04\x07\x00\x00\x00\x14\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xfd\x00\x53\x06\x00\x00\x3b\x06\x00\x00\x39\x01\x00\x00\x00\x00\x2b\x01\x06\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xf7\x00\x9e\x02\x23\x06\xea\x00\x91\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x28\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xee\x00\x1b\x01\xe0\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xc0\x03\xfa\x00\x00\x00\x00\x00\x5c\x03\x0b\x06\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x90\x00\x86\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xce\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xe6\x00\xc3\x00\xd4\x00\x00\x00\xf3\x05\xcf\x00\xdb\x05\x00\x00\xfb\x00\xc3\x05\xab\x05\xf8\x02\x00\x00\x30\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x4d\x02\x46\x02\xae\x00\x00\x00\x00\x00\x3a\x02\x00\x00\xb3\x00\x9f\x00\x00\x00\x84\x01\x00\x00\x00\x00\x00\x00\x00\x00\x93\x05\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x74\x00\x00\x00\x00\x00\x00\x00\x7b\x05\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x77\x00\x00\x00\x69\x00\x66\x00\x00\x00\x63\x05\x00\x00\x00\x00\x4b\x05\x00\x00\x33\x05\x55\x01\x01\x01\x00\x00\x1b\x05\x00\x00\x91\x00\x4c\x00\x1a\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03\x05\x00\x00\x00\x00\x00\x00\xeb\x04\x00\x00\x00\x00\x00\x00\x00\x00"#++happyDefActions :: HappyAddr+happyDefActions = HappyA# "\x00\x00\x00\x00\x00\x00\xfd\xff\x5b\xff\x58\xff\xf9\xff\x8c\xff\xc4\xff\xc5\xff\x00\x00\xa0\xff\x71\xff\xc6\xff\x5e\xff\x5d\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x5c\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xe6\xff\xeb\xff\x00\x00\x57\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xcb\xff\x9f\xff\x9e\xff\x70\xff\x00\x00\x00\x00\xeb\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xe6\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x5e\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x96\xff\x00\x00\x97\xff\xa1\xff\x7b\xff\xa2\xff\xa3\xff\x99\xff\x00\x00\x00\x00\x55\xff\x00\x00\x00\x00\x00\x00\x6a\xff\x00\x00\x6e\xff\x00\x00\x80\xff\x8a\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xfc\xff\x00\x00\xfe\xff\xfb\xff\x00\x00\x53\xff\x00\x00\x00\x00\x00\x00\xa8\xff\xa9\xff\xaa\xff\xab\xff\xac\xff\xad\xff\xae\xff\xaf\xff\xb0\xff\xb1\xff\xb2\xff\xb3\xff\xb4\xff\xb5\xff\xb6\xff\xb7\xff\xb8\xff\xb9\xff\xba\xff\xbb\xff\xbc\xff\xbd\xff\xbe\xff\xbf\xff\xc0\xff\xc1\xff\xc2\xff\xc3\xff\x8d\xff\x94\xff\x95\xff\x00\x00\x00\x00\x76\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x77\xff\x78\xff\x00\x00\x68\xff\x66\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x56\xff\x00\x00\x6f\xff\x00\x00\x7a\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x69\xff\xe5\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xef\xff\x00\x00\xe3\xff\x00\x00\x9b\xff\x00\x00\x00\x00\x00\x00\x00\x00\x9d\xff\xe9\xff\x00\x00\x9a\xff\x9c\xff\x00\x00\xe4\xff\xe2\xff\x00\x00\xe3\xff\x00\x00\x00\x00\xe3\xff\x00\x00\xec\xff\xed\xff\xee\xff\x5a\xff\x59\xff\x67\xff\x00\x00\x83\xff\x00\x00\x00\x00\x84\xff\x00\x00\x8f\xff\x00\x00\x00\x00\x93\xff\x00\x00\x00\x00\x98\xff\x00\x00\xc8\xff\xc9\xff\x00\x00\x5e\xff\x00\x00\x00\x00\x60\xff\x00\x00\x65\xff\x6d\xff\x00\x00\x00\x00\x72\xff\x00\x00\x00\x00\x73\xff\x74\xff\x00\x00\x00\x00\xde\xff\xa7\xff\xda\xff\x00\x00\x00\x00\xa6\xff\xa5\xff\x54\xff\xfa\xff\x00\x00\x00\x00\xd9\xff\xd8\xff\xd7\xff\x00\x00\xdd\xff\xdc\xff\xdb\xff\xca\xff\x85\xff\x8b\xff\x00\x00\x00\x00\x79\xff\x81\xff\x5f\xff\x5e\xff\x00\x00\x5e\xff\x64\xff\x00\x00\x00\x00\x00\x00\x6c\xff\x00\x00\x00\x00\x00\x00\x00\x00\x7d\xff\x00\x00\x7c\xff\xf1\xff\x00\x00\xf8\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xa4\xff\x00\x00\xf0\xff\x00\x00\xe7\xff\x00\x00\x00\x00\xe0\xff\xe1\xff\xf2\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x8e\xff\x92\xff\x6b\xff\xc7\xff\x00\x00\x91\xff\x63\xff\x5e\xff\x62\xff\x75\xff\x82\xff\x00\x00\x89\xff\x87\xff\x86\xff\xd4\xff\xd0\xff\x00\x00\xd6\xff\xd1\xff\x00\x00\xd5\xff\xd2\xff\x00\x00\xd3\xff\x00\x00\x85\xff\x61\xff\x00\x00\x7f\xff\x7e\xff\x00\x00\xf7\xff\x00\x00\x00\x00\x00\x00\xf3\xff\x00\x00\xea\xff\x00\x00\xe7\xff\x00\x00\xdf\xff\x00\x00\x00\x00\x00\x00\x90\xff\x88\xff\xce\xff\xcf\xff\xcd\xff\xcc\xff\xf4\xff\xf6\xff\x00\x00\x51\xff\x00\x00\xe8\xff\x00\x00\x00\x00\xf5\xff\x52\xff"#++happyCheck :: HappyAddr+happyCheck = HappyA# "\xff\xff\x02\x00\x03\x00\x04\x00\x07\x00\x0a\x00\x0c\x00\x0b\x00\x09\x00\x0b\x00\x0b\x00\x10\x00\x0a\x00\x0e\x00\x0f\x00\x10\x00\x0b\x00\x0b\x00\x16\x00\x0b\x00\x10\x00\x16\x00\x2c\x00\x0b\x00\x2e\x00\x3b\x00\x09\x00\x09\x00\x09\x00\x0b\x00\x0b\x00\x0e\x00\x0b\x00\x10\x00\x44\x00\x18\x00\x25\x00\x1e\x00\x1f\x00\x2d\x00\x29\x00\x2a\x00\x2c\x00\x16\x00\x0e\x00\x0a\x00\x10\x00\x2d\x00\x34\x00\x35\x00\x36\x00\x34\x00\x35\x00\x34\x00\x3b\x00\x3a\x00\x39\x00\x09\x00\x3b\x00\x3c\x00\x3d\x00\x23\x00\x3d\x00\x3b\x00\x10\x00\x42\x00\x37\x00\x3b\x00\x45\x00\x46\x00\x47\x00\x3b\x00\x09\x00\x34\x00\x35\x00\x36\x00\x43\x00\x3b\x00\x3b\x00\x10\x00\x2d\x00\x05\x00\x53\x00\x54\x00\x0c\x00\x59\x00\x57\x00\x58\x00\x5c\x00\x5a\x00\x5b\x00\x5c\x00\x02\x00\x03\x00\x04\x00\x4e\x00\x09\x00\x5c\x00\x5c\x00\x09\x00\x0a\x00\x0b\x00\x5d\x00\x10\x00\x0e\x00\x0f\x00\x10\x00\x3b\x00\x4e\x00\x0a\x00\x59\x00\x06\x00\x16\x00\x5c\x00\x42\x00\x10\x00\x06\x00\x2d\x00\x2b\x00\x0c\x00\x39\x00\x3a\x00\x3b\x00\x15\x00\x0c\x00\x06\x00\x2d\x00\x25\x00\x41\x00\x42\x00\x0c\x00\x29\x00\x2a\x00\x0c\x00\x0c\x00\x0c\x00\x58\x00\x38\x00\x1c\x00\x40\x00\x06\x00\x2b\x00\x34\x00\x35\x00\x39\x00\x0b\x00\x3b\x00\x39\x00\x20\x00\x3b\x00\x06\x00\x58\x00\x2d\x00\x42\x00\x2d\x00\x0b\x00\x42\x00\x2d\x00\x3b\x00\x45\x00\x46\x00\x47\x00\x40\x00\x2d\x00\x05\x00\x38\x00\x2d\x00\x2d\x00\x2d\x00\x34\x00\x35\x00\x1a\x00\x1b\x00\x53\x00\x0c\x00\x58\x00\x3b\x00\x57\x00\x58\x00\x11\x00\x5a\x00\x5b\x00\x5c\x00\x02\x00\x03\x00\x04\x00\x0c\x00\x00\x00\x01\x00\x02\x00\x09\x00\x0a\x00\x0b\x00\x06\x00\x0c\x00\x0e\x00\x0f\x00\x10\x00\x10\x00\x0c\x00\x0d\x00\x06\x00\x0f\x00\x16\x00\x0c\x00\x1a\x00\x1b\x00\x0c\x00\x10\x00\x16\x00\x17\x00\x18\x00\x0c\x00\x1a\x00\x1b\x00\x34\x00\x1d\x00\x11\x00\x25\x00\x0c\x00\x21\x00\x22\x00\x29\x00\x2a\x00\x3d\x00\x3e\x00\x3f\x00\x15\x00\x21\x00\x22\x00\x06\x00\x29\x00\x2a\x00\x34\x00\x35\x00\x48\x00\x0c\x00\x2f\x00\x39\x00\x0c\x00\x3b\x00\x07\x00\x08\x00\x10\x00\x20\x00\x52\x00\x0c\x00\x42\x00\x55\x00\x0c\x00\x45\x00\x46\x00\x47\x00\x10\x00\x07\x00\x08\x00\x06\x00\x21\x00\x22\x00\x0c\x00\x07\x00\x08\x00\x20\x00\x06\x00\x53\x00\x0c\x00\x09\x00\x0a\x00\x57\x00\x58\x00\x20\x00\x5a\x00\x5b\x00\x5c\x00\x02\x00\x03\x00\x04\x00\x1a\x00\x1b\x00\x01\x00\x02\x00\x09\x00\x06\x00\x0b\x00\x06\x00\x1f\x00\x0e\x00\x0f\x00\x10\x00\x06\x00\x0c\x00\x0d\x00\x06\x00\x0f\x00\x16\x00\x0c\x00\x52\x00\x23\x00\x0c\x00\x55\x00\x16\x00\x17\x00\x18\x00\x04\x00\x1a\x00\x1b\x00\x0c\x00\x1d\x00\x06\x00\x25\x00\x0c\x00\x21\x00\x22\x00\x29\x00\x2a\x00\x0c\x00\x21\x00\x22\x00\x1f\x00\x21\x00\x22\x00\x06\x00\x1a\x00\x1b\x00\x34\x00\x35\x00\x06\x00\x0c\x00\x06\x00\x39\x00\x06\x00\x3b\x00\x0e\x00\x0f\x00\x10\x00\x11\x00\x12\x00\x13\x00\x42\x00\x1a\x00\x1b\x00\x45\x00\x46\x00\x47\x00\x17\x00\x18\x00\x19\x00\x06\x00\x21\x00\x22\x00\x09\x00\x0a\x00\x17\x00\x18\x00\x13\x00\x53\x00\x06\x00\x05\x00\x20\x00\x57\x00\x58\x00\x06\x00\x5a\x00\x5b\x00\x5c\x00\x0d\x00\x0e\x00\x0f\x00\x10\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x19\x00\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x1f\x00\x20\x00\x21\x00\x22\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\x28\x00\x06\x00\x06\x00\x1e\x00\x1f\x00\x09\x00\x0a\x00\x06\x00\x0d\x00\x0e\x00\x0f\x00\x10\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x19\x00\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x1f\x00\x20\x00\x21\x00\x22\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\x28\x00\x4c\x00\x08\x00\x06\x00\x4f\x00\x50\x00\x06\x00\x0d\x00\x0e\x00\x0f\x00\x10\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x19\x00\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x1f\x00\x20\x00\x21\x00\x22\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\x28\x00\x0c\x00\x4c\x00\x06\x00\x0a\x00\x4f\x00\x50\x00\x0d\x00\x0e\x00\x0f\x00\x10\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x19\x00\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x1f\x00\x20\x00\x21\x00\x22\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\x28\x00\x03\x00\x4c\x00\x1a\x00\x1b\x00\x4f\x00\x50\x00\x0d\x00\x0e\x00\x0f\x00\x10\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x19\x00\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x1f\x00\x20\x00\x21\x00\x22\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\x28\x00\x03\x00\x4c\x00\x06\x00\x20\x00\x4f\x00\x50\x00\x0c\x00\x0d\x00\x0e\x00\x0f\x00\x10\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x19\x00\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x1f\x00\x20\x00\x21\x00\x22\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\x28\x00\x4c\x00\x06\x00\x06\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x0c\x00\x0d\x00\x0e\x00\x0f\x00\x06\x00\x06\x00\x06\x00\x09\x00\x0a\x00\x12\x00\x16\x00\x17\x00\x18\x00\x01\x00\x1a\x00\x1b\x00\x06\x00\x1d\x00\x4e\x00\x09\x00\x0a\x00\x21\x00\x22\x00\x06\x00\x4e\x00\x0b\x00\x09\x00\x0a\x00\x4c\x00\x2d\x00\x07\x00\x4f\x00\x50\x00\x0c\x00\x0d\x00\x0e\x00\x0f\x00\x10\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x19\x00\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x1f\x00\x20\x00\x21\x00\x22\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\x28\x00\x0c\x00\x0d\x00\x0e\x00\x0f\x00\x10\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x19\x00\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x1f\x00\x20\x00\x21\x00\x22\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\x28\x00\x06\x00\x02\x00\x3b\x00\x09\x00\x0a\x00\x06\x00\x4c\x00\x0a\x00\x2d\x00\x4f\x00\x50\x00\x0c\x00\x0d\x00\x06\x00\x0f\x00\x06\x00\x09\x00\x0a\x00\x09\x00\x0a\x00\x0a\x00\x16\x00\x17\x00\x18\x00\x2d\x00\x1a\x00\x1b\x00\x06\x00\x1d\x00\x07\x00\x09\x00\x0a\x00\x21\x00\x22\x00\x2b\x00\x4c\x00\x0b\x00\x2c\x00\x4f\x00\x50\x00\x0c\x00\x0d\x00\x0e\x00\x0f\x00\x10\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x19\x00\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x1f\x00\x20\x00\x21\x00\x22\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\x28\x00\x0c\x00\x0d\x00\x0e\x00\x0f\x00\x10\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x19\x00\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x1f\x00\x20\x00\x21\x00\x22\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\x28\x00\x06\x00\x2d\x00\x01\x00\x09\x00\x0a\x00\x06\x00\x4c\x00\x2c\x00\x58\x00\x4f\x00\x50\x00\x0c\x00\x0d\x00\x0e\x00\x0f\x00\x0a\x00\x10\x00\x11\x00\x12\x00\x13\x00\x2e\x00\x16\x00\x17\x00\x18\x00\x0a\x00\x1a\x00\x1b\x00\x58\x00\x1d\x00\x07\x00\x18\x00\x2d\x00\x21\x00\x22\x00\x0a\x00\x4c\x00\x09\x00\x3b\x00\x4f\x00\x50\x00\x0c\x00\x0d\x00\x0e\x00\x0f\x00\x10\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x19\x00\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x1f\x00\x20\x00\x21\x00\x22\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\x28\x00\x09\x00\x18\x00\x14\x00\x0d\x00\x0e\x00\x0f\x00\x10\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x19\x00\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x1f\x00\x20\x00\x21\x00\x22\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\x28\x00\x2b\x00\x2e\x00\x0b\x00\x0b\x00\x4c\x00\x06\x00\x3a\x00\x4f\x00\x50\x00\x32\x00\x33\x00\x0c\x00\x0d\x00\x58\x00\x0f\x00\x48\x00\x2c\x00\x0a\x00\x2d\x00\x14\x00\x51\x00\x16\x00\x17\x00\x18\x00\x58\x00\x1a\x00\x1b\x00\x40\x00\x1d\x00\x3b\x00\x4d\x00\x09\x00\x21\x00\x22\x00\x09\x00\x4c\x00\x14\x00\x55\x00\x4f\x00\x50\x00\x0d\x00\x0e\x00\x0f\x00\x10\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x19\x00\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x1f\x00\x20\x00\x21\x00\x22\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\x28\x00\x0d\x00\x0e\x00\x0f\x00\x10\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x19\x00\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x1f\x00\x20\x00\x21\x00\x22\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\x28\x00\x55\x00\x14\x00\x0a\x00\x0a\x00\x49\x00\x58\x00\x3b\x00\x4c\x00\x14\x00\x06\x00\x4f\x00\x50\x00\x58\x00\x3a\x00\x31\x00\x0c\x00\x0d\x00\x0e\x00\x0f\x00\x3b\x00\x01\x00\x2d\x00\x2d\x00\x59\x00\x2c\x00\x16\x00\x17\x00\x18\x00\x2c\x00\x1a\x00\x1b\x00\x4d\x00\x1d\x00\x58\x00\x4b\x00\x4c\x00\x21\x00\x22\x00\x4f\x00\x50\x00\x0d\x00\x0e\x00\x0f\x00\x10\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x19\x00\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x1f\x00\x20\x00\x21\x00\x22\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\x28\x00\x0d\x00\x0e\x00\x0f\x00\x10\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x19\x00\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x1f\x00\x20\x00\x21\x00\x22\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\x28\x00\x30\x00\x3b\x00\x2d\x00\x2d\x00\x3b\x00\x0b\x00\x06\x00\x4c\x00\x2e\x00\x3b\x00\x4f\x00\x50\x00\x0c\x00\x0d\x00\x0e\x00\x0f\x00\x0b\x00\x58\x00\x09\x00\x3b\x00\x3b\x00\x44\x00\x16\x00\x17\x00\x18\x00\x3b\x00\x1a\x00\x1b\x00\x5e\x00\x1d\x00\x0b\x00\x09\x00\x56\x00\x21\x00\x22\x00\x4c\x00\x3b\x00\x4a\x00\x4f\x00\x50\x00\x0d\x00\x0e\x00\x0f\x00\x10\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x19\x00\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x1f\x00\x20\x00\x21\x00\x22\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\x28\x00\x06\x00\x44\x00\x58\x00\x3b\x00\x58\x00\x09\x00\x0c\x00\x0d\x00\x0e\x00\x0f\x00\x59\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x16\x00\x17\x00\x18\x00\xff\xff\x1a\x00\x1b\x00\xff\xff\x1d\x00\x06\x00\xff\xff\xff\xff\x21\x00\x22\x00\xff\xff\x0c\x00\x0d\x00\x0e\x00\x0f\x00\xff\xff\x4c\x00\xff\xff\xff\xff\x4f\x00\x50\x00\x16\x00\x17\x00\x18\x00\xff\xff\x1a\x00\x1b\x00\xff\xff\x1d\x00\x06\x00\xff\xff\xff\xff\x21\x00\x22\x00\xff\xff\x0c\x00\x0d\x00\x0e\x00\x0f\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x16\x00\x17\x00\x18\x00\xff\xff\x1a\x00\x1b\x00\xff\xff\x1d\x00\x06\x00\xff\xff\xff\xff\x21\x00\x22\x00\xff\xff\x0c\x00\x0d\x00\x0e\x00\x0f\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x16\x00\x17\x00\x18\x00\xff\xff\x1a\x00\x1b\x00\xff\xff\x1d\x00\x06\x00\xff\xff\xff\xff\x21\x00\x22\x00\xff\xff\x0c\x00\x0d\x00\x0e\x00\x0f\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x16\x00\x17\x00\x18\x00\xff\xff\x1a\x00\x1b\x00\xff\xff\x1d\x00\x06\x00\xff\xff\xff\xff\x21\x00\x22\x00\xff\xff\x0c\x00\x0d\x00\x0e\x00\x0f\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x16\x00\x17\x00\x18\x00\xff\xff\x1a\x00\x1b\x00\xff\xff\x1d\x00\x06\x00\xff\xff\xff\xff\x21\x00\x22\x00\xff\xff\x0c\x00\x0d\x00\xff\xff\x0f\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x16\x00\x17\x00\x18\x00\xff\xff\x1a\x00\x1b\x00\xff\xff\x1d\x00\x06\x00\xff\xff\xff\xff\x21\x00\x22\x00\xff\xff\x0c\x00\x0d\x00\xff\xff\x0f\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x16\x00\x17\x00\x18\x00\xff\xff\x1a\x00\x1b\x00\xff\xff\x1d\x00\x06\x00\xff\xff\xff\xff\x21\x00\x22\x00\xff\xff\x0c\x00\x0d\x00\xff\xff\x0f\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x16\x00\x17\x00\x18\x00\xff\xff\x1a\x00\x1b\x00\xff\xff\x1d\x00\x06\x00\xff\xff\xff\xff\x21\x00\x22\x00\xff\xff\x0c\x00\x0d\x00\xff\xff\x0f\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x16\x00\x17\x00\x18\x00\xff\xff\x1a\x00\x1b\x00\xff\xff\x1d\x00\x06\x00\xff\xff\xff\xff\x21\x00\x22\x00\xff\xff\x0c\x00\x0d\x00\xff\xff\x0f\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x16\x00\x17\x00\x18\x00\xff\xff\x1a\x00\x1b\x00\xff\xff\x1d\x00\x06\x00\xff\xff\xff\xff\x21\x00\x22\x00\xff\xff\x0c\x00\x0d\x00\xff\xff\x0f\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x16\x00\x17\x00\x18\x00\xff\xff\x1a\x00\x1b\x00\xff\xff\x1d\x00\x06\x00\xff\xff\xff\xff\x21\x00\x22\x00\xff\xff\x0c\x00\x0d\x00\xff\xff\x0f\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x16\x00\x17\x00\x18\x00\xff\xff\x1a\x00\x1b\x00\xff\xff\x1d\x00\x06\x00\xff\xff\xff\xff\x21\x00\x22\x00\xff\xff\x0c\x00\x0d\x00\xff\xff\x0f\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x16\x00\x17\x00\x18\x00\xff\xff\x1a\x00\x1b\x00\xff\xff\x1d\x00\x06\x00\xff\xff\xff\xff\x21\x00\x22\x00\xff\xff\x0c\x00\x0d\x00\xff\xff\x0f\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x16\x00\x17\x00\x18\x00\xff\xff\x1a\x00\x1b\x00\xff\xff\x1d\x00\x06\x00\xff\xff\xff\xff\x21\x00\x22\x00\xff\xff\x0c\x00\x0d\x00\xff\xff\x0f\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x16\x00\x17\x00\x18\x00\xff\xff\x1a\x00\x1b\x00\xff\xff\x1d\x00\x06\x00\xff\xff\xff\xff\x21\x00\x22\x00\xff\xff\x0c\x00\x0d\x00\xff\xff\x0f\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x16\x00\x17\x00\x18\x00\xff\xff\x1a\x00\x1b\x00\xff\xff\x1d\x00\x06\x00\xff\xff\xff\xff\x21\x00\x22\x00\xff\xff\x0c\x00\x0d\x00\xff\xff\x0f\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x16\x00\x17\x00\x18\x00\xff\xff\x1a\x00\x1b\x00\xff\xff\x1d\x00\x06\x00\xff\xff\xff\xff\x21\x00\x22\x00\xff\xff\x0c\x00\x0d\x00\xff\xff\x0f\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x16\x00\x17\x00\x18\x00\xff\xff\x1a\x00\x1b\x00\xff\xff\x1d\x00\x06\x00\xff\xff\xff\xff\x21\x00\x22\x00\xff\xff\x0c\x00\x0d\x00\xff\xff\x0f\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x16\x00\x17\x00\x18\x00\xff\xff\x1a\x00\x1b\x00\xff\xff\x1d\x00\x06\x00\xff\xff\xff\xff\x21\x00\x22\x00\xff\xff\x0c\x00\x0d\x00\xff\xff\x0f\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x16\x00\x17\x00\x18\x00\xff\xff\x1a\x00\x1b\x00\xff\xff\x1d\x00\x06\x00\xff\xff\xff\xff\x21\x00\x22\x00\xff\xff\x0c\x00\x0d\x00\xff\xff\x0f\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x16\x00\x17\x00\x18\x00\xff\xff\x1a\x00\x1b\x00\xff\xff\x1d\x00\x06\x00\xff\xff\xff\xff\x21\x00\x22\x00\xff\xff\x0c\x00\x0d\x00\xff\xff\x0f\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x16\x00\x17\x00\x18\x00\xff\xff\x1a\x00\x1b\x00\xff\xff\x1d\x00\x06\x00\xff\xff\xff\xff\x21\x00\x22\x00\xff\xff\x0c\x00\x0d\x00\xff\xff\x0f\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x16\x00\x17\x00\x18\x00\xff\xff\x1a\x00\x1b\x00\xff\xff\x1d\x00\x06\x00\xff\xff\xff\xff\x21\x00\x22\x00\xff\xff\x0c\x00\x0d\x00\xff\xff\x0f\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x16\x00\x17\x00\x18\x00\xff\xff\x1a\x00\x1b\x00\xff\xff\x1d\x00\x06\x00\xff\xff\xff\xff\x21\x00\x22\x00\xff\xff\x0c\x00\x0d\x00\xff\xff\x0f\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x16\x00\x17\x00\x18\x00\xff\xff\x1a\x00\x1b\x00\xff\xff\x1d\x00\x06\x00\xff\xff\xff\xff\x21\x00\x22\x00\xff\xff\x0c\x00\x0d\x00\xff\xff\x0f\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x16\x00\x17\x00\x18\x00\xff\xff\x1a\x00\x1b\x00\xff\xff\x1d\x00\x06\x00\xff\xff\xff\xff\x21\x00\x22\x00\xff\xff\x0c\x00\x0d\x00\xff\xff\x0f\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x16\x00\x17\x00\x18\x00\xff\xff\x1a\x00\x1b\x00\xff\xff\x1d\x00\x06\x00\xff\xff\xff\xff\x21\x00\x22\x00\xff\xff\x0c\x00\x0d\x00\xff\xff\x0f\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x16\x00\x17\x00\x18\x00\xff\xff\x1a\x00\x1b\x00\xff\xff\x1d\x00\x06\x00\xff\xff\xff\xff\x21\x00\x22\x00\xff\xff\x0c\x00\x0d\x00\xff\xff\x0f\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x16\x00\x17\x00\x18\x00\xff\xff\x1a\x00\x1b\x00\xff\xff\x1d\x00\x06\x00\xff\xff\xff\xff\x21\x00\x22\x00\xff\xff\x0c\x00\x0d\x00\xff\xff\x0f\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x16\x00\x17\x00\x18\x00\xff\xff\x1a\x00\x1b\x00\xff\xff\x1d\x00\x06\x00\xff\xff\xff\xff\x21\x00\x22\x00\xff\xff\x0c\x00\x0d\x00\xff\xff\x0f\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x16\x00\x17\x00\x18\x00\xff\xff\x1a\x00\x1b\x00\xff\xff\x1d\x00\x06\x00\xff\xff\xff\xff\x21\x00\x22\x00\xff\xff\x0c\x00\x0d\x00\xff\xff\x0f\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x16\x00\x17\x00\x18\x00\xff\xff\x1a\x00\x1b\x00\xff\xff\x1d\x00\x06\x00\xff\xff\xff\xff\x21\x00\x22\x00\xff\xff\x0c\x00\x0d\x00\xff\xff\x0f\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x16\x00\x17\x00\x18\x00\xff\xff\x1a\x00\x1b\x00\xff\xff\x1d\x00\x06\x00\xff\xff\xff\xff\x21\x00\x22\x00\xff\xff\x0c\x00\x0d\x00\xff\xff\x0f\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x16\x00\x17\x00\x18\x00\xff\xff\x1a\x00\x1b\x00\xff\xff\x1d\x00\x06\x00\xff\xff\xff\xff\x21\x00\x22\x00\xff\xff\x0c\x00\x0d\x00\xff\xff\x0f\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x16\x00\x17\x00\x18\x00\xff\xff\x1a\x00\x1b\x00\xff\xff\x1d\x00\x06\x00\xff\xff\xff\xff\x21\x00\x22\x00\xff\xff\x0c\x00\x0d\x00\xff\xff\x0f\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x16\x00\x17\x00\x18\x00\xff\xff\x1a\x00\x1b\x00\xff\xff\x1d\x00\x06\x00\xff\xff\xff\xff\x21\x00\x22\x00\xff\xff\x0c\x00\x0d\x00\xff\xff\x0f\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x16\x00\x17\x00\x18\x00\xff\xff\x1a\x00\x1b\x00\xff\xff\x1d\x00\x06\x00\xff\xff\xff\xff\x21\x00\x22\x00\xff\xff\x0c\x00\x0d\x00\xff\xff\x0f\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x16\x00\x17\x00\x18\x00\xff\xff\x1a\x00\x1b\x00\xff\xff\x1d\x00\x06\x00\xff\xff\xff\xff\x21\x00\x22\x00\xff\xff\x0c\x00\x0d\x00\xff\xff\x0f\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x16\x00\x17\x00\x18\x00\xff\xff\x1a\x00\x1b\x00\xff\xff\x1d\x00\x06\x00\xff\xff\xff\xff\x21\x00\x22\x00\xff\xff\x0c\x00\x0d\x00\xff\xff\x0f\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x16\x00\x17\x00\x18\x00\xff\xff\x1a\x00\x1b\x00\xff\xff\x1d\x00\x06\x00\xff\xff\xff\xff\x21\x00\x22\x00\xff\xff\x0c\x00\x0d\x00\xff\xff\x0f\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x16\x00\x17\x00\x18\x00\xff\xff\x1a\x00\x1b\x00\xff\xff\x1d\x00\x06\x00\xff\xff\xff\xff\x21\x00\x22\x00\xff\xff\x0c\x00\x0d\x00\xff\xff\x0f\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x16\x00\x17\x00\x18\x00\xff\xff\x1a\x00\x1b\x00\xff\xff\x1d\x00\x06\x00\xff\xff\xff\xff\x21\x00\x22\x00\xff\xff\x0c\x00\x0d\x00\xff\xff\x0f\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x16\x00\x17\x00\x18\x00\xff\xff\x1a\x00\x1b\x00\xff\xff\x1d\x00\x06\x00\xff\xff\xff\xff\x21\x00\x22\x00\xff\xff\x0c\x00\x0d\x00\xff\xff\x0f\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x16\x00\x17\x00\x18\x00\xff\xff\x1a\x00\x1b\x00\xff\xff\x1d\x00\x06\x00\xff\xff\xff\xff\x21\x00\x22\x00\xff\xff\x0c\x00\x0d\x00\xff\xff\x0f\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x16\x00\x17\x00\x18\x00\xff\xff\x1a\x00\x1b\x00\xff\xff\x1d\x00\x06\x00\xff\xff\xff\xff\x21\x00\x22\x00\xff\xff\x0c\x00\x0d\x00\xff\xff\x0f\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x16\x00\x17\x00\x18\x00\xff\xff\x1a\x00\x1b\x00\xff\xff\x1d\x00\x06\x00\xff\xff\xff\xff\x21\x00\x22\x00\xff\xff\x0c\x00\x0d\x00\xff\xff\x0f\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x16\x00\x17\x00\x18\x00\xff\xff\x1a\x00\x1b\x00\xff\xff\x1d\x00\x06\x00\xff\xff\xff\xff\x21\x00\x22\x00\xff\xff\x0c\x00\x0d\x00\xff\xff\x0f\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x16\x00\x17\x00\x18\x00\xff\xff\x1a\x00\x1b\x00\xff\xff\x1d\x00\x06\x00\xff\xff\xff\xff\x21\x00\x22\x00\xff\xff\x0c\x00\x0d\x00\xff\xff\x0f\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x16\x00\x17\x00\x18\x00\xff\xff\x1a\x00\x1b\x00\xff\xff\x1d\x00\x06\x00\xff\xff\xff\xff\x21\x00\x22\x00\xff\xff\x0c\x00\x0d\x00\xff\xff\x0f\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x16\x00\x17\x00\x18\x00\xff\xff\x1a\x00\x1b\x00\xff\xff\x1d\x00\x06\x00\xff\xff\xff\xff\x21\x00\x22\x00\xff\xff\x0c\x00\x0d\x00\xff\xff\x0f\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x16\x00\x17\x00\x18\x00\xff\xff\x1a\x00\x1b\x00\xff\xff\x1d\x00\x06\x00\xff\xff\xff\xff\x21\x00\x22\x00\xff\xff\x0c\x00\x0d\x00\xff\xff\x0f\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x16\x00\x17\x00\x18\x00\xff\xff\x1a\x00\x1b\x00\xff\xff\x1d\x00\x06\x00\xff\xff\xff\xff\x21\x00\x22\x00\xff\xff\x0c\x00\x0d\x00\xff\xff\x0f\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x16\x00\x17\x00\x18\x00\xff\xff\x1a\x00\x1b\x00\xff\xff\x1d\x00\x06\x00\xff\xff\xff\xff\x21\x00\x22\x00\xff\xff\x0c\x00\x0d\x00\xff\xff\x0f\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x16\x00\x17\x00\x18\x00\xff\xff\x1a\x00\x1b\x00\xff\xff\x1d\x00\x06\x00\xff\xff\xff\xff\x21\x00\x22\x00\xff\xff\x0c\x00\x0d\x00\xff\xff\x0f\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x16\x00\x17\x00\x18\x00\xff\xff\x1a\x00\x1b\x00\xff\xff\x1d\x00\x06\x00\xff\xff\xff\xff\x21\x00\x22\x00\xff\xff\x0c\x00\x0d\x00\xff\xff\x0f\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x16\x00\x17\x00\x18\x00\xff\xff\x1a\x00\x1b\x00\xff\xff\x1d\x00\x06\x00\xff\xff\xff\xff\x21\x00\x22\x00\xff\xff\x0c\x00\x0d\x00\xff\xff\x0f\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x16\x00\x17\x00\x18\x00\xff\xff\x1a\x00\x1b\x00\xff\xff\x1d\x00\x06\x00\xff\xff\xff\xff\x21\x00\x22\x00\xff\xff\x0c\x00\x0d\x00\xff\xff\x0f\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x16\x00\x17\x00\x18\x00\xff\xff\x1a\x00\x1b\x00\xff\xff\x1d\x00\x06\x00\xff\xff\xff\xff\x21\x00\x22\x00\xff\xff\x0c\x00\x0d\x00\xff\xff\x0f\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x16\x00\x17\x00\x18\x00\xff\xff\x1a\x00\x1b\x00\xff\xff\x1d\x00\x06\x00\xff\xff\xff\xff\x21\x00\x22\x00\xff\xff\x0c\x00\x0d\x00\xff\xff\x0f\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x16\x00\x17\x00\x18\x00\xff\xff\x1a\x00\x1b\x00\xff\xff\x1d\x00\x06\x00\xff\xff\xff\xff\x21\x00\x22\x00\xff\xff\x0c\x00\x0d\x00\xff\xff\x0f\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x16\x00\x17\x00\x18\x00\xff\xff\x1a\x00\x1b\x00\xff\xff\x1d\x00\x06\x00\xff\xff\xff\xff\x21\x00\x22\x00\xff\xff\x0c\x00\x0d\x00\xff\xff\x0f\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x16\x00\x17\x00\x18\x00\xff\xff\x1a\x00\x1b\x00\xff\xff\x1d\x00\x06\x00\xff\xff\xff\xff\x21\x00\x22\x00\xff\xff\x0c\x00\x0d\x00\xff\xff\x0f\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x16\x00\x17\x00\x18\x00\xff\xff\x1a\x00\x1b\x00\xff\xff\x1d\x00\x06\x00\xff\xff\xff\xff\x21\x00\x22\x00\xff\xff\x0c\x00\x0d\x00\xff\xff\x0f\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x16\x00\x17\x00\x18\x00\xff\xff\x1a\x00\x1b\x00\xff\xff\x1d\x00\x06\x00\xff\xff\xff\xff\x21\x00\x22\x00\xff\xff\x0c\x00\x0d\x00\xff\xff\x0f\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x16\x00\x17\x00\x18\x00\xff\xff\x1a\x00\x1b\x00\xff\xff\x1d\x00\x06\x00\xff\xff\xff\xff\x21\x00\x22\x00\xff\xff\x0c\x00\x0d\x00\xff\xff\x0f\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x16\x00\x17\x00\x18\x00\xff\xff\x1a\x00\x1b\x00\xff\xff\x1d\x00\x06\x00\xff\xff\xff\xff\x21\x00\x22\x00\xff\xff\x0c\x00\x0d\x00\xff\xff\x0f\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x16\x00\x17\x00\x18\x00\xff\xff\x1a\x00\x1b\x00\xff\xff\x1d\x00\x06\x00\xff\xff\xff\xff\x21\x00\x22\x00\xff\xff\x0c\x00\x0d\x00\xff\xff\x0f\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x16\x00\x17\x00\x18\x00\xff\xff\x1a\x00\x1b\x00\xff\xff\x1d\x00\xff\xff\xff\xff\xff\xff\x21\x00\x22\x00\x0d\x00\x0e\x00\x0f\x00\x10\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x19\x00\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x1f\x00\x20\x00\x21\x00\x22\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\x28\x00\x0d\x00\x0e\x00\x0f\x00\x10\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x19\x00\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x1f\x00\x20\x00\x21\x00\x22\x00\x23\x00\x24\x00\x25\x00\x0d\x00\x0e\x00\x0f\x00\x10\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x19\x00\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x1f\x00\x20\x00\x21\x00\x22\x00\x23\x00\xff\xff\x25\x00\x0d\x00\x0e\x00\x0f\x00\x10\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x19\x00\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x1f\x00\x20\x00\x21\x00\x22\x00\xff\xff\xff\xff\x25\x00\x0e\x00\x0f\x00\x10\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x19\x00\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x1f\x00\x20\x00\x21\x00\x22\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff"#++happyTable :: HappyAddr+happyTable = HappyA# "\x00\x00\x11\x00\x12\x00\x13\x00\xb4\x00\x65\x01\x70\x01\x0c\x01\x14\x00\x74\x01\x15\x00\x66\x01\x19\x01\x16\x00\x17\x00\x18\x00\x15\x00\x57\x00\x19\x00\x43\x00\xef\x00\x19\x00\xe7\x00\x46\x00\xe8\x00\xca\x00\x20\x01\x42\x00\x45\x00\x43\x00\x46\x00\x21\x01\xab\x00\x22\x01\xcb\x00\x59\x00\x1a\x00\xef\x00\xb2\x00\xbb\x00\x1b\x00\x1c\x00\x75\x01\x19\x00\x1d\x01\xba\x00\x1e\x01\xbb\x00\xac\x00\xad\x00\x0d\x01\x1d\x00\x1e\x00\xcd\x00\x36\x00\xb5\x00\x1f\x00\x14\x00\x20\x00\x21\x00\x22\x00\x89\x01\xce\x00\x36\x00\x18\x00\x23\x00\x5a\x00\x36\x00\x24\x00\x25\x00\x26\x00\x36\x00\x14\x00\xac\x00\xad\x00\xae\x00\x80\x00\x36\x00\x36\x00\x18\x00\xbb\x00\x8b\x01\x27\x00\x28\x00\x71\x01\x0e\x01\x29\x00\x2a\x00\x0f\x01\x2b\x00\x2c\x00\x2d\x00\x11\x00\x12\x00\x13\x00\x23\x01\x14\x00\x2d\x00\x58\x00\x14\x00\x84\x00\x15\x00\x81\x00\x18\x00\x16\x00\x17\x00\x18\x00\x20\x00\x1f\x01\x68\x01\xaf\x00\x82\x01\x19\x00\xb0\x00\x23\x00\x66\x01\xbc\x00\xbb\x00\x30\x01\x5c\x01\x03\x01\x04\x01\x20\x00\x81\x01\x29\x01\x83\x01\xb6\x00\x1a\x00\x05\x01\x23\x00\x38\x01\x1b\x00\x1c\x00\x3a\x01\x08\x01\xbc\x00\x2a\x00\xb7\x00\xbd\x00\x31\x01\x62\x01\xbf\x00\x1d\x00\x1e\x00\x2d\x01\x63\x01\x20\x00\x1f\x00\x6d\x01\x20\x00\x62\x01\x2a\x00\xbb\x00\x23\x00\xb6\x00\x66\x01\x23\x00\xbb\x00\x36\x00\x24\x00\x25\x00\x26\x00\xc0\x00\xbb\x00\x78\x01\xb8\x00\xbb\x00\xbb\x00\xbb\x00\x15\x01\x16\x01\x7a\x01\x0c\x00\x27\x00\x46\x00\x2a\x00\x36\x00\x29\x00\x2a\x00\xa4\x00\x2b\x00\x2c\x00\x2d\x00\x11\x00\x12\x00\x13\x00\x4a\x01\x2d\x00\x02\x00\x03\x00\x14\x00\x52\x00\x15\x00\x04\x00\x48\x00\x16\x00\x17\x00\x18\x00\xa5\x00\x05\x00\x06\x00\x04\x00\x07\x00\x19\x00\x48\x00\x47\x01\x0c\x00\x05\x00\x49\x00\x08\x00\x09\x00\x0a\x00\x46\x00\x0b\x00\x0c\x00\x38\x00\x0d\x00\x47\x00\x1a\x00\x56\x01\x0e\x00\x0f\x00\x1b\x00\x1c\x00\x39\x00\x3a\x00\x3b\x00\x5e\x01\x59\x01\x0f\x00\x04\x00\x5c\x00\x5d\x00\x1d\x00\x1e\x00\x3c\x00\x05\x00\x5e\x00\x1f\x00\x48\x00\x20\x00\x3b\x01\xe2\x00\x53\x00\x58\x01\x3d\x00\xe3\x00\x23\x00\x3e\x00\x48\x00\x24\x00\x25\x00\x26\x00\x54\x00\x3e\x01\xe2\x00\x26\x01\x2b\x01\x0f\x00\xe3\x00\xe1\x00\xe2\x00\x5a\x01\x11\x01\x27\x00\xe3\x00\x7c\x01\x13\x01\x29\x00\x2a\x00\x2e\x01\x2b\x00\x2c\x00\x2d\x00\x11\x00\x12\x00\x13\x00\x54\x01\x0c\x00\x02\x00\x03\x00\x14\x00\xed\x00\x15\x00\x04\x00\x06\x01\x16\x00\x17\x00\x18\x00\x04\x00\x05\x00\x06\x00\x04\x00\x07\x00\x19\x00\x05\x00\x3d\x00\x43\x01\x05\x00\x3e\x00\x08\x00\x09\x00\x0a\x00\x45\x01\x0b\x00\x0c\x00\xf7\x00\x0d\x00\xfa\x00\x1a\x00\xf8\x00\x0e\x00\x0f\x00\x1b\x00\x1c\x00\x00\x01\x2d\x01\x0f\x00\x06\x01\x01\x01\x0f\x00\x04\x00\x32\x01\x0c\x00\x1d\x00\x1e\x00\x08\x01\x05\x00\x40\x00\x1f\x00\x43\x00\x20\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x23\x00\xdd\x00\x0c\x00\x24\x00\x25\x00\x26\x00\xa8\x00\x0a\x00\xa9\x00\x11\x01\x3f\x00\x0f\x00\x7d\x01\x13\x01\x0a\x01\x0a\x00\xa6\x00\x27\x00\xc3\x00\xb9\x00\xc8\x00\x29\x00\x2a\x00\xc6\x00\x2b\x00\x2c\x00\x2d\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\x32\x01\x11\x01\xb1\x00\xb2\x00\x76\x01\x13\x01\xce\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\x7b\x00\x2b\x01\xcf\x00\x7c\x00\x7d\x00\xd1\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xd0\x00\x7b\x00\xd2\x00\xdf\x00\x7c\x00\x7d\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xda\x00\x7b\x00\xd3\x00\x0c\x00\x7c\x00\x7d\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\x36\x00\x7b\x00\x34\x00\x55\x00\x7c\x00\x7d\x00\x8f\x01\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\x7b\x00\x04\x00\x40\x00\x7c\x00\x7d\x00\x45\x01\x8b\x01\x05\x00\x4e\x00\x50\x01\x07\x00\x11\x01\x43\x00\x4b\x00\x48\x01\x13\x01\x5a\x00\x08\x00\x09\x00\x0a\x00\x8d\x01\x0b\x00\x0c\x00\x11\x01\x0d\x00\x85\x01\x4b\x01\x13\x01\x0e\x00\x0f\x00\x11\x01\x86\x01\x89\x01\x4c\x01\x13\x01\x7b\x00\x7a\x01\xb4\x00\x7c\x00\x7d\x00\x87\x01\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\x88\x01\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\x11\x01\x81\x00\x36\x00\x3a\x01\x13\x01\x04\x00\x7b\x00\x69\x01\x6a\x01\x7c\x00\x7d\x00\x05\x00\x06\x00\x11\x01\x07\x00\x11\x01\x3d\x01\x13\x01\x12\x01\x13\x01\x6b\x01\x08\x00\x09\x00\x0a\x00\x6c\x01\x0b\x00\x0c\x00\x11\x01\x0d\x00\xb4\x00\x16\x01\x13\x01\x0e\x00\x0f\x00\x6f\x01\x7b\x00\x72\x01\x76\x01\x7c\x00\x7d\x00\xdd\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xf3\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\x11\x01\x7a\x01\x78\x01\x17\x01\x13\x01\x04\x00\x7b\x00\x4a\x01\x2a\x00\x7c\x00\x7d\x00\x05\x00\x4e\x00\x51\x01\x07\x00\x4e\x01\x62\x00\x63\x00\x64\x00\x65\x00\x4f\x01\x08\x00\x09\x00\x0a\x00\x50\x01\x0b\x00\x0c\x00\x2a\x00\x0d\x00\xb4\x00\x5d\x01\x5e\x01\x0e\x00\x0f\x00\x62\x01\x7b\x00\x1b\x01\x36\x00\x7c\x00\x7d\x00\xf6\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\x1c\x01\x2a\x01\x34\x01\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\x35\x01\x36\x01\x37\x01\x39\x01\x7b\x00\x04\x00\xb5\x00\x7c\x00\x7d\x00\x60\x01\x61\x01\x05\x00\x24\x01\x2a\x00\x07\x00\x40\x01\x41\x01\x43\x01\x42\x01\x25\x01\x45\x01\x08\x00\x09\x00\x0a\x00\x2a\x00\x0b\x00\x0c\x00\x47\x01\x0d\x00\xca\x00\xe5\x00\xe6\x00\x0e\x00\x0f\x00\xe9\x00\x7b\x00\xea\x00\xeb\x00\x7c\x00\x7d\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xec\x00\xed\x00\xf2\x00\xf5\x00\xd7\x00\x2a\x00\x36\x00\x7b\x00\xfc\x00\x04\x00\x7c\x00\x7d\x00\x2a\x00\xb5\x00\x10\x01\x05\x00\x4e\x00\x27\x01\x07\x00\x36\x00\x11\x01\xb6\x00\xc1\x00\x1a\x01\x85\x00\x08\x00\x09\x00\x0a\x00\x86\x00\x0b\x00\x0c\x00\x87\x00\x0d\x00\x2a\x00\xd9\x00\x7b\x00\x0e\x00\x0f\x00\x7c\x00\x7d\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xa8\x00\x36\x00\xb6\x00\xc1\x00\x36\x00\xc5\x00\x04\x00\x7b\x00\xc2\x00\x36\x00\x7c\x00\x7d\x00\x05\x00\x4e\x00\xf0\x00\x07\x00\xc8\x00\x2a\x00\xd6\x00\xcc\x00\x36\x00\xd5\x00\x08\x00\x09\x00\x0a\x00\x36\x00\x0b\x00\x0c\x00\xff\xff\x0d\x00\x2f\x00\x31\x00\x30\x00\x0e\x00\x0f\x00\x00\x00\x36\x00\x33\x00\x00\x00\x00\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\x04\x00\x3f\x00\x2a\x00\x36\x00\x2a\x00\x7e\x00\x05\x00\x4e\x00\xf3\x00\x07\x00\x7f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\x4e\x00\x09\x01\x07\x00\x00\x00\x7b\x00\x00\x00\x00\x00\x7c\x00\x7d\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\x4e\x00\x82\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\x4e\x00\xb0\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\x4e\x00\x4f\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\x4e\x00\x50\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\x8f\x01\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\x8d\x01\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\x7b\x01\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\x7e\x01\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\x7f\x01\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\x80\x01\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\x6c\x01\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\x72\x01\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\x52\x01\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\x53\x01\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\x55\x01\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\x57\x01\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\x23\x01\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\x3c\x01\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\xdf\x00\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\xe0\x00\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\xf6\x00\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\xf9\x00\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\xfc\x00\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\xfd\x00\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\xfe\x00\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\xff\x00\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\x05\x01\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\x87\x00\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\x88\x00\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\x89\x00\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\x8a\x00\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\x8b\x00\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\x8c\x00\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\x8d\x00\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\x8e\x00\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\x8f\x00\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\x90\x00\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\x91\x00\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\x92\x00\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\x93\x00\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\x94\x00\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\x95\x00\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\x96\x00\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\x97\x00\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\x98\x00\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\x99\x00\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\x9a\x00\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\x9b\x00\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\x9c\x00\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\x9d\x00\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\x9e\x00\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\x9f\x00\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\xa0\x00\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\xa1\x00\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\xa2\x00\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\xa3\x00\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\xc2\x00\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\xc5\x00\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\xd7\x00\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\xd9\x00\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\xdb\x00\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\x31\x00\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\x33\x00\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\x4a\x00\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\x4c\x00\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\x4d\x00\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x04\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x00\x00\x05\x00\x52\x00\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x00\x00\x0d\x00\x00\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x00\x00\x77\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x00\x00\x00\x00\x00\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"#++happyReduceArr = array (1, 174) [+	(1 , happyReduce_1),+	(2 , happyReduce_2),+	(3 , happyReduce_3),+	(4 , happyReduce_4),+	(5 , happyReduce_5),+	(6 , happyReduce_6),+	(7 , happyReduce_7),+	(8 , happyReduce_8),+	(9 , happyReduce_9),+	(10 , happyReduce_10),+	(11 , happyReduce_11),+	(12 , happyReduce_12),+	(13 , happyReduce_13),+	(14 , happyReduce_14),+	(15 , happyReduce_15),+	(16 , happyReduce_16),+	(17 , happyReduce_17),+	(18 , happyReduce_18),+	(19 , happyReduce_19),+	(20 , happyReduce_20),+	(21 , happyReduce_21),+	(22 , happyReduce_22),+	(23 , happyReduce_23),+	(24 , happyReduce_24),+	(25 , happyReduce_25),+	(26 , happyReduce_26),+	(27 , happyReduce_27),+	(28 , happyReduce_28),+	(29 , happyReduce_29),+	(30 , happyReduce_30),+	(31 , happyReduce_31),+	(32 , happyReduce_32),+	(33 , happyReduce_33),+	(34 , happyReduce_34),+	(35 , happyReduce_35),+	(36 , happyReduce_36),+	(37 , happyReduce_37),+	(38 , happyReduce_38),+	(39 , happyReduce_39),+	(40 , happyReduce_40),+	(41 , happyReduce_41),+	(42 , happyReduce_42),+	(43 , happyReduce_43),+	(44 , happyReduce_44),+	(45 , happyReduce_45),+	(46 , happyReduce_46),+	(47 , happyReduce_47),+	(48 , happyReduce_48),+	(49 , happyReduce_49),+	(50 , happyReduce_50),+	(51 , happyReduce_51),+	(52 , happyReduce_52),+	(53 , happyReduce_53),+	(54 , happyReduce_54),+	(55 , happyReduce_55),+	(56 , happyReduce_56),+	(57 , happyReduce_57),+	(58 , happyReduce_58),+	(59 , happyReduce_59),+	(60 , happyReduce_60),+	(61 , happyReduce_61),+	(62 , happyReduce_62),+	(63 , happyReduce_63),+	(64 , happyReduce_64),+	(65 , happyReduce_65),+	(66 , happyReduce_66),+	(67 , happyReduce_67),+	(68 , happyReduce_68),+	(69 , happyReduce_69),+	(70 , happyReduce_70),+	(71 , happyReduce_71),+	(72 , happyReduce_72),+	(73 , happyReduce_73),+	(74 , happyReduce_74),+	(75 , happyReduce_75),+	(76 , happyReduce_76),+	(77 , happyReduce_77),+	(78 , happyReduce_78),+	(79 , happyReduce_79),+	(80 , happyReduce_80),+	(81 , happyReduce_81),+	(82 , happyReduce_82),+	(83 , happyReduce_83),+	(84 , happyReduce_84),+	(85 , happyReduce_85),+	(86 , happyReduce_86),+	(87 , happyReduce_87),+	(88 , happyReduce_88),+	(89 , happyReduce_89),+	(90 , happyReduce_90),+	(91 , happyReduce_91),+	(92 , happyReduce_92),+	(93 , happyReduce_93),+	(94 , happyReduce_94),+	(95 , happyReduce_95),+	(96 , happyReduce_96),+	(97 , happyReduce_97),+	(98 , happyReduce_98),+	(99 , happyReduce_99),+	(100 , happyReduce_100),+	(101 , happyReduce_101),+	(102 , happyReduce_102),+	(103 , happyReduce_103),+	(104 , happyReduce_104),+	(105 , happyReduce_105),+	(106 , happyReduce_106),+	(107 , happyReduce_107),+	(108 , happyReduce_108),+	(109 , happyReduce_109),+	(110 , happyReduce_110),+	(111 , happyReduce_111),+	(112 , happyReduce_112),+	(113 , happyReduce_113),+	(114 , happyReduce_114),+	(115 , happyReduce_115),+	(116 , happyReduce_116),+	(117 , happyReduce_117),+	(118 , happyReduce_118),+	(119 , happyReduce_119),+	(120 , happyReduce_120),+	(121 , happyReduce_121),+	(122 , happyReduce_122),+	(123 , happyReduce_123),+	(124 , happyReduce_124),+	(125 , happyReduce_125),+	(126 , happyReduce_126),+	(127 , happyReduce_127),+	(128 , happyReduce_128),+	(129 , happyReduce_129),+	(130 , happyReduce_130),+	(131 , happyReduce_131),+	(132 , happyReduce_132),+	(133 , happyReduce_133),+	(134 , happyReduce_134),+	(135 , happyReduce_135),+	(136 , happyReduce_136),+	(137 , happyReduce_137),+	(138 , happyReduce_138),+	(139 , happyReduce_139),+	(140 , happyReduce_140),+	(141 , happyReduce_141),+	(142 , happyReduce_142),+	(143 , happyReduce_143),+	(144 , happyReduce_144),+	(145 , happyReduce_145),+	(146 , happyReduce_146),+	(147 , happyReduce_147),+	(148 , happyReduce_148),+	(149 , happyReduce_149),+	(150 , happyReduce_150),+	(151 , happyReduce_151),+	(152 , happyReduce_152),+	(153 , happyReduce_153),+	(154 , happyReduce_154),+	(155 , happyReduce_155),+	(156 , happyReduce_156),+	(157 , happyReduce_157),+	(158 , happyReduce_158),+	(159 , happyReduce_159),+	(160 , happyReduce_160),+	(161 , happyReduce_161),+	(162 , happyReduce_162),+	(163 , happyReduce_163),+	(164 , happyReduce_164),+	(165 , happyReduce_165),+	(166 , happyReduce_166),+	(167 , happyReduce_167),+	(168 , happyReduce_168),+	(169 , happyReduce_169),+	(170 , happyReduce_170),+	(171 , happyReduce_171),+	(172 , happyReduce_172),+	(173 , happyReduce_173),+	(174 , happyReduce_174)+	]++happy_n_terms = 95 :: Int+happy_n_nonterms = 36 :: Int++happyReduce_1 = happySpecReduce_2  0# happyReduction_1+happyReduction_1 happy_x_2+	happy_x_1+	 =  case happyOut5 happy_x_1 of { happy_var_1 -> +	happyIn4+		 (happy_var_1+	)}++happyReduce_2 = happySpecReduce_1  1# happyReduction_2+happyReduction_2 happy_x_1+	 =  case happyOut6 happy_x_1 of { happy_var_1 -> +	happyIn5+		 ([happy_var_1]+	)}++happyReduce_3 = happySpecReduce_2  1# happyReduction_3+happyReduction_3 happy_x_2+	happy_x_1+	 =  case happyOut6 happy_x_1 of { happy_var_1 -> +	happyIn5+		 ([happy_var_1]+	)}++happyReduce_4 = happySpecReduce_3  1# happyReduction_4+happyReduction_4 happy_x_3+	happy_x_2+	happy_x_1+	 =  case happyOut5 happy_x_1 of { happy_var_1 -> +	case happyOut6 happy_x_3 of { happy_var_3 -> +	happyIn5+		 (happy_var_1++[happy_var_3]+	)}}++happyReduce_5 = happyReduce 4# 1# happyReduction_5+happyReduction_5 (happy_x_4 `HappyStk`+	happy_x_3 `HappyStk`+	happy_x_2 `HappyStk`+	happy_x_1 `HappyStk`+	happyRest)+	 = case happyOut5 happy_x_1 of { happy_var_1 -> +	case happyOut6 happy_x_3 of { happy_var_3 -> +	happyIn5+		 (happy_var_1++[happy_var_3]+	) `HappyStk` happyRest}}++happyReduce_6 = happySpecReduce_1  2# happyReduction_6+happyReduction_6 happy_x_1+	 =  case happyOut17 happy_x_1 of { happy_var_1 -> +	happyIn6+		 (happy_var_1+	)}++happyReduce_7 = happyReduce 5# 2# happyReduction_7+happyReduction_7 (happy_x_5 `HappyStk`+	happy_x_4 `HappyStk`+	happy_x_3 `HappyStk`+	happy_x_2 `HappyStk`+	happy_x_1 `HappyStk`+	happyRest)+	 = case happyOut16 happy_x_3 of { happy_var_3 -> +	case happyOut17 happy_x_5 of { happy_var_5 -> +	happyIn6+		 (Ast "variable" [happy_var_3,Avar "any",happy_var_5]+	) `HappyStk` happyRest}}++happyReduce_8 = happyReduce 7# 2# happyReduction_8+happyReduction_8 (happy_x_7 `HappyStk`+	happy_x_6 `HappyStk`+	happy_x_5 `HappyStk`+	happy_x_4 `HappyStk`+	happy_x_3 `HappyStk`+	happy_x_2 `HappyStk`+	happy_x_1 `HappyStk`+	happyRest)+	 = case happyOut16 happy_x_3 of { happy_var_3 -> +	case happyOut13 happy_x_5 of { happy_var_5 -> +	case happyOut17 happy_x_7 of { happy_var_7 -> +	happyIn6+		 (Ast "variable" [happy_var_3,happy_var_5,happy_var_7]+	) `HappyStk` happyRest}}}++happyReduce_9 = happyReduce 9# 2# happyReduction_9+happyReduction_9 (happy_x_9 `HappyStk`+	happy_x_8 `HappyStk`+	happy_x_7 `HappyStk`+	happy_x_6 `HappyStk`+	happy_x_5 `HappyStk`+	happy_x_4 `HappyStk`+	happy_x_3 `HappyStk`+	happy_x_2 `HappyStk`+	happy_x_1 `HappyStk`+	happyRest)+	 = case happyOut10 happy_x_3 of { happy_var_3 -> +	case happyOut11 happy_x_5 of { happy_var_5 -> +	case happyOut17 happy_x_8 of { happy_var_8 -> +	happyIn6+		 (if (null happy_var_5)+                                                          then parseError [TError ("Nullary functions are not supported: "++happy_var_3)]+                                                          else Ast "function" ([Avar happy_var_3,happy_var_8,Avar "any"]++mkPairs happy_var_5)+	) `HappyStk` happyRest}}}++happyReduce_10 = happyReduce 11# 2# happyReduction_10+happyReduction_10 (happy_x_11 `HappyStk`+	happy_x_10 `HappyStk`+	happy_x_9 `HappyStk`+	happy_x_8 `HappyStk`+	happy_x_7 `HappyStk`+	happy_x_6 `HappyStk`+	happy_x_5 `HappyStk`+	happy_x_4 `HappyStk`+	happy_x_3 `HappyStk`+	happy_x_2 `HappyStk`+	happy_x_1 `HappyStk`+	happyRest)+	 = case happyOut10 happy_x_3 of { happy_var_3 -> +	case happyOut11 happy_x_5 of { happy_var_5 -> +	case happyOut13 happy_x_8 of { happy_var_8 -> +	case happyOut17 happy_x_10 of { happy_var_10 -> +	happyIn6+		 (if (null happy_var_5)+                                                          then parseError [TError ("Nullary functions are not supported: "++happy_var_3)]+                                                          else Ast "function" ([Avar happy_var_3,happy_var_10,happy_var_8]++mkPairs happy_var_5)+	) `HappyStk` happyRest}}}}++happyReduce_11 = happyReduce 9# 2# happyReduction_11+happyReduction_11 (happy_x_9 `HappyStk`+	happy_x_8 `HappyStk`+	happy_x_7 `HappyStk`+	happy_x_6 `HappyStk`+	happy_x_5 `HappyStk`+	happy_x_4 `HappyStk`+	happy_x_3 `HappyStk`+	happy_x_2 `HappyStk`+	happy_x_1 `HappyStk`+	happyRest)+	 = case happyOut10 happy_x_3 of { happy_var_3 -> +	case happyOut11 happy_x_5 of { happy_var_5 -> +	case happyOut17 happy_x_8 of { happy_var_8 -> +	happyIn6+		 (if (null happy_var_5)+                                                          then parseError [TError ("Nullary views are not supported: "++happy_var_3)]+                                                          else Ast "view" ([Avar happy_var_3,happy_var_8]++map fst happy_var_5)+	) `HappyStk` happyRest}}}++happyReduce_12 = happyReduce 7# 2# happyReduction_12+happyReduction_12 (happy_x_7 `HappyStk`+	happy_x_6 `HappyStk`+	happy_x_5 `HappyStk`+	happy_x_4 `HappyStk`+	happy_x_3 `HappyStk`+	happy_x_2 `HappyStk`+	happy_x_1 `HappyStk`+	happyRest)+	 = case happyOut10 happy_x_2 of { happy_var_2 -> +	case happyOut11 happy_x_4 of { happy_var_4 -> +	case happyOut13 happy_x_7 of { happy_var_7 -> +	happyIn6+		 (Ast "signature" ([Avar happy_var_2,happy_var_7]++map snd happy_var_4)+	) `HappyStk` happyRest}}}++happyReduce_13 = happyReduce 6# 2# happyReduction_13+happyReduction_13 (happy_x_6 `HappyStk`+	happy_x_5 `HappyStk`+	happy_x_4 `HappyStk`+	happy_x_3 `HappyStk`+	happy_x_2 `HappyStk`+	happy_x_1 `HappyStk`+	happyRest)+	 = case happyOut10 happy_x_3 of { happy_var_3 -> +	case happyOut13 happy_x_6 of { happy_var_6 -> +	happyIn6+		 (Ast "element" [Avar happy_var_3,happy_var_6]+	) `HappyStk` happyRest}}++happyReduce_14 = happyReduce 5# 2# happyReduction_14+happyReduction_14 (happy_x_5 `HappyStk`+	happy_x_4 `HappyStk`+	happy_x_3 `HappyStk`+	happy_x_2 `HappyStk`+	happy_x_1 `HappyStk`+	happyRest)+	 = case happyOut10 happy_x_3 of { happy_var_3 -> +	case happyOut13 happy_x_5 of { happy_var_5 -> +	happyIn6+		 (Ast "type" [Avar happy_var_3,happy_var_5]+	) `HappyStk` happyRest}}++happyReduce_15 = happyReduce 5# 2# happyReduction_15+happyReduction_15 (happy_x_5 `HappyStk`+	happy_x_4 `HappyStk`+	happy_x_3 `HappyStk`+	happy_x_2 `HappyStk`+	happy_x_1 `HappyStk`+	happyRest)+	 = case happyOut7 happy_x_3 of { happy_var_3 -> +	case happyOut30 happy_x_4 of { happy_var_4 -> +	case happyOut8 happy_x_5 of { happy_var_5 -> +	happyIn6+		 (Ast "import" (happy_var_3:happy_var_4:happy_var_5)+	) `HappyStk` happyRest}}}++happyReduce_16 = happySpecReduce_3  2# happyReduction_16+happyReduction_16 happy_x_3+	happy_x_2+	happy_x_1+	 =  case happyOut7 happy_x_2 of { happy_var_2 -> +	case happyOut30 happy_x_3 of { happy_var_3 -> +	happyIn6+		 (Ast "schema" [happy_var_2,happy_var_3]+	)}}++happyReduce_17 = happySpecReduce_3  3# happyReduction_17+happyReduction_17 happy_x_3+	happy_x_2+	happy_x_1+	 =  case happyOutTok happy_x_2 of { (QName happy_var_2) -> +	happyIn7+		 (Avar happy_var_2+	)}++happyReduce_18 = happySpecReduce_3  3# happyReduction_18+happyReduction_18 happy_x_3+	happy_x_2+	happy_x_1+	 =  happyIn7+		 (Avar "default-element"+	)++happyReduce_19 = happySpecReduce_3  3# happyReduction_19+happyReduction_19 happy_x_3+	happy_x_2+	happy_x_1+	 =  happyIn7+		 (Avar "default-function"+	)++happyReduce_20 = happySpecReduce_0  3# happyReduction_20+happyReduction_20  =  happyIn7+		 (Avar ""+	)++happyReduce_21 = happySpecReduce_3  4# happyReduction_21+happyReduction_21 happy_x_3+	happy_x_2+	happy_x_1+	 =  case happyOut30 happy_x_2 of { happy_var_2 -> +	case happyOut9 happy_x_3 of { happy_var_3 -> +	happyIn8+		 (happy_var_2:happy_var_3+	)}}++happyReduce_22 = happySpecReduce_0  4# happyReduction_22+happyReduction_22  =  happyIn8+		 ([]+	)++happyReduce_23 = happySpecReduce_3  5# happyReduction_23+happyReduction_23 happy_x_3+	happy_x_2+	happy_x_1+	 =  case happyOut30 happy_x_2 of { happy_var_2 -> +	case happyOut9 happy_x_3 of { happy_var_3 -> +	happyIn9+		 (happy_var_3++[happy_var_2]+	)}}++happyReduce_24 = happySpecReduce_0  5# happyReduction_24+happyReduction_24  =  happyIn9+		 ([]+	)++happyReduce_25 = happySpecReduce_1  6# happyReduction_25+happyReduction_25 happy_x_1+	 =  case happyOutTok happy_x_1 of { (QName happy_var_1) -> +	happyIn10+		 (happy_var_1+	)}++happyReduce_26 = happySpecReduce_3  6# happyReduction_26+happyReduction_26 happy_x_3+	happy_x_2+	happy_x_1+	 =  case happyOutTok happy_x_1 of { (QName happy_var_1) -> +	case happyOutTok happy_x_3 of { (QName happy_var_3) -> +	happyIn10+		 (happy_var_1++":"++happy_var_3+	)}}++happyReduce_27 = happySpecReduce_1  7# happyReduction_27+happyReduction_27 happy_x_1+	 =  case happyOut12 happy_x_1 of { happy_var_1 -> +	happyIn11+		 (happy_var_1+	)}++happyReduce_28 = happySpecReduce_0  7# happyReduction_28+happyReduction_28  =  happyIn11+		 ([]+	)++happyReduce_29 = happySpecReduce_1  8# happyReduction_29+happyReduction_29 happy_x_1+	 =  case happyOut16 happy_x_1 of { happy_var_1 -> +	happyIn12+		 ([(happy_var_1,Avar "any")]+	)}++happyReduce_30 = happySpecReduce_3  8# happyReduction_30+happyReduction_30 happy_x_3+	happy_x_2+	happy_x_1+	 =  case happyOut16 happy_x_1 of { happy_var_1 -> +	case happyOut13 happy_x_3 of { happy_var_3 -> +	happyIn12+		 ([(happy_var_1,happy_var_3)]+	)}}++happyReduce_31 = happySpecReduce_3  8# happyReduction_31+happyReduction_31 happy_x_3+	happy_x_2+	happy_x_1+	 =  case happyOut12 happy_x_1 of { happy_var_1 -> +	case happyOut16 happy_x_3 of { happy_var_3 -> +	happyIn12+		 (happy_var_1++[(happy_var_3,Avar "any")]+	)}}++happyReduce_32 = happyReduce 5# 8# happyReduction_32+happyReduction_32 (happy_x_5 `HappyStk`+	happy_x_4 `HappyStk`+	happy_x_3 `HappyStk`+	happy_x_2 `HappyStk`+	happy_x_1 `HappyStk`+	happyRest)+	 = case happyOut12 happy_x_1 of { happy_var_1 -> +	case happyOut16 happy_x_3 of { happy_var_3 -> +	case happyOut13 happy_x_5 of { happy_var_5 -> +	happyIn12+		 (happy_var_1++[(happy_var_3,happy_var_5)]+	) `HappyStk` happyRest}}}++happyReduce_33 = happySpecReduce_1  9# happyReduction_33+happyReduction_33 happy_x_1+	 =  case happyOut10 happy_x_1 of { happy_var_1 -> +	happyIn13+		 (Avar happy_var_1+	)}++happyReduce_34 = happySpecReduce_2  9# happyReduction_34+happyReduction_34 happy_x_2+	happy_x_1+	 =  case happyOut10 happy_x_1 of { happy_var_1 -> +	happyIn13+		 (Ast "+" [Avar happy_var_1]+	)}++happyReduce_35 = happySpecReduce_2  9# happyReduction_35+happyReduction_35 happy_x_2+	happy_x_1+	 =  case happyOut10 happy_x_1 of { happy_var_1 -> +	happyIn13+		 (Ast "*" [Avar happy_var_1]+	)}++happyReduce_36 = happySpecReduce_2  9# happyReduction_36+happyReduction_36 happy_x_2+	happy_x_1+	 =  case happyOut10 happy_x_1 of { happy_var_1 -> +	happyIn13+		 (Ast "?" [Avar happy_var_1]+	)}++happyReduce_37 = happySpecReduce_1  9# happyReduction_37+happyReduction_37 happy_x_1+	 =  case happyOut14 happy_x_1 of { happy_var_1 -> +	happyIn13+		 (happy_var_1+	)}++happyReduce_38 = happySpecReduce_2  9# happyReduction_38+happyReduction_38 happy_x_2+	happy_x_1+	 =  case happyOut14 happy_x_1 of { happy_var_1 -> +	happyIn13+		 (Ast "+" [happy_var_1]+	)}++happyReduce_39 = happySpecReduce_2  9# happyReduction_39+happyReduction_39 happy_x_2+	happy_x_1+	 =  case happyOut14 happy_x_1 of { happy_var_1 -> +	happyIn13+		 (Ast "*" [happy_var_1]+	)}++happyReduce_40 = happySpecReduce_2  9# happyReduction_40+happyReduction_40 happy_x_2+	happy_x_1+	 =  case happyOut14 happy_x_1 of { happy_var_1 -> +	happyIn13+		 (Ast "?" [happy_var_1]+	)}++happyReduce_41 = happySpecReduce_3  10# happyReduction_41+happyReduction_41 happy_x_3+	happy_x_2+	happy_x_1+	 =  happyIn14+		 (Ast "element" []+	)++happyReduce_42 = happySpecReduce_3  10# happyReduction_42+happyReduction_42 happy_x_3+	happy_x_2+	happy_x_1+	 =  happyIn14+		 (Ast "attribute" []+	)++happyReduce_43 = happySpecReduce_3  10# happyReduction_43+happyReduction_43 happy_x_3+	happy_x_2+	happy_x_1+	 =  case happyOut10 happy_x_1 of { happy_var_1 -> +	happyIn14+		 (Ast happy_var_1 []+	)}++happyReduce_44 = happyReduce 4# 10# happyReduction_44+happyReduction_44 (happy_x_4 `HappyStk`+	happy_x_3 `HappyStk`+	happy_x_2 `HappyStk`+	happy_x_1 `HappyStk`+	happyRest)+	 = case happyOut15 happy_x_3 of { happy_var_3 -> +	happyIn14+		 (Ast "element" happy_var_3+	) `HappyStk` happyRest}++happyReduce_45 = happyReduce 4# 10# happyReduction_45+happyReduction_45 (happy_x_4 `HappyStk`+	happy_x_3 `HappyStk`+	happy_x_2 `HappyStk`+	happy_x_1 `HappyStk`+	happyRest)+	 = case happyOut15 happy_x_3 of { happy_var_3 -> +	happyIn14+		 (Ast "attribute" happy_var_3+	) `HappyStk` happyRest}++happyReduce_46 = happySpecReduce_1  11# happyReduction_46+happyReduction_46 happy_x_1+	 =  happyIn15+		 ([Avar "*"]+	)++happyReduce_47 = happySpecReduce_1  11# happyReduction_47+happyReduction_47 happy_x_1+	 =  case happyOut10 happy_x_1 of { happy_var_1 -> +	happyIn15+		 ([Avar happy_var_1]+	)}++happyReduce_48 = happySpecReduce_3  11# happyReduction_48+happyReduction_48 happy_x_3+	happy_x_2+	happy_x_1+	 =  case happyOut10 happy_x_3 of { happy_var_3 -> +	happyIn15+		 ([Avar "*",Avar happy_var_3]+	)}++happyReduce_49 = happySpecReduce_3  11# happyReduction_49+happyReduction_49 happy_x_3+	happy_x_2+	happy_x_1+	 =  case happyOut10 happy_x_1 of { happy_var_1 -> +	case happyOut10 happy_x_3 of { happy_var_3 -> +	happyIn15+		 ([Avar happy_var_1,Avar happy_var_3]+	)}}++happyReduce_50 = happyReduce 4# 11# happyReduction_50+happyReduction_50 (happy_x_4 `HappyStk`+	happy_x_3 `HappyStk`+	happy_x_2 `HappyStk`+	happy_x_1 `HappyStk`+	happyRest)+	 = case happyOut10 happy_x_3 of { happy_var_3 -> +	happyIn15+		 ([Avar "*",Ast "?" [Avar happy_var_3]]+	) `HappyStk` happyRest}++happyReduce_51 = happyReduce 4# 11# happyReduction_51+happyReduction_51 (happy_x_4 `HappyStk`+	happy_x_3 `HappyStk`+	happy_x_2 `HappyStk`+	happy_x_1 `HappyStk`+	happyRest)+	 = case happyOut10 happy_x_1 of { happy_var_1 -> +	case happyOut10 happy_x_3 of { happy_var_3 -> +	happyIn15+		 ([Avar happy_var_1,Ast "?" [Avar happy_var_3]]+	) `HappyStk` happyRest}}++happyReduce_52 = happySpecReduce_1  12# happyReduction_52+happyReduction_52 happy_x_1+	 =  case happyOutTok happy_x_1 of { (Variable happy_var_1) -> +	happyIn16+		 (Avar happy_var_1+	)}++happyReduce_53 = happyReduce 5# 13# happyReduction_53+happyReduction_53 (happy_x_5 `HappyStk`+	happy_x_4 `HappyStk`+	happy_x_3 `HappyStk`+	happy_x_2 `HappyStk`+	happy_x_1 `HappyStk`+	happyRest)+	 = case happyOut19 happy_x_1 of { happy_var_1 -> +	case happyOut22 happy_x_2 of { happy_var_2 -> +	case happyOut23 happy_x_3 of { happy_var_3 -> +	case happyOut17 happy_x_5 of { happy_var_5 -> +	happyIn17+		 ((snd happy_var_3) (happy_var_1 (happy_var_2 ((fst happy_var_3) happy_var_5)))+	) `HappyStk` happyRest}}}}++happyReduce_54 = happyReduce 4# 13# happyReduction_54+happyReduction_54 (happy_x_4 `HappyStk`+	happy_x_3 `HappyStk`+	happy_x_2 `HappyStk`+	happy_x_1 `HappyStk`+	happyRest)+	 = case happyOut20 happy_x_2 of { happy_var_2 -> +	case happyOut17 happy_x_4 of { happy_var_4 -> +	happyIn17+		 (call "some" [happy_var_2 happy_var_4]+	) `HappyStk` happyRest}}++happyReduce_55 = happyReduce 4# 13# happyReduction_55+happyReduction_55 (happy_x_4 `HappyStk`+	happy_x_3 `HappyStk`+	happy_x_2 `HappyStk`+	happy_x_1 `HappyStk`+	happyRest)+	 = case happyOut20 happy_x_2 of { happy_var_2 -> +	case happyOut17 happy_x_4 of { happy_var_4 -> +	happyIn17+		 (call "not" [call "some" [happy_var_2 (call "not" [happy_var_4])]]+	) `HappyStk` happyRest}}++happyReduce_56 = happyReduce 6# 13# happyReduction_56+happyReduction_56 (happy_x_6 `HappyStk`+	happy_x_5 `HappyStk`+	happy_x_4 `HappyStk`+	happy_x_3 `HappyStk`+	happy_x_2 `HappyStk`+	happy_x_1 `HappyStk`+	happyRest)+	 = case happyOut17 happy_x_2 of { happy_var_2 -> +	case happyOut17 happy_x_4 of { happy_var_4 -> +	case happyOut17 happy_x_6 of { happy_var_6 -> +	happyIn17+		 (Ast "if" [happy_var_2,happy_var_4,happy_var_6]+	) `HappyStk` happyRest}}}++happyReduce_57 = happySpecReduce_1  13# happyReduction_57+happyReduction_57 happy_x_1+	 =  case happyOut33 happy_x_1 of { happy_var_1 -> +	happyIn17+		 (happy_var_1+	)}++happyReduce_58 = happySpecReduce_1  13# happyReduction_58+happyReduction_58 happy_x_1+	 =  case happyOut27 happy_x_1 of { happy_var_1 -> +	happyIn17+		 (happy_var_1+	)}++happyReduce_59 = happySpecReduce_1  13# happyReduction_59+happyReduction_59 happy_x_1+	 =  case happyOut26 happy_x_1 of { happy_var_1 -> +	happyIn17+		 (happy_var_1+	)}++happyReduce_60 = happySpecReduce_3  13# happyReduction_60+happyReduction_60 happy_x_3+	happy_x_2+	happy_x_1+	 =  case happyOut17 happy_x_1 of { happy_var_1 -> +	case happyOut17 happy_x_3 of { happy_var_3 -> +	happyIn17+		 (call "to" [happy_var_1,happy_var_3]+	)}}++happyReduce_61 = happySpecReduce_3  13# happyReduction_61+happyReduction_61 happy_x_3+	happy_x_2+	happy_x_1+	 =  case happyOut17 happy_x_1 of { happy_var_1 -> +	case happyOut17 happy_x_3 of { happy_var_3 -> +	happyIn17+		 (call "+" [happy_var_1,happy_var_3]+	)}}++happyReduce_62 = happySpecReduce_3  13# happyReduction_62+happyReduction_62 happy_x_3+	happy_x_2+	happy_x_1+	 =  case happyOut17 happy_x_1 of { happy_var_1 -> +	case happyOut17 happy_x_3 of { happy_var_3 -> +	happyIn17+		 (call "-" [happy_var_1,happy_var_3]+	)}}++happyReduce_63 = happySpecReduce_3  13# happyReduction_63+happyReduction_63 happy_x_3+	happy_x_2+	happy_x_1+	 =  case happyOut17 happy_x_1 of { happy_var_1 -> +	case happyOut17 happy_x_3 of { happy_var_3 -> +	happyIn17+		 (call "*" [happy_var_1,happy_var_3]+	)}}++happyReduce_64 = happySpecReduce_3  13# happyReduction_64+happyReduction_64 happy_x_3+	happy_x_2+	happy_x_1+	 =  case happyOut17 happy_x_1 of { happy_var_1 -> +	case happyOut17 happy_x_3 of { happy_var_3 -> +	happyIn17+		 (call "div" [happy_var_1,happy_var_3]+	)}}++happyReduce_65 = happySpecReduce_3  13# happyReduction_65+happyReduction_65 happy_x_3+	happy_x_2+	happy_x_1+	 =  case happyOut17 happy_x_1 of { happy_var_1 -> +	case happyOut17 happy_x_3 of { happy_var_3 -> +	happyIn17+		 (call "idiv" [happy_var_1,happy_var_3]+	)}}++happyReduce_66 = happySpecReduce_3  13# happyReduction_66+happyReduction_66 happy_x_3+	happy_x_2+	happy_x_1+	 =  case happyOut17 happy_x_1 of { happy_var_1 -> +	case happyOut17 happy_x_3 of { happy_var_3 -> +	happyIn17+		 (call "mod" [happy_var_1,happy_var_3]+	)}}++happyReduce_67 = happySpecReduce_3  13# happyReduction_67+happyReduction_67 happy_x_3+	happy_x_2+	happy_x_1+	 =  case happyOut17 happy_x_1 of { happy_var_1 -> +	case happyOut17 happy_x_3 of { happy_var_3 -> +	happyIn17+		 (call "=" [happy_var_1,happy_var_3]+	)}}++happyReduce_68 = happySpecReduce_3  13# happyReduction_68+happyReduction_68 happy_x_3+	happy_x_2+	happy_x_1+	 =  case happyOut17 happy_x_1 of { happy_var_1 -> +	case happyOut17 happy_x_3 of { happy_var_3 -> +	happyIn17+		 (call "!=" [happy_var_1,happy_var_3]+	)}}++happyReduce_69 = happySpecReduce_3  13# happyReduction_69+happyReduction_69 happy_x_3+	happy_x_2+	happy_x_1+	 =  case happyOut17 happy_x_1 of { happy_var_1 -> +	case happyOut17 happy_x_3 of { happy_var_3 -> +	happyIn17+		 (call "<" [happy_var_1,happy_var_3]+	)}}++happyReduce_70 = happySpecReduce_3  13# happyReduction_70+happyReduction_70 happy_x_3+	happy_x_2+	happy_x_1+	 =  case happyOut17 happy_x_1 of { happy_var_1 -> +	case happyOut17 happy_x_3 of { happy_var_3 -> +	happyIn17+		 (call "<=" [happy_var_1,happy_var_3]+	)}}++happyReduce_71 = happySpecReduce_3  13# happyReduction_71+happyReduction_71 happy_x_3+	happy_x_2+	happy_x_1+	 =  case happyOut17 happy_x_1 of { happy_var_1 -> +	case happyOut17 happy_x_3 of { happy_var_3 -> +	happyIn17+		 (call ">" [happy_var_1,happy_var_3]+	)}}++happyReduce_72 = happySpecReduce_3  13# happyReduction_72+happyReduction_72 happy_x_3+	happy_x_2+	happy_x_1+	 =  case happyOut17 happy_x_1 of { happy_var_1 -> +	case happyOut17 happy_x_3 of { happy_var_3 -> +	happyIn17+		 (call ">=" [happy_var_1,happy_var_3]+	)}}++happyReduce_73 = happySpecReduce_3  13# happyReduction_73+happyReduction_73 happy_x_3+	happy_x_2+	happy_x_1+	 =  case happyOut17 happy_x_1 of { happy_var_1 -> +	case happyOut17 happy_x_3 of { happy_var_3 -> +	happyIn17+		 (call "<<" [happy_var_1,happy_var_3]+	)}}++happyReduce_74 = happySpecReduce_3  13# happyReduction_74+happyReduction_74 happy_x_3+	happy_x_2+	happy_x_1+	 =  case happyOut17 happy_x_1 of { happy_var_1 -> +	case happyOut17 happy_x_3 of { happy_var_3 -> +	happyIn17+		 (call ">>" [happy_var_1,happy_var_3]+	)}}++happyReduce_75 = happySpecReduce_3  13# happyReduction_75+happyReduction_75 happy_x_3+	happy_x_2+	happy_x_1+	 =  case happyOut17 happy_x_1 of { happy_var_1 -> +	case happyOut17 happy_x_3 of { happy_var_3 -> +	happyIn17+		 (call "is" [happy_var_1,happy_var_3]+	)}}++happyReduce_76 = happySpecReduce_3  13# happyReduction_76+happyReduction_76 happy_x_3+	happy_x_2+	happy_x_1+	 =  case happyOut17 happy_x_1 of { happy_var_1 -> +	case happyOut17 happy_x_3 of { happy_var_3 -> +	happyIn17+		 (call "eq" [happy_var_1,happy_var_3]+	)}}++happyReduce_77 = happySpecReduce_3  13# happyReduction_77+happyReduction_77 happy_x_3+	happy_x_2+	happy_x_1+	 =  case happyOut17 happy_x_1 of { happy_var_1 -> +	case happyOut17 happy_x_3 of { happy_var_3 -> +	happyIn17+		 (call "ne" [happy_var_1,happy_var_3]+	)}}++happyReduce_78 = happySpecReduce_3  13# happyReduction_78+happyReduction_78 happy_x_3+	happy_x_2+	happy_x_1+	 =  case happyOut17 happy_x_1 of { happy_var_1 -> +	case happyOut17 happy_x_3 of { happy_var_3 -> +	happyIn17+		 (call "lt" [happy_var_1,happy_var_3]+	)}}++happyReduce_79 = happySpecReduce_3  13# happyReduction_79+happyReduction_79 happy_x_3+	happy_x_2+	happy_x_1+	 =  case happyOut17 happy_x_1 of { happy_var_1 -> +	case happyOut17 happy_x_3 of { happy_var_3 -> +	happyIn17+		 (call "le" [happy_var_1,happy_var_3]+	)}}++happyReduce_80 = happySpecReduce_3  13# happyReduction_80+happyReduction_80 happy_x_3+	happy_x_2+	happy_x_1+	 =  case happyOut17 happy_x_1 of { happy_var_1 -> +	case happyOut17 happy_x_3 of { happy_var_3 -> +	happyIn17+		 (call "gt" [happy_var_1,happy_var_3]+	)}}++happyReduce_81 = happySpecReduce_3  13# happyReduction_81+happyReduction_81 happy_x_3+	happy_x_2+	happy_x_1+	 =  case happyOut17 happy_x_1 of { happy_var_1 -> +	case happyOut17 happy_x_3 of { happy_var_3 -> +	happyIn17+		 (call "ge" [happy_var_1,happy_var_3]+	)}}++happyReduce_82 = happySpecReduce_3  13# happyReduction_82+happyReduction_82 happy_x_3+	happy_x_2+	happy_x_1+	 =  case happyOut17 happy_x_1 of { happy_var_1 -> +	case happyOut17 happy_x_3 of { happy_var_3 -> +	happyIn17+		 (call "and" [happy_var_1,happy_var_3]+	)}}++happyReduce_83 = happySpecReduce_3  13# happyReduction_83+happyReduction_83 happy_x_3+	happy_x_2+	happy_x_1+	 =  case happyOut17 happy_x_1 of { happy_var_1 -> +	case happyOut17 happy_x_3 of { happy_var_3 -> +	happyIn17+		 (call "or" [happy_var_1,happy_var_3]+	)}}++happyReduce_84 = happySpecReduce_3  13# happyReduction_84+happyReduction_84 happy_x_3+	happy_x_2+	happy_x_1+	 =  case happyOut17 happy_x_1 of { happy_var_1 -> +	case happyOut17 happy_x_3 of { happy_var_3 -> +	happyIn17+		 (call "not" [happy_var_1,happy_var_3]+	)}}++happyReduce_85 = happySpecReduce_3  13# happyReduction_85+happyReduction_85 happy_x_3+	happy_x_2+	happy_x_1+	 =  case happyOut17 happy_x_1 of { happy_var_1 -> +	case happyOut17 happy_x_3 of { happy_var_3 -> +	happyIn17+		 (call "union" [happy_var_1,happy_var_3]+	)}}++happyReduce_86 = happySpecReduce_3  13# happyReduction_86+happyReduction_86 happy_x_3+	happy_x_2+	happy_x_1+	 =  case happyOut17 happy_x_1 of { happy_var_1 -> +	case happyOut17 happy_x_3 of { happy_var_3 -> +	happyIn17+		 (call "intersect" [happy_var_1,happy_var_3]+	)}}++happyReduce_87 = happySpecReduce_3  13# happyReduction_87+happyReduction_87 happy_x_3+	happy_x_2+	happy_x_1+	 =  case happyOut17 happy_x_1 of { happy_var_1 -> +	case happyOut17 happy_x_3 of { happy_var_3 -> +	happyIn17+		 (call "except" [happy_var_1,happy_var_3]+	)}}++happyReduce_88 = happyReduce 4# 13# happyReduction_88+happyReduction_88 (happy_x_4 `HappyStk`+	happy_x_3 `HappyStk`+	happy_x_2 `HappyStk`+	happy_x_1 `HappyStk`+	happyRest)+	 = case happyOut17 happy_x_1 of { happy_var_1 -> +	case happyOut13 happy_x_4 of { happy_var_4 -> +	happyIn17+		 (call "instance-of" [happy_var_1,Ast "type" [happy_var_4]]+	) `HappyStk` happyRest}}++happyReduce_89 = happyReduce 4# 13# happyReduction_89+happyReduction_89 (happy_x_4 `HappyStk`+	happy_x_3 `HappyStk`+	happy_x_2 `HappyStk`+	happy_x_1 `HappyStk`+	happyRest)+	 = case happyOut17 happy_x_1 of { happy_var_1 -> +	case happyOut13 happy_x_4 of { happy_var_4 -> +	happyIn17+		 (call "cast-as" [happy_var_1,Ast "type" [happy_var_4]]+	) `HappyStk` happyRest}}++happyReduce_90 = happyReduce 4# 13# happyReduction_90+happyReduction_90 (happy_x_4 `HappyStk`+	happy_x_3 `HappyStk`+	happy_x_2 `HappyStk`+	happy_x_1 `HappyStk`+	happyRest)+	 = case happyOut17 happy_x_1 of { happy_var_1 -> +	case happyOut13 happy_x_4 of { happy_var_4 -> +	happyIn17+		 (call "castable-as" [happy_var_1,Ast "type" [happy_var_4]]+	) `HappyStk` happyRest}}++happyReduce_91 = happyReduce 5# 13# happyReduction_91+happyReduction_91 (happy_x_5 `HappyStk`+	happy_x_4 `HappyStk`+	happy_x_3 `HappyStk`+	happy_x_2 `HappyStk`+	happy_x_1 `HappyStk`+	happyRest)+	 = case happyOut17 happy_x_3 of { happy_var_3 -> +	case happyOut39 happy_x_5 of { happy_var_5 -> +	happyIn17+		 (let v = "_tc" in Ast "let" [Avar v,happy_var_3,happy_var_5 v]+	) `HappyStk` happyRest}}++happyReduce_92 = happySpecReduce_2  13# happyReduction_92+happyReduction_92 happy_x_2+	happy_x_1+	 =  case happyOut17 happy_x_2 of { happy_var_2 -> +	happyIn17+		 (call "uplus" [happy_var_2]+	)}++happyReduce_93 = happySpecReduce_2  13# happyReduction_93+happyReduction_93 happy_x_2+	happy_x_1+	 =  case happyOut17 happy_x_2 of { happy_var_2 -> +	happyIn17+		 (call "uminus" [happy_var_2]+	)}++happyReduce_94 = happySpecReduce_2  13# happyReduction_94+happyReduction_94 happy_x_2+	happy_x_1+	 =  case happyOut17 happy_x_2 of { happy_var_2 -> +	happyIn17+		 (call "not" [happy_var_2]+	)}++happyReduce_95 = happySpecReduce_1  13# happyReduction_95+happyReduction_95 happy_x_1+	 =  case happyOut30 happy_x_1 of { happy_var_1 -> +	happyIn17+		 (happy_var_1+	)}++happyReduce_96 = happySpecReduce_1  13# happyReduction_96+happyReduction_96 happy_x_1+	 =  case happyOutTok happy_x_1 of { (TInteger happy_var_1) -> +	happyIn17+		 (Aint happy_var_1+	)}++happyReduce_97 = happySpecReduce_1  13# happyReduction_97+happyReduction_97 happy_x_1+	 =  case happyOutTok happy_x_1 of { (TFloat happy_var_1) -> +	happyIn17+		 (Afloat happy_var_1+	)}++happyReduce_98 = happyReduce 4# 13# happyReduction_98+happyReduction_98 (happy_x_4 `HappyStk`+	happy_x_3 `HappyStk`+	happy_x_2 `HappyStk`+	happy_x_1 `HappyStk`+	happyRest)+	 = case happyOut17 happy_x_3 of { happy_var_3 -> +	happyIn17+		 (Ast "validate" [happy_var_3]+	) `HappyStk` happyRest}++happyReduce_99 = happyReduce 4# 13# happyReduction_99+happyReduction_99 (happy_x_4 `HappyStk`+	happy_x_3 `HappyStk`+	happy_x_2 `HappyStk`+	happy_x_1 `HappyStk`+	happyRest)+	 = case happyOut17 happy_x_2 of { happy_var_2 -> +	case happyOut17 happy_x_4 of { happy_var_4 -> +	happyIn17+		 (Ast "insert" [happy_var_2,Ast "destination" [happy_var_4]]+	) `HappyStk` happyRest}}++happyReduce_100 = happySpecReduce_3  13# happyReduction_100+happyReduction_100 happy_x_3+	happy_x_2+	happy_x_1+	 =  case happyOut17 happy_x_3 of { happy_var_3 -> +	happyIn17+		 (Ast "delete" [happy_var_3]+	)}++happyReduce_101 = happyReduce 4# 13# happyReduction_101+happyReduction_101 (happy_x_4 `HappyStk`+	happy_x_3 `HappyStk`+	happy_x_2 `HappyStk`+	happy_x_1 `HappyStk`+	happyRest)+	 = case happyOut17 happy_x_2 of { happy_var_2 -> +	case happyOut17 happy_x_4 of { happy_var_4 -> +	happyIn17+		 (Ast "replace" [happy_var_2,happy_var_4]+	) `HappyStk` happyRest}}++happyReduce_102 = happySpecReduce_1  14# happyReduction_102+happyReduction_102 happy_x_1+	 =  case happyOut17 happy_x_1 of { happy_var_1 -> +	happyIn18+		 ([happy_var_1]+	)}++happyReduce_103 = happySpecReduce_3  14# happyReduction_103+happyReduction_103 happy_x_3+	happy_x_2+	happy_x_1+	 =  case happyOut18 happy_x_1 of { happy_var_1 -> +	case happyOut17 happy_x_3 of { happy_var_3 -> +	happyIn18+		 (happy_var_1++[happy_var_3]+	)}}++happyReduce_104 = happySpecReduce_2  15# happyReduction_104+happyReduction_104 happy_x_2+	happy_x_1+	 =  case happyOut20 happy_x_2 of { happy_var_2 -> +	happyIn19+		 (happy_var_2+	)}++happyReduce_105 = happySpecReduce_2  15# happyReduction_105+happyReduction_105 happy_x_2+	happy_x_1+	 =  case happyOut21 happy_x_2 of { happy_var_2 -> +	happyIn19+		 (happy_var_2+	)}++happyReduce_106 = happySpecReduce_3  15# happyReduction_106+happyReduction_106 happy_x_3+	happy_x_2+	happy_x_1+	 =  case happyOut19 happy_x_1 of { happy_var_1 -> +	case happyOut20 happy_x_3 of { happy_var_3 -> +	happyIn19+		 (happy_var_1 . happy_var_3+	)}}++happyReduce_107 = happySpecReduce_3  15# happyReduction_107+happyReduction_107 happy_x_3+	happy_x_2+	happy_x_1+	 =  case happyOut19 happy_x_1 of { happy_var_1 -> +	case happyOut21 happy_x_3 of { happy_var_3 -> +	happyIn19+		 (happy_var_1 . happy_var_3+	)}}++happyReduce_108 = happySpecReduce_3  16# happyReduction_108+happyReduction_108 happy_x_3+	happy_x_2+	happy_x_1+	 =  case happyOut16 happy_x_1 of { happy_var_1 -> +	case happyOut17 happy_x_3 of { happy_var_3 -> +	happyIn20+		 (\x -> Ast "for" [happy_var_1,Avar "$",happy_var_3,x]+	)}}++happyReduce_109 = happyReduce 5# 16# happyReduction_109+happyReduction_109 (happy_x_5 `HappyStk`+	happy_x_4 `HappyStk`+	happy_x_3 `HappyStk`+	happy_x_2 `HappyStk`+	happy_x_1 `HappyStk`+	happyRest)+	 = case happyOut16 happy_x_1 of { happy_var_1 -> +	case happyOut16 happy_x_3 of { happy_var_3 -> +	case happyOut17 happy_x_5 of { happy_var_5 -> +	happyIn20+		 (\x -> Ast "for" [happy_var_1,happy_var_3,happy_var_5,x]+	) `HappyStk` happyRest}}}++happyReduce_110 = happyReduce 5# 16# happyReduction_110+happyReduction_110 (happy_x_5 `HappyStk`+	happy_x_4 `HappyStk`+	happy_x_3 `HappyStk`+	happy_x_2 `HappyStk`+	happy_x_1 `HappyStk`+	happyRest)+	 = case happyOut20 happy_x_1 of { happy_var_1 -> +	case happyOut16 happy_x_3 of { happy_var_3 -> +	case happyOut17 happy_x_5 of { happy_var_5 -> +	happyIn20+		 (\x -> happy_var_1(Ast "for" [happy_var_3,Avar "$",happy_var_5,x])+	) `HappyStk` happyRest}}}++happyReduce_111 = happyReduce 7# 16# happyReduction_111+happyReduction_111 (happy_x_7 `HappyStk`+	happy_x_6 `HappyStk`+	happy_x_5 `HappyStk`+	happy_x_4 `HappyStk`+	happy_x_3 `HappyStk`+	happy_x_2 `HappyStk`+	happy_x_1 `HappyStk`+	happyRest)+	 = case happyOut20 happy_x_1 of { happy_var_1 -> +	case happyOut16 happy_x_3 of { happy_var_3 -> +	case happyOut16 happy_x_5 of { happy_var_5 -> +	case happyOut17 happy_x_7 of { happy_var_7 -> +	happyIn20+		 (\x -> happy_var_1(Ast "for" [happy_var_3,happy_var_5,happy_var_7,x])+	) `HappyStk` happyRest}}}}++happyReduce_112 = happySpecReduce_3  17# happyReduction_112+happyReduction_112 happy_x_3+	happy_x_2+	happy_x_1+	 =  case happyOut16 happy_x_1 of { happy_var_1 -> +	case happyOut17 happy_x_3 of { happy_var_3 -> +	happyIn21+		 (\x -> Ast "let" [happy_var_1,happy_var_3,x]+	)}}++happyReduce_113 = happyReduce 5# 17# happyReduction_113+happyReduction_113 (happy_x_5 `HappyStk`+	happy_x_4 `HappyStk`+	happy_x_3 `HappyStk`+	happy_x_2 `HappyStk`+	happy_x_1 `HappyStk`+	happyRest)+	 = case happyOut21 happy_x_1 of { happy_var_1 -> +	case happyOut16 happy_x_3 of { happy_var_3 -> +	case happyOut17 happy_x_5 of { happy_var_5 -> +	happyIn21+		 (\x -> happy_var_1(Ast "let" [happy_var_3,happy_var_5,x])+	) `HappyStk` happyRest}}}++happyReduce_114 = happySpecReduce_2  18# happyReduction_114+happyReduction_114 happy_x_2+	happy_x_1+	 =  case happyOut17 happy_x_2 of { happy_var_2 -> +	happyIn22+		 (\x -> Ast "predicate" [happy_var_2,x]+	)}++happyReduce_115 = happySpecReduce_0  18# happyReduction_115+happyReduction_115  =  happyIn22+		 (id+	)++happyReduce_116 = happySpecReduce_3  19# happyReduction_116+happyReduction_116 happy_x_3+	happy_x_2+	happy_x_1+	 =  case happyOut24 happy_x_3 of { happy_var_3 -> +	happyIn23+		 ((\x -> Ast "sortTuple" (x:(fst happy_var_3)),+                                                           \x -> Ast "sort" (x:(snd happy_var_3)))+	)}++happyReduce_117 = happySpecReduce_0  19# happyReduction_117+happyReduction_117  =  happyIn23+		 ((id,id)+	)++happyReduce_118 = happySpecReduce_2  20# happyReduction_118+happyReduction_118 happy_x_2+	happy_x_1+	 =  case happyOut17 happy_x_1 of { happy_var_1 -> +	case happyOut25 happy_x_2 of { happy_var_2 -> +	happyIn24+		 (([happy_var_1],[happy_var_2])+	)}}++happyReduce_119 = happyReduce 4# 20# happyReduction_119+happyReduction_119 (happy_x_4 `HappyStk`+	happy_x_3 `HappyStk`+	happy_x_2 `HappyStk`+	happy_x_1 `HappyStk`+	happyRest)+	 = case happyOut24 happy_x_1 of { happy_var_1 -> +	case happyOut17 happy_x_3 of { happy_var_3 -> +	case happyOut25 happy_x_4 of { happy_var_4 -> +	happyIn24+		 (((fst happy_var_1)++[happy_var_3],(snd happy_var_1)++[happy_var_4])+	) `HappyStk` happyRest}}}++happyReduce_120 = happySpecReduce_1  21# happyReduction_120+happyReduction_120 happy_x_1+	 =  happyIn25+		 (Avar "ascending"+	)++happyReduce_121 = happySpecReduce_1  21# happyReduction_121+happyReduction_121 happy_x_1+	 =  happyIn25+		 (Avar "descending"+	)++happyReduce_122 = happySpecReduce_0  21# happyReduction_122+happyReduction_122  =  happyIn25+		 (Avar "ascending"+	)++happyReduce_123 = happyReduce 4# 22# happyReduction_123+happyReduction_123 (happy_x_4 `HappyStk`+	happy_x_3 `HappyStk`+	happy_x_2 `HappyStk`+	happy_x_1 `HappyStk`+	happyRest)+	 = case happyOut10 happy_x_3 of { happy_var_3 -> +	happyIn26+		 (call "element" [Avar happy_var_3]+	) `HappyStk` happyRest}++happyReduce_124 = happyReduce 4# 22# happyReduction_124+happyReduction_124 (happy_x_4 `HappyStk`+	happy_x_3 `HappyStk`+	happy_x_2 `HappyStk`+	happy_x_1 `HappyStk`+	happyRest)+	 = case happyOut10 happy_x_3 of { happy_var_3 -> +	happyIn26+		 (call "attribute" [Avar happy_var_3]+	) `HappyStk` happyRest}++happyReduce_125 = happyReduce 6# 23# happyReduction_125+happyReduction_125 (happy_x_6 `HappyStk`+	happy_x_5 `HappyStk`+	happy_x_4 `HappyStk`+	happy_x_3 `HappyStk`+	happy_x_2 `HappyStk`+	happy_x_1 `HappyStk`+	happyRest)+	 = case happyOut28 happy_x_1 of { happy_var_1 -> +	case happyOut29 happy_x_3 of { happy_var_3 -> +	case happyOut10 happy_x_5 of { happy_var_5 -> +	happyIn27+		 (if head happy_var_1 == Astring happy_var_5+                                                             then Ast "element_construction" (happy_var_1++[Ast "append" happy_var_3])+                                                          else parseError [TError ("Unmatched tags in element construction: "+                                                                                   ++(show (head happy_var_1))++" '"++happy_var_5++"'")]+	) `HappyStk` happyRest}}}++happyReduce_126 = happyReduce 5# 23# happyReduction_126+happyReduction_126 (happy_x_5 `HappyStk`+	happy_x_4 `HappyStk`+	happy_x_3 `HappyStk`+	happy_x_2 `HappyStk`+	happy_x_1 `HappyStk`+	happyRest)+	 = case happyOut28 happy_x_1 of { happy_var_1 -> +	case happyOut10 happy_x_4 of { happy_var_4 -> +	happyIn27+		 (if head happy_var_1 == Astring happy_var_4+                                                             then Ast "element_construction" (happy_var_1++[Ast "append" []])+                                                          else parseError [TError ("Unmatched tags in element construction: "+                                                                                   ++(show (head happy_var_1))++" '"++happy_var_4++"'")]+	) `HappyStk` happyRest}}++happyReduce_127 = happySpecReduce_2  23# happyReduction_127+happyReduction_127 happy_x_2+	happy_x_1+	 =  case happyOut28 happy_x_1 of { happy_var_1 -> +	happyIn27+		 (Ast "element_construction" (happy_var_1++[Ast "append" []])+	)}++happyReduce_128 = happyReduce 7# 23# happyReduction_128+happyReduction_128 (happy_x_7 `HappyStk`+	happy_x_6 `HappyStk`+	happy_x_5 `HappyStk`+	happy_x_4 `HappyStk`+	happy_x_3 `HappyStk`+	happy_x_2 `HappyStk`+	happy_x_1 `HappyStk`+	happyRest)+	 = case happyOut17 happy_x_3 of { happy_var_3 -> +	case happyOut18 happy_x_6 of { happy_var_6 -> +	happyIn27+		 (Ast "element_construction" [happy_var_3,Ast "attributes" [],concatenateAll happy_var_6]+	) `HappyStk` happyRest}}++happyReduce_129 = happyReduce 7# 23# happyReduction_129+happyReduction_129 (happy_x_7 `HappyStk`+	happy_x_6 `HappyStk`+	happy_x_5 `HappyStk`+	happy_x_4 `HappyStk`+	happy_x_3 `HappyStk`+	happy_x_2 `HappyStk`+	happy_x_1 `HappyStk`+	happyRest)+	 = case happyOut17 happy_x_3 of { happy_var_3 -> +	case happyOut18 happy_x_6 of { happy_var_6 -> +	happyIn27+		 (Ast "attribute_construction" [happy_var_3,concatenateAll happy_var_6]+	) `HappyStk` happyRest}}++happyReduce_130 = happyReduce 5# 23# happyReduction_130+happyReduction_130 (happy_x_5 `HappyStk`+	happy_x_4 `HappyStk`+	happy_x_3 `HappyStk`+	happy_x_2 `HappyStk`+	happy_x_1 `HappyStk`+	happyRest)+	 = case happyOut10 happy_x_2 of { happy_var_2 -> +	case happyOut18 happy_x_4 of { happy_var_4 -> +	happyIn27+		 (Ast "element_construction" [Astring happy_var_2,Ast "attributes" [],concatenateAll happy_var_4]+	) `HappyStk` happyRest}}++happyReduce_131 = happyReduce 5# 23# happyReduction_131+happyReduction_131 (happy_x_5 `HappyStk`+	happy_x_4 `HappyStk`+	happy_x_3 `HappyStk`+	happy_x_2 `HappyStk`+	happy_x_1 `HappyStk`+	happyRest)+	 = case happyOut10 happy_x_2 of { happy_var_2 -> +	case happyOut18 happy_x_4 of { happy_var_4 -> +	happyIn27+		 (Ast "attribute_construction" [Astring happy_var_2,concatenateAll happy_var_4]+	) `HappyStk` happyRest}}++happyReduce_132 = happySpecReduce_2  24# happyReduction_132+happyReduction_132 happy_x_2+	happy_x_1+	 =  case happyOut10 happy_x_2 of { happy_var_2 -> +	happyIn28+		 ([Astring happy_var_2,Ast "attributes" []]+	)}++happyReduce_133 = happySpecReduce_3  24# happyReduction_133+happyReduction_133 happy_x_3+	happy_x_2+	happy_x_1+	 =  case happyOut10 happy_x_2 of { happy_var_2 -> +	case happyOut32 happy_x_3 of { happy_var_3 -> +	happyIn28+		 ([Astring happy_var_2,Ast "attributes" happy_var_3]+	)}}++happyReduce_134 = happySpecReduce_3  25# happyReduction_134+happyReduction_134 happy_x_3+	happy_x_2+	happy_x_1+	 =  case happyOut18 happy_x_2 of { happy_var_2 -> +	happyIn29+		 ([concatenateAll happy_var_2]+	)}++happyReduce_135 = happySpecReduce_1  25# happyReduction_135+happyReduction_135 happy_x_1+	 =  case happyOutTok happy_x_1 of { (TString happy_var_1) -> +	happyIn29+		 ([Astring happy_var_1]+	)}++happyReduce_136 = happySpecReduce_1  25# happyReduction_136+happyReduction_136 happy_x_1+	 =  case happyOutTok happy_x_1 of { (XMLtext happy_var_1) -> +	happyIn29+		 ([Astring happy_var_1]+	)}++happyReduce_137 = happySpecReduce_1  25# happyReduction_137+happyReduction_137 happy_x_1+	 =  case happyOut27 happy_x_1 of { happy_var_1 -> +	happyIn29+		 ([happy_var_1]+	)}++happyReduce_138 = happyReduce 4# 25# happyReduction_138+happyReduction_138 (happy_x_4 `HappyStk`+	happy_x_3 `HappyStk`+	happy_x_2 `HappyStk`+	happy_x_1 `HappyStk`+	happyRest)+	 = case happyOut29 happy_x_1 of { happy_var_1 -> +	case happyOut18 happy_x_3 of { happy_var_3 -> +	happyIn29+		 (happy_var_1++[concatenateAll happy_var_3]+	) `HappyStk` happyRest}}++happyReduce_139 = happySpecReduce_2  25# happyReduction_139+happyReduction_139 happy_x_2+	happy_x_1+	 =  case happyOut29 happy_x_1 of { happy_var_1 -> +	case happyOutTok happy_x_2 of { (TString happy_var_2) -> +	happyIn29+		 (happy_var_1++[Astring happy_var_2]+	)}}++happyReduce_140 = happySpecReduce_2  25# happyReduction_140+happyReduction_140 happy_x_2+	happy_x_1+	 =  case happyOut29 happy_x_1 of { happy_var_1 -> +	case happyOutTok happy_x_2 of { (XMLtext happy_var_2) -> +	happyIn29+		 (happy_var_1++[Astring happy_var_2]+	)}}++happyReduce_141 = happySpecReduce_2  25# happyReduction_141+happyReduction_141 happy_x_2+	happy_x_1+	 =  case happyOut29 happy_x_1 of { happy_var_1 -> +	case happyOut27 happy_x_2 of { happy_var_2 -> +	happyIn29+		 (happy_var_1++[happy_var_2]+	)}}++happyReduce_142 = happySpecReduce_1  26# happyReduction_142+happyReduction_142 happy_x_1+	 =  case happyOut31 happy_x_1 of { happy_var_1 -> +	happyIn30+		 (if length happy_var_1 == 0 then Astring ""+                                                          else if length happy_var_1 == 1 then head happy_var_1 else Ast "append" happy_var_1+	)}++happyReduce_143 = happySpecReduce_1  27# happyReduction_143+happyReduction_143 happy_x_1+	 =  case happyOutTok happy_x_1 of { (TString happy_var_1) -> +	happyIn31+		 (if happy_var_1=="" then [] else [Astring happy_var_1]+	)}++happyReduce_144 = happySpecReduce_3  27# happyReduction_144+happyReduction_144 happy_x_3+	happy_x_2+	happy_x_1+	 =  case happyOut18 happy_x_2 of { happy_var_2 -> +	happyIn31+		 ([concatAll happy_var_2]+	)}++happyReduce_145 = happySpecReduce_2  27# happyReduction_145+happyReduction_145 happy_x_2+	happy_x_1+	 =  case happyOut31 happy_x_1 of { happy_var_1 -> +	case happyOutTok happy_x_2 of { (TString happy_var_2) -> +	happyIn31+		 (if happy_var_2=="" then happy_var_1 else happy_var_1++[Astring happy_var_2]+	)}}++happyReduce_146 = happyReduce 4# 27# happyReduction_146+happyReduction_146 (happy_x_4 `HappyStk`+	happy_x_3 `HappyStk`+	happy_x_2 `HappyStk`+	happy_x_1 `HappyStk`+	happyRest)+	 = case happyOut31 happy_x_1 of { happy_var_1 -> +	case happyOut18 happy_x_3 of { happy_var_3 -> +	happyIn31+		 (happy_var_1++[concatAll happy_var_3]+	) `HappyStk` happyRest}}++happyReduce_147 = happySpecReduce_3  28# happyReduction_147+happyReduction_147 happy_x_3+	happy_x_2+	happy_x_1+	 =  case happyOut10 happy_x_1 of { happy_var_1 -> +	case happyOut30 happy_x_3 of { happy_var_3 -> +	happyIn32+		 ([Ast "pair" [Astring happy_var_1,happy_var_3]]+	)}}++happyReduce_148 = happyReduce 4# 28# happyReduction_148+happyReduction_148 (happy_x_4 `HappyStk`+	happy_x_3 `HappyStk`+	happy_x_2 `HappyStk`+	happy_x_1 `HappyStk`+	happyRest)+	 = case happyOut32 happy_x_1 of { happy_var_1 -> +	case happyOut10 happy_x_2 of { happy_var_2 -> +	case happyOut30 happy_x_4 of { happy_var_4 -> +	happyIn32+		 (happy_var_1++[Ast "pair" [Astring happy_var_2,happy_var_4]]+	) `HappyStk` happyRest}}}++happyReduce_149 = happySpecReduce_2  29# happyReduction_149+happyReduction_149 happy_x_2+	happy_x_1+	 =  case happyOut37 happy_x_1 of { happy_var_1 -> +	case happyOut36 happy_x_2 of { happy_var_2 -> +	happyIn33+		 (happy_var_1 "child" (Avar ".") happy_var_2+	)}}++happyReduce_150 = happySpecReduce_3  29# happyReduction_150+happyReduction_150 happy_x_3+	happy_x_2+	happy_x_1+	 =  case happyOut37 happy_x_2 of { happy_var_2 -> +	case happyOut36 happy_x_3 of { happy_var_3 -> +	happyIn33+		 (happy_var_2 "attribute" (Avar ".") happy_var_3+	)}}++happyReduce_151 = happySpecReduce_3  29# happyReduction_151+happyReduction_151 happy_x_3+	happy_x_2+	happy_x_1+	 =  case happyOut37 happy_x_1 of { happy_var_1 -> +	case happyOut36 happy_x_2 of { happy_var_2 -> +	case happyOut34 happy_x_3 of { happy_var_3 -> +	happyIn33+		 (happy_var_3 (happy_var_1 "child" (Avar ".") happy_var_2)+	)}}}++happyReduce_152 = happyReduce 4# 29# happyReduction_152+happyReduction_152 (happy_x_4 `HappyStk`+	happy_x_3 `HappyStk`+	happy_x_2 `HappyStk`+	happy_x_1 `HappyStk`+	happyRest)+	 = case happyOut37 happy_x_2 of { happy_var_2 -> +	case happyOut36 happy_x_3 of { happy_var_3 -> +	case happyOut34 happy_x_4 of { happy_var_4 -> +	happyIn33+		 (happy_var_4 (happy_var_2 "attribute" (Avar ".") happy_var_3)+	) `HappyStk` happyRest}}}++happyReduce_153 = happySpecReduce_1  30# happyReduction_153+happyReduction_153 happy_x_1+	 =  case happyOut35 happy_x_1 of { happy_var_1 -> +	happyIn34+		 (happy_var_1+	)}++happyReduce_154 = happySpecReduce_2  30# happyReduction_154+happyReduction_154 happy_x_2+	happy_x_1+	 =  case happyOut34 happy_x_1 of { happy_var_1 -> +	case happyOut35 happy_x_2 of { happy_var_2 -> +	happyIn34+		 (happy_var_2 . happy_var_1+	)}}++happyReduce_155 = happySpecReduce_3  31# happyReduction_155+happyReduction_155 happy_x_3+	happy_x_2+	happy_x_1+	 =  case happyOut37 happy_x_2 of { happy_var_2 -> +	case happyOut36 happy_x_3 of { happy_var_3 -> +	happyIn35+		 (\e -> happy_var_2 "child" e happy_var_3+	)}}++happyReduce_156 = happyReduce 4# 31# happyReduction_156+happyReduction_156 (happy_x_4 `HappyStk`+	happy_x_3 `HappyStk`+	happy_x_2 `HappyStk`+	happy_x_1 `HappyStk`+	happyRest)+	 = case happyOut37 happy_x_3 of { happy_var_3 -> +	case happyOut36 happy_x_4 of { happy_var_4 -> +	happyIn35+		 (\e -> happy_var_3 "attribute" e happy_var_4+	) `HappyStk` happyRest}}++happyReduce_157 = happyReduce 4# 31# happyReduction_157+happyReduction_157 (happy_x_4 `HappyStk`+	happy_x_3 `HappyStk`+	happy_x_2 `HappyStk`+	happy_x_1 `HappyStk`+	happyRest)+	 = case happyOut37 happy_x_3 of { happy_var_3 -> +	case happyOut36 happy_x_4 of { happy_var_4 -> +	happyIn35+		 (\e -> happy_var_3 "descendant" e happy_var_4+	) `HappyStk` happyRest}}++happyReduce_158 = happyReduce 5# 31# happyReduction_158+happyReduction_158 (happy_x_5 `HappyStk`+	happy_x_4 `HappyStk`+	happy_x_3 `HappyStk`+	happy_x_2 `HappyStk`+	happy_x_1 `HappyStk`+	happyRest)+	 = case happyOut37 happy_x_4 of { happy_var_4 -> +	case happyOut36 happy_x_5 of { happy_var_5 -> +	happyIn35+		 (\e -> happy_var_4 "attribute-descendant" e happy_var_5+	) `HappyStk` happyRest}}++happyReduce_159 = happySpecReduce_2  31# happyReduction_159+happyReduction_159 happy_x_2+	happy_x_1+	 =  happyIn35+		 (\e -> Ast "step" [Avar "parent",Astring "*",e]+	)++happyReduce_160 = happyReduce 4# 32# happyReduction_160+happyReduction_160 (happy_x_4 `HappyStk`+	happy_x_3 `HappyStk`+	happy_x_2 `HappyStk`+	happy_x_1 `HappyStk`+	happyRest)+	 = case happyOut36 happy_x_1 of { happy_var_1 -> +	case happyOut17 happy_x_3 of { happy_var_3 -> +	happyIn36+		 (happy_var_1 ++ [happy_var_3]+	) `HappyStk` happyRest}}++happyReduce_161 = happySpecReduce_0  32# happyReduction_161+happyReduction_161  =  happyIn36+		 ([]+	)++happyReduce_162 = happySpecReduce_1  33# happyReduction_162+happyReduction_162 happy_x_1+	 =  case happyOut38 happy_x_1 of { happy_var_1 -> +	happyIn37+		 (\t e ps -> if null ps+								     then happy_var_1 t e+                                                                     else Ast "filter" (happy_var_1 t e:ps)+	)}++happyReduce_163 = happySpecReduce_1  33# happyReduction_163+happyReduction_163 happy_x_1+	 =  happyIn37+		 (\t e ps -> Ast "step" ((Avar t):(Astring "*"):e:ps)+	)++happyReduce_164 = happySpecReduce_1  33# happyReduction_164+happyReduction_164 happy_x_1+	 =  case happyOut10 happy_x_1 of { happy_var_1 -> +	happyIn37+		 (\t e ps -> if elem happy_var_1 path_steps+                                                                     then parseError [TError ("Axis "++happy_var_1++" is missing a node step")]+                                                                     else Ast "step" ((Avar t):(Astring happy_var_1):e:ps)+	)}++happyReduce_165 = happyReduce 4# 33# happyReduction_165+happyReduction_165 (happy_x_4 `HappyStk`+	happy_x_3 `HappyStk`+	happy_x_2 `HappyStk`+	happy_x_1 `HappyStk`+	happyRest)+	 = case happyOutTok happy_x_1 of { (QName happy_var_1) -> +	case happyOut10 happy_x_4 of { happy_var_4 -> +	happyIn37+		 (\t e ps -> if elem happy_var_1 path_steps+                                                                     then if t == "child"+                                                                          then Ast "step" ((Avar happy_var_1):(Astring happy_var_4):e:ps)+                                                                          else parseError [TError ("The navigation step must be /"++happy_var_1++"::"++happy_var_4)]+                                                                     else parseError [TError ("Not a valid axis name: "++happy_var_1)]+	) `HappyStk` happyRest}}++happyReduce_166 = happyReduce 4# 33# happyReduction_166+happyReduction_166 (happy_x_4 `HappyStk`+	happy_x_3 `HappyStk`+	happy_x_2 `HappyStk`+	happy_x_1 `HappyStk`+	happyRest)+	 = case happyOutTok happy_x_1 of { (QName happy_var_1) -> +	happyIn37+		 (\t e ps -> if elem happy_var_1 path_steps+                                                                     then if t == "child"+                                                                          then Ast "step" ((Avar happy_var_1):(Astring "*"):e:ps)+                                                                          else parseError [TError ("The navigation step must be /"++happy_var_1++"::*")]+                                                                     else parseError [TError ("Not a valid axis name: "++happy_var_1)]+	) `HappyStk` happyRest}++happyReduce_167 = happySpecReduce_1  34# happyReduction_167+happyReduction_167 happy_x_1+	 =  case happyOut16 happy_x_1 of { happy_var_1 -> +	happyIn38+		 (\_ _ -> happy_var_1+	)}++happyReduce_168 = happySpecReduce_1  34# happyReduction_168+happyReduction_168 happy_x_1+	 =  happyIn38+		 (\_ e -> e+	)++happyReduce_169 = happySpecReduce_3  34# happyReduction_169+happyReduction_169 happy_x_3+	happy_x_2+	happy_x_1+	 =  case happyOut18 happy_x_2 of { happy_var_2 -> +	happyIn38+		 (\t e -> if e == Avar "."+                                                                  then concatenateAll happy_var_2+	                                                          else Ast "context" [e,Astring t,concatenateAll happy_var_2]+	)}++happyReduce_170 = happySpecReduce_2  34# happyReduction_170+happyReduction_170 happy_x_2+	happy_x_1+	 =  happyIn38+		 (\_ _ -> call "empty" []+	)++happyReduce_171 = happyReduce 4# 34# happyReduction_171+happyReduction_171 (happy_x_4 `HappyStk`+	happy_x_3 `HappyStk`+	happy_x_2 `HappyStk`+	happy_x_1 `HappyStk`+	happyRest)+	 = case happyOut10 happy_x_1 of { happy_var_1 -> +	case happyOut18 happy_x_3 of { happy_var_3 -> +	happyIn38+		 (\t e -> if e == Avar "."+                                                                     then call happy_var_1 happy_var_3+                                                                  else Ast "context" [e,Astring t,call happy_var_1 happy_var_3]+	) `HappyStk` happyRest}}++happyReduce_172 = happySpecReduce_3  34# happyReduction_172+happyReduction_172 happy_x_3+	happy_x_2+	happy_x_1+	 =  case happyOut10 happy_x_1 of { happy_var_1 -> +	happyIn38+		 (\_ e -> if elem happy_var_1 ["last","position","true","false","empty","select"]+                                                                  then call happy_var_1 []+                                                                  else call happy_var_1 [e]+	)}++happyReduce_173 = happyReduce 7# 35# happyReduction_173+happyReduction_173 (happy_x_7 `HappyStk`+	happy_x_6 `HappyStk`+	happy_x_5 `HappyStk`+	happy_x_4 `HappyStk`+	happy_x_3 `HappyStk`+	happy_x_2 `HappyStk`+	happy_x_1 `HappyStk`+	happyRest)+	 = case happyOut13 happy_x_2 of { happy_var_2 -> +	case happyOut17 happy_x_4 of { happy_var_4 -> +	case happyOut17 happy_x_7 of { happy_var_7 -> +	happyIn39+		 (\v -> Ast "if" [call "instance-of" [Avar v,Ast "type" [happy_var_2]],happy_var_4,happy_var_7]+	) `HappyStk` happyRest}}}++happyReduce_174 = happyReduce 5# 35# happyReduction_174+happyReduction_174 (happy_x_5 `HappyStk`+	happy_x_4 `HappyStk`+	happy_x_3 `HappyStk`+	happy_x_2 `HappyStk`+	happy_x_1 `HappyStk`+	happyRest)+	 = case happyOut13 happy_x_2 of { happy_var_2 -> +	case happyOut17 happy_x_4 of { happy_var_4 -> +	case happyOut39 happy_x_5 of { happy_var_5 -> +	happyIn39+		 (\v -> Ast "if" [call "instance-of" [Avar v,Ast "type" [happy_var_2]],happy_var_4,happy_var_5 v]+	) `HappyStk` happyRest}}}++happyNewToken action sts stk [] =+	happyDoAction 94# notHappyAtAll action sts stk []++happyNewToken action sts stk (tk:tks) =+	let cont i = happyDoAction i tk action sts stk tks in+	case tk of {+	RETURN -> cont 1#;+	SOME -> cont 2#;+	EVERY -> cont 3#;+	IF -> cont 4#;+	THEN -> cont 5#;+	ELSE -> cont 6#;+	LB -> cont 7#;+	RB -> cont 8#;+	LP -> cont 9#;+	RP -> cont 10#;+	LSB -> cont 11#;+	RSB -> cont 12#;+	TO -> cont 13#;+	PLUS -> cont 14#;+	MINUS -> cont 15#;+	TIMES -> cont 16#;+	DIV -> cont 17#;+	IDIV -> cont 18#;+	MOD -> cont 19#;+	TEQ -> cont 20#;+	TNE -> cont 21#;+	TLT -> cont 22#;+	TLE -> cont 23#;+	TGT -> cont 24#;+	TGE -> cont 25#;+	PRE -> cont 26#;+	POST -> cont 27#;+	IS -> cont 28#;+	SEQ -> cont 29#;+	SNE -> cont 30#;+	SLT -> cont 31#;+	SLE -> cont 32#;+	SGT -> cont 33#;+	SGE -> cont 34#;+	AND -> cont 35#;+	OR -> cont 36#;+	NOT -> cont 37#;+	UNION -> cont 38#;+	INTERSECT -> cont 39#;+	EXCEPT -> cont 40#;+	FOR -> cont 41#;+	LET -> cont 42#;+	IN -> cont 43#;+	AS -> cont 44#;+	COMMA -> cont 45#;+	ASSIGN -> cont 46#;+	WHERE -> cont 47#;+	ORDER -> cont 48#;+	BY -> cont 49#;+	ASCENDING -> cont 50#;+	DESCENDING -> cont 51#;+	ELEMENT -> cont 52#;+	ATTRIBUTE -> cont 53#;+	STAG -> cont 54#;+	ETAG -> cont 55#;+	SATISFIES -> cont 56#;+	ATSIGN -> cont 57#;+	SLASH -> cont 58#;+	QName happy_dollar_dollar -> cont 59#;+	DECLARE -> cont 60#;+	FUNCTION -> cont 61#;+	VARIABLE -> cont 62#;+	VIEW -> cont 63#;+	AT -> cont 64#;+	DOTS -> cont 65#;+	DOT -> cont 66#;+	SEMI -> cont 67#;+	COLON -> cont 68#;+	INSERT -> cont 69#;+	DELETE -> cont 70#;+	REPLACE -> cont 71#;+	TYPE -> cont 72#;+	INTO -> cont 73#;+	FROM -> cont 74#;+	WITH -> cont 75#;+	INSTANCE -> cont 76#;+	OF -> cont 77#;+	QMARK -> cont 78#;+	CAST -> cont 79#;+	CASTABLE -> cont 80#;+	CASE -> cont 81#;+	DEFAULT -> cont 82#;+	TYPESWITCH -> cont 83#;+	IMPORT -> cont 84#;+	NAMESPACE -> cont 85#;+	SCHEMA -> cont 86#;+	VALIDATE -> cont 87#;+	Variable happy_dollar_dollar -> cont 88#;+	XMLtext happy_dollar_dollar -> cont 89#;+	TInteger happy_dollar_dollar -> cont 90#;+	TFloat happy_dollar_dollar -> cont 91#;+	TString happy_dollar_dollar -> cont 92#;+	TokenEOF -> cont 93#;+	_ -> happyError' (tk:tks)+	}++happyError_ tk tks = happyError' (tk:tks)++newtype HappyIdentity a = HappyIdentity a+happyIdentity = HappyIdentity+happyRunIdentity (HappyIdentity a) = a++instance Monad HappyIdentity where+    return = HappyIdentity+    (HappyIdentity p) >>= q = q p++happyThen :: () => HappyIdentity a -> (a -> HappyIdentity b) -> HappyIdentity b+happyThen = (>>=)+happyReturn :: () => a -> HappyIdentity a+happyReturn = (return)+happyThen1 m k tks = (>>=) m (\a -> k a tks)+happyReturn1 :: () => a -> b -> HappyIdentity a+happyReturn1 = \a tks -> (return) a+happyError' :: () => [(Token)] -> HappyIdentity a+happyError' = HappyIdentity . parseError++parse tks = happyRunIdentity happySomeParser where+  happySomeParser = happyThen (happyParse 0# tks) (\x -> happyReturn (happyOut4 x))++happySeq = happyDontSeq+++-- Abstract Syntax Tree for XQueries+data Ast = Ast String [Ast]+         | Avar String+         | Aint Int+         | Afloat Double+         | Astring String+         deriving Eq+++instance Show Ast+  where show (Ast s []) = s ++ "()"+        show (Ast s (x:xs)) = s ++ "(" ++ show x+                              ++ foldr (\a r -> ","++show a++r) "" xs+                              ++ ")"+        show (Avar s) = s+        show (Aint n) = show n+        show (Afloat n) = show n+        show (Astring s) = "\'" ++ s ++ "\'"+++screenSize = 80::Int++prettyAst :: Ast -> Int -> (String,Int)+prettyAst (Avar s) p = (s,(length s)+p)+prettyAst (Aint n) p = let s = show n in (s,(length s)+p)+prettyAst (Afloat n) p = let s = show n in (s,(length s)+p)+prettyAst (Astring s) p = ("\'" ++ s ++ "\'",(length s)+p+2)+prettyAst (Ast s args) p+    = let (ps,np) = prettyArgs args+      in (s++"("++ps++")",np+1)+    where prettyArgs [] = ("",p+1)+          prettyArgs xs = let ss = show (head xs) ++ foldr (\a r -> ","++show a++r) "" (tail xs)+                              np = (length s)+p+1+                          in if (length ss)+p < screenSize+                             then (ss,(length ss)+p)+                             else let ds = map (\x -> let (s,ep) = prettyAst x np+                                                      in (s ++ ",\n" ++ space np,ep)) (init xs)+                                      (ls,lp) = prettyAst (last xs) np+                                  in (concatMap fst ds ++ ls,lp)+          space n = replicate n ' '+++ppAst :: Ast -> String+ppAst e = let (s,_) = prettyAst e 0 in s+++call :: String -> [Ast] -> Ast+call name args = Ast "call" ((Avar name):args)+++concatenateAll :: [Ast] -> Ast+concatenateAll [x] = x+concatenateAll (x:xs) = foldl (\a r -> call "concatenate" [a,r]) x xs+concatenateAll _ = call "empty" []+++concatAll :: [Ast] -> Ast+concatAll [x] = call "string" [x]+concatAll (x:xs) = foldl (\a r -> call "concatenate" [call "string" [a],r]) x xs+concatAll _ = call "empty" []+++mkPairs = map (\(x,y) -> Ast "pair" [x,y])+++path_steps = ["child", "descendant", "attribute", "self", "descendant-or-self", "following-sibling", "following",+              "attribute-descendant", "parent", "ancestor", "preceding-sibling", "preceding", "ancestor-or-self" ]+++data Token+  = RETURN | SOME | EVERY | IF | THEN | ELSE | LB | RB | LP | RP | LSB | RSB+  | TO | PLUS | MINUS | TIMES | DIV | IDIV | MOD | AS | QMARK+  | TEQ | TNE | TLT | TLE | TGT | TGE | SEQ | SNE | SLT | SLE | SGT | SGE+  | AND | OR | NOT | UNION | INTERSECT | EXCEPT | FOR | LET | IN | COMMA+  | ASSIGN | WHERE | ORDER | BY | ASCENDING | DESCENDING | ELEMENT+  | ATTRIBUTE | STAG | ETAG | SATISFIES | ATSIGN | SLASH | DECLARE | SEMI | COLON+  | FUNCTION | VARIABLE | VIEW | AT | DOT | DOTS | TokenEOF | PRE | POST | IS+  | INSERT | INTO | DELETE | FROM | REPLACE | TYPE | WITH | INSTANCE | OF+  | CAST | CASTABLE | CASE | DEFAULT | TYPESWITCH | IMPORT | NAMESPACE | SCHEMA | VALIDATE+  | QName String | Variable String | XMLtext String | TInteger Int+  | TFloat Double | TString String | TError String+    deriving Eq+++instance Show Token+    where show (QName s) = "QName("++s++")"+	  show (Variable s) = "Variable("++s++")"+	  show (XMLtext s) = "XMLtext("++s++")"+	  show (TInteger n) = "Integer("++(show n)++")"+	  show (TFloat n) = "Double("++(show n)++")"+	  show (TString s) = "String("++s++")"+	  show (TError s) = "'"++s++"'"+          show t = case filter (\(n,_) -> n==t) tokenList of+                     (_,b):_ -> b+                     _ -> "Illegal token"+++printToken (QName s) = s+printToken (Variable s) = "$"++s+printToken (XMLtext s) = "'"++s++"'"+printToken (TInteger n) = show n+printToken (TFloat n) = show n+printToken (TString s) = "\""++s++"\""+printToken (TError s) = "error("++s++")"+printToken t = case filter (\(n,_) -> n==t) tokenList of+           (_,b):_ -> b+           _ -> "Illegal token"+++tokenList :: [(Token,String)]+tokenList = [(TokenEOF,"EOF"),(RETURN,"return"),(SOME,"some"),(EVERY,"every"),(IF,"if"),(THEN,"then"),(ELSE,"else"),+             (LB,"["),(RB,"]"),(LP,"("),(RP,")"),(LSB,"{"),(RSB,"}"),(QMARK,"?"),+             (TO,"to"),(PLUS,"+"),(MINUS,"-"),(TIMES,"*"),(DIV,"div"),(IDIV,"idiv"),(MOD,"mod"),+             (TEQ,"="),(TNE,"!="),(TLT,"<"),(TLE,"<="),(TGT,">"),(TGE,">="),(PRE,"<<"),(POST,">>"),+             (IS,"is"),(SEQ,"eq"),(SNE,"ne"),(SLT,"lt"),(SLE,"le"),(SGT,"gt"),(SGE,"ge"),(AND,"and"),+             (OR,"or"),(NOT,"not"),(UNION,"|"),(INTERSECT,"intersect"),(EXCEPT,"except"),+             (FOR,"for"),(LET,"let"),(IN,"in"),(AS,"as"),(COMMA,"','"),(ASSIGN,":="),(WHERE,"where"),(ORDER,"order"),+             (BY,"by"),(ASCENDING,"ascending"),(DESCENDING,"descending"),(ELEMENT,"element"),+             (ATTRIBUTE,"attribute"),(STAG,"</"),(ETAG,"/>"),(SATISFIES,"satisfies"),(ATSIGN,"@"),+             (SLASH,"/"),(DECLARE,"declare"),(FUNCTION,"function"),(VARIABLE,"variable"),(VIEW,"view"),+  	     (INSERT,"insert"),(INTO,"into"),(DELETE,"delete"),(FROM,"from"),(REPLACE,"replace"),(WITH,"with"),+             (TYPE,"type"),(AT,"at"),(DOTS,".."),(DOT,"."),(SEMI,";"),(COLON,":"),(INSTANCE,"instance"),(OF,"of"),+             (CAST,"cast"),(CASTABLE,"castable"),(CASE,"case"),(DEFAULT,"default"),(TYPESWITCH,"typeswitch"),+             (VALIDATE,"validate")]+++parseError tk = error (case tk of+                         ((TError s):_) -> "Parse error: "++s+                         (TokenEOF:_) -> "Parse error: Unexpected end of file"+		         _ -> "Parse error: "++(foldr (\a r -> (printToken a)++" "++r) "" (init (take 11 tk))))+++scan :: String -> [Token]+scan cs = lexer cs ""+++xmlText :: String -> [Token]+xmlText "" = []+xmlText text = [XMLtext text]+++-- scans XML syntax and returns an XMLtext token with the text+xml :: String -> String -> String -> [Token]+xml ('{':cs) text n = (xmlText text)++(LSB : lexer cs ('{':n))+xml ('<':'/':cs) text n = (xmlText text)++(STAG : lexer cs ('<':'/':n))+xml ('<':'!':'-':cs) text n = xmlComment cs (text++"<!-") n+xml ('<':'?':cs) text n = xmlComment cs (text++"<?") n+xml ('<':cs) text n = (xmlText text)++(TLT : lexer cs ('<':n))+xml ('(':':':cs) text n = xqComment cs text n+xml (c:cs) text n = xml cs (text++[c]) n+xml [] text _ = xmlText text+++xqComment :: String -> String -> String -> [Token]+xqComment (':':')':cs) text n = xml cs text n+xqComment (_:cs) text n = xqComment cs text n+xqComment [] text _ = xmlText text+++xmlComment :: String -> String -> String -> [Token]+xmlComment ('-':'!':'>':cs) text n = xml cs (text++"-!>") n+xmlComment ('?':'>':cs) text n = xml cs (text++"?>") n+xmlComment (c:cs) text n = xmlComment cs (text++[c]) n+xmlComment [] text _ = xmlText text+++isQN :: Char -> Bool+isQN c = elem c "_-." || isDigit c || isAlpha c+++isVar :: Char -> Bool+isVar c = elem c "_-." || isDigit c || isAlpha c+++inXML :: String -> Bool+inXML ('>':'<':_) = True+inXML _ = False+++-- the XQuery scanner+lexer :: String -> String -> [Token]+lexer [] "" = [ TokenEOF ]+lexer [] _ = [ TError "Unexpected end of input" ]+lexer (' ':'>':' ':cs) n = TGT : lexer cs n+lexer (c:cs) n+      | isSpace c = lexer cs n+      | isAlpha c || c=='_' = lexVar (c:cs) n+      | isDigit c = lexNum (c:cs) n+lexer ('$':c:cs) n | isAlpha c+      = let (var,rest) = span isVar (c:cs)+        in (Variable var) : lexer rest n+lexer (':':'=':cs) n = ASSIGN : lexer cs n+lexer ('<':'/':cs) n = STAG : lexer cs ('<':'/':n)+lexer ('<':'=':cs) n = TLE : lexer cs n+lexer ('>':'=':cs) n = TGE : lexer cs n+lexer ('<':'<':cs) n = PRE : lexer cs n+lexer ('>':'>':cs) n = POST : lexer cs n+lexer ('/':'>':cs) m = case m of+                         '<':n -> ETAG : (if inXML n then xml cs "" n else lexer cs n)+                         _ -> [ TError "Unexpected token: '/>'" ]+lexer ('(':':':cs) n = lexComment cs n+lexer ('<':'!':'-':cs) n = lexXmlComment cs "<!-" n+lexer ('<':'?':cs) n = lexXmlComment cs "<?" n+lexer ('.':'.':cs) n = DOTS : lexer cs n+lexer ('.':cs) n = DOT : lexer cs n+lexer ('!':'=':cs) n = TNE : lexer cs n+lexer ('\'':cs) n = lexString cs "" ('\'':n)+lexer ('\"':cs) n = lexString cs "" ('\"': n)+lexer ('[':cs) n = LB : lexer cs n+lexer (']':cs) n = RB : lexer cs n+lexer ('(':cs) n = LP : lexer cs n+lexer (')':cs) n = RP : lexer cs n+lexer ('}':cs) m = case m of+                     '{':'\"':n -> RSB : lexString cs "" ('\"':n)+                     '{':'\'':n -> RSB : lexString cs "" ('\'':n)+                     '{':n -> RSB : (if inXML n then xml cs "" n else lexer cs n)+                     _ -> [ TError "Unexpected token: '}'" ]+lexer ('+':cs) n = PLUS : lexer cs n+lexer ('-':cs) n = MINUS : lexer cs n+lexer ('*':cs) n = TIMES : lexer cs n+lexer ('=':cs) n = TEQ : lexer cs n+lexer ('<':c:cs) n = TLT : (lexer (c:cs) (if isAlpha c then ('<':n) else n))+lexer ('>':cs) m = case m of+                     '<':'/':'>':'<':n -> TGT : (if inXML n then xml cs "" n else lexer cs n)+                     '<':n -> TGT : xml cs "" ('>':m) +                     _ -> TGT : lexer cs m+lexer (',':cs) n = COMMA : lexer cs n+lexer ('@':cs) n = ATSIGN : lexer cs n+lexer ('?':cs) n = QMARK : lexer cs n+lexer ('/':cs) n = SLASH : lexer cs n+lexer ('{':cs) n = LSB : lexer cs ('{':n)+lexer ('|':cs) n = UNION : lexer cs n+lexer (';':cs) n = SEMI : lexer cs n+lexer (':':cs) n = COLON : lexer cs n+lexer (c:cs) n = TError ("Illegal character: '"++[c,'\'']) : lexer cs n+++lexExp :: String -> (String,String)+lexExp (e:cs)+    | e == 'e' || e == 'E'+    = case cs of+        '+':rest -> span isDigit rest+        '-':rest -> let (s,rest1) = span isDigit rest+                    in ('-':s,rest1)+        rest -> span isDigit rest+lexExp cs = ("",cs)+++lexNum :: String -> String -> [Token]+lexNum cs n+    = let (si,rest) = span isDigit cs+      in case rest of+           '.':rest1+               -> let (sd,rest2) = span isDigit rest1+                  in case lexExp rest2 of+                       ("",_) -> (TFloat (read $ si ++ "." ++ sd)) : lexer rest2 n+                       (exp,rest3) -> (TFloat (read $ si ++ "." ++ sd ++ "e" ++ exp)) : lexer rest3 n+           _ -> case lexExp rest of+                  ("",_) -> (TInteger (read si)) : lexer rest n+                  (exp,rest3) -> (TFloat (read $ si ++ "e" ++ exp)) : lexer rest3 n+++lexString :: String -> String -> String -> [Token]+lexString ('\"':cs) s m = case m of+                            '\"':n -> (TString s) : (lexer cs n)+                            _ -> lexString cs (s++"\"") m+lexString ('\'':cs) s m = case m of+                            '\'':n -> (TString s) : (lexer cs n)+                            _ -> lexString cs (s++"\'") m+-- a string in an attribute value must evaluate between {}+lexString ('{':cs) s (c:'<':n) = (TString s) : LSB : (lexer cs ('{':c:'<':n))+lexString ('\\':'n':cs) s n = lexString cs (s++['\n']) n+lexString ('\\':'r':cs) s n = lexString cs (s++['\r']) n+lexString (c:cs) s n = lexString cs (s++[c]) n+lexString [] s n = [ TError "End of input while in string" ]+++lexComment :: String -> String -> [Token]+lexComment (':':')':cs) n = lexer cs n+lexComment (_:cs) n = lexComment cs n+lexComment [] n = [ TError "End of input while in comment" ]+++lexXmlComment :: String -> String -> String -> [Token]+lexXmlComment ('-':'!':'>':cs) text n = (xmlText (text++"-!>"))++(lexer cs n)+lexXmlComment ('?':'>':cs) text n = (xmlText (text++"?>"))++(lexer cs n)+lexXmlComment (c:cs) text n = lexXmlComment cs (text++[c]) n+lexXmlComment [] text _ = xmlText text+++lexVar :: String -> String -> [Token]+lexVar cs n =+    let (nm,rest) = span isQN cs+        token = case nm of+          "return" -> RETURN+          "some" -> SOME+          "every" -> EVERY+          "if" -> IF+          "then" -> THEN+          "else" -> ELSE+          "to" -> TO+          "div" -> DIV+          "idiv" -> IDIV+          "mod" -> MOD+          "and" -> AND+          "or" -> OR+          "not" -> NOT+          "union" -> UNION+          "intersect" -> INTERSECT+          "except" -> EXCEPT+          "for" -> FOR+          "let" -> LET+          "in" -> IN+          "as" -> AS+          "where" -> WHERE+          "order" -> ORDER+          "by" -> BY+          "ascending" -> ASCENDING+          "descending" -> DESCENDING+          "element" -> ELEMENT+          "attribute" -> ATTRIBUTE+          "satisfies" -> SATISFIES+          "declare" -> DECLARE+          "function" -> FUNCTION+          "variable" -> VARIABLE+          "namespace" -> NAMESPACE+          "view" -> VIEW+          "at" -> AT+          "eq" -> SEQ+          "ne" -> SNE+          "lt" -> SLT+          "le" -> SLE+          "gt" -> SGT+          "ge" -> SGE+          "is" -> IS+	  "insert" -> INSERT+	  "into" -> INTO+	  "delete" -> DELETE+	  "from" -> FROM+	  "replace" -> REPLACE+	  "type" -> TYPE+	  "with" -> WITH+          "instance" -> INSTANCE+          "of" -> OF+          "cast" -> CAST+          "castable" -> CASTABLE+          "case" -> CASE+          "default" -> DEFAULT+          "typeswitch" -> TYPESWITCH+          "schema" -> SCHEMA+          "import" -> IMPORT+          "validate" -> VALIDATE           var -> QName var     in case token of          QName v1 -> case rest of
+ src/Text/XML/HXQ/TypeInference.hs view
@@ -0,0 +1,522 @@+{-------------------------------------------------------------------------------------+-+- The XQuery polymorphic type inference system+- Programmer: Leonidas Fegaras+- Based on P. Wadler's work on XQuery type checking+-   and on "Typing Haskell in Haskell" by Mark P. Jones+- Email: fegaras@cse.uta.edu+- Web: http://lambda.uta.edu/+- Creation: 08/10/09, last update: 09/29/09+- +- Copyright (c) 2009 by Leonidas Fegaras, the University of Texas at Arlington. All rights reserved.+- This material is provided as is, with absolutely no warranty expressed or implied.+- Any use is at your own risk. Permission is hereby granted to use or copy this program+- for any purpose, provided the above notices are retained on all copies.+-+--------------------------------------------------------------------------------------}+++module Text.XML.HXQ.TypeInference(typeInference,typeCheck) where++import List(nub,intersect,union)+import Control.Monad+import Text.XML.HXQ.Parser+import Text.XML.HXQ.XTree+import Text.XML.HXQ.Functions+import Text.XML.HXQ.Types+import Debug.Trace+++type Subst = [(TVar,Type)]+++apply :: Subst -> Type -> Type+apply s t@(TVariable v)+      = case lookup v s of+          Just bt -> bt+          _ -> t+apply s (TElement n t)+    = TElement n (apply s t)+apply s (TAttribute n t)+    = TAttribute n (apply s t)+apply s (TSequence t1 t2)+    = TSequence (apply s t1) (apply s t2)+apply s (TInterleaving t1 t2)+    = TInterleaving (apply s t1) (apply s t2)+apply s (TChoice t1 t2)+    = TChoice (apply s t1) (apply s t2)+apply s (TQualified t c)+    = TQualified (apply s t) c+apply s t = t+++tv :: Type -> [TVar]+tv (TVariable v) = [v]+tv (TElement n t) = tv t+tv (TAttribute n t) = tv t+tv (TSequence t1 t2) = union (tv t1) (tv t2)+tv (TInterleaving t1 t2) = union (tv t1) (tv t2)+tv (TChoice t1 t2) = union (tv t1) (tv t2)+tv (TQualified t c) = tv t+tv t = []+++compose :: Subst -> Subst -> Subst+compose s1 s2 = [ (v,apply s1 t) | (v,t) <- s2 ] ++ s1+++merge :: Subst -> Subst -> Maybe Subst+merge s1 s2+    = if all (\v -> apply s1 (TVariable v) == apply s2 (TVariable v))+             (intersect (map fst s1) (map fst s2))+      then Just $ s1++s2+      else Nothing+++varBind :: TVar -> Type -> Maybe Subst+varBind v (TVariable w) | v == w = Just []+varBind v t+    = if elem v (tv t) then Nothing else Just [(v,t)]+++makeSequence ts+    = simplifyType $ ms ts+      where ms [] = TEmpty+            ms [t] = t+            ms (t:ts) = TSequence t (ms ts)+++simplifyType t+    = st t+      where st t+                = case t of+                    TSequence TEmpty t -> st t+                    TSequence t TEmpty -> st t+                    TInterleaving TEmpty t -> st t+                    TInterleaving t TEmpty -> st t+                    TQualified TEmpty _ -> TEmpty+                    TQualified (TQualified t q1) q2+                        -> st (TQualified t (if q1=='*' || q2=='*' then '*' else if q1=='+' || q2=='+' then '+' else '?'))+                    TChoice TEmpty t -> st (TQualified t '?')+                    TChoice t TEmpty -> st (TQualified t '?')+                    TChoice t1 t2 | t1 == t2 -> st t1+                    TSequence t1 t2 -> TSequence (st t1) (st t2)+                    TInterleaving t1 t2 -> TInterleaving (st t1) (st t2)+                    TChoice t1 t2 -> TChoice (st t1) (st t2)+                    TQualified t q -> TQualified (st t) q+                    _ -> t+++xpathStep :: Type -> String -> String -> NS -> Type+xpathStep t step tag ns+    = xps t+      where xps t@(TElement n t')+                = case step of+                    "self" -> if n==tag || tag=="*" then t else TEmpty+                    "child" -> xpathStep t' "self" tag ns+                    "descendant" -> xpathStep t' "descendant-or-self" tag ns+                    "descendant-or-self"+                        -> if n==tag || tag=="*"+                           then makeSequence [t,xpathStep t' "descendant-or-self" tag ns]+                           else xpathStep t' "descendant-or-self" tag ns+                    "attribute-self" -> xpathStep t' "" tag ns+                    "attribute-descendant" -> xps t'+                    _ -> tNode+            xps t@(TAttribute n t')+                = case step of+                    "attribute-self" -> if n==tag || tag=="*" then t else TEmpty+                    "attribute-descendant"+                        -> if n==tag || tag=="*" then makeSequence [t,xps t'] else xps t'+                    _ -> TEmpty+            xps (TSequence t1 t2)+                = makeSequence [xps t1,xps t2]+            xps (TInterleaving t1 t2)+                = simplifyType $ TInterleaving (xps t1) (xps t2)+            xps (TChoice t1 t2)+                = simplifyType $ TChoice (xps t1) (xps t2)+            xps (TQualified t c)+                = simplifyType $ TQualified (xps t) c+            xps t+                | t == tItem+                = case expandQName (QName "" (defaultElementNS ns) tag) ns of+                    t'@(TElement _ _) -> t'+                    t' ->  TElement tag t'+            xps t = TEmpty+++collectAttributes :: Type -> (Type,[Type])+collectAttributes = ca+    where ca (TSequence t1 t2)+              = let (t1',a1) = ca t1+                    (t2',a2) = ca t2+                in (TSequence t1' t2',a1++a2)+          ca (TChoice t1 t2)+              = let (t1',a1) = ca t1+                    (t2',a2) = ca t2+                in (TChoice t1' t2',a1++a2)+          ca (TInterleaving t1 t2)+              = let (t1',a1) = ca t1+                    (t2',a2) = ca t2+                in (TInterleaving t1' t2',a1++a2)+          ca (TQualified t c)+              = let (t',a) = ca t+                in (TQualified t' c,a)+          ca t@(TAttribute _ _) = (TEmpty,[t])+          ca t = (t,[])+++normalizeType :: Type -> [[Type]]+normalizeType = nt+    where nt (TSequence t1 t2)+              = [ p1++p2 | p1 <- nt t1, p2 <- nt t2 ]+          nt (TChoice t1 t2)+              = union (nt t1) (nt t2)+          nt (TInterleaving t1 t2)+              = let ps1 = nt t1+                    ps2 = nt t2+                in union [ p1++p2 | p1 <- ps1, p2 <- ps2 ]+                         [ p2++p1 | p1 <- ps1, p2 <- ps2 ]+          nt (TElement n t)+              = [ [TElement n (makeSequence p)] | p <- nt t ]+          nt (TQualified t '?')+              = union (nt t) [[]]+          nt TEmpty = []+          nt t = [[t]]+++strip :: Type -> Type+strip t+    = case p t of+        [] -> TEmpty+        [t] -> t+        ts -> foldr1 TChoice ts+      where p TEmpty = []+            p (TSequence t1 t2) = union (p t1) (p t2)+            p (TInterleaving t1 t2) = union (p t1) (p t2)+            p (TChoice t1 t2) = union (p t1) (p t2)+            p (TQualified t c) = p t+            p t = [t]+++dotQual :: Char -> Char -> Char+dotQual q1 q2+    = if q2=='0' then '0'+      else case q1 of+             '0' -> '0'+             '-' -> q2+             '?' -> if elem q2 "-?" then '?' else '*'+             '+' -> if elem q2 "-+" then '+' else '*'+             '*' -> '*'+++makeDot :: Type -> Char -> Type+makeDot t q+    = case dotQual (qualifier t) q of+        '0' -> TEmpty+        '-' -> strip t+        c -> TQualified (strip t) c+++leqQual :: Char -> Char -> Bool+leqQual q1 q2+    = case q1 of+        '0' -> elem q2 "0?*"+        '-' -> elem q2 "-?+*"+        '?' -> elem q2 "?*"+        '+' -> elem q2 "+*"+        '*' -> q2=='*'+++qualifier :: Type -> Char+qualifier t+    = q t+      where q TEmpty = '0'+            q (TSequence t1 t2)+                = let q1 = q t1+                      q2 = q t2+                  in if q2=='0' then q1+                     else case q1 of+                            '0' -> q2+                            '-' -> '+'+                            '?' -> if elem q2 "-+" then '+' else '*'+                            '+' -> '+'+                            '*' -> if elem q2 "-+" then '+' else '*'+            q (TInterleaving t1 t2) = q (TSequence t1 t2)+            q (TChoice t1 t2)+                = let q1 = q t1+                      q2 = q t2+                  in case q1 of+                       '0' -> if q2=='-' then '?' else if q2=='+' then '*' else q2+                       '-' -> if q2=='0' then '?' else q2+                       '?' -> if elem q2 "+*" then '*' else '?'+                       '+' -> if elem q2 "-+" then '+' else '*'+                       '*' -> '*'+            q (TQualified t c)+                = dotQual (q t) c+            q t = '-'+++subtype :: String -> String -> Bool+subtype n m+    = n == m+      || m == "string"+      || n == "string"+      || (m == "numeric" && elem n ["integer", "decimal", "float", "double"])+      || (n == "numeric" && elem m ["integer", "decimal", "float", "double"])+      || (n /= "anyAtomicType" && n /= "numeric" && isBuildInType n && subtype (findA n buildInTypes) m)+++mguL :: [Type] -> [Type] -> Maybe Subst+mguL [] []+    = Just []+mguL (t1:ts1) (t2:ts2)+    = liftM2 compose (mgu t1 t2) (mguL ts1 ts2)+mguL _ _ = Nothing+++-- most general unifier with subtyping t1<=t2+mgu :: Type -> Type -> Maybe Subst+mgu (TVariable v) t = varBind v t+mgu t (TVariable v) = varBind v t+mgu (TBase n) (TBase m)+    = if uri n==xsNamespace && uri m==xsNamespace+         && (subtype (localName n) (localName m))+      then Just []+      else Nothing+mgu (TElement n1 t1@(TBase n)) t2@(TBase m)+    = mgu t1 t2+mgu _ TAny = Just []+mgu TAny _ = Just []+mgu _ (TItem "item") = Just []+mgu (TItem n) (TItem "node") = Just []+mgu (TElement n1 t1) (TElement n2 t2)+    | n1 == n2 || n2 == "*"+    = mgu t1 t2+mgu (TAttribute n1 t1) (TAttribute n2 t2)+    | n1 == n2 || n2 == "*"+    = mgu t1 t2+mgu (TQualified t1 c1) (TQualified t2 c2)+    = if leqQual c1 c2+      then mgu t1 t2+      else Nothing+mgu (TSequence t1 t2) t3@(TQualified _ '*')+    = liftM2 compose (mgu t1 t3) (mgu t2 t3)+mgu t1 (TQualified t2 c)+    = mgu t1 t2+mgu t1 t2+    | length nt1 + length nt2 > 2+    = msum [ foldr (liftM2 compose) (Just [])+                   [ mguL p1 p2 | p2 <- nt2 ]+           | p1 <- nt1 ]+    where nt1 = normalizeType t1+          nt2 = normalizeType t2+mgu t1 t2 = Nothing+++newtype TI a = TI (Subst -> Int -> (Subst,Int,a))++instance Monad TI where+    return x = TI(\s n -> (s,n,x))+    TI c >>= f = TI(\s n -> let (s',m,x) = c s n; TI fx = f x in fx s' m)+++runTI :: TI a -> a+runTI (TI c) = let (s,n,result) = c [] 0 in result+++getSubst :: TI Subst+getSubst = TI(\s n -> (s,n,s))+++extSubst :: Subst -> TI()+extSubst s' = TI(\s n -> (compose s' s,n,()))+++unifyT :: Ast -> Type -> Type -> TI() -> TI()+unifyT e t1 t2 c+    = do s <- getSubst+         case mgu (apply s t1) (apply s t2) of+           Just s' -> extSubst s'+           Nothing -> c+++unify :: Ast -> Type -> Type -> TI()+unify e t1 t2+    = unifyT e t1 t2 (error $ "Incompatible type in "++show e++" (expected: "+                              ++show t1++", found: "++show t2++")")+++unifyL :: Ast -> [Type] -> [Type] -> TI()+unifyL e ts1 ts2+    = do s <- getSubst+         case mguL (map (apply s) ts1) (map (apply s) ts2) of+           Just s' -> extSubst s'+           Nothing -> error $ "Incompatible types in "++show e++" (expected: "+                              ++show ts1++", found: "++show ts2++")"+++newTVar :: TI Type+newTVar = TI(\s n -> (s,n+1,TVariable n))+++-- type assumptions for the XQuery variables+type Assumptions = [(String,Type)]+++-- function signatures+type Signatures = [(String,([Type],Type))]+++functionSignatures :: NS -> Signatures+functionSignatures ns+    = map (\(fn,len,otp:tps,_,_) -> (fn,(tps,otp))) systemFunctions+++-- XQuery Type Inference+typeInf :: Ast -> Assumptions -> Type -> Signatures -> NS -> TI Type+typeInf e assumptions context fncs ns+  = do t <- (ti $! e) assumptions context+       s <- getSubst+       --trace (show e++" "++show assumptions++" "++show s++" -> "++show t) (return t)+       return t+  where+    ti e assumptions context =+     case e of+      Avar "." -> return context+      Avar v -> return (findV v assumptions)+      Ast "global" [Avar v] -> return (findV v assumptions)+      Aint n -> return tInt+      Afloat n -> return tFloat+      Astring s -> return tString+      Ast "nonIO" [u] -> typeInf u assumptions context fncs ns+      Ast "context" [v,Astring dp,body]+          -> do vt <- typeInf v assumptions context fncs ns+                typeInf body assumptions vt fncs ns+      Ast "call" [Avar "position"] -> return tInt+      Ast "call" [Avar "last"] -> return tInt+      Ast "call" [Avar f,Astring file]+          | elem f ["doc","fn:doc"]+          -> return (TItem "item")+      Ast "call" [Avar "debug",c]+          -> typeInf c assumptions context fncs ns+      Ast "call" [Avar "eval",x]+          -> do tx <- typeInf x assumptions context fncs ns+                () <- unify x tx tString+                newTVar+      Ast "step" (Avar step:Astring tag:e:preds)+          -> do te <- typeInf e assumptions context fncs ns+                let te' = xpathStep te step tag ns+                _ <- mapM (\p -> do tp <- typeInf p assumptions te' fncs ns+                                    unifyT p tp tBool (unify p tp tNumeric)) preds+                return te'+      Ast "filter" (e:preds)+          -> do te <- typeInf e assumptions context fncs ns+                _ <- mapM (\p -> do tp <- typeInf p assumptions te fncs ns+                                    unifyT p tp tBool (unify p tp tNumeric)) preds+                return te+      Ast "predicate" [condition,body]+          -> do tb <- typeInf body assumptions context fncs ns+                tc <- typeInf condition assumptions tb fncs ns+                () <- unify condition tc tBool+                return tb+      Ast "append" args+          -> do as <- mapM (\x -> typeInf x assumptions context fncs ns) args+                return $ makeSequence as+      Ast "if" [c,x,y]+          -> do tc <- typeInf c assumptions context fncs ns+                () <- unify c tc tBool+                tt <- typeInf x assumptions context fncs ns+                te <- typeInf y assumptions context fncs ns+                () <- unify e tt te+                return tt+      Ast "validate" [e]+          -> typeInf e assumptions context fncs ns+      Ast "insert" [e1,e2]+          -> do t1 <- typeInf e1 assumptions context fncs ns+                t2 <- typeInf e2 assumptions context fncs ns+                return TEmpty+      Ast "delete" [e]+          -> do te <- typeInf e assumptions context fncs ns+                return TEmpty+      Ast "replace" [e1,e2]+          -> do t1 <- typeInf e1 assumptions context fncs ns+                t2 <- typeInf e2 assumptions context fncs ns+                return TEmpty+      Ast "call" ((Avar "concatenate"):args)+          -> do ts <- mapM (\a -> typeInf a assumptions context fncs ns) args+                return $ makeSequence ts+      Ast "call" ((Avar "concat"):args)+          -> do ts <- mapM (\a -> typeInf a assumptions context fncs ns) args+                return $ tString+      Ast "call" (v@(Avar fname):args)+          -> do ts <- mapM (\a -> typeInf a assumptions context fncs ns) args+                let fn = functionTag fname ns+                    t = tag fname ns+                case filter (\(n,_) -> n == localName fn) (functionSignatures ns) of+                  [] -> if uri t == xsNamespace && isBuildInType (localName t) && length ts == 1+                        then return $ TBase t+                        else case filter (\(n,_) -> n == localName fn) fncs of+                               (_,(params,out)):_+                                   -> if (length params) == (length args)+                                      then do () <- unifyL e ts params+                                              return out+                                      else error ("Wrong number of arguments in function call: "++fname)+                               _ -> error ("Undefined function: "++fname)+                  fs -> case filter (\(_,(pts,_)) -> length args == length pts) fs of+                          [] -> error ("wrong number of arguments in function call: " ++ fname)+                          fs' -> case filter (\(_,(pts,ot)) -> mguL ts pts /= Nothing) fs' of+                                   [(_,(pts,ot))] -> do () <- unifyL e ts pts+                                                        return ot+                                   _ -> error ("Incompatible arguments in function call: "++fname++show ts+                                               ++"\n(expected "++concatMap (\(_,(pts,_)) -> show pts++" ") fs'++")")+      Ast "construction" [tag,id,parent,Ast "attributes" al,body]+             -> do tt <- typeInf tag assumptions context fncs ns+                   () <- unify e tt tString+                   tb <- typeInf body assumptions context fncs ns+                   let (tb',ats) = collectAttributes tb+                   alc <- mapM (\(Ast "pair" [a,v])+                                    -> do ta <- typeInf a assumptions context fncs ns+                                          () <- unify a ta tString+                                          tv <- typeInf v assumptions context fncs ns+                                          return $ TAttribute (case a of Astring n -> n; _ -> "*") tv) al+                   return $ TElement (case tag of Astring n -> n; _ -> "*")+                                     (makeSequence (alc++ats++[tb']))+      Ast "attribute_construction" [name,value]+          -> do tn <- typeInf name assumptions context fncs ns+                () <- unify e tn tString+                tv <- typeInf value assumptions context fncs ns+                return $ TAttribute (case name of Astring n -> n; _ -> "*") tv+      Ast "let" [Avar var,source,body]+          -> do ts <- typeInf source assumptions context fncs ns+                typeInf body ((var,ts):assumptions) context fncs ns+      Ast "for" [Avar var,Avar "$",source,body]      -- a for-loop without an index+          -> do ts <- typeInf source assumptions context fncs ns+                let te = strip ts+                ot <- typeInf body ((var,te):assumptions) context fncs ns+                return $ makeDot ot (qualifier ts)+      Ast "for" [Avar var,Avar ivar,source,body]     -- a for-loop with an index+          -> do ts <- typeInf source assumptions context fncs ns+                let te = strip ts+                ot <- typeInf body ((var,te):(ivar,tInt):assumptions) context fncs ns+                return $ makeDot ot (qualifier ts)+      Ast "sortTuple" (exp:orderBys)             -- prepare each FLWOR tuple for sorting+          -> do te <- typeInf exp assumptions context fncs ns+                _ <- mapM (\a -> typeInf a assumptions context fncs ns) orderBys+                return te+      Ast "sort" (exp:ordList)+          -> typeInf exp assumptions context fncs ns+      Ast "type" [e]+          -> return $ toType e ns+      _ -> error ("Illegal XQuery: "++(show e))+++typeInference :: Ast -> Assumptions -> Signatures -> NS -> Type+typeInference e as fncs ns+    = runTI $ typeInf e as (error "Unspecified context") fncs ns+++typeCheck :: Ast -> Type -> Assumptions -> Signatures -> NS -> Bool+typeCheck e t as fncs ns+    = runTI $ do t' <- typeInf e as (error "Unspecified context") fncs ns+                 () <- unify e t t'+                 return True
src/Text/XML/HXQ/Types.hs view
@@ -4,9 +4,9 @@ - Programmer: Leonidas Fegaras - Email: fegaras@cse.uta.edu - Web: http://lambda.uta.edu/-- Creation: 01/16/09, last update: 01/16/09+- Creation: 01/16/09, last update: 09/29/09 - -- Copyright (c) 2008 by Leonidas Fegaras, the University of Texas at Arlington. All rights reserved.+- Copyright (c) 2009 by Leonidas Fegaras, the University of Texas at Arlington. All rights reserved. - This material is provided as is, with absolutely no warranty expressed or implied. - Any use is at your own risk. Permission is hereby granted to use or copy this program - for any purpose, provided the above notices are retained on all copies.@@ -14,18 +14,19 @@ --------------------------------------------------------------------------------------}  -module Text.XML.HXQ.Types(readNum,toNum,toInt,toString,toFloat,-                          buildInTypes,isBuildInType,instanceOf,castAs,castableAs) where+module Text.XML.HXQ.Types where -import Char(isDigit)+import Char(isDigit,isSpace)+import List(isSuffixOf,inits,tails) import Text.XML.HXQ.Parser import Text.XML.HXQ.XTree+import XMLParse(XMLEvent(..),parseDocument)+import HXML(Name,AttList)   buildInTypes :: [(String,String)] buildInTypes-    = map (\(n,m) -> ("xs:"++n,"xs:"++m))-      [("untypedAtomic","anyAtomicType"),+    = [("untypedAtomic","anyAtomicType"),        ("dateTime","anyAtomicType"),        ("date","anyAtomicType"),        ("time","anyAtomicType"),@@ -46,14 +47,14 @@        ("NOTATION","anyAtomicType"),        ("yearMonthDuration","duration"),        ("dayTmeDuration","duration"),-       ("Integer","decimal"),-       ("nonPositiveInteger","Integer"),+       ("integer","decimal"),+       ("nonPositiveInteger","integer"),        ("negativeInteger","nonPositiveInteger"),-       ("long","Integer"),+       ("long","integer"),        ("int","long"),        ("short","int"),        ("byte","short"),-       ("nonNegativeInteger","Integer"),+       ("nonNegativeInteger","integer"),        ("unsignedLong","nonNegativeInteger"),        ("unsignedInt","unsignedLong"),        ("unsignedShort","unsignedInt"),@@ -71,21 +72,51 @@        ("ENTITY","NCName")]  +typeHierarchy :: [(String,String)]+typeHierarchy+    = [("anyAtomicType","item"),+       ("node","item"),+       ("attribute","node"),+       ("comment","node"),+       ("document","node"),+       ("element","node"),+       ("processing-instruction","node"),+       ("text","node")]++ isBuildInType :: String -> Bool-isBuildInType "xs:anyAtomicType" = True-isBuildInType name = memV name buildInTypes+isBuildInType "anyAtomicType" = True+isBuildInType "numeric" = True+isBuildInType name = memA name buildInTypes  +baseType s = TBase (QName "xs" xsNamespace s)++tString = baseType "string"+tInt = baseType "integer"+tFloat = baseType "float"+tBool = baseType "boolean"+tAtomic = baseType "anyAtomicType"+tUAtomic = baseType "untypedAtomic"+tItem = TItem "item"+tNode = TItem "node"+tText = TItem "text"+tStar t = TQualified t '*'+tPlus t = TQualified t '+'+tOptional t = TQualified t '?'+tNumeric = TBase (QName "" xsNamespace "numeric")   -- (integer,decimal,float,double)++ -- find the value of a variable in an association list-findV var ((n,b):_) | n==var = b-findV var (_:xs) = findV var xs-findV var _ = error ("Undefined variable: "++var)+findA var ((n,b):_) | n==var = b+findA var (_:xs) = findA var xs+findA var _ = error ("Undefined variable: "++var)   -- is the variable defined in the association list?-memV var ((n,_):_) | n==var = True-memV var (_:xs) = memV var xs-memV _ _ = False+memA var ((n,_):_) | n==var = True+memA var (_:xs) = memA var xs+memA _ _ = False   -- xs:string casting. Much like string()@@ -175,83 +206,376 @@  -- all casting functions casts :: [(String,XTree->Maybe XTree)]-casts-    = map (\(n,f) -> ("xs:"++n,f))-      [("anyAtomicType",Just . id),-       ("string",Just . XText . toString),-       ("float",toFloat),-       ("Integer",toInt),-       ("nonNegativeInteger",\x -> do XInt n <- toInt x-                                      return $! XInt $ abs n),-       ("boolean",toBool)]+casts = [("anyAtomicType",Just . id),+         ("string",Just . XText . toString),+         ("float",toFloat),+         ("integer",toInt),+         ("nonNegativeInteger",\x -> do XInt n <- toInt x+                                        return $! XInt $ abs n),+         ("boolean",toBool)]   -- implements: expr instance of type-instanceOf :: XSeq -> Ast -> Bool-instanceOf expr typ-    = instOf expr typ-      where instOf [] (Ast "empty-sequence" []) = True-            instOf [] (Ast "?" _) = True-            instOf [x] (Ast "?" [tp]) = instOfOne x tp-            instOf xs (Ast "*" [tp])-                = all (\x -> instOfOne x tp) xs-            instOf xs (Ast "+" [tp])-                = (not $ null xs) && all (\x -> instOfOne x tp) xs-            instOf [x] tp = instOfOne x tp-            instOf _ _ = False-            instOfOne (XElem t _ _ _ xs) seqType-                = case seqType of-                    Ast "item" [] -> True-                    Ast "node" [] -> True-                    Ast "element" [] -> True-                    Ast "element" [Avar tag]-                        -> tag == "*" || t == tag-                    Ast "element" [Avar tag,Ast "?" [tp]]-                        -> (tag == "*" || t == tag)-                           && null xs || instOf xs tp-                    Ast "element" [Avar tag,tp]-                        -> (tag == "*" || t == tag) && instOf xs tp-                    _ -> False-            instOfOne (XAttr nm v) seqType-                = case seqType of-                    Ast "item" [] -> True-                    Ast "attribute" [Avar name]-                        -> name == "*" || nm == name-                    _ -> False-            instOfOne x (Avar tname)-                = if memV tname casts-                  then (findV tname casts x) /= Nothing-                  else if memV tname buildInTypes-                       then instOfOne x (Avar $ findV tname buildInTypes)-                       else error $ "Unrecognized build-in type: "++tname-            instOfOne _ _ = False+instanceOf :: XSeq -> Type -> Bool+instanceOf e tp+    = case typeValidate tp e of+        Success _ -> True+        _ -> False   -- implements: expr cast as type-castAs :: XSeq -> Ast -> XSeq-castAs [] (Ast "?" _) = []+castAs :: XSeq -> Type -> XSeq+castAs [] (TQualified _ '?') = [] castAs [XElem _ _ _ _ xs] tp = castAs xs tp-castAs [x] (Avar tname)-    = if memV tname casts-      then case findV tname casts x of+castAs [x] (TBase (QName nm u tname))+    | u == xsNamespace+    = if memA tname casts+      then case findA tname casts x of              Just v -> [v]              Nothing -> error $ "Value "++show x++" cannot be cast to the atomic type: "++tname-      else if memV tname buildInTypes-           then castAs [x] (Avar $ findV tname buildInTypes)+      else if memA tname buildInTypes+           then castAs [x] (TBase (QName nm u $ findA tname buildInTypes))            else error $ "Unrecognized build-in type: "++tname castAs xs tp = error $ "Value "++show xs++" cannot be cast to the type "++show tp   -- implements: expr castable as type-castableAs :: XSeq -> Ast -> Bool-castableAs [] (Ast "?" _) = True+castableAs :: XSeq -> Type -> Bool+castableAs [] (TQualified _ '?') = True castableAs [XElem _ _ _ _ xs] tp = castableAs xs tp-castableAs [x] (Avar tname)-    = if memV tname casts-      then case findV tname casts x of-             Just _ -> True-             Nothing -> False-      else if memV tname buildInTypes-           then castableAs [x] (Avar $ findV tname buildInTypes)+castableAs [x] (TBase (QName nm u tname))+    | u == xsNamespace+    = if memA tname casts+      then findA tname casts x /= Nothing+      else if memA tname buildInTypes+           then castableAs [x] (TBase (QName nm u $ findA tname buildInTypes))            else error $ "Unrecognized build-in type: "++tname castableAs _ _ = False+++-- inline element and type references in an XML Schema+expandQName :: QName -> NS -> Type+expandQName tag ns+    = es $ expand tag+      where expand (QName n uri ln)+                = let u = if uri == "" then defaultElementNS ns else uri+                  in case lookup u (schemas ns) of+                       Just s -> case lookup ln s of+                                   Just t -> t+                                   _ -> error ("Tag "++show tag++" is not defined in XML Schema "++u)+                       _ -> error ("Undefined schema "++n++"="++u)+            es (TNamed tag)+                | uri tag /= xsNamespace+                = es $ expand tag+            es (TElement n t) = TElement n $! (es t)+            es (TAttribute a t) = TAttribute a $! (es t)+            es (TSequence t1 t2) = (TSequence $! (es t1)) $! (es t2)+            es (TInterleaving t1 t2) = (TInterleaving $! (es t1)) $! (es t2)+            es (TChoice t1 t2) = (TChoice $! (es t1)) $! (es t2)+            es (TQualified t c) = (TQualified $! (es t)) c+            es t = t+++-- Convert an XQuery type representation to an XML Schema+toType :: Ast -> NS -> Type+toType e ns+    = case e of+        Avar "any" -> tItem+        Avar "numeric" -> tNumeric+        Avar s -> TBase (tag s ns)+        Ast "item" [] -> tItem+        Ast "node" [] -> tNode+        Ast "text" [] -> tText+        Ast "empty-sequence" [] -> TEmpty+        Ast "element" []+            -> TElement "*" TAny+        Ast "element" [Avar tag]+            -> TElement tag TAny+        Ast "element" [Avar tag,tp]+            -> TElement tag (toType tp ns)+        Ast "attribute" []+            -> TAttribute "*" TAny+        Ast "attribute" [Avar tag]+            -> TAttribute tag TAny+        Ast "attribute" [Avar tag,tp]+            -> TAttribute tag (toType tp ns)+        Ast "*" [tp]+            -> TQualified (toType tp ns) '*'+        Ast "+" [tp]+            -> TQualified (toType tp ns) '+'+        Ast "?" [tp]+            -> TQualified (toType tp ns) '?'+        Ast item []+            -> TItem item+        _ -> error $ "Unknown type "++show e+++-- Derive the XML Schema from its XML representation+schema2Type :: XTree -> NS -> (Type,XMLSchema)+schema2Type x ns = s2t x+    where s2t (XElem tag _ _ _ ts)+             | tag == documentRootTag+             = (TAny,concat (map (snd . s2t) (filter isElem ts)))+          s2t (XElem tag al _ _ ts)+             | uri tag == xsNamespace+             = case (localName tag,filter isElem ts) of+                 ("element",[])+                     -> case lookup "ref" al of+                          Just s -> qualify al (named s,[])+                          _ -> let t = case lookup "type" al of Just s -> defined s; _ -> TAny+                                   n = case lookup "name" al of Just n -> n; _ -> "*"+                               in qualify al (TElement n t,[])+                 ("element",ts)+                     -> let tt = map s2t ts+                            t = makeSequence $ map fst tt+                            n = case lookup "name" al of Just n -> n; _ -> "*"+                        in qualify al (TElement n t, concatMap snd tt)+                 ("attribute",[])+                     -> let t = case lookup "type" al of Just s -> defined s; _ -> TAny+                            n = case lookup "name" al of Just n -> n; _ -> "*"+                        in qualify al (case lookup "use" al of+                                         Just "required" -> TAttribute n t+                                         _ -> TQualified (TAttribute n t) '?',[])+                 ("attribute",ts)+                     -> let tt = map s2t ts+                            t = makeSequence $ map fst tt+                            n = case lookup "name" al of Just n -> n; _ -> "*"+                        in qualify al (case lookup "use" al of+                                         Just "required" -> TAttribute n t+                                         _ -> TQualified (TAttribute n t) '?',+                                       concatMap snd tt)+                 ("complexType",[])+                     -> case (lookup "type" al, lookup "name" al) of+                          (Just t, Just n) -> qualify al (defined t,[])+                          (_, Just n) -> qualify al (named n,[])+                          (Just t, _) -> qualify al (defined t,[])+                          _ -> case lookup "mixed" al of+                                 Just "true" -> qualify al (TQualified TAny '*',[])+                                 _ -> error $ "wrong complexType: "++show x+                 ("complexType",ts)+                     -> let tt = map s2t ts+                            t = makeSequence $ map fst tt+                        in case lookup "mixed" al of+                             Just "true" -> qualify al (makeSequence [TQualified TAny '*',t],+                                                        concatMap snd tt)+                             _ -> qualify al (t, concatMap snd tt)+                 ("sequence",ts)+                     -> let tt = map s2t ts+                            t = makeSequence $ map fst tt+                        in qualify al (t, concatMap snd tt)+                 ("choice",ts)+                     -> let tt = map s2t ts+                            t = foldl1 TChoice $ map fst tt+                        in qualify al (t, concatMap snd tt)+                 ("list",[])+                     -> case lookup "itemType" al of+                          Just s -> (TQualified (defined s) '*', [])+                          _ -> error $ "wrong list: "++show x+                 ("simpleType",ts)+                     -> let tt = map s2t ts+                            t = makeSequence $ map fst tt+                        in qualify al (t, concatMap snd tt)+                 ("extension",ts)+                     -> let tt = map s2t ts+                            t = makeSequence $ map fst tt+                        in case lookup "base" al of+                             Just s -> qualify al (makeSequence [defined s,t],+                                                   concatMap snd tt)+                             _ -> qualify al (t, concatMap snd tt)+                 ("restriction",_)+                     -> case lookup "base" al of+                          Just s -> qualify al (defined s, [])+                          _ -> error $ "wrong restriction: "++show x+                 ("simpleContent",[t])+                     -> qualify al $ s2t t+                 ("schema",ts)+                     -> let tt1 = map s2t (filter isType ts)+                            tt2 = map s2t (filter (not . isType) ts)+                        in (TAny, concatMap snd tt1++concatMap snd tt2)+                 (_,ts)+                     -> let tt = map s2t ts+                            t = makeSequence $ map fst tt+                        in (t, concatMap snd tt)+          s2t _ = (TEmpty,[])+          qualify al (t,binds)+                = let nt = case (lookup "minOccurs" al,lookup "maxOccurs" al) of+                             (Nothing, Nothing) -> t+                             (Just "0", Just "1") -> TQualified t '?'+                             (Just "1", _) -> TQualified t '+'+                             (_,_) -> TQualified t '*'+                  in case lookup "name" al of+                       Just n -> (nt,(n,nt):binds)+                       _ -> (nt,binds)+          makeSequence ts+                = ms $ filter (/= TEmpty) ts+                where ms [] = TEmpty+                      ms [t] = t+                      ms (t:ts) = TSequence t (ms ts)+          lookup s ((QName _ _ m,v):_) | s==m = Just v+          lookup s (_:xs) = lookup s xs+          lookup s [] = Nothing+          isElem (XElem s _ _ _ _) = True+          isElem _ = False+          isType (XElem s _ _ _ _) | elem (localName s) ["complexType","simpleType"] = True+          isType _ = False+          named s = TNamed (tag s ns)+          defined s = let qn = tag s ns+                      in if isBuildInType (localName qn)+                         then TBase qn+                         else TNamed qn+++data Match a+    = Success a                  -- a = value to be matched after success+    | Failure [(Type,XTree)]     -- failure history (trace)+++instance Monad Match where+    return s = Success s+    Success s >>= f = f s+    Failure ts >>= _ = Failure ts+++-- validate the XML sequence xs against the XML Schema type tp+typeValidate :: Type -> XSeq -> Match XSeq+typeValidate tp xs+    = v tp xs []+      where allV t xs as+                = case v t xs as of+                    x@(Success []) -> x+                    Success xs'+                        -> allV t xs' as+                    Failure _ -> Success xs+            sp (XText s:xs)+                | all isSpace s+                = sp xs+            sp x = x+            v t (XText s:xs) as+                | all isSpace s+                = v t xs as+            v t xs as+                = case t of+                    TEmpty -> Success xs+                    TAny -> Success []+                    TQualified (TAttribute name t') '?'+                        -> if memA name as+                           then do v t' [XText $ findA name as] []+                                   return xs+                           else Success xs+                    TAttribute name t'+                        -> if memA name as+                           then do v t' [XText $ findA name as] []+                                   return xs+                           else Failure []+                    TSequence t1 t2+                        -> do xs' <- v t1 xs as+                              v t2 xs' as+                    TInterleaving t1 t2+                        -> case v t1 xs as of+                             Success xs'+                                 -> v t2 xs' as+                             _ -> do xs' <- v t2 xs as+                                     v t1 xs' as+                    TChoice t1 t2+                        -> case v t1 xs as of+                             Failure ts+                                 -> v t2 xs as+                             x -> x+                    TQualified t '?'+                        -> case v t xs as of+                             Failure _ -> Success xs+                             x -> x+                    TQualified t '+'+                        -> do xs' <- v t xs as+                              allV t xs' as+                    TQualified t '*'+                        -> allV t xs as+                    _ -> case xs of+                           [] -> Failure [(t,XText "Unexpected end of element content")]+                           x:xs'-> case t of+                                     TBase s+                                         -> if uri s == xsNamespace+                                               && castableAs [x] (TBase s)+                                            then Success xs'+                                            else Failure [(t,x)]+                                     TAny -> Success xs'+                                     TItem "item"+                                         -> Success xs'+                                     TItem "node"+                                         -> case x of+                                              XElem _ _ _ _ _ -> Success xs'+                                              _ -> Failure [(t,x)]+                                     TItem _ -> error ("Unexpected named type: "++show t)+                                     TElement tag t'+                                         -> case x of+                                              XElem tag' as' _ _ xs''+                                                  -> if tag == localName tag' || tag == "*"+                                                     then case v t' xs'' (map (\(q,v) -> (localName q,v)) as') of+                                                            Failure ts -> Failure ((t,x):ts)+                                                            Success s+                                                                -> case sp s of+                                                                     [] -> Success xs'+                                                                     (z:_) -> Failure [(t,z)]+                                                     else Failure [(t,x)]+                                              _ -> Failure [(t,x)]+                                     _ -> Failure [(t,x)]+++-- Validate the XML data using XML Schema+validateXSeq :: XSeq -> NS -> Match XSeq+validateXSeq xs ns+    = vs xs+      where vs (XElem rt _ _ _ xs':xs)+                | rt == documentRootTag+                = vs xs'+            vs (x@(XElem tag _ _ _ _):xs)+                = case expandQName tag ns of+                    t@(TElement _ _)+                        -> do xs' <- typeValidate t [x]+                              vs xs+                    t -> do xs' <- typeValidate (TElement (localName tag) t) [x]+                            vs xs+            vs (_:xs) = vs xs+            vs [] = Success []+++validate :: XSeq -> XSeq -> NS -> XSeq+validate xs [xt] ns+    = let (_,t) = schema2Type xt ns+          n = ns{ defaultElementNS="default", schemas=("default",t):schemas ns }+      in case validateXSeq xs n of+           Failure ((_,x):_)+               -> [x]+           Success [] -> []+           Success [XText s]+               | all isSpace s+               -> []+           _ -> [XBool False]+++parseSchema :: String -> NS -> IO XMLSchema+parseSchema schema ns+    = do sch <- readFile schema+         let x = materialize False (parseDocument sch)+             (_,t) = schema2Type x ns+         return t+++-- | Validate the XML document against the XML Schema. Also done using the validate XQuery form.+validateFile :: FilePath -> FilePath -> IO Bool+validateFile file schema+    = do sch <- readFile schema+         let ns = initialNS+             (_,t) = schema2Type (materialize False (parseDocument sch)) ns+         doc <- readFile file+         let xs = materialize False (parseDocument doc)+             n = ns{ defaultElementNS="default", schemas=("default",t):schemas ns }+         case validateXSeq [xs] n of+           Failure ts+               -> error ("Failed to validate the file against the schema: "+                         ++show ts)+           Success [] -> return True+           Success [XText s]+               | all isSpace s+               -> return True+           _ -> error "Failed to validate the file against the schema"
src/Text/XML/HXQ/XQuery.hs view
@@ -4,7 +4,7 @@ - Programmer: Leonidas Fegaras - Email: fegaras@cse.uta.edu - Web: http://lambda.uta.edu/-- Creation: 03/22/08, last update: 01/17/09+- Creation: 03/22/08, last update: 09/12/09 -  - Copyright (c) 2008 by Leonidas Fegaras, the University of Texas at Arlington. All rights reserved. - This material is provided as is, with absolutely no warranty expressed or implied.@@ -24,19 +24,21 @@ -- For more information, look at <http://lambda.uta.edu/HXQ/>. module Text.XML.HXQ.XQuery (        -- * The XML Data Representation-       Name, AttList, XTree(..), XSeq, putXSeq,+       Prefix, URI, LocalName, QName(..), Attributes, XTree(..), XSeq, TVar, TQualifier, Type(..), putXSeq,        -- * The XQuery Compiler        xq, xe, qx,        -- * The XQuery Interpreter        xquery, eval,+       -- * Validation using XML Schema+       validateFile,        -- * The XQuery Compiler with Database Connectivity        xqdb,        -- * The XQuery Interpreter with Database Connectivity        xqueryDB,        -- * Shredding and Publishing XML Documents Using a Relational Database-       genSchema, shred, shredC, isSchema, printSchema, createIndex,-       -- * Other Functions-       XMLEvent(..), connect, disconnect, commit, rollback, prepareSQL, executeSQL+       Path, Table(..), genSchema, shred, shredC, isSchema, printSchema, createIndex,+       -- * Other Database Functions+       connect, disconnect, commit, rollback, prepareSQL, executeSQL     ) where  import HXML(Name,AttList)@@ -45,6 +47,7 @@ import XMLParse import Text.XML.HXQ.Compiler import Text.XML.HXQ.Interpreter+import Text.XML.HXQ.Types   -- | The XQuery interpreter as an XQuery function.
src/Text/XML/HXQ/XTree.hs view
@@ -4,7 +4,7 @@ - Programmer: Leonidas Fegaras - Email: fegaras@cse.uta.edu - Web: http://lambda.uta.edu/-- Creation: 05/01/08, last update: 03/29/09+- Creation: 05/01/08, last update: 09/29/09 -  - Copyright (c) 2008 by Leonidas Fegaras, the University of Texas at Arlington. All rights reserved. - This material is provided as is, with absolutely no warranty expressed or implied.@@ -17,8 +17,7 @@ {-# OPTIONS_GHC -funbox-strict-fields #-}  -module Text.XML.HXQ.XTree-    ( XTree(..), XSeq, materialize, putXSeq, showXS ) where+module Text.XML.HXQ.XTree where  import System.IO import Char(isSpace)@@ -26,26 +25,62 @@ import HXML(Name,AttList) import Text.XML.HXQ.Parser(Ast(..)) import System.CPUTime--- import Debug.Trace -- import System.IO.Unsafe  +-- | Namespace prefix+type Prefix = String++-- | Namespace URI+type URI = String++-- | Local name+type LocalName = String++-- | A qualified name has a namespace prefix, a URI, and a local name+data QName = QName { prefix :: Prefix, uri :: URI, localName :: LocalName }++instance Eq QName where+    (QName _ u1 ln1) == (QName _ u2 ln2)+        = u1 == u2 && ln1 == ln2++instance Ord QName where+    (QName _ u1 ln1) <= (QName _ u2 ln2)+        = u1 < u2 || (u1 == u2 && ln1 <= ln2)++instance Show QName where+    show (QName "" _ ln) = ln+    show (QName ns _ ln) = ns++":"++ln+++-- | XML attributes are bindings from qualified names to values+type Attributes = [(QName,String)]+++matchQName x@(QName _ u1 ln1) y@(QName _ u2 ln2)+    = (u1 == u2 || u1 == "" || u2 == "")+      && (ln1 == ln2 || ln2 == "*" || ln1 == "*")+++documentRootTag = QName "" "" "_document"++ -- | A rose tree representation of XML data. -- An XML element is:  @XElem tagname atributes preorder parent children@. -- The preorder numbering is the document order of elements. -- The parent is a cyclic reference to the parent element.-data XTree =  XElem    !Name !AttList !Int XTree [XTree]   -- ^ an XML tree node (element)-           |  XAttr    !Name !String    -- ^ attribute construction+data XTree =  XElem    !QName !Attributes !Int XTree [XTree]   -- ^ an XML tree node (element)+           |  XAttr    !QName !String   -- ^ attribute construction            |  XText    !String          -- ^ an XML tree leaf (PCDATA)            |  XInt     !Int             -- ^ an XML tree leaf (int)            |  XFloat   !Double          -- ^ an XML tree leaf (double)            |  XBool    !Bool            -- ^ an XML tree leaf (boolean)-           |  XPI      Name String	-- ^ processing instruction+           |  XPI      String String	-- ^ processing instruction            |  XGERef   String		-- ^ general entity reference            |  XComment String		-- ^ comment-           |  XError   String		-- ^ error report+           |  XError   String		-- ^ error message            |  XNull                     -- ^ null value-           |  XType    Ast              -- ^ type information+           |  XType    Type             -- ^ type information            |  XNoPad                    -- ^ marker for no padding in XSeq            deriving Eq @@ -63,21 +98,27 @@         XNull -> True         XNoPad -> True         _ -> False-      where emptyAL = all (\(a,v) -> case (a,v) of (_,"") -> True; ('_':_,_) -> True; _ -> False)+      where emptyAL = all (\(a,v) -> case (a,v) of+                                       (_,"") -> True+                                       (QName _ _ ('_':_),_) -> True+                                       _ -> False)  -showAL :: AttList -> String-showAL = foldr (\(a,v) r -> case (a,v) of ('_':_,_) -> r; _ -> " "++a++"=\""++v++"\""++r) []+showAL :: Attributes -> String+showAL = foldr (\(a,v) r -> case (a,v) of+                              (QName _ _ ('_':_),_) -> r+                              _ -> " "++show a++"=\""++v++"\""++r) [] + showXT :: XTree -> Bool -> String showXT e pad     = case e of-        XElem "_document" _ _ _ xs -> showXS xs-        XElem tag al _ _ [] -> "<"++tag++showAL al++"/>"+        XElem tag _ _ _ xs | tag == documentRootTag -> showXS xs+        XElem tag al _ _ [] -> "<"++show tag++showAL al++"/>"         XElem _ _ _ _ _ | emptyElem e -> ""-        XElem tag al _ _ xs | all emptyElem xs -> "<"++tag++showAL al++"/>"-        XElem tag al _ _ xs -> "<"++tag++showAL al++">"++showXS xs++"</"++tag++">"-        XAttr tag val -> p++tag++"=\""++val++"\""+        XElem tag al _ _ xs | all emptyElem xs -> "<"++show tag++showAL al++"/>"+        XElem tag al _ _ xs -> "<"++show tag++showAL al++">"++showXS xs++"</"++show tag++">"+        XAttr tag val -> p++show tag++"=\""++val++"\""         XText text -> p++text         XInt n -> p++show n         XFloat n -> p++show n@@ -106,9 +147,146 @@ putXSeq xs = hSetBuffering stdout NoBuffering >> putStrLn (showXS xs)  -{--------------- Build the rose tree from the XML stream ----------------------------}+{--------------------------- XQuery Types ---------------------------------------} +-- | A type variable+type TVar = Int ++-- | Type qualifier: *, +, or ?+type TQualifier = Char+++-- | An XQuery type+data Type+    = TVariable TVar                 -- ^ type variable (needed for polymorphic type inference)+    | TBase QName                    -- ^ xs:integer, xs:string, ...+    | TItem String                   -- ^ item(), node(), ...+    | TNamed QName                   -- ^ reference to a user-defined type+    | TElement String Type           -- ^ element tag { t }+    | TAttribute String Type         -- ^ attribute name { t }+    | TAny                           -- ^ any element or attribute content+    | TEmpty                         -- ^ ()+    | TSequence Type Type            -- ^ t1, t2+    | TInterleaving Type Type        -- ^ t1 & t2+    | TChoice Type Type              -- ^ t1 | t2+    | TQualified Type TQualifier     -- ^ t*, t+, or t?+      deriving Eq+++showType :: Type -> Int -> String+showType t prec+    = case t of+        TVariable s -> '#':show s+        TBase s -> show s+        TItem s -> s++"()"+        TNamed s -> show s+        TEmpty -> "()"+        TAny -> "xs:any"+        TElement n TAny -> "element "++n+        TAttribute a TAny -> "attribute "++a+        TElement n t+            -> "element "++n++" { "++showType t 3++" }"+        TAttribute a t+            -> "attribute "++a++" { "++showType t 3++" }"+        TSequence t1 t2 -> paren 3 prec (showType t1 3++", "++showType t2 3)+        TInterleaving t1 t2 -> paren 3 prec (showType t1 2++" & "++showType t2 2)+        TChoice t1 t2 -> paren 2 prec (showType t1 2++" | "++showType t2 2)+        TQualified t c -> paren 4 prec (showType t 4++[c])+    where paren p1 p2 s | p1<p2 = "("++s++")"+                        | otherwise = s+++instance Show Type where+    show t = showType t 4+++-- | XML Schema bindings+type XMLSchema = [(LocalName,Type)]+++-- | Binding from a namespace URI to an XML Schema+type Schemas = [(URI,XMLSchema)]+++-- | Binding from namespace prefixes to URIs+type NamespacePrefixes = [(Prefix,URI)]+++-- | The namespace context is the default element namespace, the default function namespace,+-- the namespace prefixes, and the XML Schemas associated with namespaces+data NS = NS { defaultElementNS :: URI, defaultFunctionNS :: URI,+               prefixes :: NamespacePrefixes, schemas :: Schemas }+          deriving Show+++tag :: String -> NS -> QName+tag s ns+    = case span (/= ':') s of+        (_,"") -> QName "" (defaultElementNS ns) s+        (s1,_:s2) -> case lookup s1 (prefixes ns) of+                       Just u -> QName s1 u s2+                       Nothing -> error ("Undeclared element namespace: "++s1)++attributeTag s ns+    = case span (/= ':') s of+        (_,"") -> QName "" "" s+        (s1,_:s2) -> case lookup s1 (prefixes ns) of+                       Just u -> QName s1 u s2+                       Nothing -> error ("Undeclared attribute namespace: "++s1)+++functionTag :: String -> NS -> QName+functionTag s ns+    = case span (/= ':') s of+        (_,"") -> QName "" (defaultFunctionNS ns) s+        (s1,_:s2) -> case lookup s1 (prefixes ns) of+                       Just u -> QName s1 u s2+                       Nothing -> error ("Undeclared function namespace: "++s1)+++attributes :: AttList -> NS -> Attributes+attributes al ns+    = map (\(s,v) -> (attributeTag s ns,v)) al+++elementNamespaces :: AttList -> NS -> NS+elementNamespaces atts ns+    = ns { defaultElementNS = foldr (\(a,v) r -> case a of "xmlns" -> v; _ -> r) (defaultElementNS ns) atts,+           prefixes = foldr (\(a,v) r -> case splitAt 6 a of+                                           ("xmlns:",p)+                                               -> case lookup p predefinedNamespaces of+                                                    Just uri+                                                        -> if uri == v+                                                           then (p,v):r+                                                           else error ("You cannot redefine the system namespace "++p)+                                                    Nothing -> (p,v):r+                                           _ -> r) (prefixes ns) atts }+++predefinedNamespaces :: NamespacePrefixes+predefinedNamespaces+    = [ ("xml", "http://www.w3.org/XML/1998/namespace"),+        ("xmlns", "http://www.w3.org/2000/xmlns/"),+        ("xsl", "http://www.w3.org/1999/XSL/Transform"),+        ("xs", "http://www.w3.org/2001/XMLSchema"),+        ("xsi", "http://www.w3.org/2001/XMLSchema-instance"),+        ("fn", "http://www.w3.org/2005/xpath-functions"),+        ("xdt", "http://www.w3.org/2005/xpath-datatypes"),+        ("local", "http://www.w3.org/2005/xquery-local-functions") ]+++xsNamespace = let Just uri = lookup "xs" predefinedNamespaces in uri+fnNamespace = let Just uri = lookup "fn" predefinedNamespaces in uri+++initialNS = NS { defaultElementNS="", defaultFunctionNS=fnNamespace,+                 prefixes=predefinedNamespaces, schemas=[] }+++{--------------- Build an XTree from the XML stream ----------------------------}++ type Stream = [XMLEvent]  noParentError = XError "Undefined parent reference"@@ -127,98 +305,107 @@   -- Lazily materialize the SAX stream into a DOM tree without setting parent references.-materializeWithoutParent :: Int -> Stream -> XTree-materializeWithoutParent level stream-    = XElem "_document" [] 1 noParentError-            ((\(x,_,_)->x) (mdl stream 2 level []))-      where md s@(x@(StartEvent n atts):xs) i level ns+materializeWithoutParent :: Int -> Stream -> NS -> XTree+materializeWithoutParent level stream ns+    = XElem documentRootTag [] 1 noParentError+            ((\(x,_,_)->x) (mdl stream 2 level [] ns))+      where md s@(x@(StartEvent n atts):xs) i level ls ns                 | level == 0-                    = let f [] i = m s i-                          f ((StartEvent n atts):ns) i-                              = let (e,xs',i') = f ns $! i+1-                                in (XElem n atts i noParentError [e],xs',i')-                          (e,xs',i') = (f $! (reverse ns)) i-                      in (e,xs',i',ns)+                    = let f [] i ns = m s i ns+                          f ((StartEvent n atts):ls) i ns+                              = let ns' = elementNamespaces atts ns+                                    (e,xs',i') = (f ls $! i+1) $! ns'+                                in (((XElem $! (tag n ns')) $! (attributes atts ns')) i noParentError [e],xs',i')+                          (e,xs',i') = (f $! (reverse ls)) i ns+                      in (e,xs',i',ls)                 | otherwise-                    = ((md xs $! i+1) $! level-1) $! x:ns-            md ((EndEvent n):xs) i level (x:ns)-                = (md xs i $! level+1) ns-            md (_:xs) i level ns-                    = md xs i level ns-            md [] _ _ _ = (XText "",[],0,[])-            mdl xs@(_:_) i level ns-                = let (e,xs',i',ns') = md xs i level ns-                      (el,xs'',i'') = mdl xs' i' 0 ns'+                    = (((md xs $! i+1) $! level-1) $! x:ls) ns+            md ((EndEvent n):xs) i level (x:ls) ns+                = (md xs i $! level+1) ls ns+            md (_:xs) i level ls ns+                    = md xs i level ls ns+            md [] _ _ _ _ = (XText "",[],0,[])+            mdl xs@(_:_) i level ls ns+                = let (e,xs',i',ls') = md xs i level ls ns+                      (el,xs'',i'') = mdl xs' i' 0 ls' ns                   in (e:el,xs'',i'')-            mdl [] _ _ _ = ([],[],0)-            m ((TextEvent t):xs) i = (XText t,xs,i)-            m ((EmptyEvent n atts):xs) i-                = (XElem n atts i noParentError [],xs,i+1)-            m ((StartEvent n atts):xs) i-                = let (el,xs',i') = ml n xs $! i+1-                  in (XElem n atts i noParentError el,xs',i')-            m ((PIEvent n s):xs) i = (XPI n s,xs,i)-            m ((CommentEvent s):xs) i = (XComment s,xs,i)-            m ((GERefEvent n):xs) i = (XGERef n,xs,i)-            m ((ErrorEvent s):xs) i = (XError s,xs,i)-            m (_:xs) i = (XError "Unrecognized XML event",xs,i)-            m [] i = (XError "Unterminated element",[],i)-            ml _ [] i = ([],[],i)-            ml tag ((EndEvent n):xs) i+            mdl [] _ _ _ _ = ([],[],0)+            m ((TextEvent t):xs) i _ = (XText t,xs,i)+            m ((EmptyEvent n atts):xs) i ns+                = let ns' = elementNamespaces atts ns+                  in (((XElem $! (tag n ns')) $! (attributes atts ns')) i noParentError [],xs,i+1)+            m ((StartEvent n atts):xs) i ns+                = let ns' = elementNamespaces atts ns+                      (el,xs',i') = (ml n xs $! i+1) $! ns'+                  in (((XElem $! (tag n ns')) $! (attributes atts ns')) i noParentError el,xs',i')+            m ((PIEvent n s):xs) i _ = (XPI n s,xs,i)+            m ((CommentEvent s):xs) i _ = (XComment s,xs,i)+            m ((GERefEvent n):xs) i _ = (XGERef n,xs,i)+            m ((ErrorEvent s):xs) i _ = (XError s,xs,i)+            m (_:xs) i _ = (XError "Unrecognized XML event",xs,i)+            m [] i _ = (XError "Unterminated element",[],i)+            ml _ [] i _ = ([],[],i)+            ml tag ((EndEvent n):xs) i ns                 | n==tag = ([],xs,i)-                | otherwise = error $ "Unmatched tags: <"++tag++"></"++n++">"-            ml tag xs i = let (e,xs',i') = m xs i-                              (el,xs'',i'') = ml tag xs' i'-                          in (e:el,xs'',i'')+                | otherwise = error $ "Unmatched tags: <"++show tag++"></"++n++">"+            ml tag xs i ns+                = let (e,xs',i') = m xs i ns+                      (el,xs'',i'') = ml tag xs' i' ns+                  in (e:el,xs'',i'')   -- Lazily materialize the SAX stream into a DOM tree setting parent references.--- It has space leaks for large documents.+-- It causes space leaks for large documents. -- Used only if the query has backward steps that cannot be eliminated.-materializeWithParent :: Int -> Stream -> XTree-materializeWithParent level stream = root-    where root = XElem "_document" [] 1 (XError "Trying to access the root parent")-                       ((\(x,_,_)->x) (mdl stream 2 level root []))-          md s@(x@(StartEvent n atts):xs) i level p ns+materializeWithParent :: Int -> Stream -> NS -> XTree+materializeWithParent level stream ns = root+    where root = XElem documentRootTag [] 1 (XError "Trying to access the root parent")+                       ((\(x,_,_)->x) (mdl stream 2 level root [] ns))+          md s@(x@(StartEvent n atts):xs) i level p ls ns               | level == 0-                  = let f [] i p = m s i p-                        f ((StartEvent n atts):ns) i p-                            = let (e,xs',i') = (f ns $! i+1) x-                                  x = XElem n atts i p [e]+                  = let f [] i p ns = m s i p ns+                        f ((StartEvent n atts):ls) i p ns+                            = let ns' = elementNamespaces atts ns+                                  (e,xs',i') = (f ls $! i+1) x $! ns'+                                  x = ((XElem $! (tag n ns')) $! (attributes atts ns')) i p [e]                               in (x,xs',i')-                        (e,xs',i') = (f $! (reverse ns)) i p-                    in (e,xs',i',ns)+                        (e,xs',i') = (f $! (reverse ls)) i p ns+                    in (e,xs',i',ls)               | otherwise-                  = ((md xs $! i+1) $! level-1) p $! x:ns-          md ((EndEvent n):xs) i level p (x:ns)-              = (md xs i $! level+1) p ns-          md (_:xs) i level p ns-              = md xs i level p ns-          md [] _ _ _ _ = (XText "",[],0,[])-          mdl xs@(_:_) i level p ns-              = let (e,xs',i',ns') = md xs i level p ns-                    (el,xs'',i'') = mdl xs' i' 0 p ns'+                  = (((md xs $! i+1) $! level-1) p $! x:ls) ns+          md ((EndEvent n):xs) i level p (x:ls) ns+              = (md xs i $! level+1) p ls ns+          md (_:xs) i level p ls ns+              = md xs i level p ls ns+          md [] _ _ _ _ _ = (XText "",[],0,[])+          mdl xs@(_:_) i level p ls ns+              = let (e,xs',i',ls') = md xs i level p ls ns+                    (el,xs'',i'') = mdl xs' i' 0 p ls' ns                 in (e:el,xs'',i'')-          mdl [] _ _ _ _ = ([],[],0)-          m ((TextEvent t):xs) i _ = (XText t,xs,i)-          m ((EmptyEvent n atts):xs) i p = (XElem n atts i p [],xs,i+1)-          m ((StartEvent n atts):xs) i p-              = let (el,xs',i') = (ml n xs $! (i+1)) node-                    node = XElem n atts i p el+          mdl [] _ _ _ _ _ = ([],[],0)+          m ((TextEvent t):xs) i _ _ = (XText t,xs,i)+          m ((EmptyEvent n atts):xs) i p ns+              = let ns' = elementNamespaces atts ns+                in (((XElem $! (tag n ns')) $! (attributes atts ns')) i p [],xs,i+1)+          m ((StartEvent n atts):xs) i p ns+              = let ns' = elementNamespaces atts ns+                    (el,xs',i') = (ml n xs $! (i+1)) node $! ns'+                    node = ((XElem $! (tag n ns')) $!  (attributes atts ns')) i p el                 in (node,xs',i')-          m ((PIEvent n s):xs) i _ = (XPI n s,xs,i)-          m ((CommentEvent s):xs) i _ = (XComment s,xs,i)-          m ((GERefEvent n):xs) i _ = (XGERef n,xs,i)-          m ((ErrorEvent s):xs) i _ = (XError s,xs,i)-          m (_:xs) i _ = (XError "unrecognized XML event",xs,i)-          m [] i _ = (XError "unbalanced tags",[],i)-          ml _ [] i _ = ([],[],i)-          ml tag ((EndEvent n):xs) i _+          m ((PIEvent n s):xs) i _ _ = (XPI n s,xs,i)+          m ((CommentEvent s):xs) i _ _ = (XComment s,xs,i)+          m ((GERefEvent n):xs) i _ _ = (XGERef n,xs,i)+          m ((ErrorEvent s):xs) i _ _ = (XError s,xs,i)+          m (_:xs) i _ _ = (XError "unrecognized XML event",xs,i)+          m [] i _ _ = (XError "unbalanced tags",[],i)+          ml _ [] i _ _ = ([],[],i)+          ml tag ((EndEvent n):xs) i _ _                 | n==tag = ([],xs,i)-                | otherwise = error $ "Unmatched tags: <"++tag++"></"++n++">"-          ml tag xs i p = let (e,xs',i') = m xs i p-                              (el,xs'',i'') = ml tag xs' i' p-                          in (e:el,xs'',i'')+                | otherwise = error $ "Unmatched tags: <"++show tag++"></"++n++">"+          ml tag xs i p ns+              = let (e,xs',i') = m xs i p ns+                    (el,xs'',i'') = ml tag xs' i' p ns+                in (e:el,xs'',i'')   -- It looks at the first maxStreamingUnitSize events in the stream to determine@@ -248,5 +435,5 @@ materialize withParent stream     = let level = docLevel stream maxStreamingUnitSize 0 1000000       in if withParent-         then materializeWithParent level stream-         else materializeWithoutParent level stream+         then materializeWithParent level stream initialNS+         else materializeWithoutParent level stream initialNS
src/noDB/Text/XML/HXQ/OptionalDB.hs view
@@ -22,7 +22,14 @@   type Statement = String-type Table = String++-- | XPath to reach a table/column+type Path = [String]++-- | A relational schema representation+data Table = Table String Path Bool [Table]  -- ^ table-name relative-path mixed-content? components+           | Column String Path Int          -- ^ column-name relative-path max-byte-size+           deriving (Show,Read)  data Connection = Connection String 
src/withDB/Text/XML/HXQ/DB.hs view
@@ -4,7 +4,7 @@ - Programmer: Leonidas Fegaras - Email: fegaras@cse.uta.edu - Web: http://lambda.uta.edu/-- Creation: 05/12/08, last update: 02/01/09+- Creation: 05/12/08, last update: 07/18/09 -  - Copyright (c) 2008 by Leonidas Fegaras, the University of Texas at Arlington. All rights reserved. - This material is provided as is, with absolutely no warranty expressed or implied.@@ -18,8 +18,8 @@   module Text.XML.HXQ.DB-    ( publishXmlDoc, executeSQL, prepareSQL, genSchema, shred, shredC,-      printSchema, isSchema, createIndex, insertDB, deleteDB, replaceDB ) where+    ( Path, Table(..), publishXmlDoc, findSchema, executeSQL, prepareSQL, genSchema, shred, shredC,+      printSchema, isSchema, createIndex, insertDB, deleteDB, replaceDB, xml2sql, sql2xml ) where  import System.IO.Unsafe import Char(isSpace,isDigit,toLower)@@ -64,7 +64,7 @@       XInt n -> SqlInteger (toInteger n)       XFloat n -> SqlString (show n)       XBool n -> SqlBool n-      XElem n _ _ _ [x] -> xml2sql x+      XElem _ _ _ _ [x] -> xml2sql x       _ -> error ("*** Cannot convert "++show e++" into sql")  @@ -75,13 +75,18 @@  perror = error "Constructed elements do not have a parent" +dbNamespace = "DB" +dbtag t = QName "db" dbNamespace t++ executeSQL :: Statement -> XSeq -> IO XSeq executeSQL stmt args     = do n <- handleSqlError (execute stmt (map xml2sql args))          result <- handleSqlError (fetchAllRowsAL stmt)-         return (map (\x -> XElem "row" [] 0 perror (map (\(s,v) -> XElem (column s) [] 0 perror [sql2xml v]) x)) result)-    where column s = if elem '.' s then tail (dropWhile (/= '.') s) else s+         return (map (\x -> XElem (dbtag "row") [] 0 perror+                                  (map (\(s,v) -> XElem (column s) [] 0 perror [sql2xml v]) x)) result)+    where column s = QName "" "" (if elem '.' s then tail (dropWhile (/= '.') s) else s)   prepareSQL :: Connection -> String -> IO Statement@@ -150,11 +155,12 @@ ----------------------------------------------------------------------------------------}  +-- | XPath to reach a table/column type Path = [String] --data Table = Table String Path Bool [Table]  -- table-name relative-path mixed-content? components-           | Column String Path Int          -- column-name relative-path max-byte-size+-- | A relational schema representation+data Table = Table String Path Bool [Table]  -- ^ table-name relative-path mixed-content? components+           | Column String Path Int          -- ^ column-name relative-path max-byte-size            deriving (Show,Read)  instance DeepSeq Table where deepSeq = seq@@ -217,11 +223,11 @@ relationalSchema (Table n path b ts) parent     = ["\ncreate table "++n++" (      /* "++printPath path        ++(if b then " (mixed content)" else "")++" */\n"-       ++n++"_id integer primary key not null"-       ++",\n"++n++"_parent integer"++(if parent /= "" then (" references "++parent++"("++parent++"_id)") else "")+       ++"_id integer primary key not null"+       ++",\n"++"_parent integer"++(if parent /= "" then (" references "++parent++"(_id)") else "")        ++(concat [ ",\n"++m++" varchar("++show size++")    /* "++printPath p++" */" | Column m p size <- ts ])        ++")\n"]-      ++ (if parent /= "" then ["create index "++n++"_parent_index on "++n++" ("++n++"_parent)\n"] else [])+      ++ (if parent /= "" then ["create index "++n++"_parent_index on "++n++" (_parent)\n"] else [])       ++ [ s | t@(Table _ _ _ _) <- ts, s <- relationalSchema t n ]  @@ -659,18 +665,18 @@                 = c ("{for $"++n++" in SQL(select(),tables($"++n++"),"                      ++(if parent == "()"                         then "true()"-                        else "$"++n++"/"++n++"_parent eq $"++parent++"/"++parent++"_id")+                        else "$"++n++"/_parent eq $"++parent++"/_id")                      ++") return <"++p++">"++header n n False++"}"++ pubLS ts n parent id ++ "</"++p++">}")             pubS (Column tag (('@':p):_) _) parent c-                = c ("{attribute "++p++" {$"++parent++"/"++tag++"/text()}}")+                = c ("{attribute "++p++" {$"++parent++"/"++tag++"/data()}}")             pubS (Column tag (p:_) _) parent c-                = c ("<"++p++">"++header tag parent False++",$"++parent++"/"++tag++"/text()}</"++p++">")+                = c ("<"++p++">"++header tag parent False++",$"++parent++"/"++tag++"/data()}</"++p++">")             pubS (Column tag [] _) parent c-                = c ("{$"++parent++"/"++tag++"/text()}")+                = c ("{$"++parent++"/"++tag++"/data()}")             pubS _ _ c = c ""             header tag parent composite-                = "{attribute {'_id'} {$"++parent++"/"++parent++"_id/text()}"-                  ++",attribute {'_parent'} {"++(if needsParent && parent /= "()/()_id" then "$"++parent else "()")++"}"+                = "{attribute {'_id'} {$"++parent++"/_id/data()}"+                  ++",attribute {'_parent'} {"++(if needsParent && parent /= "()/_id" then "$"++parent else "()")++"}"                   ++",attribute {'_table'} {'"++schema++" "++parent++(if composite then " +" else " ")++tag++"'}"             pubLS [] _ _ c = c ""             pubLS (x@(t:ts)) n parent c@@ -733,7 +739,8 @@          [[(_,ids)]] <- fetchAllRowsAL stmt1          let id = (read (dbString ids))+1              toStream (XElem tag al _ _ ts)-                 = (StartEvent tag al) : (concatMap toStream ts ++ [EndEvent tag])+                 = (StartEvent (localName tag) (map (\(a,v) -> (localName a,v)) al))+                      : (concatMap toStream ts ++ [EndEvent (localName tag)])              toStream x = [TextEvent (show x)]              insertTree tree i                  = let ic = populate (toStream tree) [table,table] 0 [[],[]]@@ -761,7 +768,7 @@ insertDB :: Connection -> XSeq -> XSeq -> IO XSeq insertDB db from into     = case into of-        [d@(XElem tag (("_table",tnm):_) id parent cs)]+        [d@(XElem tag ((QName _ _ "_table",tnm):_) id parent cs)]             -> do let [schema,tableName,attrName] = words tnm                   table <- findSchema db schema                   let [dest@(Table _ _ _ tbs)] = getDestinationTable table tableName@@ -770,7 +777,7 @@                      else do mapM (\x -> case x of                                            XElem t _ _ _ ts                                                -> if head attrName == '+'-                                                  then case [ z | z@(Table _ (tn:_) _ _) <- tbs, t==tn ] of+                                                  then case [ z | z@(Table _ (tn:_) _ _) <- tbs, localName t==tn ] of                                                          [Table tx (tn:_) tb s]                                                              -> insertChildren db schema (Table tableName [] False [Table tx [tn] tb s]) from id                                                          _ -> case child_step t d of@@ -794,20 +801,20 @@  removeTuples :: Connection -> String -> Table -> Integer -> IO () removeTuples db schema (Table n _ _ ts) parent-    = do stmt <- handleSqlError (prepare db ("select "++n++"_id from "++n++" where "++n++"_parent = ?"))+    = do stmt <- handleSqlError (prepare db ("select id from "++n++" where parent = ?"))          handleSqlError (execute stmt [SqlInteger parent])          result <- fetchAllRowsAL stmt          case result of            [[(_,ids)]]                -> do let id = read (dbString ids)-                     handleSqlError (run db ("delete from "++n++" where "++n++"_id = ?") [SqlInteger id])+                     handleSqlError (run db ("delete from "++n++" where id = ?") [SqlInteger id])                      mapM (\t -> removeTuples db schema t id) ts                      return ()            _ -> return () removeTuples _ _ _ _  = return ()  -getColumns (XElem tag (("_table",tnm):_) id parent cs)+getColumns (XElem tag ((QName _ _ "_table",tnm):_) id parent cs)     = let [schema,tableName,attrName] = words tnm       in if head attrName == '+'          then concatMap getColumns cs@@ -816,16 +823,16 @@   deleteDB :: Connection -> XSeq -> IO XSeq-deleteDB db (x@(XElem tag (("_table",tnm):_) id parent cs):xs)+deleteDB db (x@(XElem tag ((QName _ _ "_table",tnm):_) id parent cs):xs)     = do let [schema,tableName,attrName] = words tnm          if tableName /= attrName             then mapM (\c -> handleSqlError (run db ("update "++tableName++" set "++c-                                                     ++" = NULL where "++tableName++"_id = ?")+                                                     ++" = NULL where id = ?")                                                     [SqlInteger (toInteger id)]))                       (getColumns x)             else do table <- findSchema db schema                     let [Table n _ _ ts] = getDestinationTable table tableName-                    handleSqlError (run db ("delete from "++n++" where "++n++"_id = ?")+                    handleSqlError (run db ("delete from "++n++" where id = ?")                                            [SqlInteger (toInteger id)])                     mapM (\t -> removeTuples db schema t (toInteger id)) ts                     return [0]@@ -837,16 +844,16 @@ replaceDB :: Connection -> XSeq -> XSeq -> IO XSeq replaceDB db dest with     = case dest of-        [d@(XElem tag (("_table",tnm):_) id parent cs)]+        [d@(XElem tag ((QName _ _ "_table",tnm):_) id parent cs)]             -> do let [schema,tableName,attrName] = words tnm                       update x = do handleSqlError (run db ("update "++tableName++" set "++attrName-                                                            ++" = ? where "++tableName++"_id = ?")+                                                            ++" = ? where id = ?")                                                     [SqlString (show x),SqlInteger (toInteger id)])                                     return []                   table <- findSchema db schema                   if tableName == attrName                      then let [dest@(Table _ _ _ ts)] = getDestinationTable table tableName-                          in do handleSqlError (run db ("delete from "++tableName++" where "++tableName++"_id = ?")+                          in do handleSqlError (run db ("delete from "++tableName++" where id = ?")                                                 [SqlInteger (toInteger id)])                                 mapM (\t -> removeTuples db schema t (toInteger id)) ts                                 insertChildren db schema dest with id@@ -860,14 +867,14 @@                                                           -> case child_step t' d of                                                                [z] -> replaceDB db [z] [w]                                                                _ -> dbError db ("The replace destination element tagged '"-                                                                                ++tag++"' does not have a child tagged '"++t'++"'")+                                                                                ++show tag++"' does not have a child tagged '"++show t'++"'")                                                       _ -> if head attrName == '+'                                                            then dbError db ("The destination element tagged '"-                                                                            ++tag++"' can only be replaced with another element")+                                                                            ++show tag++"' can only be replaced with another element")                                                            else update w                                              ) ts                                    else dbError db ("The destination element tagged '"-                                                    ++tag++"' cannot be replaced with an element tagged '"++t++"'")+                                                    ++show tag++"' cannot be replaced with an element tagged '"++show t++"'")                             [x] | head attrName /= '+' -> update x                             [] -> return []                             _ -> dbError db ("The replace source must be a singleton value: "++show with)
src/withDB/Text/XML/HXQ/OptionalDB.hs view
@@ -16,7 +16,7 @@  module Text.XML.HXQ.OptionalDB     ( IConnection, Statement, Connection, publishXmlDoc, executeSQL, prepareSQL, connect, disconnect, commit, rollback,-      genSchema, shred, shredC, printSchema, isSchema, createIndex, insertDB, deleteDB, replaceDB+      Path, Table(..), genSchema, shred, shredC, printSchema, isSchema, createIndex, insertDB, deleteDB, replaceDB     ) where