Project

Profile

Help

Revision cabcd277

Added by Michael Kay about 15 years ago

Fix bugs 1620437 and 1620488 - regular expression problems Fix bug 1620437

View differences:

latest8.8/bj/net/sf/saxon/dotnet/DotNetRegexTranslator.java
1279 1279
        }
1280 1280

  
1281 1281
        void inClassOutputBmp(FastStringBuffer buf) {
1282
            buf.append("\\" + i + ".{0}");  // terminate the back-reference with a syntactic separator
1282
            if (i != -1) {
1283
            	buf.append("(?:\\" + i + ")");  // terminate the back-reference with a syntactic separator
1284
            } else {
1285
                buf.append("(?:)"); // matches a zero-length string, while allowing a quantifier
1286
            }
1283 1287
        }
1284 1288
    }
1285 1289

  
......
1531 1535
                        recede();
1532 1536
                    }
1533 1537
                }
1534
                return new BackReference(c0);
1538
                if (captures.contains(c0)) {
1539
                    return new BackReference(c0);
1540
                } else {
1541
                    //match a zero-length string
1542
                    return new BackReference(-1);
1543
                }
1535 1544
            } else {
1536 1545
                throw makeException("digit not allowed after \\");
1537 1546
            }
......
1558 1567
            if (!isAsciiAlnum(curChar) && curChar != '-')
1559 1568
                expect('}');
1560 1569
        }
1561
        String propertyName = regExp.subSequence(start, pos - 1).toString();
1570
        CharSequence propertyNameCS = regExp.subSequence(start, pos - 1); 
1571
        if (ignoreWhitespace && !inCharClassExpr) {
1572
            propertyNameCS = Whitespace.removeAllWhitespace(propertyNameCS);
1573
        }
1574
        String propertyName = propertyNameCS.toString();
1562 1575
        advance();
1563 1576
        switch (propertyName.length()) {
1564 1577
        case 0:

Also available in: Unified diff