ICU-60 fix handling of anchors in toRule

X-SVN-Rev: 6316
This commit is contained in:
Alan Liu 2001-10-18 23:02:32 +00:00
parent fac983c3a1
commit 47c0722dcb
2 changed files with 32 additions and 6 deletions

View File

@ -5,8 +5,8 @@
*******************************************************************************
*
* $Source: /xsrl/Nsvn/icu/icu4j/src/com/ibm/icu/text/TransliterationRule.java,v $
* $Date: 2001/10/04 22:33:53 $
* $Revision: 1.30 $
* $Date: 2001/10/18 23:02:32 $
* $Revision: 1.31 $
*
*****************************************************************************************
*/
@ -44,7 +44,7 @@ import com.ibm.util.Utility;
* <p>Copyright &copy; IBM Corporation 1999. All rights reserved.
*
* @author Alan Liu
* @version $RCSfile: TransliterationRule.java,v $ $Revision: 1.30 $ $Date: 2001/10/04 22:33:53 $
* @version $RCSfile: TransliterationRule.java,v $ $Revision: 1.31 $ $Date: 2001/10/18 23:02:32 $
*/
class TransliterationRule {
@ -791,6 +791,11 @@ class TransliterationRule {
boolean emitBraces =
(anteContextLength != 0) || (keyLength != pattern.length());
// Emit start anchor
if ((flags & ANCHOR_START) != 0) {
rule.append('^');
}
// Emit the input pattern
for (i=0; i<pattern.length(); ++i) {
if (emitBraces && i == anteContextLength) {
@ -828,6 +833,11 @@ class TransliterationRule {
appendToRule(rule, '}', true, escapeUnprintable, quoteBuf);
}
// Emit end anchor
if ((flags & ANCHOR_END) != 0) {
rule.append('$');
}
appendToRule(rule, " > ", true, escapeUnprintable, quoteBuf);
// Emit the output pattern
@ -905,6 +915,9 @@ class TransliterationRule {
/**
* $Log: TransliterationRule.java,v $
* Revision 1.31 2001/10/18 23:02:32 alan
* jitterbug 60: fix handling of anchors in toRule
*
* Revision 1.30 2001/10/04 22:33:53 alan
* jitterbug 69: minor fix to incremental RBT code
*

View File

@ -5,8 +5,8 @@
*******************************************************************************
*
* $Source: /xsrl/Nsvn/icu/icu4j/src/com/ibm/text/Attic/TransliterationRule.java,v $
* $Date: 2001/10/04 22:33:53 $
* $Revision: 1.30 $
* $Date: 2001/10/18 23:02:32 $
* $Revision: 1.31 $
*
*****************************************************************************************
*/
@ -44,7 +44,7 @@ import com.ibm.util.Utility;
* <p>Copyright &copy; IBM Corporation 1999. All rights reserved.
*
* @author Alan Liu
* @version $RCSfile: TransliterationRule.java,v $ $Revision: 1.30 $ $Date: 2001/10/04 22:33:53 $
* @version $RCSfile: TransliterationRule.java,v $ $Revision: 1.31 $ $Date: 2001/10/18 23:02:32 $
*/
class TransliterationRule {
@ -791,6 +791,11 @@ class TransliterationRule {
boolean emitBraces =
(anteContextLength != 0) || (keyLength != pattern.length());
// Emit start anchor
if ((flags & ANCHOR_START) != 0) {
rule.append('^');
}
// Emit the input pattern
for (i=0; i<pattern.length(); ++i) {
if (emitBraces && i == anteContextLength) {
@ -828,6 +833,11 @@ class TransliterationRule {
appendToRule(rule, '}', true, escapeUnprintable, quoteBuf);
}
// Emit end anchor
if ((flags & ANCHOR_END) != 0) {
rule.append('$');
}
appendToRule(rule, " > ", true, escapeUnprintable, quoteBuf);
// Emit the output pattern
@ -905,6 +915,9 @@ class TransliterationRule {
/**
* $Log: TransliterationRule.java,v $
* Revision 1.31 2001/10/18 23:02:32 alan
* jitterbug 60: fix handling of anchors in toRule
*
* Revision 1.30 2001/10/04 22:33:53 alan
* jitterbug 69: minor fix to incremental RBT code
*