Class BaseTokenizer
- Namespace
- AngleSharp.Common
- Assembly
- AngleSharp.dll
Common methods and variables of all tokenizers.
public abstract class BaseTokenizer : IDisposable
- Inheritance
-
BaseTokenizer
- Implements
- Derived
- Inherited Members
- Extension Methods
Constructors
BaseTokenizer(TextSource)
Creates a new instance of the base tokenizer.
public BaseTokenizer(TextSource source)
Parameters
source
TextSourceThe source to tokenize.
Properties
Current
Gets the current character.
protected char Current { get; }
Property Value
InsertionPoint
Gets the current insertion point.
public int InsertionPoint { get; protected set; }
Property Value
IsNormalized
Gets if the current index has been normalized (CRLF -> LF).
protected bool IsNormalized { get; }
Property Value
Position
Gets the current source index.
public int Position { get; }
Property Value
StringBuffer
Gets the allocated string buffer.
protected StringBuilder StringBuffer { get; }
Property Value
Methods
Advance()
Advances in the source by 1 character if possible.
protected void Advance()
Advance(int)
Advances in the source by n characters or less if possible.
protected void Advance(int n)
Parameters
n
intThe positive number of characters.
Back()
Goes back in the source by 1 character if possible.
protected void Back()
Back(int)
Goes back in the source by n characters or less if possible.
protected void Back(int n)
Parameters
n
intThe positive number of characters.
ContinuesWithInsensitive(string)
Checks if the source continues with the given string. The comparison is case-insensitive.
protected bool ContinuesWithInsensitive(string s)
Parameters
s
stringThe string to compare to.
Returns
- bool
True if the source continues with the given string.
ContinuesWithSensitive(string)
Checks if the source continues with the given string. The comparison is case-sensitive.
protected bool ContinuesWithSensitive(string s)
Parameters
s
stringThe string to compare to.
Returns
- bool
True if the source continues with the given string.
Dispose()
Disposes the tokenizer by releasing the buffer.
public void Dispose()
FlushBuffer()
Flushes the buffer.
public string FlushBuffer()
Returns
- string
The content of the buffer.
GetCurrentPosition()
Gets the current text position in the source.
public TextPosition GetCurrentPosition()
Returns
- TextPosition
The (row, col) position.
GetNext()
Gets the next character in the source by advancing.
protected char GetNext()
Returns
- char
The next char.
GetPrevious()
Gets the previous character in the source by going back.
protected char GetPrevious()
Returns
- char
The previous char.
PeekString(int)
Gets the string formed by the next characters.
protected string PeekString(int length)
Parameters
length
intThe length of the string.
Returns
- string
The upcoming string.
SkipSpaces()
Skips the next space character(s).
protected char SkipSpaces()
Returns
- char
The upcoming first non-space.