クラス ParseContext
java.lang.Object
org.iplass.mtp.impl.parser.ParseContext
-
フィールドの概要
フィールド -
コンストラクタの概要
コンストラクタ -
メソッドの概要
修飾子とタイプメソッド説明booleanconsumeChars(char[] ignores) 現在のindexから、指定されたignore文字以外の文字が現れるまで、 popChar()する。booleanconsumeChars(int length) booleanequalsNextToken(String expectedToken, char[] delimiters) intintintindexOf(char c) 現在のindex以降で最初に指定の文字が現れるindexを返す。innerToken(char delimiter, boolean withDoubleDelimierEscape) delimiterで指定されている文字で囲まれている文字を切り出す。booleanisEnd()intlastIndexOf(char c) 現在のindex以降で、最後に指定の文字が現れるindexを返す。nextToken(char[] delimiters) delimitersで指定されている文字が現れるか、stream最後になるまで次のTokenとして切り出す。charpeekChar()charpopChar()voidpushBack()void指定の文字列でリセットする。voidsetCurrentIndex(int currentIndex) booleanstartsWith(String prefix) 現在のインデックス以降が指定のprefixで始まるかどうかを返す。subContext(int begin, int end) 現在の文字列シーケンスから、指定のbegin、endで文字列を切り出す。toString()int
-
フィールド詳細
-
WHITE_SPACES
public static char[] WHITE_SPACES空白として認識するchar。 ' ', '\t', '\n', '\r', '\f', '\b' -
TOKEN_DELIMITERS
public static char[] TOKEN_DELIMITERS
-
-
コンストラクタの詳細
-
ParseContext
public ParseContext() -
ParseContext
-
ParseContext
ParseContext(String stream, int offset)
-
-
メソッドの詳細
-
totalCurrentIndex
public int totalCurrentIndex() -
reset
指定の文字列でリセットする。 このインスタンスを再利用する際に使用する。- パラメータ:
stream-
-
setCurrentIndex
- パラメータ:
currentIndex-- 例外:
ParseException
-
getCurrentIndex
public int getCurrentIndex() -
getLength
public int getLength() -
peekChar
public char peekChar()- 戻り値:
-
popChar
public char popChar()- 戻り値:
-
pushBack
- 例外:
IndexOutOfBoundsException- すでに先頭である場合
-
isEnd
public boolean isEnd() -
subContext
現在の文字列シーケンスから、指定のbegin、endで文字列を切り出す。- パラメータ:
begin-end-- 戻り値:
- 例外:
IndexOutOfBoundsException
-
indexOf
public int indexOf(char c) 現在のindex以降で最初に指定の文字が現れるindexを返す。 見つからない場合は-1。- パラメータ:
c-- 戻り値:
-
lastIndexOf
public int lastIndexOf(char c) 現在のindex以降で、最後に指定の文字が現れるindexを返す。 見つからない場合は-1。- パラメータ:
c-- 戻り値:
-
consumeChars
public boolean consumeChars(char[] ignores) 現在のindexから、指定されたignore文字以外の文字が現れるまで、 popChar()する。 もし、ひとつもpopChar()しなかった場合は、falseがかえる。- パラメータ:
ignores- 消費文字列- 戻り値:
-
consumeChars
- 例外:
ParseException
-
nextToken
delimitersで指定されている文字が現れるか、stream最後になるまで次のTokenとして切り出す。 いきなり、delimitersがきたり、いきなりstream最後の場合は、null。- パラメータ:
delimiters-- 戻り値:
-
innerToken
delimiterで指定されている文字で囲まれている文字を切り出す。 いきなり、delimiterで囲まれていなかったり、いきなりstream最後の場合は、null。 切り出した後の、indexのポジションは、最後のdelimiterの後。- パラメータ:
delimiter-withDoubleDelimierEscape- delimiterで指定していた文字が重ねられていた場合エスケープとして扱う場合trueescapeChar-- 戻り値:
-
startsWith
現在のインデックス以降が指定のprefixで始まるかどうかを返す。- パラメータ:
prefix-- 戻り値:
-
equalsNextToken
- 例外:
ParseException
-
toString
-