JustBash.Parser.Lexer (JustBash v0.4.0)

View Source

Hand-written lexer for bash scripts.

Processes input as a binary with explicit state tracking, enabling native heredoc body consumption without the limitations of a context-free parser generator.

Summary

Functions

Tokenize input string into a list of tokens.

Tokenize input string into a list of tokens.

Functions

tokenize(input)

@spec tokenize(String.t()) ::
  {:ok, [JustBash.Parser.Lexer.Token.t()]}
  | {:error, JustBash.Parser.Lexer.Error.t()}

Tokenize input string into a list of tokens.

Returns {:ok, tokens} on success or {:error, %LexerError{}} on failure. Use tokenize!/1 if you prefer exceptions.

tokenize!(input)

@spec tokenize!(String.t()) :: [JustBash.Parser.Lexer.Token.t()]

Tokenize input string into a list of tokens.

Raises JustBash.Parser.Lexer.Error on failure.