diff options
| author | Ito Kazumitsu <kaz@maczuka.gcd.org> | 2006-07-25 14:34:49 +0000 |
|---|---|---|
| committer | Ito Kazumitsu <kaz@maczuka.gcd.org> | 2006-07-25 14:34:49 +0000 |
| commit | 0dfcdeae3483e525a255235aaec31a770a32574f (patch) | |
| tree | 3c1871b1c0cc424f497bf2598c333fdf03bb055b /gnu/java/util/regex/RE.java | |
| parent | 59e6156e0e792d9b6bdf0d474cb8154fc19f080c (diff) | |
| download | classpath-0dfcdeae3483e525a255235aaec31a770a32574f.tar.gz | |
2006-07-25 Ito Kazumitsu <kaz@maczuka.gcd.org>
Fixes bug #28413
* gnu/java/util/regex/RETokenEnd.java(check_java_line_terminators):
New field.
(RETokenEnd): New constructer to set check_java_line_terminators.
(matchThis): Checck line terminators if check_java_line_terminators.
* gnu/java/util/regex/RETokenStart.java: Likewise.
* gnu/regexp/RE.java(initialize): Use the new constructors for
RETokenEnd and RETokenStart if REG_MULTILINE is set.
* java/util/regex/Pattern.java(Patteren): Changed so that
gnu/regexp/RE.java may use the new the new constructors.
Diffstat (limited to 'gnu/java/util/regex/RE.java')
| -rw-r--r-- | gnu/java/util/regex/RE.java | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/gnu/java/util/regex/RE.java b/gnu/java/util/regex/RE.java index 24dd4ef3f..1aab3b781 100644 --- a/gnu/java/util/regex/RE.java +++ b/gnu/java/util/regex/RE.java @@ -750,7 +750,20 @@ public class RE extends REToken { else if ((unit.ch == '^') && !(unit.bk || quot)) { addToken(currentToken); currentToken = null; - addToken(new RETokenStart(subIndex,((cflags & REG_MULTILINE) > 0) ? syntax.getLineSeparator() : null)); + RETokenStart token = null; + if ((cflags & REG_MULTILINE) > 0) { + String sep = syntax.getLineSeparator(); + if (sep == null) { + token = new RETokenStart(subIndex, null, true); + } + else { + token = new RETokenStart(subIndex, sep); + } + } + else { + token = new RETokenStart(subIndex, null); + } + addToken(token); } // END OF LINE OPERATOR @@ -759,7 +772,20 @@ public class RE extends REToken { else if ((unit.ch == '$') && !(unit.bk || quot)) { addToken(currentToken); currentToken = null; - addToken(new RETokenEnd(subIndex,((cflags & REG_MULTILINE) > 0) ? syntax.getLineSeparator() : null)); + RETokenEnd token = null; + if ((cflags & REG_MULTILINE) > 0) { + String sep = syntax.getLineSeparator(); + if (sep == null) { + token = new RETokenEnd(subIndex, null, true); + } + else { + token = new RETokenEnd(subIndex, sep); + } + } + else { + token = new RETokenEnd(subIndex, null); + } + addToken(token); } // MATCH-ANY-CHARACTER OPERATOR (except possibly newline and null) |
