AlgorithmLexer

class AlgorithmLexer(content: String)

A lexer for algorithms

Parameters

content

Content of the algorithm

Constructors

Link copied to clipboard
constructor(content: String)

Types

Link copied to clipboard
object Constants
Link copied to clipboard
open class IncorrectArgumentCountException(val keyword: String, val count: Int, val expected: Int) : AlgorithmLexer.SyntaxException

Exception thrown when an incorrect argument count is found

Link copied to clipboard
open class IncorrectArgumentTypeException(val keyword: String, val value: Value, val expected: KClass<out Value>) : AlgorithmLexer.SyntaxException

Exception thrown when an incorrect argument type is found

Link copied to clipboard
open class SyntaxException(message: String) : Exception

Base class for all syntax errors

Link copied to clipboard

Exception thrown when an unexpected brace is found

Link copied to clipboard

Exception thrown when an unexpected keyword is found

Link copied to clipboard

Exception thrown when an unexpected slash is found

Link copied to clipboard

Exception thrown when an unknown keyword is found

Functions

Link copied to clipboard

Parse an algorithm, and return a list of actions

Link copied to clipboard
fun registerKeyword(keyword: String, handler: (List<Value>) -> Action): AlgorithmLexer

Register a keyword handler

Link copied to clipboard

Register multiple keyword handlers