| 1 | # ABSTRACT: Perl Markdown Compiler | ||||||||||
| 2 | package Markdown::Compiler; | ||||||||||
| 3 | 17 | ▶ | use Moo; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 17 | ▶ | use Markdown::Compiler::Lexer; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 17 | ▶ | use Markdown::Compiler::Parser; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 17 | ▶ | use Markdown::Compiler::Target::HTML; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | 17 | ▶ | use Module::Runtime qw( use_module ); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | |||||||||||
| 9 | 17 | has source => ( | |||||||||
| 10 | is => 'ro', | ||||||||||
| 11 | required => 1, | ||||||||||
| 12 | ); | ||||||||||
| 13 | |||||||||||
| 14 | has lexer => ( | ||||||||||
| 15 | is => 'ro', | ||||||||||
| 16 | lazy => 1, | ||||||||||
| 17 | builder => sub { | ||||||||||
| 18 | 44 | ▶ | Markdown::Compiler::Lexer->new( source => shift->source ); | ||||||||
|
Subroutine
_build_lexer: called CC=1 SCAR=0.0
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||
| 19 | }, | ||||||||||
| 20 | 17 | ); | |||||||||
| 21 | |||||||||||
| 22 | has parser => ( | ||||||||||
| 23 | is => 'ro', | ||||||||||
| 24 | lazy => 1, | ||||||||||
| 25 | builder => sub { | ||||||||||
| 26 | 26 | ▶ | Markdown::Compiler::Parser->new( stream => shift->stream ); | ||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||
| 27 | }, | ||||||||||
| 28 | 17 | ); | |||||||||
| 29 | |||||||||||
| 30 | has stream => ( | ||||||||||
| 31 | is => 'ro', | ||||||||||
| 32 | lazy => 1, | ||||||||||
| 33 | builder => sub { | ||||||||||
| 34 | 64 | ▶ | shift->lexer->tokens; | ||||||||
|
Subroutine
_build_stream: called CC=1 SCAR=0.0
| |||||||||||
| 35 | }, | ||||||||||
| 36 | 17 | ); | |||||||||
| 37 | |||||||||||
| 38 | has tree => ( | ||||||||||
| 39 | is => 'ro', | ||||||||||
| 40 | lazy => 1, | ||||||||||
| 41 | builder => sub { | ||||||||||
| 42 | 46 | ▶ | shift->parser->tree; | ||||||||
|
Subroutine
_build_tree: called CC=1 SCAR=0.0
| |||||||||||
| 43 | }, | ||||||||||
| 44 | 17 | ); | |||||||||
| 45 | |||||||||||
| 46 | has compiler => ( | ||||||||||
| 47 | is => 'ro', | ||||||||||
| 48 | lazy => 1, | ||||||||||
| 49 | builder => sub { | ||||||||||
| 50 | 64 | ▶ | Markdown::Compiler::Target::HTML->new( tree => shift->tree ); | ||||||||
|
Subroutine
_build_compiler: called CC=1 SCAR=0.0
| |||||||||||
| 51 | }, | ||||||||||
| 52 | 17 | ); | |||||||||
| 53 | |||||||||||
| 54 | sub compiler_for { | ||||||||||
| 55 | 0 | ▶ | my ( $self, $target ) = @_; | ||||||||
|
Subroutine
compiler_for: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||
| 56 | |||||||||||
| 57 | 0 | ▶ | $target = substr($target,0,1) eq '+' | ||||||||
|
Branch: 1 branch
| |||||||||||
| 58 | ? substr($target,1) | ||||||||||
| 59 | : 'Markdown::Compiler::Target::' . $target; | ||||||||||
| 60 | |||||||||||
| 61 | 0 | return use_module("$target")->new( tree => $self->tree ); | |||||||||
| 62 | } | ||||||||||
| 63 | |||||||||||
| 64 | has result => ( | ||||||||||
| 65 | is => 'ro', | ||||||||||
| 66 | lazy => 1, | ||||||||||
| 67 | builder => sub { | ||||||||||
| 68 | 64 | ▶ | shift->compiler->result; | ||||||||
|
Subroutine
_build_result: called CC=1 SCAR=0.0
| |||||||||||
| 69 | } | ||||||||||
| 70 | 17 | ); | |||||||||
| 71 | |||||||||||
| 72 | has metadata => ( | ||||||||||
| 73 | is => 'ro', | ||||||||||
| 74 | lazy => 1, | ||||||||||
| 75 | builder => sub { | ||||||||||
| 76 | 0 | ▶ | shift->compiler->metadata; | ||||||||
|
Subroutine
_build_metadata: not called CC=1 SCAR=6.9
| |||||||||||
| 77 | } | ||||||||||
| 78 | 17 | ); | |||||||||
| 79 | |||||||||||
| 80 | 17 | 1; | |||||||||
| 81 | |||||||||||
| 82 | __END__ | ||||||||||