Sophie

Sophie

distrib > Mageia > 3 > x86_64 > by-pkgid > 334c73eb2cbee096307b926bf8d6e67a > files > 1430

ocaml-pxp-devel-1.2.3-5.mga3.x86_64.rpm

(* $Id: lexer.mll 719 2007-05-07 15:04:40Z gerd $
 * ----------------------------------------------------------------------
 *
 *)

{
  open Parser
}

rule scan_file = parse
    "/*" [^ '*']* ('*'+ [^ '/' '*'] [^ '*']* )* '*'* "*/"
      { Space }
  | "%token"
      { Token }
  | "<" [' ' '\t' '\r' '\n']* ">"
      { Type 
      }
  | [ '_' 'a'-'z' ] [ 'a'-'z' 'A'-'Z' '0'-'9' '_' ]*
      { let s = Lexing.lexeme lexbuf in
	Lname s
      }
  | [ 'A'-'Z' ] [ 'a'-'z' 'A'-'Z' '0'-'9' '_' ]*
      { let s = Lexing.lexeme lexbuf in
	Uname s
      }
  | "%%"
      { Separator }
  | "("
      { Lparen }
  | ","
      { Comma }
  | ")"
      { Rparen }
  | "[" 
      { Lbracket }
  | "]" 
      { Rbracket }
  | ":"
      { Colon }
  | "{{" [^ '}']* ( '}' [^ '}']+ )* "}}"
      { let s = Lexing.lexeme lexbuf in
	Code (String.sub s 2 (String.length s - 4), 0, 0)
      }
  | "?"
      { Error }
  | "|"
      { Alt }
  | "+"
      { Loop_plus }
  | "*"
      { Loop_star }
  | [' ' '\t' '\r' '\n']+
      { Space }
  | "$"
      { Dollar }
  | eof
      { Eof }

and scan_header = parse
    "%%"
      { Separator }
  | "%"
      { Code("%", 0, 0) }
  | [^ '%']*
      { Code(Lexing.lexeme lexbuf, 0, 0) }
  | eof
      { Eof }

and scan_rest = parse
    _*
      { Code(Lexing.lexeme lexbuf, 0, 0) }
  | eof 
      { Eof }