Package org.eclipse.lemminx.dom.parser
Class MultiLineStream
java.lang.Object
org.eclipse.lemminx.dom.parser.MultiLineStream
Multi line stream.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidadvance(int n) intadvanceIfAnyOfChars(int[] ch) booleanadvanceIfChar(int ch) booleanadvanceIfChars(int[] ch) advanceIfRegExp(Pattern regex) advanceIfRegExpGroup1(Pattern regex) Advances stream on regex, but will grab the first groupbooleanadvanceUntilAnyOfChars(int[] ch) Will advance until any of the provided chars are encounteredbooleanadvanceUntilChar(int ch) Advances stream.position no matter what until it hits ch or eof(this.len)booleanadvanceUntilCharOrNewTag(int ch) Will advance the stream position until ch or '<'booleanadvanceUntilChars(int[] ch) booleanadvanceUntilCharsOrNewTag(int[] ch) Advances until it matches int[] ch OR it hits '<' If this returns true, peek if next char is '<' to check which case was hitbooleanadvanceUntilCharUsingStack(int closingBracket) Will advance the stream position until 'closingBracket' or using a stack to consider possible open/closed bracket pairs in between.intadvanceWhileChar(Predicate<Integer> condition) booleaneos()intvoidgoBack(int n) voidgoBackTo(int pos) voidgoToEnd()intpeekChar()intpeekChar(int n) Peeks at next char at position + n.intpeekCharAtOffset(int offset) Peeks at the char at position 'offset' of the whole documentintpos()booleanAdvances until it reaches a whitespace character
-
Constructor Details
-
MultiLineStream
-
-
Method Details
-
eos
public boolean eos() -
getSource
-
pos
public int pos() -
goBackTo
public void goBackTo(int pos) -
goBack
public void goBack(int n) -
advance
public void advance(int n) -
goToEnd
public void goToEnd() -
peekChar
public int peekChar() -
peekChar
public int peekChar(int n) Peeks at next char at position + n. peekChar() == peekChar(0)- Parameters:
n-- Returns:
-
peekCharAtOffset
public int peekCharAtOffset(int offset) Peeks at the char at position 'offset' of the whole document- Parameters:
offset-- Returns:
-
advanceIfChar
public boolean advanceIfChar(int ch) -
advanceIfChars
public boolean advanceIfChars(int[] ch) -
advanceIfAnyOfChars
public int advanceIfAnyOfChars(int[] ch) -
advanceIfRegExp
-
advanceIfRegExpGroup1
Advances stream on regex, but will grab the first group- Parameters:
regex-- Returns:
-
advanceUntilChar
public boolean advanceUntilChar(int ch) Advances stream.position no matter what until it hits ch or eof(this.len)- Returns:
- boolean: was the char found
-
advanceUntilAnyOfChars
public boolean advanceUntilAnyOfChars(int[] ch) Will advance until any of the provided chars are encountered -
advanceUntilCharOrNewTag
public boolean advanceUntilCharOrNewTag(int ch) Will advance the stream position until ch or '<' -
advanceUntilCharUsingStack
public boolean advanceUntilCharUsingStack(int closingBracket) Will advance the stream position until 'closingBracket' or using a stack to consider possible open/closed bracket pairs in between. 'closingBracket' should be the closing bracket eg: > | ] -
advanceUntilChars
public boolean advanceUntilChars(int[] ch) -
advanceUntilCharsOrNewTag
public boolean advanceUntilCharsOrNewTag(int[] ch) Advances until it matches int[] ch OR it hits '<' If this returns true, peek if next char is '<' to check which case was hit -
skipWhitespace
public boolean skipWhitespace()Advances until it reaches a whitespace character -
advanceWhileChar
-
getLastNonWhitespaceOffset
public int getLastNonWhitespaceOffset()
-