glex

Types

pub opaque type Lexer
pub type Position {
  Position(Int)
}

Constructors

  • Position(Int)
pub opaque type Rule
pub type Token {
  Valid(name: String, value: String)
  Ignored(name: String, value: String)
  Invalid(value: String)
  EndOfFile
}

Constructors

  • Valid(name: String, value: String)
  • Ignored(name: String, value: String)
  • Invalid(value: String)
  • EndOfFile

Functions

pub fn add_ignore(
  lexer: Lexer,
  name: String,
  pattern: String,
) -> Lexer
pub fn add_rule(
  lexer: Lexer,
  name: String,
  pattern: String,
) -> Lexer
pub fn build(lexer: Lexer, source: String) -> Lexer
pub fn ignored_only(
  tokens: List(#(Token, Position)),
) -> List(#(Token, Position))
pub fn invalid_only(
  tokens: List(#(Token, Position)),
) -> List(#(Token, Position))
pub fn iterator(lexer: Lexer) -> Iterator(#(Token, Position))
pub fn lex(lexer: Lexer) -> List(#(Token, Position))
pub fn new() -> Lexer
pub fn new_rule(name: String, pattern: String) -> Rule
pub fn next(lexer: Lexer) -> #(Lexer, #(Token, Position))
pub fn ok(tokens: List(#(Token, Position))) -> Bool
pub fn valid_only(
  tokens: List(#(Token, Position)),
) -> List(#(Token, Position))
Search Document