Home Reference Source Test
import Input from 'botlang/src/Lexer/Input.js'
public class | source

Input

Representation of the input stream with some util functions. The class is used by the botlang lexer which takes an instance of Input as a constructor argument and converts it into a token stream.

Test:

Constructor Summary

Public Constructor
public

Create an Input.

Method Summary

Public Methods
public

Determine whether or not there are no more values in the stream.

public

error(message: String): void

Throw a new Error.

public

Return the next character from the input stream.

public

Return the character from the current position without "consuming" it.

Public Constructors

public constructor(input: String) source

Create an Input.

Params:

NameTypeAttributeDescription
input String

Test:

Public Methods

public eof(): Boolean source

Determine whether or not there are no more values in the stream.

Return:

Boolean

Test:

public error(message: String): void source

Throw a new Error.

Params:

NameTypeAttributeDescription
message String

Return:

void

Throw:

Error

Test:

public next(): String source

Return the next character from the input stream.

Return:

String

Test:

public peek(): String source

Return the character from the current position without "consuming" it.

Return:

String

Test: