]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/ocaml/mathql/mQueryTLexer.mll
a small correction to mathQL.ml
[helm.git] / helm / ocaml / mathql / mQueryTLexer.mll
index 0075f3ac1bb4ad1ff882cc96b743eabd1850387d..ca24965b1ff7e08dac5d0fee89b9146df7fc600c 100644 (file)
@@ -41,48 +41,44 @@ let SPC   = [' ' '\t' '\n']+
 let ALPHA = ['A'-'Z' 'a'-'z']
 let NUM   = ['0'-'9']
 let IDEN  = ALPHA (NUM | ALPHA)*
-let DQ    = '"'
-let SQ    = '''
-let QSTR  = [^ ''']*
-let USTR  = [^ '"' ':' '/' '#' '?' '*']+
+let QSTR  = [^ '"\']*
 
-rule rtoken = parse
-   | DQ               { DQT   }
-   | ":/"             { PROT  }
-   | "/"              { SLASH }
-   | "#1"             { FRAG  }
-   | "?"              { QUEST }
-   | "**"             { SSTAR }
-   | "*"              { STAR  }
-   | USTR             { STR (Lexing.lexeme lexbuf) }
-and stoken = parse
-   | SQ               { SQT   }
-   | QSTR             { STR (Lexing.lexeme lexbuf) }
-and qtoken = parse
-   | SPC              { qtoken lexbuf }
-   | '('              { LPR    }
-   | ')'              { RPR    }
-   | '$'              { DLR    }
-   | SQ               { STR (qstr stoken lexbuf) }
-   | DQ               { REF (ref rtoken lexbuf) }
-   | "name"           { NAME   }
-   | "mainconclusion" { MCONCL }
-   | "conclusion"     { CONCL  }
-   | "true"           { TRUE   }
-   | "false"          { FALSE  }
-   | "and"            { AND    }
-   | "or"             { OR     }
-   | "not"            { NOT    }
-   | "is"             { IS     }
-   | "select"         { SELECT }
-   | "in"             { IN     }
-   | "where"          { WHERE  }
-   | "use"            { USE    }
-   | "position"       { POS    }
-   | "usedby"         { USEDBY }
-   | "pattern"        { PATT   }
-   | "union"          { UNION  }
-   | "intersect"      { INTER  }
-   | IDEN             { ID (Lexing.lexeme lexbuf) }
-   | eof              { EOF   }
+
+rule string_token = parse
+   | '"'         { DQ  }
+   | '\' .       { STR (Lexing.lexeme lexbuf) }
+   | QSTR        { STR (String.sub 1 1 (Lexing.lexeme lexbuf)) }
+   | eof         { EOF }
+and main_token = parse
+   | SPC         { main_token lexbuf }
+   | '('         { LP }
+   | ')'         { RP }
+   | '@'         { AT }
+   | '%'         { PC }
+   | '$'         { DL }
+   | '.'         { FS }
+   | '"'         { STR (qstr string_token lexbuf }
+   | "and"       { AND    }
+   | "attr"      { ATTR   }
+   | "attribute" { ATTRIB }
+   | "diff"      { DIFF   }
+   | "eq"        { EQ     }
+   | "false"     { FALSE  }
+   | "fun"       { FUN    }
+   | "in"        { IN     }
+   | "intersect" { INTER  }
+   | "not"       { NOT    }
+   | "or"        { OR     }
+   | "pattern"   { PAT    }
+   | "ref"       { REF    }
+   | "refof"     { REFOF  }
+   | "relation"  { REL    }
+   | "select"    { SELECT }
+   | "sub"       { SUB    }
+   | "super"     { SUPER  }
+   | "true"      { TRUE   }
+   | "union"     { UNION  }
+   | "where"     { WHERE  }
+   | IDEN        { ID (Lexing.lexeme lexbuf) }
+   | eof         { EOF    }