Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

66 lines (63 sloc) 2.45 kb
{
open Parser (* The type token is defined in parser.mli *)
(* exception Eof
*)
}
rule token = parse
| [' ' '\t'] { token lexbuf } (* skip blanks *)
| ['\n' ] { token lexbuf } (* skip newline *)
| "yadi>" { token lexbuf } (* skip prompt info *)
| '_' { ANON_VAR }
| ['0'-'9']+ as lxm { VAL(int_of_string lxm) }
| ['A'-'Z']['a'-'z']* as lxm { RELNAME(lxm) }
| ['_']['A'-'Z' 'a'-'z']+ as lxm { BOOLPRED(lxm) }
| ['+']['A'-'Z' 'a'-'z']+ as lxm { AGGFUN(lxm) }
| ['#']['a'-'z']+ as cmd {match cmd with
| "#testcommand" -> TESTCOMM
| "#reconnect" -> RECONNECT
| "#quit" -> QUITCOMM
| "#changeout" -> CHANGEOUT
| "#readscript" -> READSCR
| "#help" -> HELPCOMM
| "#tableinfo" -> TABINFOCOMM
| "#gettables" -> GETTABLECOMM
| "#getdb" -> GETDBCOMM
| _ -> UNKNOWNCOMM
}
| ['a'-'z']+ as lxm { match lxm with
| "and" -> AND
| "not" -> NOT
| "select" -> SELECT
| "from"-> SELECT (*same help parameter*)
| "join" -> JOIN
| "wherenot" -> WHERENOT
| "where" -> WHERE
| "union" -> UNION
| "isodd" -> ISODD
| "iseven" -> ISEVEN
| "haslength" -> HASLENGTH
| "divides" -> DIVIDES
| "max" -> MAX
| "min" -> MIN
| "sum" -> SUM
| "count" -> COUNT
| "avg" -> AVG
| _ -> VARNAME(lxm)
}
| ['A'-'Z' 'a'-'z']['A'-'Z' 'a'-'z' '0'-'9' '_' '-']* as lxm { ANYNAME(lxm) }
| ['A'-'Z' 'a'-'z' '0'-'9' '_' '-']+ as lxm { PASSNAME(lxm) }
| '.' { DOT } (* end of rule or query *)
| ":-" { IMPLIEDBY }
| "?-" { QMARK } (* query mark *)
| ',' { SEP }
| '(' { LPAREN }
| ')' { RPAREN }
| '=' { EQ }
| '<' { LE }
| '>' { GR }
| "<=" { LQ }
| ">=" { GQ }
| "<>" { NE }
| '/' { EOP }
| eof { raise End_of_file }
| _ as c { Printf.printf "Warning: unknown symbol is ignored: %c\n" c; token lexbuf }
Jump to Line
Something went wrong with that request. Please try again.