]> matita.cs.unibo.it Git - helm.git/blob - helm/ocaml/mathql/mQueryTLexer.mll
a small correction to mathQL.ml
[helm.git] / helm / ocaml / mathql / mQueryTLexer.mll
1 (* Copyright (C) 2000, HELM Team.
2  * 
3  * This file is part of HELM, an Hypertextual, Electronic
4  * Library of Mathematics, developed at the Computer Science
5  * Department, University of Bologna, Italy.
6  * 
7  * HELM is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  * 
12  * HELM is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with HELM; if not, write to the Free Software
19  * Foundation, Inc., 59 Temple Place - Suite 330, Boston,
20  * MA  02111-1307, USA.
21  * 
22  * For details, see the HELM World-Wide-Web page,
23  * http://cs.unibo.it/helm/.
24  *)
25
26 (******************************************************************************)
27 (*                                                                            *)
28 (*                               PROJECT HELM                                 *)
29 (*                                                                            *)
30 (*                     Ferruccio Guidi <fguidi@cs.unibo.it>                   *)
31 (*                                 23/05/2002                                 *)
32 (*                                                                            *)
33 (*                                                                            *)
34 (******************************************************************************)
35
36
37    open MQueryTParser
38 }
39
40 let SPC   = [' ' '\t' '\n']+
41 let ALPHA = ['A'-'Z' 'a'-'z']
42 let NUM   = ['0'-'9']
43 let IDEN  = ALPHA (NUM | ALPHA)*
44 let QSTR  = [^ '"\']*
45
46
47 rule string_token = parse
48    | '"'         { DQ  }
49    | '\' .       { STR (Lexing.lexeme lexbuf) }
50    | QSTR        { STR (String.sub 1 1 (Lexing.lexeme lexbuf)) }
51    | eof         { EOF }
52 and main_token = parse
53    | SPC         { main_token lexbuf }
54    | '('         { LP }
55    | ')'         { RP }
56    | '@'         { AT }
57    | '%'         { PC }
58    | '$'         { DL }
59    | '.'         { FS }
60    | '"'         { STR (qstr string_token lexbuf }
61    | "and"       { AND    }
62    | "attr"      { ATTR   }
63    | "attribute" { ATTRIB }
64    | "diff"      { DIFF   }
65    | "eq"        { EQ     }
66    | "false"     { FALSE  }
67    | "fun"       { FUN    }
68    | "in"        { IN     }
69    | "intersect" { INTER  }
70    | "not"       { NOT    }
71    | "or"        { OR     }
72    | "pattern"   { PAT    }
73    | "ref"       { REF    }
74    | "refof"     { REFOF  }
75    | "relation"  { REL    }
76    | "select"    { SELECT }
77    | "sub"       { SUB    }
78    | "super"     { SUPER  }
79    | "true"      { TRUE   }
80    | "union"     { UNION  }
81    | "where"     { WHERE  }
82    | IDEN        { ID (Lexing.lexeme lexbuf) }
83    | eof         { EOF    }
84