Asm-Preproc
view release on metacpan or search on metacpan
1.00 2013-07-26
Feature Changes
* Asm::Preproc::Stream removed, use Iterator::Simple::Lookahead instead
0.08 2013-07-23
Bug Fixes
* Revert to 0.06 - changes impacted CPU::Z80::Assembler.
0.07 2013-07-16
New Features
* Parse different eol combinations in input file (\r, \n, \r\n, \n\r) and
convert all to \n. Read files in binary mode in chunks of 8K.
* Add option to do or not line continuation on lines ended with \\.
* Add option to define %include statement format.
* Add option to define %line statement format.
* Add option to define preprocessor lines to be ignored.
Other
* Asm::Preproc::Stream - Deprecated, use Iterator::Simple::Lookahead instead
0.06 2010-10-15
t/data/f06.asm
t/data/f07.asm
t/data/f08.asm
t/data/sub/f01.asm
t/data/sub/f11.asm
t/Lexer.t
t/Line.t
t/manifest.t
t/pod-coverage.t
t/pod.t
t/Preproc-eol.t
t/Preproc-include.t
t/Preproc-input.t
t/Preproc-line.t
t/Preproc-stream.t
t/Token-error.t
t/Token-new.t
t/utils.pl
META.yml Module YAML meta-data (added by MakeMaker)
META.json Module JSON meta-data (added by MakeMaker)
lib/Asm/Preproc.pm view on Meta::CPAN
# while line ends in \\, remove all blanks before it and \r \n after
# the line contains at most one \n, due to include_list() iterator
while ($text =~ s/ \s* \\ [\r\n]* \z / /x) {
my $next = $top->iter->();
$top->line_nr( $top->line_nr + $top->line_inc );
defined($next) or last; # no more input, ignore last \\
$text .= $next;
}
# normalize eol
$text =~ s/ \s* \z /\n/x; # any ending blanks replaced by \n
# line to be returned, is used in %include below
my $line = Asm::Preproc::Line->new($text, $top->file, $line_nr);
# check for pre-processor directives
if ($text =~ /^ \s* [\#\%] /gcix) {
if ($text =~ / \G line /gcix) {
# %line n+m file
# #line n "file"
t/Preproc-eol.t view on Meta::CPAN
use warnings;
use Test::More;
use File::Slurp;
require_ok 't/utils.pl';
our $pp;
#------------------------------------------------------------------------------
# test eol normalization and joining continuation lines
my @input = ("1\r\n",
"2\n",
"3",
"4a\\\r\n",
"4b\\\n",
"4c\\ ", # back-slash only joins if at end of line
"5a\\",
"5b\\\n",
"5c\r\n",
"6\\");
t/Preproc-stream.t view on Meta::CPAN
use Test::More;
use File::Slurp;
use_ok 'Asm::Preproc';
use_ok 'Asm::Preproc::Line';
use_ok 'Iterator::Simple::Lookahead';
our $pp;
#------------------------------------------------------------------------------
# test eol normalization and joining continuation lines
isa_ok $pp = Asm::Preproc->new, 'Asm::Preproc';
$pp->include_list(1..3);
isa_ok my $s = $pp->line_stream, 'Iterator::Simple::Lookahead';
is_deeply $s->next, Asm::Preproc::Line->new("1\n", "-", 1);
is_deeply $s->next, Asm::Preproc::Line->new("2\n", "-", 2);
is_deeply $s->next, Asm::Preproc::Line->new("3\n", "-", 3);
is $s->next, undef;
done_testing();
( run in 1.306 second using v1.01-cache-2.11-cpan-8f98c5d2c55 )