diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2003-09-30 17:25:54 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2003-09-30 17:25:54 +0000 |
commit | 20b23f0c929d64825f8cba0680e19fdf9c5981e4 (patch) | |
tree | 63e9dcffa3ab40bb764d2592e3ed419236fcf074 /perl_checker.src | |
parent | 76ca19f66e50228c0c2782b1ab4ea7c62ec27819 (diff) | |
download | perl-MDK-Common-20b23f0c929d64825f8cba0680e19fdf9c5981e4.tar perl-MDK-Common-20b23f0c929d64825f8cba0680e19fdf9c5981e4.tar.gz perl-MDK-Common-20b23f0c929d64825f8cba0680e19fdf9c5981e4.tar.bz2 perl-MDK-Common-20b23f0c929d64825f8cba0680e19fdf9c5981e4.tar.xz perl-MDK-Common-20b23f0c929d64825f8cba0680e19fdf9c5981e4.zip |
detect s@...@...@ instead of getting crazy
Diffstat (limited to 'perl_checker.src')
-rw-r--r-- | perl_checker.src/lexer.mll | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/perl_checker.src/lexer.mll b/perl_checker.src/lexer.mll index b1250e3..ac04193 100644 --- a/perl_checker.src/lexer.mll +++ b/perl_checker.src/lexer.mll @@ -346,12 +346,17 @@ let hex_in_string lexbuf next_rule s = else "\\x{" ^ s ^ "}" in next_s s (Stack.pop next_rule) lexbuf + +let set_delimit_char lexbuf op = + match lexeme_char lexbuf (String.length op) with + | '@' -> die lexbuf ("don't use " ^ op ^ "@...@, replace @ with / ! , or |") + | c -> delimit_char := c } let stash = [ '$' '@' '%' '&' '*' ] let ident_start = ['a'-'z' 'A'-'Z' '_'] let ident = ident_start ['0'-'9' 'A'-'Z' 'a'-'z' '_'] * -let pattern_separator = [ '/' '!' ',' '|' ] +let pattern_separator = [ '/' '!' ',' '|' '@' ] rule token = parse | [' ' '\t']+ { @@ -533,7 +538,7 @@ rule token = parse } | "m" pattern_separator { - delimit_char := lexeme_char lexbuf 1 ; + set_delimit_char lexbuf "m" ; current_string_start_line := !current_file_current_line; let s, pos = ins re_delimited_string lexbuf in let opts, _ = raw_ins pattern_options lexbuf in @@ -542,7 +547,7 @@ rule token = parse } | "qr" pattern_separator { - delimit_char := lexeme_char lexbuf 2 ; + set_delimit_char lexbuf "qr" ; current_string_start_line := !current_file_current_line; let s, pos = ins re_delimited_string lexbuf in let opts, _ = raw_ins pattern_options lexbuf in @@ -551,7 +556,7 @@ rule token = parse } | "s" pattern_separator { - delimit_char := lexeme_char lexbuf 1 ; + set_delimit_char lexbuf "s" ; current_string_start_line := !current_file_current_line; let s1, (start, _) = ins re_delimited_string lexbuf in let s2, (_, end_) = ins delimited_string lexbuf in @@ -562,7 +567,7 @@ rule token = parse } | "tr" pattern_separator { - delimit_char := lexeme_char lexbuf 2 ; + set_delimit_char lexbuf "tr" ; current_string_start_line := !current_file_current_line; let s1, (start, _) = ins delimited_string lexbuf in let s2, (_, end_) = ins delimited_string lexbuf in |