JustBash.Parser.Lexer.Token (JustBash v0.3.0)

View Source

Token representation for the bash lexer.

Each token contains:

  • type - The token type (e.g., :word, :pipe, :if)
  • value - The string value of the token
  • raw_value - Original source text (for assignment parsing)
  • start/end - Byte positions in source
  • line/column - Line and column numbers
  • quoted - Whether the token started with a quote
  • single_quoted - Whether single-quoted specifically

Summary

Functions

Create an EOF token at the end of input.

Create a new token with the given attributes.

Types

t()

@type t() :: %JustBash.Parser.Lexer.Token{
  column: pos_integer(),
  end: non_neg_integer(),
  line: pos_integer(),
  quoted: boolean(),
  raw_value: String.t() | nil,
  single_quoted: boolean(),
  start: non_neg_integer(),
  type: token_type(),
  value: String.t()
}

token_type()

@type token_type() ::
  :eof
  | :newline
  | :semicolon
  | :amp
  | :pipe
  | :pipe_amp
  | :and_and
  | :or_or
  | :bang
  | :less
  | :great
  | :dless
  | :dgreat
  | :lessand
  | :greatand
  | :lessgreat
  | :dlessdash
  | :clobber
  | :tless
  | :and_great
  | :and_dgreat
  | :lparen
  | :rparen
  | :lbrace
  | :rbrace
  | :dsemi
  | :semi_and
  | :semi_semi_and
  | :dbrack_start
  | :dbrack_end
  | :dparen_start
  | :dparen_end
  | :if
  | :then
  | :else
  | :elif
  | :fi
  | :for
  | :while
  | :until
  | :do
  | :done
  | :case
  | :esac
  | :in
  | :function
  | :select
  | :time
  | :coproc
  | :word
  | :name
  | :number
  | :assignment_word
  | :comment
  | :heredoc_content

Functions

eof(input)

@spec eof(String.t()) :: t()

Create an EOF token at the end of input.

new(attrs)

@spec new(keyword()) :: t()

Create a new token with the given attributes.