diff options
Diffstat (limited to 'gnu/java/util/regex/RE.java')
-rw-r--r-- | gnu/java/util/regex/RE.java | 32 |
1 files changed, 29 insertions, 3 deletions
diff --git a/gnu/java/util/regex/RE.java b/gnu/java/util/regex/RE.java index cd12aab8f..1aab3b781 100644 --- a/gnu/java/util/regex/RE.java +++ b/gnu/java/util/regex/RE.java @@ -130,7 +130,7 @@ public class RE extends REToken { private static final String VERSION = "1.1.5-dev"; // The localized strings are kept in a separate file - private static ResourceBundle messages = PropertyResourceBundle.getBundle("gnu/regexp/MessagesBundle", Locale.getDefault()); + private static ResourceBundle messages = PropertyResourceBundle.getBundle("gnu/java/util/regex/MessagesBundle", Locale.getDefault()); // These are, respectively, the first and last tokens in our linked list // If there is only one token, firstToken == lastToken @@ -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) |