X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2Focaml%2Fmathql%2FmQueryTLexer.mll;h=5f9b2ebac254b9d7dee42ae15674e2fbc3c861ad;hb=7646d66b5a68ad83611e19ac2634c86c16bc7d21;hp=0075f3ac1bb4ad1ff882cc96b743eabd1850387d;hpb=6c04191a9045120d3cf5f6046eee627d6499e5c9;p=helm.git diff --git a/helm/ocaml/mathql/mQueryTLexer.mll b/helm/ocaml/mathql/mQueryTLexer.mll index 0075f3ac1..5f9b2ebac 100644 --- a/helm/ocaml/mathql/mQueryTLexer.mll +++ b/helm/ocaml/mathql/mQueryTLexer.mll @@ -41,48 +41,59 @@ 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 = [^ '"' ':' '/' '#' '?' '*']+ - -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 } +let QSTR = [^ '"' '\\']+ +rule string_token = parse + | '"' { DQ } + | '\\' _ { STR (String.sub (Lexing.lexeme lexbuf) 1 1) } + | QSTR { STR (Lexing.lexeme lexbuf) } + | eof { EOF } +and query_token = parse + | SPC { query_token lexbuf } + | '"' { STR (qstr string_token lexbuf) } + | '(' { LP } + | ')' { RP } + | '{' { LC } + | '}' { RC } + | '@' { AT } + | '%' { PC } + | '$' { DL } + | '.' { FS } + | ',' { CM } + | "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 } + | "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 } +and result_token = parse + | SPC { result_token lexbuf } + | '"' { STR (qstr string_token lexbuf) } + | '{' { LC } + | '}' { RC } + | ',' { CM } + | ';' { SC } + | '=' { IS } + | "attr" { ATTR } + | eof { EOF }