let rec token lexbuf =
__ocaml_lex_token_rec lexbuf 0
and __ocaml_lex_token_rec lexbuf __ocaml_lex_state =
match Lexing.engine __ocaml_lex_tables __ocaml_lex_state lexbuf with
| 0 ->
# 49 "ocamlbuild/glob_lexer.mll"
( ATOM(Pattern(let (p,_) = parse_pattern ['>'] Epsilon lexbuf in p)) )
# 187 "ocamlbuild/glob_lexer.ml"
| 1 ->
# 50 "ocamlbuild/glob_lexer.mll"
( ATOM(Constant(parse_string (Buffer.create 32) lexbuf)) )
# 192 "ocamlbuild/glob_lexer.ml"
| 2 ->
# 51 "ocamlbuild/glob_lexer.mll"
( AND )
# 197 "ocamlbuild/glob_lexer.ml"
| 3 ->
# 52 "ocamlbuild/glob_lexer.mll"
( OR )
# 202 "ocamlbuild/glob_lexer.ml"
| 4 ->
# 53 "ocamlbuild/glob_lexer.mll"
( NOT )
# 207 "ocamlbuild/glob_lexer.ml"
| 5 ->
# 54 "ocamlbuild/glob_lexer.mll"
( TRUE )
# 212 "ocamlbuild/glob_lexer.ml"
| 6 ->
# 55 "ocamlbuild/glob_lexer.mll"
( FALSE )
# 217 "ocamlbuild/glob_lexer.ml"
| 7 ->
# 56 "ocamlbuild/glob_lexer.mll"
( LPAR )
# 222 "ocamlbuild/glob_lexer.ml"
| 8 ->
# 57 "ocamlbuild/glob_lexer.mll"
( RPAR )
# 227 "ocamlbuild/glob_lexer.ml"
| 9 ->
# 58 "ocamlbuild/glob_lexer.mll"
( token lexbuf )
# 232 "ocamlbuild/glob_lexer.ml"
| 10 ->
# 59 "ocamlbuild/glob_lexer.mll"
( EOF )
# 237 "ocamlbuild/glob_lexer.ml"
| __ocaml_lex_state -> lexbuf.Lexing.refill_buff lexbuf; __ocaml_lex_token_rec lexbuf __ocaml_lex_state
and parse_pattern eof_chars p lexbuf =
__ocaml_lex_parse_pattern_rec eof_chars p lexbuf 29
and __ocaml_lex_parse_pattern_rec eof_chars p lexbuf __ocaml_lex_state =
match Lexing.engine __ocaml_lex_tables __ocaml_lex_state lexbuf with
| 0 ->
let
# 62 "ocamlbuild/glob_lexer.mll"
u
# 249 "ocamlbuild/glob_lexer.ml"
= Lexing.sub_lexeme lexbuf lexbuf.Lexing.lex_start_pos lexbuf.Lexing.lex_curr_pos in
# 62 "ocamlbuild/glob_lexer.mll"
( parse_pattern eof_chars (concat_patterns p (Word u)) lexbuf )
# 253 "ocamlbuild/glob_lexer.ml"
| 1 ->
# 64 "ocamlbuild/glob_lexer.mll"
(
let rec loop pl =
let (p',c) = parse_pattern ['}';','] Epsilon lexbuf in
let pl = p' :: pl in
if c = ',' then
loop pl
else
parse_pattern eof_chars (concat_patterns p (Union pl)) lexbuf
in
loop []
)
# 268 "ocamlbuild/glob_lexer.ml"
| 2 ->
# 76 "ocamlbuild/glob_lexer.mll"
(
let cl = Not(Or(parse_class [] lexbuf)) in
parse_pattern eof_chars (concat_patterns p (Class cl)) lexbuf
)
# 276 "ocamlbuild/glob_lexer.ml"
| 3 ->
# 81 "ocamlbuild/glob_lexer.mll"
(
let cl = Or(parse_class [] lexbuf) in
parse_pattern eof_chars (concat_patterns p (Class cl)) lexbuf
)
# 284 "ocamlbuild/glob_lexer.ml"
| 4 ->
# 87 "ocamlbuild/glob_lexer.mll"
( let q = Union[slash; Concat(slash, Concat(Star any, slash)) ] in
parse_pattern eof_chars (concat_patterns p q) lexbuf )
# 290 "ocamlbuild/glob_lexer.ml"
| 5 ->
# 90 "ocamlbuild/glob_lexer.mll"
( let q = Union[Epsilon; Concat(slash, Star any)] in
parse_pattern eof_chars (concat_patterns p q) lexbuf )
# 296 "ocamlbuild/glob_lexer.ml"
| 6 ->
# 93 "ocamlbuild/glob_lexer.mll"
( let q = Union[Epsilon; Concat(Star any, slash)] in
parse_pattern eof_chars (concat_patterns p q) lexbuf )
# 302 "ocamlbuild/glob_lexer.ml"
| 7 ->
# 95 "ocamlbuild/glob_lexer.mll"
( raise (Parse_error("Ambiguous ** pattern not allowed unless surrounded by one or more slashes")) )
# 307 "ocamlbuild/glob_lexer.ml"
| 8 ->
# 96 "ocamlbuild/glob_lexer.mll"
( parse_pattern eof_chars (concat_patterns p (Star not_slash)) lexbuf )
# 312 "ocamlbuild/glob_lexer.ml"
| 9 ->
# 97 "ocamlbuild/glob_lexer.mll"
( parse_pattern eof_chars (concat_patterns p slash) lexbuf )
# 317 "ocamlbuild/glob_lexer.ml"
| 10 ->
# 98 "ocamlbuild/glob_lexer.mll"
( parse_pattern eof_chars (concat_patterns p not_slash) lexbuf )
# 322 "ocamlbuild/glob_lexer.ml"
| 11 ->
let
# 99 "ocamlbuild/glob_lexer.mll"
c
# 328 "ocamlbuild/glob_lexer.ml"
= Lexing.sub_lexeme_char lexbuf lexbuf.Lexing.lex_start_pos in
# 100 "ocamlbuild/glob_lexer.mll"
( if List.mem c eof_chars then
(p,c)
else
raise (Parse_error(sf "Unexpected character %C in glob pattern" c))
)
# 336 "ocamlbuild/glob_lexer.ml"
| __ocaml_lex_state -> lexbuf.Lexing.refill_buff lexbuf; __ocaml_lex_parse_pattern_rec eof_chars p lexbuf __ocaml_lex_state
and parse_string b lexbuf =
__ocaml_lex_parse_string_rec b lexbuf 43
and __ocaml_lex_parse_string_rec b lexbuf __ocaml_lex_state =
match Lexing.engine __ocaml_lex_tables __ocaml_lex_state lexbuf with
| 0 ->
# 107 "ocamlbuild/glob_lexer.mll"
( Buffer.contents b )
# 347 "ocamlbuild/glob_lexer.ml"
| 1 ->
# 108 "ocamlbuild/glob_lexer.mll"
( Buffer.add_char b '"'; parse_string b lexbuf )
# 352 "ocamlbuild/glob_lexer.ml"
| 2 ->
let
# 109 "ocamlbuild/glob_lexer.mll"
u
# 358 "ocamlbuild/glob_lexer.ml"
= Lexing.sub_lexeme lexbuf lexbuf.Lexing.lex_start_pos lexbuf.Lexing.lex_curr_pos in
# 109 "ocamlbuild/glob_lexer.mll"
( Buffer.add_string b u; parse_string b lexbuf )
# 362 "ocamlbuild/glob_lexer.ml"
| 3 ->
let
# 110 "ocamlbuild/glob_lexer.mll"
c
# 368 "ocamlbuild/glob_lexer.ml"
= Lexing.sub_lexeme_char lexbuf lexbuf.Lexing.lex_start_pos in
# 110 "ocamlbuild/glob_lexer.mll"
( raise (Parse_error(sf "Unexpected character %C in string" c)) )
# 372 "ocamlbuild/glob_lexer.ml"
| __ocaml_lex_state -> lexbuf.Lexing.refill_buff lexbuf; __ocaml_lex_parse_string_rec b lexbuf __ocaml_lex_state
and parse_class cl lexbuf =
__ocaml_lex_parse_class_rec cl lexbuf 48
and __ocaml_lex_parse_class_rec cl lexbuf __ocaml_lex_state =
match Lexing.engine __ocaml_lex_tables __ocaml_lex_state lexbuf with
| 0 ->
# 113 "ocamlbuild/glob_lexer.mll"
( cl )
# 383 "ocamlbuild/glob_lexer.ml"
| 1 ->
# 114 "ocamlbuild/glob_lexer.mll"
( ((Atom('-','-'))::cl) )
# 388 "ocamlbuild/glob_lexer.ml"
| 2 ->
let
# 115 "ocamlbuild/glob_lexer.mll"
c1
# 394 "ocamlbuild/glob_lexer.ml"
= Lexing.sub_lexeme_char lexbuf lexbuf.Lexing.lex_start_pos
and
# 115 "ocamlbuild/glob_lexer.mll"
c2
# 399 "ocamlbuild/glob_lexer.ml"
= Lexing.sub_lexeme_char lexbuf (lexbuf.Lexing.lex_start_pos + 2) in
# 115 "ocamlbuild/glob_lexer.mll"
( parse_class ((Atom(c1,c2))::cl) lexbuf )
# 403 "ocamlbuild/glob_lexer.ml"
| 3 ->
let
# 116 "ocamlbuild/glob_lexer.mll"
c
# 409 "ocamlbuild/glob_lexer.ml"
= Lexing.sub_lexeme_char lexbuf lexbuf.Lexing.lex_start_pos in
# 116 "ocamlbuild/glob_lexer.mll"
( parse_class ((Atom(c,c))::cl) lexbuf )
# 413 "ocamlbuild/glob_lexer.ml"
| __ocaml_lex_state -> lexbuf.Lexing.refill_buff lexbuf; __ocaml_lex_parse_class_rec cl lexbuf __ocaml_lex_state