Mercurial > hg > octave-nkf
comparison test/fntests.m @ 11032:c9b0a75b02e8
Make all regexp in Octave compatible with both POSIX and PCRE.
author | Rik <octave@nomad.inbox5.com> |
---|---|
date | Tue, 28 Sep 2010 09:25:14 -0700 |
parents | fa56fd98c0c5 |
children | d9c8916bb9dd |
comparison
equal
deleted
inserted
replaced
11031:d81b6144c4ba | 11032:c9b0a75b02e8 |
---|---|
73 if (n > 3 && strcmp (f((end-2):end), ".cc")) | 73 if (n > 3 && strcmp (f((end-2):end), ".cc")) |
74 fid = fopen (f); | 74 fid = fopen (f); |
75 if (fid >= 0) | 75 if (fid >= 0) |
76 str = fread (fid, "*char")'; | 76 str = fread (fid, "*char")'; |
77 fclose (fid); | 77 fclose (fid); |
78 retval = ! isempty (regexp (str,'[\r\n](DEFUN|DEFUN_DLD)\b', "once")); | 78 retval = ! isempty (regexp (str,"[\r\n](DEFUN|DEFUN_DLD)\\b", "once")); |
79 else | 79 else |
80 error ("fopen failed: %s", f); | 80 error ("fopen failed: %s", f); |
81 endif | 81 endif |
82 elseif (n > 2 && strcmp (f((end-1):end), ".m")) | 82 elseif (n > 2 && strcmp (f((end-1):end), ".m")) |
83 retval = true; | 83 retval = true; |
91 if (fid >= 0) | 91 if (fid >= 0) |
92 str = fread (fid, "*char")'; | 92 str = fread (fid, "*char")'; |
93 fclose (fid); | 93 fclose (fid); |
94 ## Avoid PCRE 'lineanchors' by searching for newline followed by PTN. | 94 ## Avoid PCRE 'lineanchors' by searching for newline followed by PTN. |
95 ## Equivalent to regexp ('^PTN','lineanchors') | 95 ## Equivalent to regexp ('^PTN','lineanchors') |
96 retval = ! isempty (regexp (str, '[\r\n]\s*%!(test|assert|error|warning)', "once")); | 96 retval = ! isempty (regexp (str, "[\r\n]\\s*%!(test|assert|error|warning)", "once")); |
97 else | 97 else |
98 error ("fopen failed: %s", f); | 98 error ("fopen failed: %s", f); |
99 endif | 99 endif |
100 endfunction | 100 endfunction |
101 | 101 |