]> matita.cs.unibo.it Git - helm.git/blob - helm/ocaml/mathql/mQueryTLexer.mll
Fun implemented.
[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 rule comm_token = parse
47    | "*)"        { query_token lexbuf }
48    | [^ '*']*    { comm_token lexbuf }
49 and string_token = parse
50    | '"'         { DQ  }
51    | '\\' _      { STR (String.sub (Lexing.lexeme lexbuf) 1 1) }
52    | QSTR        { STR (Lexing.lexeme lexbuf) }
53    | eof         { EOF }
54 and query_token = parse
55    | "(*"        { comm_token lexbuf }
56    | SPC         { query_token lexbuf }
57    | '"'         { STR (qstr string_token lexbuf) }
58    | '('         { LP }
59    | ')'         { RP }
60    | '{'         { LC }
61    | '}'         { RC }
62    | '@'         { AT }
63    | '%'         { PC }
64    | '$'         { DL }
65    | '.'         { FS }
66    | ','         { CM }
67    | '/'         { SL }
68    | "and"       { AND    }
69    | "attr"      { ATTR   }
70    | "attribute" { ATTRIB }
71    | "be"        { BE     }
72    | "diff"      { DIFF   }
73    | "eq"        { EQ     }
74    | "ex"        { EX     }
75    | "false"     { FALSE  }
76    | "fun"       { FUN    }
77    | "in"        { IN     }
78    | "intersect" { INTER  }
79    | "let"       { LET    }
80    | "meet"      { MEET   }
81    | "not"       { NOT    }
82    | "or"        { OR     }
83    | "pattern"   { PAT    }
84    | "ref"       { REF    }
85    | "refof"     { REFOF  }
86    | "relation"  { REL    }
87    | "select"    { SELECT }
88    | "sub"       { SUB    }
89    | "super"     { SUPER  }
90    | "true"      { TRUE   }
91    | "union"     { UNION  }
92    | "where"     { WHERE  }
93    | IDEN        { ID (Lexing.lexeme lexbuf) }
94    | eof         { EOF    }
95 and result_token = parse
96    | SPC         { result_token lexbuf }
97    | '"'         { STR (qstr string_token lexbuf) }
98    | '{'         { LC }
99    | '}'         { RC }
100    | ','         { CM }
101    | ';'         { SC }
102    | '='         { IS }
103    | "attr"      { ATTR   }
104    | eof         { EOF    }