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

PropertyTypeDescription
lastColumnPosnumberPosition in the string where the last column measurement was taken.
lastColumnValuenumberCached column value at Cm5StringStream.lastColumnPos.
lineStartnumberStart offset of the current line within the document.
posnumberCurrent position in the string.
startnumberPosition where the current token started.
stringstringThe current line's content.
tabSizenumberNumber of spaces per tab character.

Methods

MethodReturnsDescription
backUp(n)voidBacks up the stream n characters.
column()numberReturns the column (taking into account tabs) at which the current token starts.
current()stringGets the string between the start of the current token and the current stream position.
eat(match)stringIf the next character in the stream matches the given argument, it is consumed and returned.
eatSpace()booleanShortcut for eatWhile when matching white-space.
eatWhile(match)booleanRepeatedly calls eat with the given argument, until it fails.
eol()booleanReturns true only if the stream is at the end of the line.
indentation()numberTells you how far the current line has been indented, in spaces.
lookAhead(n)string | undefinedLook ahead and return the character n characters ahead without advancing.
match(pattern, consume?, caseFold?)booleanMatches against a string or regular expression pattern.
match(pattern, consume?)null | string[]Matches against a regular expression pattern.
next()null | stringReturns the next character in the stream and advances it.
peek()null | stringReturns the next character in the stream without advancing it.
skipTo(ch)booleanSkips to the next occurrence of the given character on the current line.
skipToEnd()voidMoves the position to the end of the line.
sol()booleanReturns true only if the stream is at the start of the line.

Links to this page: