diff --git a/Configure.pl b/Configure.pl index 3cf2beb..2f92fc6 100644 --- a/Configure.pl +++ b/Configure.pl @@ -57,8 +57,8 @@ my %config = read_parrot_config(@parrot_config_exe); my $parrot_errors = ''; - if (!%config) { - $parrot_errors .= "Unable to locate parrot_config\n"; + if (!%config) { + $parrot_errors .= "Unable to locate parrot_config\n"; } elsif ($reqsvn > $config{'revision'} && ($reqpar eq '' || version_int($reqpar) > version_int($config{'VERSION'}))) { @@ -87,9 +87,9 @@ END { no warnings; print "Cleaning up ...\n"; - if (open my $CLEAN, '-|', "$make clean") { + if (open my $CLEAN, '-|', "$make clean") { my @slurp = <$CLEAN>; - close $CLEAN; + close $CLEAN; } } diff --git a/LICENSE b/LICENSE index 32efefc..11c5acf 100644 --- a/LICENSE +++ b/LICENSE @@ -17,7 +17,7 @@ You are always permitted to make arrangements wholly outside of this license directly with the Copyright Holder of a given Package. If the terms of this license do not permit the full use that you propose to make of the Package, you should contact the Copyright Holder and seek -a different licensing arrangement. +a different licensing arrangement. Definitions @@ -50,7 +50,7 @@ Definitions "Modified Version" means the Package, if it has been changed, and such changes were not explicitly requested by the Copyright - Holder. + Holder. "Original License" means this Artistic License as Distributed with the Standard Version of the Package, in its current version or as @@ -86,7 +86,7 @@ Package will still be considered the Standard Version, and as such will be subject to the Original License. -Distribution of Modified Versions of the Package as Source +Distribution of Modified Versions of the Package as Source (4) You may Distribute your Modified Version as Source (either gratis or for a Distributor Fee, and with or without a Compiled form of the @@ -120,7 +120,7 @@ you do at least ONE of the following: Fees are allowed. -Distribution of Compiled Forms of the Standard Version +Distribution of Compiled Forms of the Standard Version or Modified Versions without the Source (5) You may Distribute Compiled forms of the Standard Version without @@ -138,7 +138,7 @@ the Source, provided that you comply with Section 4 with respect to the Source of the Modified Version. -Aggregating or Linking the Package +Aggregating or Linking the Package (7) You may aggregate the Package (either the Standard Version or Modified Version) with other packages and Distribute the resulting @@ -155,7 +155,7 @@ include the Package, and Distribute the result without restriction, provided the result does not expose a direct interface to the Package. -Items That are Not Considered Part of a Modified Version +Items That are Not Considered Part of a Modified Version (9) Works (including, but not limited to, modules and scripts) that merely extend or make use of the Package, do not, by themselves, cause diff --git a/README b/README index 128d8aa..b30a38b 100644 --- a/README +++ b/README @@ -36,7 +36,7 @@ Once you have a copy of NQP, build it as follows: $ perl Configure.pl --gen-parrot $ make -This will create a "nqp" or "nqp.exe" executable in the +This will create a "nqp" or "nqp.exe" executable in the current (nqp-rx) directory. Programs can then be run from the build directory using a command like: @@ -46,9 +46,9 @@ The C<--gen-parrot> option above tells Configure.pl to automatically download and build the most appropriate version of Parrot into a local "parrot/" subdirectory, install that Parrot into the "parrot_install/" subdirectory, and use that for building NQP. -It's okay to use the C<--gen-parrot> option on later invocations -of Configure.pl; the configure system will re-build Parrot only -if a newer version is needed for whatever version of Rakudo you're +It's okay to use the C<--gen-parrot> option on later invocations +of Configure.pl; the configure system will re-build Parrot only +if a newer version is needed for whatever version of Rakudo you're working with. You can use C<--parrot-config=/path/to/parrot_config> instead diff --git a/STATUS b/STATUS index 652e67f..0fe930f 100644 --- a/STATUS +++ b/STATUS @@ -1,4 +1,4 @@ -2009-10-09: +2009-10-09: At the moment, nqp-rx is configured to build an executable called "p6regex", which is a Perl 6 regular expression compiler for Parrot. diff --git a/build/gen_bootstrap.pl b/build/gen_bootstrap.pl index 4ee6d3e..fedda5c 100644 --- a/build/gen_bootstrap.pl +++ b/build/gen_bootstrap.pl @@ -16,16 +16,16 @@ sub make_bootstrap { open my $fh, '<', $filename or die "Unable to read $filename\n"; while (<$fh>) { - if (m{^\.include '(src/[^']*)'}) { + if (m{^\.include '(src/[^']*)'}) { print "### $_"; - make_bootstrap($1); + make_bootstrap($1); } elsif (m{^\.include '(gen/[^']*)'}) { print "### $_"; - make_bootstrap("src/stage2/$1"); + make_bootstrap("src/stage2/$1"); } else { print; } } } - + diff --git a/build/gen_parrot.pl b/build/gen_parrot.pl index ae67fbd..a235e2d 100644 --- a/build/gen_parrot.pl +++ b/build/gen_parrot.pl @@ -83,4 +83,4 @@ sub read_parrot_config { } %config; } - + diff --git a/src/HLL/Actions.pm b/src/HLL/Actions.pm index 05e85a4..efccecc 100644 --- a/src/HLL/Actions.pm +++ b/src/HLL/Actions.pm @@ -69,7 +69,7 @@ our sub isaPAST($x) { method EXPR($/, $key?) { unless $key { return 0; } my $past := $/.peek_ast // $.peek_ast; - unless $past { + unless $past { $past := PAST::Op.new( :node($/) ); if $ { $past.pasttype( ~$ ); } elsif $ { $past.pirop( ~$ ); } @@ -98,11 +98,11 @@ method termish($/) { method term:sym($/) { make $.ast } method integer($/) { - make $ + make $ ?? string_to_int( $, 10) - !! ( $ + !! ( $ ?? $.ast - !! ( $ + !! ( $ ?? $.ast !! string_to_int( $, 2) ) @@ -122,7 +122,7 @@ method octint($/) { method quote_EXPR($/) { my $past := $.ast; if HLL::Grammar::quotemod_check($/, 'w') { - if isaPAST($past) { + if isaPAST($past) { $/.CURSOR.panic("Can't form :w list from non-constant strings (yet)"); } else { @@ -170,7 +170,7 @@ method quote_atom($/) { method quote_escape:sym($/) { make "\\"; } method quote_escape:sym($/) { make ~$ } - + method quote_escape:sym($/) { make "\b"; } method quote_escape:sym($/) { make "\n"; } method quote_escape:sym($/) { make "\r"; } diff --git a/src/HLL/Grammar.pm b/src/HLL/Grammar.pm index b6c5cb4..422409e 100644 --- a/src/HLL/Grammar.pm +++ b/src/HLL/Grammar.pm @@ -21,8 +21,8 @@ grammar HLL::Grammar; token infixish { } token prefixish { <.ws> } - token postfixish { - | + token postfixish { + | | } @@ -72,19 +72,19 @@ grammar HLL::Grammar; token quote_escape:sym { \\ n } token quote_escape:sym { \\ r } token quote_escape:sym { \\ t } - token quote_escape:sym { - \\ x - [ | '[' ']' ] + token quote_escape:sym { + \\ x + [ | '[' ']' ] } - token quote_escape:sym { - \\ o - [ | '[' ']' ] + token quote_escape:sym { + \\ o + [ | '[' ']' ] } token quote_escape:sym { \\ c } token charname { || - || <[a..z A..Z]> <-[ \] , # ]>*? <[a..z A..Z ) ]> + || <[a..z A..Z]> <-[ \] , # ]>*? <[a..z A..Z ) ]> > } token charnames { [<.ws><.ws>] ** ',' } diff --git a/src/NQP/Actions.pm b/src/NQP/Actions.pm index ada8be2..4822e0d 100644 --- a/src/NQP/Actions.pm +++ b/src/NQP/Actions.pm @@ -22,8 +22,8 @@ sub block_immediate($block) { } sub sigiltype($sigil) { - $sigil eq '%' - ?? 'Hash' + $sigil eq '%' + ?? 'Hash' !! ($sigil eq '@' ?? 'ResizablePMCArray' !! 'Undef'); } @@ -44,18 +44,18 @@ method comp_unit($/) { method statementlist($/) { my $past := PAST::Stmts.new( :node($/) ); if $ { - for $ { + for $ { my $ast := $_.ast; if $ast.isa(PAST::Block) && !$ast.blocktype { $ast := block_immediate($ast); } - $past.push( $ast ); + $past.push( $ast ); } } make $past; } -method statement($/) { +method statement($/) { my $past; if $ { $past := $.ast; } elsif $ { $past := $.ast; } @@ -121,7 +121,7 @@ method statement_control:sym($/) { method statement_control:sym($/) { my $pasttype := 'repeat_' ~ ~$; my $past; - if $ { + if $ { $past := xblock_immediate( $.ast ); $past.pasttype($pasttype); } @@ -182,8 +182,8 @@ method term:sym($/) { make $.ast; } method term:sym($/) { make $.ast; } method colonpair($/) { - my $past := $ - ?? $[0].ast + my $past := $ + ?? $[0].ast !! PAST::Val.new( :value( !$ ) ); $past.named( ~$ ); make $past; @@ -197,9 +197,9 @@ method variable($/) { } else { $past := PAST::Var.new( :name(~$/) ); - if $[0] eq '*' { - $past.scope('contextual'); - $past.viviself( PAST::Op.new( 'Contextual ' ~ ~$/ ~ ' not found', + if $[0] eq '*' { + $past.scope('contextual'); + $past.viviself( PAST::Op.new( 'Contextual ' ~ ~$/ ~ ' not found', :pirop('die') ) ); } @@ -216,7 +216,7 @@ method package_declarator:sym($/) { my $past := $.ast; my $classinit := PAST::Op.new( - PAST::Op.new( + PAST::Op.new( :inline( ' %r = get_root_global ["parrot"], "P6metaclass"') ), ~$, @@ -263,16 +263,16 @@ method variable_declarator($/) { if $*SCOPE eq 'has' { $BLOCK.symbol($name, :scope('attribute') ); unless $BLOCK { - $BLOCK := + $BLOCK := PAST::Op.new( :pasttype('list'), :named('attr') ); } $BLOCK.push( $name ); $past := PAST::Stmts.new(); } - else { + else { my $scope := $*SCOPE eq 'our' ?? 'package' !! 'lexical'; - my $decl := PAST::Var.new( :name($name), :scope($scope), :isdecl(1), - :lvalue(1), :viviself( sigiltype($sigil) ), + my $decl := PAST::Var.new( :name($name), :scope($scope), :isdecl(1), + :lvalue(1), :viviself( sigiltype($sigil) ), :node($/) ); $BLOCK.symbol($name, :scope($scope) ); $BLOCK[0].push($decl); @@ -291,7 +291,7 @@ method routine_def($/) { my $name := ~$[0].ast; $past.name($name); if $*SCOPE ne 'our' { - @BLOCK[0][0].push(PAST::Var.new( :name($name), :isdecl(1), + @BLOCK[0][0].push(PAST::Var.new( :name($name), :isdecl(1), :viviself($past), :scope('lexical') ) ); @BLOCK[0].symbol($name, :scope('lexical') ); $past := PAST::Var.new( :name($name) ); @@ -320,12 +320,12 @@ method signature($/) { for $ { $BLOCKINIT.push($_.ast); } } -method parameter($/) { +method parameter($/) { my $quant := $; my $past; if $ { $past := $.ast; - if $quant ne '!' { + if $quant ne '!' { $past.viviself( sigiltype($) ); } } @@ -339,22 +339,22 @@ method parameter($/) { $past.viviself( sigiltype($) ); } } - if $ { - if $quant eq '*' { + if $ { + if $quant eq '*' { $/.CURSOR.panic("Can't put default on slurpy parameter"); } - if $quant eq '!' { + if $quant eq '!' { $/.CURSOR.panic("Can't put default on required parameter"); } - $past.viviself( $[0].ast ); + $past.viviself( $[0].ast ); } unless $past.viviself { @BLOCK[0].arity( +@BLOCK[0].arity + 1 ); } - make $past; + make $past; } method param_var($/) { my $name := ~$/; - my $past := PAST::Var.new( :name($name), :scope('parameter'), + my $past := PAST::Var.new( :name($name), :scope('parameter'), :isdecl(1), :node($/) ); @BLOCK[0].symbol($name, :scope('lexical') ); make $past; @@ -453,12 +453,12 @@ method term:sym($/) { method term:sym($/) { my $ns := $; - $ns := Q:PIR { + $ns := Q:PIR { $P0 = find_lex '$ns' %r = clone $P0 }; my $name := $ns.pop; - my $var := + my $var := PAST::Var.new( :name(~$name), :namespace($ns), :scope('package') ); my $past := $var; if $ { @@ -509,9 +509,9 @@ method arglist($/) { method term:sym($/) { make $.ast; } -method circumfix:sym<( )>($/) { - make $ - ?? $[0].ast +method circumfix:sym<( )>($/) { + make $ + ?? $[0].ast !! PAST::Op.new( :pasttype('list'), :node($/) ); } @@ -532,10 +532,10 @@ method circumfix:sym<[ ]>($/) { method circumfix:sym($/) { make $.ast; } -method circumfix:sym<{ }>($/) { +method circumfix:sym<{ }>($/) { make +$ > 0 ?? $.ast - !! PAST::Op.new( :inline(' %r = new ["Hash"]'), :node($/) ); + !! PAST::Op.new( :inline(' %r = new ["Hash"]'), :node($/) ); } method circumfix:sym($/) { @@ -572,10 +572,10 @@ method postcircumfix:sym<( )>($/) { method value($/) { my $past := $ ?? $.ast - !! PAST::Val.new( + !! PAST::Val.new( :value($ ?? $.ast - !! $.ast) + !! $.ast) ); make $past; } @@ -593,8 +593,8 @@ method quote:sym($/) { method quote_escape:sym<$>($/) { make $.ast; } method quote_escape:sym<{ }>($/) { - make PAST::Op.new( - :pirop('set S*'), block_immediate($.ast), :node($/) + make PAST::Op.new( + :pirop('set S*'), block_immediate($.ast), :node($/) ); } @@ -633,7 +633,7 @@ class NQP::RegexActions is Regex::P6Regex::Actions { method codeblock($/) { my $block := $.ast; $block.blocktype('immediate'); - my $past := + my $past := PAST::Regex.new( PAST::Stmts.new( PAST::Op.new( diff --git a/src/NQP/Grammar.pm b/src/NQP/Grammar.pm index 37b1603..ecf92cd 100644 --- a/src/NQP/Grammar.pm +++ b/src/NQP/Grammar.pm @@ -17,8 +17,8 @@ token identifier { } token name { ** '::' } -token deflongname { - +token deflongname { + [ ':sym<' $=[<-[>]>*] '>' | ':sym«' $=[<-[»]>*] '»' ]? } @@ -26,8 +26,8 @@ token ENDSTMT { [ \h* $$ <.ws> ]? } -token ws { - || +token ws { + || || [ \s+ | '#' \N* @@ -37,7 +37,7 @@ token ws { } token pod_comment { - ^^ \h* '=' + ^^ \h* '=' [ | 'begin' \h+ 'END' >> [ .*? \n '=' 'end' \h+ 'END' » \N* || .* ] @@ -46,27 +46,27 @@ token pod_comment { || .*? \n '=' 'end' \h+ $ » \N* || <.panic: '=begin without matching =end'> ] - | 'begin' » \h* + | 'begin' » \h* [ $$ || '#' || <.panic: 'Unrecognized token after =begin'> ] - [ + [ || .*? \n \h* '=' 'end' » \N* - || <.panic: '=begin without matching =end'> + || <.panic: '=begin without matching =end'> ] - | - [ + | + [ <.panic: 'Obsolete pod format, please use =begin/=end instead'> ]? [ || \s || <.panic: 'Illegal pod directive'> ] \N* ] } - + ## Top-level rules -token comp_unit { +token comp_unit { <.newpad> - - [ $ || <.panic: 'Confused'> ] + + [ $ || <.panic: 'Confused'> ] } rule statementlist { @@ -98,7 +98,7 @@ token pblock { <.newpad> - | + | <.newpad> | <.panic: 'Missing block'> @@ -150,9 +150,9 @@ token statement_control:sym { token statement_control:sym { :s - [ + [ | $=[while|until]\s - | $=[while|until]\s + | $=[while|until]\s ] } @@ -162,12 +162,12 @@ token statement_control:sym { } token statement_control:sym { - :s + :s [ || <.panic: 'return requires an expression argument'> ] } token statement_control:sym { - :s + :s [ || <.panic: 'make requires an expression argument'> ] } @@ -190,8 +190,8 @@ token term:sym { } token term:sym { } token colonpair { - ':' - [ + ':' + [ | $='!' | ? ] @@ -211,10 +211,10 @@ proto token package_declarator { <...> } token package_declarator:sym { } token package_declarator:sym { $=[class|grammar] } -rule package_def { - - [ 'is' ]? - [ +rule package_def { + + [ 'is' ]? + [ || ';' || || <.panic: 'Malformed package declaration'> @@ -255,7 +255,7 @@ rule method_def { token signature { [ [<.ws><.ws>] ** ',' ]? } -token parameter { +token parameter { [ | $=['*'] | [ | ] $=['?'|'!'|] @@ -263,7 +263,7 @@ token parameter { ? } -token param_var { +token param_var { ? [ | $=[<[/!]>] ] } @@ -276,8 +276,8 @@ rule default_value { '=' } rule regex_declarator { [ - | $=[proto] [regex|token|rule] - + | $=[proto] [regex|token|rule] + '{' '<...>' '}' | $=[regex|token|rule] @@ -290,12 +290,12 @@ rule regex_declarator { token dotty { '.' - [ + [ | | ':' \s ]? } - + proto token term { <...> } @@ -318,8 +318,8 @@ token args { } token arglist { - <.ws> - [ + <.ws> + [ | | ] @@ -373,16 +373,16 @@ INIT { } -token nulltermish { - | +token nulltermish { + | | } token infixish { } token infixstopper { } -token postcircumfix:sym<[ ]> { - '[' <.ws> ']' +token postcircumfix:sym<[ ]> { + '[' <.ws> ']' } @@ -396,8 +396,8 @@ token postcircumfix:sym { } -token postcircumfix:sym<( )> { - '(' <.ws> ')' +token postcircumfix:sym<( )> { + '(' <.ws> ')' } @@ -447,15 +447,15 @@ token infix:sym<&&> { ')> } token infix:sym<||> { ')> } token infix:sym { ')> } -token infix:sym { +token infix:sym { '??' <.ws> '!!' - , :pasttype')> + , :pasttype')> } -token infix:sym<=> { +token infix:sym<=> { <.panic: 'Assignment ("=") not supported in NQP, use ":=" instead'> } token infix:sym<:=> { ')> } @@ -465,8 +465,8 @@ token infix:sym<,> { ')> } grammar NQP::Regex is Regex::P6Regex::Grammar { - token metachar:sym<:my> { - ':' <.ws> ';' + token metachar:sym<:my> { + ':' <.ws> ';' } token metachar:sym<{ }> { diff --git a/src/PAST/Compiler-Regex.pir b/src/PAST/Compiler-Regex.pir index bf34a9b..620eb03 100644 --- a/src/PAST/Compiler-Regex.pir +++ b/src/PAST/Compiler-Regex.pir @@ -6,7 +6,7 @@ PAST::Compiler-Regex - Compiler for PAST::Regex nodes =head1 DESCRIPTION -PAST::Compiler-Regex implements the transformations to convert +PAST::Compiler-Regex implements the transformations to convert PAST::Regex nodes into POST. It's still a part of PAST::Compiler; we've separated out the regex-specific transformations here for better code management and debugging. @@ -121,7 +121,7 @@ Return the POST representation of the regex AST rooted by C. concat $S0, tgt concat $S0, ', $I10)' ops.'push_pirop'('callmethod', '"!cursor_start"', 'self', 'result'=>$S0) - self.'!cursorop'(ops, '!cursor_debug', 0, '"START "', regexname_esc) + self.'!cursorop'(ops, '!cursor_debug', 0, '"START "', regexname_esc) unless caparray goto caparray_skip self.'!cursorop'(ops, '!cursor_caparray', 0, caparray :flat) caparray_skip: @@ -131,16 +131,16 @@ Return the POST representation of the regex AST rooted by C. ops.'push_pirop'('.lex', '"$/"', 'match') ops.'push_pirop'('length', eos, tgt, 'result'=>eos) - # On Parrot, indexing into variable-width encoded strings + # On Parrot, indexing into variable-width encoded strings # (such as utf8) becomes much more expensive as we move # farther away from the beginning of the string (via calls - # to utf8_skip_forward). For regexes that are starting a match + # to utf8_skip_forward). For regexes that are starting a match # at a position other than the beginning of the string (e.g., # a subrule call), we can save a lot of useless scanning work - # in utf8_skip_forward by removing the first C + # in utf8_skip_forward by removing the first C # characters from the target and then performing all indexed # operations on the resulting target relative to C. - + ops.'push_pirop'('set', off, 0) ops.'push_pirop'('lt', '$I10', 2, startlabel) ops.'push_pirop'('sub', off, '$I10', 1, 'result'=>off) @@ -206,7 +206,7 @@ are passed to the function as input arguments. done: .return (ops) .end - + =item !rxregs(keystr) @@ -576,7 +576,7 @@ standard quantifier code will handle it. null ops .return (ops) .end - + =item concat(PAST::Regex node) @@ -649,7 +649,7 @@ character list. zerowidth = iseq subtype, 'zerowidth' ops.'push_pirop'('inline', negate, subtype, 'inline'=>' # rx enumcharlist negate=%0 %1') - + ops.'push_pirop'('ge', pos, eos, fail) ops.'push_pirop'('sub', '$I10', pos, off) ops.'push_pirop'('substr', '$S10', tgt, '$I10', 1) @@ -660,7 +660,7 @@ character list. skip_zero_2: .return (ops) .end - + =item literal(PAST::Regex node) @@ -1017,7 +1017,7 @@ Perform a subcapture (capture of a portion of a regex). $P0 = node.'name'() name = self.'as_post'($P0, 'rtype'=>'*') - .local string rxname + .local string rxname rxname = self.'unique'('rxcap_') .local pmc caplabel, donelabel @@ -1110,7 +1110,7 @@ Helper method to create a new POST node of C. =item ??!!(test, trueval, falseval) -Helper method to perform ternary operation -- returns C +Helper method to perform ternary operation -- returns C if C is true, C otherwise. =cut @@ -1125,7 +1125,7 @@ if C is true, C otherwise. true: .return (trueval) .end - + =back diff --git a/src/PAST/Regex.pir b/src/PAST/Regex.pir index 6b5c232..7e96531 100644 --- a/src/PAST/Regex.pir +++ b/src/PAST/Regex.pir @@ -7,7 +7,7 @@ PAST::Regex - Regex nodes for PAST =head1 DESCRIPTION This file implements the various abstract syntax tree nodes -for regular expressions. +for regular expressions. =cut @@ -179,7 +179,7 @@ at this node. lpast = self[0] $I0 = isa lpast, ['String'] unless $I0 goto done - + .local string subtype subtype = self.'subtype'() if subtype == 'ignorecase' goto done diff --git a/src/Regex/Cursor-builtins.pir b/src/Regex/Cursor-builtins.pir index 980687b..91e2ced 100644 --- a/src/Regex/Cursor-builtins.pir +++ b/src/Regex/Cursor-builtins.pir @@ -135,11 +135,11 @@ Regex::Cursor-builtins - builtin regexes for Cursor objects .sub 'upper' :method .tailcall '!cclass'(self, 'upper', .CCLASS_UPPERCASE) .end - + .sub 'lower' :method .tailcall '!cclass'(self, 'lower', .CCLASS_LOWERCASE) .end - + .sub 'digit' :method .tailcall '!cclass'(self, 'digit', .CCLASS_NUMERIC) .end @@ -159,7 +159,7 @@ Regex::Cursor-builtins - builtin regexes for Cursor objects .sub 'cntrl' :method .tailcall '!cclass'(self, 'cntrl', .CCLASS_CONTROL) .end - + .sub 'punct' :method .tailcall '!cclass'(self, 'punct', .CCLASS_PUNCTUATION) .end @@ -211,7 +211,7 @@ Regex::Cursor-builtins - builtin regexes for Cursor objects setattribute self, '$!debug', arg .return (1) .end - + =head1 AUTHORS Patrick Michaud is the author and maintainer. diff --git a/src/Regex/Cursor-protoregex-peek.pir b/src/Regex/Cursor-protoregex-peek.pir index 6041043..0805c00 100644 --- a/src/Regex/Cursor-protoregex-peek.pir +++ b/src/Regex/Cursor-protoregex-peek.pir @@ -44,7 +44,7 @@ Perform a match for protoregex C. self.'!cursor_debug'(' token1="', $S1, '", token="', $S0, '"') # Create a hash to keep track of the methods we've already called, - # so that we don't end up calling it twice. + # so that we don't end up calling it twice. .local pmc mcalled mcalled = new ['Hash'] @@ -98,7 +98,7 @@ Perform a match for protoregex C. =item !protoregex_generation() -Reset the C<$!generation> flag to indicate that protoregexes +Reset the C<$!generation> flag to indicate that protoregexes need to be recalculated (because new protoregexes have been added). @@ -176,7 +176,7 @@ create a new one and return it. push methodlist, methodname goto proto_loop proto_done: - + # Now, walk through all of the methods, building the # tokrx and toklen tables as we go. .local pmc sorttok @@ -223,7 +223,7 @@ create a new one and return it. token_item: tkey = $P0 - # If we've already processed this token for this rule, + # If we've already processed this token for this rule, # don't enter it twice into tokrx. $I0 = exists seentok[tkey] if $I0 goto tokens_loop @@ -331,7 +331,7 @@ recreating it on future calls. setprop parrotclass, '%!prototable', prototable .return (prototable) .end - + =item !PREFIX__!protoregex(name) diff --git a/src/Regex/Cursor.pir b/src/Regex/Cursor.pir index ea783de..5c37e20 100644 --- a/src/Regex/Cursor.pir +++ b/src/Regex/Cursor.pir @@ -524,7 +524,7 @@ values of repetition count, cursor position, and mark (address). =item !mark_commit(mark) Like C above this backtracks the cursor to C -(releasing any intermediate marks), but preserves the current +(releasing any intermediate marks), but preserves the current capture states. =cut diff --git a/src/Regex/Match.pir b/src/Regex/Match.pir index 780027b..6dd0e9b 100644 --- a/src/Regex/Match.pir +++ b/src/Regex/Match.pir @@ -182,7 +182,7 @@ Returns the string value of the match $S0 = self.'Str'() .return ($S0) .end - + =item !make(obj) @@ -195,7 +195,7 @@ Set the "ast object" for the invocant. setattribute self, '$!ast', obj .return (obj) .end - + =back diff --git a/src/Regex/P6Regex/Actions.pm b/src/Regex/P6Regex/Actions.pm index bdb67b9..fb3ad62 100644 --- a/src/Regex/P6Regex/Actions.pm +++ b/src/Regex/P6Regex/Actions.pm @@ -4,8 +4,8 @@ class Regex::P6Regex::Actions is HLL::Actions; our @MODIFIERS; sub INIT() { - @MODIFIERS := Q:PIR { - %r = new ['ResizablePMCArray'] + @MODIFIERS := Q:PIR { + %r = new ['ResizablePMCArray'] $P0 = new ['Hash'] push %r, $P0 }; @@ -42,8 +42,8 @@ method nibbler($/, $key?) { my $past; if +$ > 1 { $past := PAST::Regex.new( :pasttype('alt'), :node($/) ); - for $ { - $past.push($_.ast); + for $ { + $past.push($_.ast); } } else { @@ -124,12 +124,12 @@ method quantifier:sym<**>($/) { make backmod($past, $); } -method metachar:sym($/) { +method metachar:sym($/) { my $past := @MODIFIERS[0] - ?? PAST::Regex.new( 'ws', :pasttype('subrule'), + ?? PAST::Regex.new( 'ws', :pasttype('subrule'), :subtype('method'), :node($/) ) !! 0; - make $past; + make $past; } @@ -204,9 +204,9 @@ method metachar:sym($/) { method metachar:sym<~>($/) { make PAST::Regex.new( $.ast, - PAST::Regex.new( + PAST::Regex.new( $.ast, - PAST::Regex.new( 'FAILGOAL', ~$, :pasttype('subrule'), + PAST::Regex.new( 'FAILGOAL', ~$, :pasttype('subrule'), :subtype('method') ), :pasttype('alt') ), @@ -244,10 +244,10 @@ method metachar:sym($/) { method metachar:sym($/) { make PAST::Regex.new( PAST::Op.new( :inline(~$), :pasttype('inline'), ), - :pasttype('pastnode'), :node($/) + :pasttype('pastnode'), :node($/) ); } - + method backslash:sym($/) { my $subtype := ~$ eq 'n' ?? 'nl' !! ~$; @@ -268,7 +268,7 @@ method backslash:sym($/) { } method backslash:sym($/) { - my $past := PAST::Regex.new( "\f", :pasttype('enumcharlist'), + my $past := PAST::Regex.new( "\f", :pasttype('enumcharlist'), :negate($ eq 'F'), :node($/) ); make $past; } @@ -280,26 +280,26 @@ method backslash:sym($/) { } method backslash:sym($/) { - my $past := PAST::Regex.new( "\r", :pasttype('enumcharlist'), + my $past := PAST::Regex.new( "\r", :pasttype('enumcharlist'), :negate($ eq 'R'), :node($/) ); make $past; } method backslash:sym($/) { - my $past := PAST::Regex.new( "\t", :pasttype('enumcharlist'), + my $past := PAST::Regex.new( "\t", :pasttype('enumcharlist'), :negate($ eq 'T'), :node($/) ); make $past; } method backslash:sym($/) { - my $past := PAST::Regex.new( "\x[0a,0b,0c,0d,85,2028,2029]", + my $past := PAST::Regex.new( "\x[0a,0b,0c,0d,85,2028,2029]", :pasttype('enumcharlist'), :negate($ eq 'V'), :node($/) ); make $past; } method backslash:sym($/) { - my $octlit := + my $octlit := HLL::Actions::ints_to_string( $ || $ ); make $ eq 'O' ?? PAST::Regex.new( $octlit, :pasttype('enumcharlist'), @@ -308,7 +308,7 @@ method backslash:sym($/) { } method backslash:sym($/) { - my $hexlit := + my $hexlit := HLL::Actions::ints_to_string( $ || $ ); make $ eq 'X' ?? PAST::Regex.new( $hexlit, :pasttype('enumcharlist'), @@ -339,7 +339,7 @@ method assertion:sym($/) { $past.negate( !$past.negate ); $past.subtype('zerowidth'); } - else { + else { $past := PAST::Regex.new( :pasttype('anchor'), :subtype('fail'), :node($/) ); } make $past; @@ -368,9 +368,9 @@ method assertion:sym($/) { chopn $S0, 1 %r = box $S0 }; - $past := PAST::Regex.new( + $past := PAST::Regex.new( PAST::Regex.new( $regexsym, :pasttype('literal') ), - :name($name), :pasttype('subcapture'), :node($/) + :name($name), :pasttype('subcapture'), :node($/) ); } else { @@ -391,9 +391,9 @@ method assertion:sym<[>($/) { my $past := $clist[0].ast; if $past.negate && $past.pasttype eq 'subrule' { $past.subtype('zerowidth'); - $past := PAST::Regex.new( - $past, - PAST::Regex.new( :pasttype('charclass'), :subtype('.') ), + $past := PAST::Regex.new( + $past, + PAST::Regex.new( :pasttype('charclass'), :subtype('.') ), :node($/) ); } @@ -412,7 +412,7 @@ method assertion:sym<[>($/) { } make $past; } - + method cclass_elem($/) { my $str := ''; my $past; @@ -441,7 +441,7 @@ method cclass_elem($/) { cclass_done: %r = box $S2 }; - $str := $str ~ $c; + $str := $str ~ $c; } else { $str := $str ~ $_[0]; } } @@ -466,7 +466,7 @@ sub buildsub($rpast) { $rpast, PAST::Regex.new( :pasttype('pass') ), :pasttype('concat'), - :capnames(%capnames) + :capnames(%capnames) ); PAST::Block.new( $rpast, :blocktype('method')); } diff --git a/src/Regex/P6Regex/Grammar.pm b/src/Regex/P6Regex/Grammar.pm index 617217f..99e6a72 100644 --- a/src/Regex/P6Regex/Grammar.pm +++ b/src/Regex/P6Regex/Grammar.pm @@ -1,7 +1,7 @@ grammar Regex::P6Regex::Grammar is HLL::Grammar; method obs ($old, $new, $when = 'in Perl 6') { - self.panic('Obsolete use of ' ~ ~$old ~ ';' + self.panic('Obsolete use of ' ~ ~$old ~ ';' ~ ~$when ~ ' please use ' ~ ~$new ~ 'instead'); } @@ -11,7 +11,7 @@ grammar Regex::P6Regex::Grammar is HLL::Grammar; token quote { \' $=[<-[']>*] \' } - token arg { + token arg { [ | | $=[\d+] @@ -28,8 +28,8 @@ grammar Regex::P6Regex::Grammar is HLL::Grammar; token nibbler { {*} #= open [ <.ws> ['||'|'|'|'&&'|'&'] ]? - - [ ['||'|'|'] + + [ ['||'|'|'] [ || <.panic: 'Null pattern not allowed'> ] ]* } @@ -54,7 +54,7 @@ grammar Regex::P6Regex::Grammar is HLL::Grammar; token quantifier:sym<*> { } token quantifier:sym<+> { } token quantifier:sym { } - token quantifier:sym<**> { + token quantifier:sym<**> { \s* \s* [ || $=[\d+] [ '..' $=[\d+|'*'] ]? @@ -82,24 +82,24 @@ grammar Regex::P6Regex::Grammar is HLL::Grammar; token metachar:sym { } ## we cheat here, really should be regex_infix:sym<~> - token metachar:sym<~> { - - <.ws> + token metachar:sym<~> { + + <.ws> <.ws> } - token metachar:sym<{*}> { - + token metachar:sym<{*}> { + [ \h* '#= ' \h* $=[\S+ [\h+ \S+]*] ]? } - token metachar:sym { - '<' + token metachar:sym { + '<' [ '>' || <.panic: 'regex assertion not terminated by angle bracket'> ] } token metachar:sym { - [ - | '$<' $=[<-[>]>+] '>' + [ + | '$<' $=[<-[>]>+] '>' | '$' $=[\d+] ] @@ -134,7 +134,7 @@ grammar Regex::P6Regex::Grammar is HLL::Grammar; token assertion:sym { '!' [ ' > | ] } token assertion:sym { - '.' + '.' } token assertion:sym { @@ -164,9 +164,9 @@ grammar Regex::P6Regex::Grammar is HLL::Grammar; <.normspace>? } - token mod_internal { + token mod_internal { [ - | ':' $=('!' | \d+)**1 » + | ':' $=('!' | \d+)**1 » | ':' [ '(' $=[\d+] ')' ]? ] } diff --git a/src/cheats/hll-compiler.pir b/src/cheats/hll-compiler.pir index 35f8046..792b29f 100644 --- a/src/cheats/hll-compiler.pir +++ b/src/cheats/hll-compiler.pir @@ -9,7 +9,7 @@ p6meta = get_hll_global 'P6metaclass' p6meta.'new_class'('HLL::Compiler', 'parent'=>'PCT::HLLCompiler') .end - + .sub 'parse' :method .param pmc source @@ -74,4 +74,4 @@ $S0 = $P0.'to_pir'(source, adverbs :flat :named) .return ($S0) .end - + diff --git a/src/cheats/hll-grammar.pir b/src/cheats/hll-grammar.pir index a3e0c63..5980af6 100644 --- a/src/cheats/hll-grammar.pir +++ b/src/cheats/hll-grammar.pir @@ -160,9 +160,9 @@ C< :!pair >, and C<< :pair >>. value = box $S0 pos = lpos + 1 have_value: - # Done processing the pair, store it in the hash. + # Done processing the pair, store it in the hash. hash[name] = value - goto spec_loop + goto spec_loop spec_done: # Done processing the spec string, cache the hash for later. ohash[spec] = hash @@ -180,7 +180,7 @@ C< :!pair >, and C<< :pair >>. save_hash: ohash[save] = hash .return (self) - + err_lookup: self.'panic'('Unknown operator precedence specification "', lookup, '"') .end @@ -258,7 +258,7 @@ position C. inc $I0 stop = substr brackets, $I0, 1 - # see if the opening bracket is repeated + # see if the opening bracket is repeated .local int len len = 0 bracket_loop: @@ -291,7 +291,7 @@ position C. quotemod = new ['Hash'] true = box 1 - + args_loop: unless args goto args_done @@ -321,7 +321,7 @@ position C. (cur, pos, target) = self.'!cursor_start'() .local pmc start, stop - (start, stop) = self.'peek_delimiters'(target, pos) + (start, stop) = self.'peek_delimiters'(target, pos) .lex '$*QUOTE_START', start .lex '$*QUOTE_STOP', stop @@ -654,7 +654,7 @@ An operator precedence parser. markhash = new ['Hash'] set_global '%!MARKHASH', markhash have_markhash: - markhash[markname] = pos + markhash[markname] = pos self.'!cursor_debug'('PASS MARKER') .return (1) .end diff --git a/src/cheats/nqp-builtins.pir b/src/cheats/nqp-builtins.pir index c1f61ff..e867092 100644 --- a/src/cheats/nqp-builtins.pir +++ b/src/cheats/nqp-builtins.pir @@ -16,7 +16,7 @@ .sub 'say' .param pmc list :slurpy .tailcall 'print'(list :flat, "\n") -.end +.end .sub 'ok' .param pmc condition diff --git a/t/nqp/10-cmp.t b/t/nqp/10-cmp.t index ff331c0..d2b5953 100644 --- a/t/nqp/10-cmp.t +++ b/t/nqp/10-cmp.t @@ -82,7 +82,7 @@ unless @a =:= @b { print("not "); } say("ok 17 # container equality, named arrays"); - + my $x := 'foo'; my $y := $x; my $z := 'foo'; diff --git a/t/nqp/11-sub.t b/t/nqp/11-sub.t index c67554c..75ffa58 100644 --- a/t/nqp/11-sub.t +++ b/t/nqp/11-sub.t @@ -73,4 +73,4 @@ say("ok 10 # subroutines that operate on args do not affect the original arg out sub eleven ($arg) { say("ok 11 # parameter with a trailing comma"); } -eleven( 'dummy', ); +eleven( 'dummy', ); diff --git a/t/nqp/21-contextual.t b/t/nqp/21-contextual.t index 0a93356..b362ec4 100644 --- a/t/nqp/21-contextual.t +++ b/t/nqp/21-contextual.t @@ -15,9 +15,9 @@ sub foo() { $*VAR } ok(bar() eq 'abc', 'called subroutine sees caller $*VAR'); - - { + + { my $*VAR := 'def'; ok( $*VAR eq 'def', 'basic nested contextual works'); ok( foo() eq 'def', 'called subroutine sees caller $*VAR'); diff --git a/t/nqp/27-self.t b/t/nqp/27-self.t index e83a32f..9041c61 100644 --- a/t/nqp/27-self.t +++ b/t/nqp/27-self.t @@ -8,13 +8,13 @@ class Foo { method uno() { self.foo(); }; - + method des() { if 1 { self.foo(); } }; - + method tres($a) { if 1 { self.foo(); diff --git a/t/nqp/33-init.t b/t/nqp/33-init.t index f1d5ee4..5f3cf80 100644 --- a/t/nqp/33-init.t +++ b/t/nqp/33-init.t @@ -8,7 +8,7 @@ our $foo; ok($foo == 2, 'after second INIT block'); -INIT { +INIT { our $foo; ok($foo == 0, 'first INIT'); $foo := 1; diff --git a/t/p6regex/rx_charclass b/t/p6regex/rx_charclass index 1010f81..b8e8dd5 100644 --- a/t/p6regex/rx_charclass +++ b/t/p6regex/rx_charclass @@ -73,9 +73,9 @@ # todo :pugs :pge (ab)"x$0" abxab y literal match with interpolation '?' ab abcdef n two enumerated ranges <[A..Z0..9]> abcDef y two enumerated ranges