|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.argouml.util.CustomSeparator
org.argouml.util.QuotedStringSeparator
A descendent of CustomSeparator that recognizes tokens on one of two forms:
'chr'.....'esc' 'chr'.....'chr'
'lchr'...'lchr'...'rchr'...'esc' 'rchr'....'rchr'
The first form is suited for quoted strings, like
"...\"...."or
'...\'...'.
The second form is suited for expressions, like
(a+(b*c)-15*eq(a, b)).
This is in fact the class currently used for the public separators in MyTokenizer, except PAREN_EXPR_STRING_SEPARATOR and LINE_SEPARATOR.
Field Summary | |
private char |
escChr
|
private boolean |
esced
|
private int |
level
|
private char |
startChr
|
private char |
stopChr
|
private int |
tokLen
|
Fields inherited from class org.argouml.util.CustomSeparator |
|
Constructor Summary | |
QuotedStringSeparator(char q,
char esc)
Creates a separator of the first form (see above) where 'chr' = q and 'esc' = esc. |
|
QuotedStringSeparator(char sq,
char eq,
char esc)
Creates a separator of the second form (see above) where 'lchr' = sq, 'rchr' = eq and 'esc' = esc. |
Method Summary | |
boolean |
endChar(char c)
Called to check if more characters are expected in the free part of the token. Overridden to find the end of the token. |
boolean |
hasFreePart()
Called to check if more characters are expected to follow after addChar has returned true. If true, then any following characters will be fed to endChar until endChar returns true. The default behaviour is to return false. Overridden to return true. |
void |
reset()
Called to reset the separator before staring to look for a new token. |
int |
tokenLength()
Returns the length of the matched token. It is not required to be meaningful unless addChar has returned true and hasFreePart returned false or endChar returned true. Overridden to return the entire length of the token. |
Methods inherited from class org.argouml.util.CustomSeparator |
addChar, getPeekCount |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private final char escChr
private final char startChr
private final char stopChr
private boolean esced
private int tokLen
private int level
Constructor Detail |
public QuotedStringSeparator(char q, char esc)
q
- The delimiter character.esc
- The escape character.public QuotedStringSeparator(char sq, char eq, char esc)
sq
- The left delimiter character.eq
- The right delimiter character.esc
- The escape character.Method Detail |
public void reset()
CustomSeparator
reset
in class CustomSeparator
public int tokenLength()
tokenLength
in class CustomSeparator
public boolean hasFreePart()
The default behaviour is to return false. Overridden to return true.
hasFreePart
in class CustomSeparator
public boolean endChar(char c)
endChar
in class CustomSeparator
c
- The next character in the sequence being tokenized.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
ArgoUML © 1996-2004 (20050222) | ArgoUML Homepage | ArgoUML Developers' page | ArgoUML Cookbook |