Zuzu::Token(3)

NAME
Zuzu::Token - token object produced by the lexer

DESCRIPTION
Carries token type, value, and source location used by the parser and diagnostics.

INHERITANCE
Inherits from "Moo::Object".

ROLES
None.

ATTRIBUTES

  type
Type: Str.

Token category name (for example "IDENT", "NUMBER", or "OP").

  value
Type: Any.

Literal payload or symbol text associated with "type".

  file
Type: Maybe[Str].

Source filename used for diagnostics.

  line
Type: Int.

1-based source line number used for diagnostics.

  col
Type: Int.

1-based source column number used for diagnostics.

METHODS

  is_type
Returns true when "type" matches the supplied type string.

  is_KW
Returns true when this token is a "KW" token.

When a value argument is supplied, also requires "value" to match.

  is_OP
Returns true when this token is an "OP" token.

When a value argument is supplied, also requires "value" to match.

  is_IDENT
Returns true when this token is an "IDENT" token.

  is_NUMBER
Returns true when this token is an "NUMBER" token.

  is_STRING
Returns true when this token is an "STRING" token.

  is_BOOL
Returns true when this token is an "BOOL" token.

  is_NULL
Returns true when this token is an "NULL" token.

  is_EMPTY_SET
Returns true when this token is an "EMPTY_SET" token.

  is_EOF
Returns true when this token is an "EOF" token.

SEE ALSO
Subclasses: none in this distribution.

COPYRIGHT AND LICENCE
Zuzu::Token is copyright Toby Inkster.

It is free software; you may redistribute it and/or modify it under the terms of either the Artistic License 1.0 or the GNU General Public License version 2.