]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/ocaml/mathql/mQueryTLexer.mll
Fun implemented.
[helm.git] / helm / ocaml / mathql / mQueryTLexer.mll
index ca24965b1ff7e08dac5d0fee89b9146df7fc600c..a0884e79dd21a7a6ec2f23da7380875a6639d4d6 100644 (file)
@@ -41,32 +41,43 @@ let SPC   = [' ' '\t' '\n']+
 let ALPHA = ['A'-'Z' 'a'-'z']
 let NUM   = ['0'-'9']
 let IDEN  = ALPHA (NUM | ALPHA)*
-let QSTR  = [^ '"\']*
+let QSTR  = [^ '"' '\\']+
 
-
-rule string_token = parse
+rule comm_token = parse
+   | "*)"        { query_token lexbuf }
+   | [^ '*']*    { comm_token lexbuf }
+and string_token = parse
    | '"'         { DQ  }
-   | '\' .       { STR (Lexing.lexeme lexbuf) }
-   | QSTR        { STR (String.sub 1 1 (Lexing.lexeme lexbuf)) }
+   | '\\' _      { STR (String.sub (Lexing.lexeme lexbuf) 1 1) }
+   | QSTR        { STR (Lexing.lexeme lexbuf) }
    | eof         { EOF }
-and main_token = parse
-   | SPC         { main_token lexbuf }
+and query_token = parse
+   | "(*"        { comm_token lexbuf }
+   | SPC         { query_token lexbuf }
+   | '"'         { STR (qstr string_token lexbuf) }
    | '('         { LP }
    | ')'         { RP }
+   | '{'         { LC }
+   | '}'         { RC }
    | '@'         { AT }
    | '%'         { PC }
    | '$'         { DL }
    | '.'         { FS }
-   | '"'         { STR (qstr string_token lexbuf }
+   | ','         { CM }
+   | '/'         { SL }
    | "and"       { AND    }
    | "attr"      { ATTR   }
    | "attribute" { ATTRIB }
+   | "be"        { BE     }
    | "diff"      { DIFF   }
    | "eq"        { EQ     }
+   | "ex"        { EX     }
    | "false"     { FALSE  }
    | "fun"       { FUN    }
    | "in"        { IN     }
    | "intersect" { INTER  }
+   | "let"       { LET    }
+   | "meet"      { MEET   }
    | "not"       { NOT    }
    | "or"        { OR     }
    | "pattern"   { PAT    }
@@ -81,4 +92,13 @@ and main_token = parse
    | "where"     { WHERE  }
    | IDEN        { ID (Lexing.lexeme lexbuf) }
    | eof         { EOF    }
-
+and result_token = parse
+   | SPC         { result_token lexbuf }
+   | '"'         { STR (qstr string_token lexbuf) }
+   | '{'         { LC }
+   | '}'         { RC }
+   | ','         { CM }
+   | ';'         { SC }
+   | '='         { IS }
+   | "attr"      { ATTR   }
+   | eof         { EOF    }