Skip to content

Cm5StringStream

Unofficial

A CodeMirror 5 StringStream instance for tokenizing text.

Import:

import type { Cm5StringStream } from '@obsidian-typings/obsidian-public-latest';

Signature:

export interface Cm5StringStream

Properties

Property Type Description
lastColumnPos number Position in the string where the last column measurement was taken.
lastColumnValue number Cached column value at Cm5StringStream.lastColumnPos.
lineStart number Start offset of the current line within the document.
pos number Current position in the string.
start number Position where the current token started.
string string The current line's content.
tabSize number Number of spaces per tab character.

Methods

Method Returns Description
backUp(n) void Backs up the stream n characters.
column() number Returns the column (taking into account tabs) at which the current token starts.
current() string Gets the string between the start of the current token and the current stream position.
eat(match) string If the next character in the stream matches the given argument, it is consumed and returned.
eatSpace() boolean Shortcut for eatWhile when matching white-space.
eatWhile(match) boolean Repeatedly calls eat with the given argument, until it fails.
eol() boolean Returns true only if the stream is at the end of the line.
indentation() number Tells you how far the current line has been indented, in spaces.
lookAhead(n) string | undefined Look ahead and return the character n characters ahead without advancing.
match(pattern, consume?, caseFold?) boolean Matches against a string or regular expression pattern.
match(pattern, consume?) null | string[] Matches against a regular expression pattern.
next() null | string Returns the next character in the stream and advances it.
peek() null | string Returns the next character in the stream without advancing it.
skipTo(ch) boolean Skips to the next occurrence of the given character on the current line.
skipToEnd() void Moves the position to the end of the line.
sol() boolean Returns true only if the stream is at the start of the line.

Links to this page: