| 1 | package Language::Expr::Compiler::Base; | ||
| 2 | |||
| 3 | 5 | our $DATE = '2016-07-03'; # DATE | |
| 4 | 5 | our $VERSION = '0.29'; # VERSION | |
| 5 | |||
| 6 | 5 | ▶ | use 5.010; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | 5 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 8 | 5 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 9 | |||
| 10 | 5 | ▶ | use UUID::Tiny ':std'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 11 | |||
| 12 | 5 | ▶ | use Mo qw(build default); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 13 | |||
| 14 | # [[type, uuid, data], ...] | ||
| 15 | 3 | ▶ | has markers => (is => 'rw', default => sub { [] }); |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 16 | 1 | ▶ | has func_mapping => (is => 'rw', default => sub { {} }); |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 17 | 5 | has hook_var => (is => 'rw'); | |
| 18 | 5 | has hook_func => (is => 'rw'); | |
| 19 | |||
| 20 | 31 | ▶ | sub new_marker { |
|
Subroutine
new_marker: called CC=1 SCAR=0.0
Pod
documented
| |||
| 21 | 31 | my ($self, $type, $data) = @_; | |
| 22 | 31 | my $uuid = UUID::Tiny::create_uuid_as_string(UUID_V4); | |
| 23 | #my $uuid = int(9000*rand()+1000); | ||
| 24 | #print "DEBUG: Creating new marker: type=$type, uuid=$uuid, data=", ($data // "undef"), "\n\n"; | ||
| 25 | 31 | push @{ $self->markers }, [$type, $uuid, $data]; | |
| 26 | 31 | $uuid; | |
| 27 | } | ||
| 28 | |||
| 29 | 0 | ▶ | sub marker_ids { |
|
Subroutine
marker_ids: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 30 | 0 | my ($self) = @_; | |
| 31 | 0 | map {$_->[1]} @{ $self->markers }; | |
| 32 | } | ||
| 33 | |||
| 34 | 0 | ▶ | sub marker_ids_re { |
|
Subroutine
marker_ids_re: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 35 | 0 | my ($self) = @_; | |
| 36 | 0 | my $re = "(?:" . join("|", map {$_->[1]} @{ $self->markers }) . ")"; | |
| 37 | 0 | qr/$re/; | |
| 38 | } | ||
| 39 | |||
| 40 | 5 | 1; | |
| 41 | # ABSTRACT: Base class for Expr compilers | ||
| 42 | |||
| 43 | __END__ | ||