| 1 | package Lox::Token; | ||
| 2 | 260 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 3 | 260 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 260 | ▶ | use Lox::TokenType (); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | 260 | our $VERSION = 0.02; | |
| 6 | |||
| 7 | 11277 | ▶ | sub new { |
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 8 | 11277 | my ($class, $args) = @_; | |
| 9 | return bless { | ||
| 10 | literal => $args->{literal}, | ||
| 11 | lexeme => $args->{lexeme}, | ||
| 12 | column => $args->{column}, | ||
| 13 | type => $args->{type}, | ||
| 14 | line => $args->{line}, | ||
| 15 | 11277 | }, $class; | |
| 16 | } | ||
| 17 | |||
| 18 | 0 | ▶ | sub to_string { |
|
Subroutine
to_string: not called CC=1 SCAR=6.9
Pod
undocumented
| |||
| 19 | 0 | my $self = shift; | |
| 20 | return sprintf '%3d:%3d %-12s %s %s', | ||
| 21 | $self->{line}, | ||
| 22 | $self->{column}, | ||
| 23 | Lox::TokenType::type($self->{type}), | ||
| 24 | $self->{lexeme}, | ||
| 25 | 0 | $self->{literal}; | |
| 26 | } | ||
| 27 | |||
| 28 | 0 | ▶ | sub literal { $_[0]->{literal} } |
|
Subroutine
literal: not called CC=1 SCAR=6.9
Pod
undocumented
| |||
| 29 | 5973 | ▶ | sub lexeme { $_[0]->{lexeme} } |
|
Subroutine
lexeme: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 30 | 0 | ▶ | sub column { $_[0]->{column} } |
|
Subroutine
column: not called CC=1 SCAR=6.9
Pod
undocumented
| |||
| 31 | 284 | ▶ | sub type { $_[0]->{type} } |
|
Subroutine
type: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 32 | 0 | ▶ | sub line { $_[0]->{line} } |
|
Subroutine
line: not called CC=1 SCAR=6.9
Pod
undocumented
| |||
| 33 | |||
| 34 | 0 | ▶ | sub accept { |
|
Subroutine
accept: not called CC=1 SCAR=6.9
Pod
undocumented
| |||
| 35 | 0 | my ($self, $caller) = @_; | |
| 36 | 0 | $caller->visit_token($self); | |
| 37 | } | ||
| 38 | |||
| 39 | 260 | 1; | |