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