Paulo Custodio > CPU-Z80-Assembler > CPU::Z80::Assembler::Token

Download:
CPU-Z80-Assembler-2.07.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  0
Report a bug
Module Version: 2.07   Source  

NAME ^

CPU::Z80::Assembler::Token - One token retrieved from the input

SYNOPSIS ^

  use CPU::Z80::Assembler::Token;
  my $token = CPU::Z80::Assembler::Token->new(
                    type  => $type,
                    value => $value,
                    line  => CPU::Z80::Assembler::Line->new(...));
  my $token2 = $token->clone;
  $token->error($message);
  CPU::Z80::Assembler::Token->error_at($token, $message);
  $token->warning($message);
  CPU::Z80::Assembler::Token->warning_at($token, $message);

DESCRIPTION ^

This module defines the data structure to represent one token of input text to be assembled, as retrived by the lexer. The object is created by Class::Struct and contains the token type and value, and the input line where it was found in the input. The input line is used for error messages.

EXPORTS ^

Nothing.

FUNCTIONS ^

new

Creates a new object, see Class::Struct.

type

Get/set the type - type of token.

value

Get/set the value - value of token.

line

Get/set the line - text, file name and line number where the token was read.

clone

Creates an identical copy as a new object.

as_string

  print $self->as_string;
  print "$self";

Converts to string, for debug purposes. Overloads the double-quote operator.

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.

BUGS and FEEDBACK ^

See CPU::Z80::Assembler.

SEE ALSO ^

CPU::Z80::Assembler CPU::Z80::Assembler::Line Class::Struct

AUTHORS, COPYRIGHT and LICENCE ^

See CPU::Z80::Assembler.