Added line-reader example. Changed behaviour of eof on regex to parse either eof or a newline followed be eof (better matchers other regex engines).
This commit is contained in:
7
mpc.c
7
mpc.c
@@ -2200,7 +2200,12 @@ static mpc_val_t *mpcf_re_escape(mpc_val_t *x) {
|
||||
/* Regex Special Characters */
|
||||
if (s[0] == '.') { free(s); return mpc_any(); }
|
||||
if (s[0] == '^') { free(s); return mpc_and(2, mpcf_snd, mpc_soi(), mpc_lift(mpcf_ctor_str), free); }
|
||||
if (s[0] == '$') { free(s); return mpc_and(2, mpcf_snd, mpc_eoi(), mpc_lift(mpcf_ctor_str), free); }
|
||||
if (s[0] == '$') {
|
||||
free(s);
|
||||
return mpc_or(2,
|
||||
mpc_and(2, mpcf_fst, mpc_newline(), mpc_eoi(), free),
|
||||
mpc_and(2, mpcf_snd, mpc_eoi(), mpc_lift(mpcf_ctor_str), free));
|
||||
}
|
||||
|
||||
/* Regex Escape */
|
||||
if (s[0] == '\\') {
|
||||
|
Reference in New Issue
Block a user