Package net.sf.saxon.functions.regex
Class RegexTranslator
- java.lang.Object
-
- net.sf.saxon.functions.regex.RegexTranslator
-
- Direct Known Subclasses:
JDK15RegexTranslator
public abstract class RegexTranslator extends java.lang.ObjectAbstract superclass for the various regex translators, which differ according to the target platform.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classRegexTranslator.RangeA Range represents a range of consecutive Unicode codepoints
-
Field Summary
Fields Modifier and Type Field Description static intALLprotected IntHashSetcapturesprotected booleancaseBlindprotected charcurCharprotected intcurrentCaptureprotected booleaneosprotected booleanexpandComplementBlockNamesprotected booleanignoreWhitespaceprotected booleaninCharClassExprprotected booleanisXPathprotected booleanisXPath30protected intlengthstatic intNONEstatic java.lang.StringNOT_ALLOWED_CLASSprotected intposprotected java.lang.CharSequenceregExpprotected FastStringBufferresultstatic intSOMEstatic java.lang.StringSURROGATES1_CLASSstatic java.lang.StringSURROGATES2_CLASSprotected java.util.List<RegexSyntaxException>warningsprotected intxmlVersionprotected intxsdVersion
-
Constructor Summary
Constructors Constructor Description RegexTranslator()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected intabsorbSurrogatePair()protected voidadvance()protected voidcopyCurChar()protected voidexpect(char c)protected static java.lang.StringhighSurrogateRanges(java.util.List<RegexTranslator.Range> ranges)protected static booleanisAsciiAlnum(char c)protected static booleanisJavaMetaChar(int c)protected static java.lang.StringlowSurrogateRanges(java.util.List<RegexTranslator.Range> ranges)protected RegexSyntaxExceptionmakeException(java.lang.String key)protected RegexSyntaxExceptionmakeException(java.lang.String key, java.lang.String arg)protected java.lang.CharSequenceparseQuantExact()protected voidrecede()protected abstract booleantranslateAtom()If what follows is an Atom, translate it and return true; otherwise return falseprotected voidtranslateBranch()protected voidtranslateQuantifier()protected voidtranslateQuantity()protected voidtranslateRegExp()protected voidtranslateTop()
-
-
-
Field Detail
-
regExp
protected java.lang.CharSequence regExp
-
xmlVersion
protected int xmlVersion
-
xsdVersion
protected int xsdVersion
-
isXPath
protected boolean isXPath
-
isXPath30
protected boolean isXPath30
-
ignoreWhitespace
protected boolean ignoreWhitespace
-
inCharClassExpr
protected boolean inCharClassExpr
-
caseBlind
protected boolean caseBlind
-
expandComplementBlockNames
protected boolean expandComplementBlockNames
-
pos
protected int pos
-
length
protected int length
-
curChar
protected char curChar
-
eos
protected boolean eos
-
currentCapture
protected int currentCapture
-
captures
protected IntHashSet captures
-
result
protected final FastStringBuffer result
-
warnings
protected java.util.List<RegexSyntaxException> warnings
-
NONE
public static final int NONE
- See Also:
- Constant Field Values
-
SOME
public static final int SOME
- See Also:
- Constant Field Values
-
ALL
public static final int ALL
- See Also:
- Constant Field Values
-
SURROGATES1_CLASS
public static final java.lang.String SURROGATES1_CLASS
- See Also:
- Constant Field Values
-
SURROGATES2_CLASS
public static final java.lang.String SURROGATES2_CLASS
- See Also:
- Constant Field Values
-
NOT_ALLOWED_CLASS
public static final java.lang.String NOT_ALLOWED_CLASS
- See Also:
- Constant Field Values
-
-
Method Detail
-
translateTop
protected void translateTop() throws RegexSyntaxException- Throws:
RegexSyntaxException
-
translateRegExp
protected void translateRegExp() throws RegexSyntaxException- Throws:
RegexSyntaxException
-
translateBranch
protected void translateBranch() throws RegexSyntaxException- Throws:
RegexSyntaxException
-
translateAtom
protected abstract boolean translateAtom() throws RegexSyntaxExceptionIf what follows is an Atom, translate it and return true; otherwise return false- Returns:
- true if we found an atom
- Throws:
RegexSyntaxException- if the regex syntax is incorrect
-
translateQuantifier
protected void translateQuantifier() throws RegexSyntaxException- Throws:
RegexSyntaxException
-
translateQuantity
protected void translateQuantity() throws RegexSyntaxException- Throws:
RegexSyntaxException
-
parseQuantExact
protected java.lang.CharSequence parseQuantExact() throws RegexSyntaxException- Throws:
RegexSyntaxException
-
copyCurChar
protected void copyCurChar()
-
advance
protected void advance()
-
absorbSurrogatePair
protected int absorbSurrogatePair() throws RegexSyntaxException- Throws:
RegexSyntaxException
-
recede
protected void recede()
-
expect
protected void expect(char c) throws RegexSyntaxException- Throws:
RegexSyntaxException
-
makeException
protected RegexSyntaxException makeException(java.lang.String key)
-
makeException
protected RegexSyntaxException makeException(java.lang.String key, java.lang.String arg)
-
isJavaMetaChar
protected static boolean isJavaMetaChar(int c)
-
highSurrogateRanges
protected static java.lang.String highSurrogateRanges(java.util.List<RegexTranslator.Range> ranges)
-
lowSurrogateRanges
protected static java.lang.String lowSurrogateRanges(java.util.List<RegexTranslator.Range> ranges)
-
isAsciiAlnum
protected static boolean isAsciiAlnum(char c)
-
-