Package org.eclipse.lemminx.dom.parser
Class MultiLineStream
- java.lang.Object
-
- org.eclipse.lemminx.dom.parser.MultiLineStream
-
public class MultiLineStream extends Object
Multi line stream.
-
-
Constructor Summary
Constructors Constructor Description MultiLineStream(String source, int position)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadvance(int n)intadvanceIfAnyOfChars(int[] ch)booleanadvanceIfChar(int ch)booleanadvanceIfChars(int[] ch)StringadvanceIfRegExp(Pattern regex)StringadvanceIfRegExpGroup1(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()intgetLastNonWhitespaceOffset()StringgetSource()voidgoBack(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()booleanskipWhitespace()Advances until it reaches a whitespace character
-
-
-
Constructor Detail
-
MultiLineStream
public MultiLineStream(String source, int position)
-
-
Method Detail
-
eos
public boolean eos()
-
getSource
public String 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)
-
advanceIfRegExpGroup1
public String advanceIfRegExpGroup1(Pattern regex)
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
-
getLastNonWhitespaceOffset
public int getLastNonWhitespaceOffset()
-
-