| de.susebox.jtopas.TokenizerProperties
All known Subclasses: de.susebox.jtopas.StandardTokenizerProperties, de.susebox.jtopas.AbstractTokenizerProperties,
TokenizerProperties | public interface TokenizerProperties (Code) | |
The interface TokenizerProperties declares constants and methods
to maintain the characteristics of a
Tokenizer , e. g. comments, keywords
and special sequences. A TokenizerProperties implementation instance
can be used by one or more
Tokenizer instances.
A TokenizerProperties object that is used to parse Java or C code
including line and column information, would be setup like this:
TokenizerProperties props = new StandardTokenizerProperties();
props.setParseFlags(Flags.F_COUNT_LINES);
props.addLineComment("//");
props.addBlockComment(TokenizerProperties.DEFAULT_BLOCK_COMMENT_START,
TokenizerProperties.DEFAULT_BLOCK_COMMENT_END);
props.addString("\"", "\"", "\\");
props.addString("'", "'", "\\");
props.addSpecialSequence(">>");
props.addSpecialSequence("<<");
props.addSpecialSequence("++");
props.addSpecialSequence("--");
...
props.addKeyword("class");
props.addKeyword("if");
props.addKeyword("then");
props.addKeyword("while");
props.addKeyword("do");
...
Beside the dedicated method groups for comments, strings, keywords and
special sequences (e.g.
TokenizerProperties.addKeyword ,
TokenizerProperties.removeKeyword and
TokenizerProperties.keywordExists ) there is a set of generic methods working with
TokenizerProperty objects:
When adding a property through one of the add... calls without
the flags parameter, the currently active flags of the
TokenizerProperties instance will be used for the property.
This interface is separated from the
Tokenizer interface mainly to
distinguish between the more static information, the actual source of data
and the tokenizing process. Especially in multithreaded environments where
multible instances of "equal" tokenizers are run at the same time, it saves
both memory resources and setup effort to have one TokenizerProperties
instance for all
Tokenizer instances.
Beside its function as a store for lexical element descriptions, this interface
also provides an event mechanism to notify all interested objects about changes
(additions, modifications and removals) of such lexical element descriptions.
This interface partly replaces the older
de.susebox.java.util.Tokenizer interface which is deprecated.
See Also: Token See Also: Tokenizer See Also: TokenizerProperty author: Heiko Blau |
Method Summary | |
public void | addBlockComment(String start, String end) Registering a block comment with the parser. | public void | addBlockComment(String start, String end, Object companion) Registering a block comment with the parser. | public void | addBlockComment(String start, String end, Object companion, int flags) Registering a block comment. | public void | addBlockComment(String start, String end, Object companion, int flags, int flagMask) Registering a block comment with a set of flags and an associated flag mask.
The method is an extension to
TokenizerProperties.addBlockComment(String,String,Object,int)
having a bitmask for the flags that are explicitely specified for the block
comment property. | public void | addKeyword(String keyword) Registering a keyword. | public void | addKeyword(String keyword, Object companion) Registering a keyword. | public void | addKeyword(String keyword, Object companion, int flags) Registering a keyword. | public void | addKeyword(String keyword, Object companion, int flags, int flagMask) Registering a keyword with a set of flags and an associated flag mask..
The method is an extension to
TokenizerProperties.addKeyword(String,Object,int) having
a bitmask for the flags that are explicitely specified for the pattern
property. | public void | addLineComment(String lineComment) Registering a the starting sequence of a line comment. | public void | addLineComment(String lineComment, Object companion) Registering a the starting sequence of a line comment. | public void | addLineComment(String lineComment, Object companion, int flags) Registering a the starting sequence of a line comment. | public void | addLineComment(String lineComment, Object companion, int flags, int flagMask) Registering a line comment with a set of flags and an associated flag mask.
The method is an extension to
TokenizerProperties.addLineComment(String,Object,int)
having a bitmask for the flags that are explicitely specified for the block
comment property. | public void | addPattern(String pattern) Registering a pattern. | public void | addPattern(String pattern, Object companion) Registering a pattern with an associated object. | public void | addPattern(String pattern, Object companion, int flags) Registering a pattern with an associated object. | public void | addPattern(String pattern, Object companion, int flags, int flagMask) Registering a pattern with an associated object and explicitely given flags.
See the description of the
TokenizerProperties.addPattern(String) for details on pattern.
The method is an extension to
TokenizerProperties.addPattern(String,Object,int) having
a bitmask for the flags that are specified for the pattern property. | public void | addProperty(TokenizerProperty property) Registering a
TokenizerProperty . | public void | addSeparators(String separators) Adding new separators to the existing set. | public void | addSpecialSequence(String specSeq) Registering a special sequence of characters. | public void | addSpecialSequence(String specSeq, Object companion) Registering a special sequence of characters. | public void | addSpecialSequence(String specSeq, Object companion, int flags) Registering a special sequence of characters. | public void | addSpecialSequence(String specSeq, Object companion, int flags, int flagMask) Registering a special sequence with a set of flags and an associated flag mask.
The method is an extension to
TokenizerProperties.addSpecialSequence(String,Object,int) having
a bitmask for the flags that are explicitely specified for the special sequence
property. | public void | addString(String start, String end, String escape) Registering a string description. | public void | addString(String start, String end, String escape, Object companion) Registering a the sequences that are used for string-like text parts.
This method supports also an information associated with the string,
called the companion.
If the given string starting sequence is already known to the parser,
it will simply be re-registered. | public void | addString(String start, String end, String escape, Object companion, int flags) Registering a the sequences that are used for string-like text parts.
This method supports also an information associated with the string,
called the companion.
If the given string starting sequence is already known to the parser,
it will simply be re-registered. | public void | addString(String start, String end, String escape, Object companion, int flags, int flagMask) Registering a string with a set of flags and an associated flag mask.
The method is an extension to
TokenizerProperties.addString(String,Object,int)
having a bitmask for the flags that are explicitely specified for the block
comment property. | public void | addTokenizerPropertyListener(TokenizerPropertyListener listener) Registering a new
TokenizerPropertyListener . | public void | addWhitespaces(String whitespaces) Adding new whitespaces to the existing set. | public boolean | blockCommentExists(String start) Checks if the give block comment is known. | public TokenizerProperty | getBlockComment(String start) Get the full description of a block comment property starting with the given
prefix. | public Object | getBlockCommentCompanion(String start) Retrieving a certain block comment. | public Iterator | getBlockComments() This method returns an
java.util.Iterator of
TokenizerProperty objects. | public TokenizerProperty | getKeyword(String keyword) Get the full description of a keyword property. | public Object | getKeywordCompanion(String keyword) Retrieving the companion of the given special sequence. | public Iterator | getKeywords() This method returns an
java.util.Iterator of
TokenizerProperty objects. | public TokenizerProperty | getLineComment(String lineComment) Get the full description of a line comment property starting with the given
prefix. | public Object | getLineCommentCompanion(String lineComment) Retrieving the associated object of a certain line comment. | public Iterator | getLineComments() This method returns an
java.util.Iterator of
TokenizerProperty objects. | public int | getParseFlags() Retrieving the parser control flags. | public TokenizerProperty | getPattern(String pattern) Get the full description of a pattern property. | public Object | getPatternCompanion(String pattern) Retrieving the information associated with a given pattern. | public Iterator | getPatterns() This method returns an
java.util.Iterator of
TokenizerProperty objects. | public Iterator | getProperties() This method returns an
java.util.Iterator of
TokenizerProperty objects. | public String | getSeparators() Obtaining the separator set of the TokenizerProperties . | public TokenizerProperty | getSpecialSequence(String specSeq) Get the full description of a special sequence property. | public Object | getSpecialSequenceCompanion(String specSeq) Retrieving the companion of the given special sequence. | public Iterator | getSpecialSequences() This method returns an
java.util.Iterator of
TokenizerProperty objects. | public TokenizerProperty | getString(String start) Get the full description of a string property starting with the given
prefix. | public Object | getStringCompanion(String start) Retrieving the information associated with a certain string. | public Iterator | getStrings() This method returns an
java.util.Iterator of
TokenizerProperty objects. | public String | getWhitespaces() Obtaining the whitespace character set. | public boolean | isFlagSet(int flag) Returns true if a given flag is set in the current parse flags. | public boolean | isFlagSet(TokenizerProperty prop, int flag) Checks if a given flag (see
Flags ) is set for the given
TokenizerProperty
in the context of this TokenizerProperties instance.
The method uses the flag state of the TokenizerProperty object
if it is contained in the flag mask of the property (see
TokenizerProperty.containsFlag ).
Otherwise it falls back to the flag state set globally for this
TokenizerProperties instance. | public boolean | keywordExists(String keyword) Checks if the given keyword is known to the TokenizerProperties . | public boolean | lineCommentExists(String lineComment) Checks if the give line comment is known. | public boolean | patternExists(String pattern) Checks if the given pattern is known to the parser. | public boolean | propertyExists(TokenizerProperty property) Checks if the given
TokenizerProperty is known to this TokenizerProperties
instance. | public void | removeBlockComment(String start) Removing a certain block comment. | public void | removeKeyword(String keyword) Removing a keyword property from the store. | public void | removeLineComment(String lineComment) Removing a certain line comment. | public void | removePattern(String pattern) Removing a pattern. | public void | removeProperty(TokenizerProperty property) Deregistering a
TokenizerProperty from the store. | public void | removeSeparators(String separators) Removing separators from the existing set. | public void | removeSpecialSequence(String specSeq) Removing a special sequence property from the store. | public void | removeString(String start) Removing a string description. | public void | removeTokenizerPropertyListener(TokenizerPropertyListener listener) Removing a listener from the list of registered
TokenizerPropertyListener instances. | public void | removeWhitespaces(String whitespaces) Removing whitespaces from the existing set. | public void | setParseFlags(int flags) Setting the control flags of the TokenizerProperties . | public void | setSeparators(String separators) Setting the separator set. | public void | setWhitespaces(String whitespaces) Setting the whitespace character set of the tokenizer. | public boolean | specialSequenceExists(String specSeq) Checks if the given special sequence is known to the TokenizerProperties . | public boolean | stringExists(String start) Checks if the given starting sequence of the string is known to the parser.
The method accepts both empty and null strings for start
by returning false .
Note that there is no choice of parsing flags (different to the
TokenizerProperties.addString(String,String,String,Object,int) method), since it
makes generally no sense to "overload" properties. |
DEFAULT_BLOCK_COMMENT_END | final public static String DEFAULT_BLOCK_COMMENT_END(Code) | | Default end sequence of a block comment (Java, C/C++).
|
DEFAULT_BLOCK_COMMENT_START | final public static String DEFAULT_BLOCK_COMMENT_START(Code) | | Default starting sequence of a block comment (Java, C/C++).
|
DEFAULT_CHAR_END | final public static String DEFAULT_CHAR_END(Code) | | The well-known character ending sequence of C/C++, Java and other languages.
|
DEFAULT_CHAR_ESCAPE | final public static String DEFAULT_CHAR_ESCAPE(Code) | | The well-known escape sequence for character literals in C/C++, Java and other
languages.
|
DEFAULT_CHAR_START | final public static String DEFAULT_CHAR_START(Code) | | The well-known character starting sequence of C/C++, Java and other languages.
|
DEFAULT_LINE_COMMENT | final public static String DEFAULT_LINE_COMMENT(Code) | | Default line comment seqence (Java, C++)
|
DEFAULT_SEPARATORS | final public static String DEFAULT_SEPARATORS(Code) | | Separators are otherwise not remarkable characters. An opening parenthesis
might be nessecary for a syntactically correct text, but without any special
meaning to the compiler, interpreter etc. after it has been detected.
The value of this constant includes all printable characters that are not
alphanumeric and not whitespaces. Note, that adding one of the separator
characters as a special sequence (
TokenizerProperties.addSpecialSequence ) takes
precedence.
|
DEFAULT_STRING_END | final public static String DEFAULT_STRING_END(Code) | | The well-known string ending sequence of C/C++, Java and other languages.
|
DEFAULT_STRING_ESCAPE | final public static String DEFAULT_STRING_ESCAPE(Code) | | The well-known escape sequence for strings in C/C++, Java and other languages.
|
DEFAULT_STRING_START | final public static String DEFAULT_STRING_START(Code) | | The well-known string starting sequence " of C/C++, Java and other languages.
|
DEFAULT_WHITESPACES | final public static String DEFAULT_WHITESPACES(Code) | | Whitespaces are portions of the text, that contain one or more characters
that separate the significant parts of the text. Generally, a sequence of
whitespaces is equally represented by one single whitespace character. That
is the difference to separators.
The value of this constant contains the ASCII characters space, tab, carriage
return and linefeed.
|
addBlockComment | public void addBlockComment(String start, String end, Object companion) throws IllegalArgumentException, UnsupportedOperationException(Code) | | Registering a block comment with the parser. Beside the obviously nessecary
starting and finishing sequence of the block comment, it takes an object that
is associated with the block comment, called the companion.
If the given starting sequence is already known to the parser, the block
comment is simply re-registered. Using this method on a known block comment
with an associated companion will replace that companion against the given
one.
An implementation of this interface should fire a
TokenizerPropertyEvent of type
TokenizerPropertyEvent.PROPERTY_ADDED to all registered listeners
(see
TokenizerProperties.addTokenizerPropertyListener ) with the new block comment
TokenizerProperty if the comment is a new one, or of type
TokenizerPropertyEvent.PROPERTY_MODIFIED if the comment is
re-registered.
Parameters: start - the starting sequence of the block comment Parameters: end - the finishing sequence of the block comment Parameters: companion - information object associated with this block comment throws: IllegalArgumentException - when null or an empty stringis passed for start or end throws: UnsupportedOperationException - if the method is not available for animplementation of the TokenizerProperties interface See Also: TokenizerProperties.addBlockComment(String,String) See Also: TokenizerProperties.addBlockComment(String,String,Object,int) See Also: TokenizerProperties.removeBlockComment |
addBlockComment | public void addBlockComment(String start, String end, Object companion, int flags) throws IllegalArgumentException, UnsupportedOperationException(Code) | | Registering a block comment. Beside the obviously nessecary
starting and finishing sequence of the block comment, it takes an object that
is associated with the block comment, called the companion.
If the given starting sequence is already known to the parser, the block
comment is simply re-registered. Using this method on a known block comment
with an associated companion will replace that companion against the given
one.
This version of addBlockComment supports a bitmask of the
Flags to modify the general tokenizer settings (see
TokenizerProperties.setParseFlags ) for this special element.
An implementation of this interface should fire a
TokenizerPropertyEvent of type
TokenizerPropertyEvent.PROPERTY_ADDED to all registered listeners
(see
TokenizerProperties.addTokenizerPropertyListener ) with the new block comment
TokenizerProperty if the comment is a new one, or of type
TokenizerPropertyEvent.PROPERTY_MODIFIED if the comment is
re-registered.
A call to this method is equivalent to
addBlockComment(start, end, companion, flags, flags) .
Parameters: start - the starting sequence of the block comment Parameters: end - the finishing sequence of the block comment Parameters: companion - information object associated with this block comment Parameters: flags - modification flags throws: IllegalArgumentException - when null or an empty stringis passed for start or end throws: UnsupportedOperationException - if the method is not available for animplementation of the TokenizerProperties interface See Also: TokenizerProperties.addBlockComment(String,String) See Also: TokenizerProperties.addBlockComment(String,String,Object) See Also: TokenizerProperties.addBlockComment(String,String,Object,int,int) See Also: TokenizerProperties.removeBlockComment |
addBlockComment | public void addBlockComment(String start, String end, Object companion, int flags, int flagMask) throws IllegalArgumentException, UnsupportedOperationException(Code) | | Registering a block comment with a set of flags and an associated flag mask.
The method is an extension to
TokenizerProperties.addBlockComment(String,String,Object,int)
having a bitmask for the flags that are explicitely specified for the block
comment property. All other flag values (states) should be taken from the
TokenizerProperty instance or from the
Tokenizer .
Parameters: start - the starting sequence of the block comment Parameters: end - the finishing sequence of the block comment Parameters: companion - information object associated with this block comment Parameters: flags - modification flags Parameters: flagMask - flags that have valid values in the parameter flags throws: IllegalArgumentException - when null or an empty stringis passed for keyword throws: UnsupportedOperationException - if the method is not available for animplementation of the TokenizerProperties interface See Also: TokenizerProperties.addBlockComment(String,String) See Also: TokenizerProperties.addBlockComment(String,String,Object) See Also: TokenizerProperties.addBlockComment(String,String,Object,int) See Also: TokenizerProperties.removeBlockComment |
addLineComment | public void addLineComment(String lineComment, Object companion, int flags) throws IllegalArgumentException, UnsupportedOperationException(Code) | | Registering a the starting sequence of a line comment. The line comment is
a special type of whitespace. It starts with the given character sequence
and contains all characters up to and including the next end-of-line
character(s).
Although most languages have only one line comment sequence, it is possible
to use more than one.
This method supports also an information associated with the line comment,
called the companion.
If the given line comment starting sequence is already known to the parser,
it will simply be re-registered. Using this method on a known line comment
with an associated companion will replace that companion against the given
one.
This version of addLineComment supports a bitmask of the
Flags to modify the general tokenizer settings (see
TokenizerProperties.setParseFlags ) for this special element.
An implementation of this interface should fire a
TokenizerPropertyEvent of type
TokenizerPropertyEvent.PROPERTY_ADDED to all registered listeners
(see
TokenizerProperties.addTokenizerPropertyListener ) with the new line comment
TokenizerProperty if the line comment is a new one, or of type
TokenizerPropertyEvent.PROPERTY_MODIFIED if the line comment is
re-registered.
A call to this method is equivalent to
addLineComment(lineComment, companion, flags, flags) .
Parameters: lineComment - the starting sequence of a line comment Parameters: companion - the associated information Parameters: flags - modification flags throws: IllegalArgumentException - when null or an empty stringis passed for lineComment throws: UnsupportedOperationException - if the method is not available for animplementation of the TokenizerProperties interface See Also: TokenizerProperties.addLineComment(String) See Also: TokenizerProperties.addLineComment(String,Object) See Also: TokenizerProperties.addLineComment(String,Object,int,int) See Also: TokenizerProperties.removeLineComment |
addSpecialSequence | public void addSpecialSequence(String specSeq, Object companion, int flags) throws IllegalArgumentException, UnsupportedOperationException(Code) | | Registering a special sequence of characters. Such sequences may be multicharacter
operators like the shift operators in Java.
Unlike keywords, special sequences act also as separators between other tokens.
If one special sequence is the prefix of other special sequences (in Java the
shift operator >> is the prefix of the shift operator
>>> ), always the longest possible match is returned.
Testing on special sequences takes place after whitespaces and comments are ruled
out, but before ordinary separators are tested.
This form of addSpecialSequence also takes an object associated with
the special sequence, called the companion.
This version of addSpecialSequence supports a bitmask of the
Flags to modify the general tokenizer settings (see
TokenizerProperties.setParseFlags ) for this special element.
An implementation of this interface should fire a
TokenizerPropertyEvent of type
TokenizerPropertyEvent.PROPERTY_ADDED to all registered listeners
(see
TokenizerProperties.addTokenizerPropertyListener ) with the new special sequence
TokenizerProperty if the sequence is a new one, or of type
TokenizerPropertyEvent.PROPERTY_MODIFIED if the sequence is
re-registered.
A call to this method is equivalent to addSpecialSequence(keyword, companion, flags, flags) .
Parameters: specSeq - special sequence to register Parameters: companion - information object associated with this special sequence Parameters: flags - modification flags throws: IllegalArgumentException - when null or an empty stringis passed for specSeq throws: UnsupportedOperationException - if the method is not available for animplementation of the TokenizerProperties interface See Also: TokenizerProperties.addSpecialSequence(String) See Also: TokenizerProperties.addSpecialSequence(String,Object) See Also: TokenizerProperties.addSpecialSequence(String,Object,int,int) See Also: TokenizerProperties.removeSpecialSequence |
addString | public void addString(String start, String end, String escape) throws IllegalArgumentException, UnsupportedOperationException(Code) | | Registering a string description. Strings are things like the primitive string
literals in C/C++, SQL varchar literals, but also the character literals
of C/C++ and Java.
If the given string starting sequence is already known to the parser,
it will simply be re-registered. Using this method on a known string
with an associated companion will remove that companion.
An implementation of this interface should fire a
TokenizerPropertyEvent of type
TokenizerPropertyEvent.PROPERTY_ADDED to all registered listeners
(see
TokenizerProperties.addTokenizerPropertyListener ) with the new string
TokenizerProperty if the string is a new one, or of type
TokenizerPropertyEvent.PROPERTY_MODIFIED if the string is re-registered.
Passing null or an empty string for the escape sequence means
that no escapes are used in the described string element.
Parameters: start - the starting sequence of a string Parameters: end - the finishing sequence of a string Parameters: escape - the escape sequence inside the string throws: IllegalArgumentException - when null or an empty string is passed for start or end throws: UnsupportedOperationException - if the method is not available for animplementation of the TokenizerProperties interface See Also: TokenizerProperties.addString(String,String,String,Object) See Also: TokenizerProperties.addString(String,String,String,Object,int) See Also: TokenizerProperties.removeString |
addString | public void addString(String start, String end, String escape, Object companion) throws IllegalArgumentException(Code) | | Registering a the sequences that are used for string-like text parts.
This method supports also an information associated with the string,
called the companion.
If the given string starting sequence is already known to the parser,
it will simply be re-registered. Using this method on a known string
with an associated companion will replace that companion against the given
one.
An implementation of this interface should fire a
TokenizerPropertyEvent of type
TokenizerPropertyEvent.PROPERTY_ADDED to all registered listeners
(see
TokenizerProperties.addTokenizerPropertyListener ) with the new string
TokenizerProperty if the string is a new one, or of type
TokenizerPropertyEvent.PROPERTY_MODIFIED if the string is re-registered.
Passing null or an empty string for the escape sequence means
that no escapes are used in the described string element.
Parameters: start - the starting sequence of a string Parameters: end - the finishing sequence of a string Parameters: escape - the escape sequence inside the string Parameters: companion - the associated information throws: IllegalArgumentException - when null or an empty string is passed for start or end throws: UnsupportedOperationException - if the method is not available for animplementation of the TokenizerProperties interface See Also: TokenizerProperties.addString(String,String,String) See Also: TokenizerProperties.addString(String,String,String,Object,int) See Also: TokenizerProperties.removeString |
addString | public void addString(String start, String end, String escape, Object companion, int flags) throws IllegalArgumentException, UnsupportedOperationException(Code) | | Registering a the sequences that are used for string-like text parts.
This method supports also an information associated with the string,
called the companion.
If the given string starting sequence is already known to the parser,
it will simply be re-registered. Using this method on a known string
with an associated companion will replace that companion against the given
one.
This version of addString supports a bitmask of the
Flags to modify the general tokenizer settings (see
TokenizerProperties.setParseFlags for this special element.
An implementation of this interface should fire a
TokenizerPropertyEvent of type
TokenizerPropertyEvent.PROPERTY_ADDED to all registered listeners
(see
TokenizerProperties.addTokenizerPropertyListener ) with the new string
TokenizerProperty if the string is a new one, or of type
TokenizerPropertyEvent.PROPERTY_MODIFIED if the string is re-registered.
Passing null or an empty string for the escape sequence means
that no escapes are used in the described string element.
A call to this method is equivalent to
addString(start, end, escape, flags, flags) .
Parameters: start - the starting sequence of a string Parameters: end - the finishing sequence of a string Parameters: escape - the escape sequence inside the string Parameters: companion - the associated information Parameters: flags - modification flags throws: IllegalArgumentException - when null or an empty string is passed for start or end throws: UnsupportedOperationException - if the method is not available for animplementation of the TokenizerProperties interface See Also: TokenizerProperties.addString(String,String,String) See Also: TokenizerProperties.addString(String,String,String,Object) See Also: TokenizerProperties.addString(String,String,String,Object,int,int) See Also: TokenizerProperties.removeString |
addString | public void addString(String start, String end, String escape, Object companion, int flags, int flagMask) throws IllegalArgumentException, UnsupportedOperationException(Code) | | Registering a string with a set of flags and an associated flag mask.
The method is an extension to
TokenizerProperties.addString(String,Object,int)
having a bitmask for the flags that are explicitely specified for the block
comment property. All other flag values (states) should be taken from the
TokenizerProperty instance or from the
Tokenizer .
Parameters: start - the starting sequence of a string Parameters: end - the finishing sequence of a string Parameters: escape - the escape sequence inside the string Parameters: companion - the associated information Parameters: flags - modification flags Parameters: flagMask - flags that have valid values in the parameter flags throws: IllegalArgumentException - when null or an empty stringis passed for keyword throws: UnsupportedOperationException - if the method is not available for animplementation of the TokenizerProperties interface See Also: TokenizerProperties.addString(String,String,String) See Also: TokenizerProperties.addString(String,String,String,Object) See Also: TokenizerProperties.addString(String,String,String,Object,int) See Also: TokenizerProperties.removeString |
blockCommentExists | public boolean blockCommentExists(String start)(Code) | | Checks if the give block comment is known. Only the starting sequence is
nessecary to identify the block comment.
The method accepts both empty and null strings for start
by returning false .
Parameters: start - the starting sequence of the block comment true if the block comment is known, false otherwise |
getBlockCommentCompanion | public Object getBlockCommentCompanion(String start) throws IllegalArgumentException(Code) | | Retrieving a certain block comment. Only the starting sequence is nessecary
to identify the block comment. If the block comment is not known to the
parser, then null is returned.
To distinguish between an unknown line comment and companion-less line
comment, use the method
TokenizerProperties.lineCommentExists .
Parameters: start - the starting sequence of the block comment the associated object of the block comment throws: IllegalArgumentException - when null or an empty stringis passed |
getKeywordCompanion | public Object getKeywordCompanion(String keyword) throws IllegalArgumentException(Code) | | Retrieving the companion of the given special sequence. If the special
sequence doesn't exist the method returns null .
Parameters: keyword - keyword thats companion is sought the object associated with the keyword throws: IllegalArgumentException - when null or an empty stringis passed |
getParseFlags | public int getParseFlags()(Code) | | Retrieving the parser control flags. A bitmask containing the
Flags constants is returned. These flags are the ones set for all
Tokenizer instances sharing this TokenizerProperties object and may be
partially overridden in these tokenizers.
the globally set parser control flags See Also: TokenizerProperties.setParseFlags |
getPatternCompanion | public Object getPatternCompanion(String pattern) throws IllegalArgumentException(Code) | | Retrieving the information associated with a given pattern. If the pattern
is not known to the parser, null will be returned.
If You need to know if a pattern is known to this TokenizerProperties
instance with or without a companion, use the method
TokenizerProperties.patternExists instead.
Parameters: pattern - the regular expression to be removed the associated information or null throws: IllegalArgumentException - when null or an emtpy patternis passed |
getSeparators | public String getSeparators()(Code) | | Obtaining the separator set of the TokenizerProperties . The set
may contain ranges or may be empty.
the currently used set of separating characters See Also: TokenizerProperties.setSeparators |
getSpecialSequenceCompanion | public Object getSpecialSequenceCompanion(String specSeq) throws IllegalArgumentException(Code) | | Retrieving the companion of the given special sequence. If the special
sequence doesn't exist the method returns null .
Parameters: specSeq - sequence to remove the object associated with the special sequence throws: IllegalArgumentException - when null or an empty stringis passed |
getStringCompanion | public Object getStringCompanion(String start) throws IllegalArgumentException, UnsupportedOperationException(Code) | | Retrieving the information associated with a certain string. Only the
starting sequence is nessecary to identify the string. If the string is not
known to the parser, null will be returned.
If one needs to know if a string exists without a companion or if the string
is unknown so far, use also the method
TokenizerProperties.stringExists .
Parameters: start - the starting sequence of a string the associated information or null throws: IllegalArgumentException - when null or an emtpy stringis passed |
getWhitespaces | public String getWhitespaces()(Code) | | Obtaining the whitespace character set. The set may contain ranges. The
method may return an emtpy string, if no whitespaces are known.
See Also: TokenizerProperties.setWhitespaces the currently active whitespace set |
isFlagSet | public boolean isFlagSet(TokenizerProperty prop, int flag) throws NullPointerException(Code) | | Checks if a given flag (see
Flags ) is set for the given
TokenizerProperty
in the context of this TokenizerProperties instance.
The method uses the flag state of the TokenizerProperty object
if it is contained in the flag mask of the property (see
TokenizerProperty.containsFlag ).
Otherwise it falls back to the flag state set globally for this
TokenizerProperties instance.
Parameters: prop - the TokenizerProperty concerned Parameters: flag - the flag to check (may contain more than one bit) true if the flag is set either explicit in the propertyor globally for this TokenizerProperties object, false otherwise throws: NullPointerException - if no property is given |
keywordExists | public boolean keywordExists(String keyword)(Code) | | Checks if the given keyword is known to the TokenizerProperties .
The method accepts both empty and null strings for keyword
by returning false .
Parameters: keyword - keyword to search true if the keyword is known,false otherwise |
lineCommentExists | public boolean lineCommentExists(String lineComment)(Code) | | Checks if the give line comment is known. The method accepts both empty and
null strings for lineComment by returning
false .
Parameters: lineComment - the starting sequence of the line comment true if the line comment is known, false otherwise |
patternExists | public boolean patternExists(String pattern)(Code) | | Checks if the given pattern is known to the parser. The method accepts both
empty and null strings for pattern by returning
false .
Note that there is no choice of parsing flags (different to the
TokenizerProperties.addString(String,String,String,Object,int) method), since it
makes generally no sense to "overload" properties.
Parameters: pattern - the regular expression to be looked for true if the pattern is registered, false otherwise |
propertyExists | public boolean propertyExists(TokenizerProperty property)(Code) | | Checks if the given
TokenizerProperty is known to this TokenizerProperties
instance. The method compares the characteristics given in property
against all known properties.
The method accepts null for property by returning
false .
Parameters: property - the property to search true if the property is known,false otherwise |
setParseFlags | public void setParseFlags(int flags)(Code) | | Setting the control flags of the TokenizerProperties . Use a
combination of the
Flags for the parameter.
This method sets the parse flags globally for all
Tokenizer objects
sharing this TokenizerProperties instance. Some flags can be set
for single tokenizers separately.
When adding a property like a keyword without explicitely specifying flags,
these properties are handled with the flags that were effective at the time
of adding.
The method fires a
TokenizerPropertyEvent of type
TokenizerPropertyEvent.PROPERTY_MODIFIED each time it is called with different flag masks. The passed
TokenizerProperty has the type
TokenizerProperty.PARSE_FLAG_MASK .
Parameters: flags - the parser control flags |
specialSequenceExists | public boolean specialSequenceExists(String specSeq)(Code) | | Checks if the given special sequence is known to the TokenizerProperties .
The method accepts both empty and null strings for specSeq
by returning false .
Parameters: specSeq - sequence to check true if the block comment is known,false otherwise |
stringExists | public boolean stringExists(String start)(Code) | | Checks if the given starting sequence of the string is known to the parser.
The method accepts both empty and null strings for start
by returning false .
Note that there is no choice of parsing flags (different to the
TokenizerProperties.addString(String,String,String,Object,int) method), since it
makes generally no sense to "overload" properties. A string might be introduced
by the starting case-insensitive sequence STR , but there shouldn't
be a case-sensitive start str .
Parameters: start - the starting sequence of a string true if the string is registered, false otherwise |
|
|