Paulo Custodio

NAME

Asm::Preproc::Token - One token retrieved from the input

SYNOPSIS

  use Asm::Preproc::Token;
  my $token = Asm::Preproc::Token->new($type, $value, $line);
  $token->type; $token->value; 
  $token->line; # isa Asm::Preproc::Line
  my $token2 = $token->clone;
  $token->error($message);
  $token->warning($message);
  Asm::Preproc::Token->error_at($token, $message);
  Asm::Preproc::Token->warning_at($token, $message);

DESCRIPTION

This module defines the object to represent one token of input text as retrieved from the preprocessed input text. It contains the token type (a string), the token value (a string) and a Asm::Preproc::Line object with the line where the token was found.

There are also utility methods for error messages.

METHODS

new

Creates a new object with the given type, value and line.

type

Get/set type.

value

Get/set file value.

line

Get/set line.

clone

Creates an identical copy as a new object.

error

Dies with the given error message, indicating the place in the input source file where the error occured as:

  FILE(LINE) : error ... at TOKEN

error_at

Same as error(), but is a class method and can receive an undef $token.

warning

Warns with the given error message, indicating the place in the input source file where the error occured as:

  FILE(LINE) : warning ... at TOKEN

warning_at

Same as warning(), but is a class method and can receive an undef $token.

AUTHOR, BUGS, SUPPORT, LICENSE, COPYRIGHT

See Asm::Preproc.