Input

io.github.edadma.recognizer.Input
trait Input[W, E]

Represents a position in an input stream with elements of type E and wrapped values of type W.

The Input trait provides methods to access the current element, check for end of input, advance to the next position, and collect elements or wrapped values between positions.

Type parameters

E

the type of elements in the input stream

W

the type of wrapped values associated with elements

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
class StringInput

Members list

Value members

Abstract methods

def elem: E

Returns the element at the current position.

Returns the element at the current position.

Attributes

Returns

the current element

def eoi: Boolean

Indicates whether the current position is at the end of input.

Indicates whether the current position is at the end of input.

Attributes

Returns

true if at end of input, false otherwise

def equals(obj: Any): Boolean

Tests equality between Input positions.

Tests equality between Input positions.

Value parameters

obj

the object to compare with

Attributes

Returns

true if the positions are equal, false otherwise

def next: Input[W, E]

Returns a new Input representing the position after the current one.

Returns a new Input representing the position after the current one.

Attributes

Returns

the next position in the input stream

def prev: Option[Input[W, E]]

Returns the previous Input representing the position before the current one.

Returns the previous Input representing the position before the current one.

Attributes

Returns

the previous position in the input stream

def wrapped: W

Returns the wrapped value associated with the current element.

Returns the wrapped value associated with the current element.

Attributes

Returns

the wrapped value for the current element

Concrete methods

def listElem(end: Input[W, E]): List[E]

Collects all elements between the current position and a specified end position.

Collects all elements between the current position and a specified end position.

Value parameters

end

the ending position (exclusive)

Attributes

Returns

a list of elements between current position and end

Throws
RuntimeException

if end of input is reached before the end position

def listWrapped(end: Input[W, E]): List[W]

Collects all wrapped values between the current position and a specified end position.

Collects all wrapped values between the current position and a specified end position.

Value parameters

end

the ending position (exclusive)

Attributes

Returns

a list of wrapped values between current position and end

Throws
RuntimeException

if end of input is reached before the end position

def rest: List[E]

Collects all elements from the current position to the end of input.

Collects all elements from the current position to the end of input.

Attributes

Returns

a list of all remaining elements

override def toString: String

Returns a string representation of this input position.

Returns a string representation of this input position.

Attributes

Returns

a string representing the next few elements from this position

Definition Classes
Any