StringInput

io.github.edadma.recognizer.StringInput
case class StringInput(s: String, idx: Int, prev: Option[StringInput]) extends Input[Char, Char]

An implementation of the Input trait for string inputs.

StringInput provides a character-based input implementation where each position represents a character in a string. The wrapped value is the same as the element (the character itself).

Value parameters

idx

the current position in the string (0-based index)

prev

the previous StringInput position, if any

s

the string to process

Attributes

Graph
Supertypes
trait Serializable
trait Product
trait Equals
trait Input[Char, Char]
class Object
trait Matchable
class Any
Show all

Members list

Value members

Concrete methods

def elem: Char

Returns the character at the current position.

Returns the character at the current position.

Attributes

Returns

the current character

def eoi: Boolean

Checks if the current position is at the end of input.

Checks if the current position is at the end of input.

Attributes

Returns

true if the position is beyond the end of the string

Returns a new StringInput at the next position.

Returns a new StringInput at the next position.

Attributes

Returns

a new StringInput with index incremented by 1

def wrapped: Char

Returns the wrapped value, which is the same as the character for StringInput.

Returns the wrapped value, which is the same as the character for StringInput.

Attributes

Returns

the current character

Inherited methods

def listElem(end: Input[Char, Char]): List[Char]

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

Inherited from:
Input
def listWrapped(end: Input[Char, Char]): List[Char]

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

Inherited from:
Input
def productElementNames: Iterator[String]

Attributes

Inherited from:
Product
def productIterator: Iterator[Any]

Attributes

Inherited from:
Product
def rest: List[Char]

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

Inherited from:
Input
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
Input -> Any
Inherited from:
Input