Skip to content

Commit 1da0660

Browse files
committed
make {|/ "" /|} equivalent to {|/ bos eos /|}
1 parent 8ed1b74 commit 1da0660

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

common/mik_lexer.mll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ rule token = parse
9999
| None -> IDENT id
100100
}
101101
| '\'' { char_literal (Buffer.create 16) lexbuf }
102+
| "\"\"" { EMPTY_STR }
102103
| '"' { string_literal (Buffer.create 16) lexbuf }
103104
| eof { EOF }
104105
| _ as c { raise (Error ("Unexpected character: " ^ String.make 1 c)) }

common/mik_parser.mly

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ let unclosed_error what startpos endpos =
4242

4343
%token <string> CHAR_LITERAL STRING_LITERAL IDENT MOD_IDENT PREDEFINED_CLASS
4444
%token <int> INT
45-
%token SLASH LPAREN RPAREN LBRACKET RBRACKET CARET LBRACE RBRACE
45+
%token SLASH LPAREN RPAREN LBRACKET RBRACKET CARET LBRACE RBRACE EMPTY_STR
4646
%token DASH BAR STAR PLUS QUESTION UNDERSCORE COLON EQUAL AS PIPE
4747
%token INT_CONVERTER FLOAT_CONVERTER EOF
4848

@@ -136,6 +136,9 @@ basic_atom:
136136
| STRING_LITERAL {
137137
to_pcre_regex $1 $startpos $endpos
138138
}
139+
| EMPTY_STR {
140+
to_pcre_regex "^$" $startpos $endpos
141+
}
139142
| UNDERSCORE {
140143
to_pcre_regex "." $startpos $endpos
141144
}

0 commit comments

Comments
 (0)