App: manual Page: fragments/page_4
PHP
|
HTML
fragments/page_4.pad
|
Result
|
|
{data 'fruit'}["apple","pear"]{/data} <p>A clean pass sees the store: {code clean}{fruit}{$fruit} {/fruit}{/code}</p> {code}{sequence '7;8;9', push='nums'/}{/code} <p>A plain pass pushed nums, and it survived: {pull:nums}{$sequence} {/pull:nums}</p>
|
|
App: manual Page: pages/page
PHP
|
HTML
pages/page.pad
|
Result
|
|
{meta title='Nested Passes - {code} and {page}'}
<p>A nested pass is the engine run inside itself: the content of a <code>{code}</code> pair, or the page a <code>{page}</code> tag names, is rendered as a complete PAD run of its own, and what it produced lands in the surrounding page. The pass sees the request it runs in - its variables, its stores - unless it asks for isolation.</p>
<h2>A pass and what it leaves behind</h2>
<p>A plain <code>{code}</code> shares everything. What the pass creates is still there when it returns:</p>
{example 'fragments/page_1'}
<h2>The four isolation forms</h2>
<p>Three options decide how much of the request a pass sees, and how much of the pass the request keeps. They differ on both sides of the boundary:</p>
<table border="1" cellpadding="8" cellspacing="0" style="border-collapse: collapse;"> <tr><th>form</th><th>sees the outer state</th><th>what it created afterwards</th></tr> <tr><td><code>{code}</code></td> <td>yes</td><td>still there</td></tr> <tr><td><code>{code reset}</code></td> <td>no - a blank slate going in</td><td>still there</td></tr> <tr><td><code>{code clean}</code></td> <td>yes</td><td>taken back out</td></tr> <tr><td><code>{code sandbox}</code></td> <td>no</td><td>taken back out</td></tr> </table>
<p> </p>
{example 'fragments/page_2'}
<h2>Another page as a pass</h2>
<p><code>{page 'name'}</code> runs that page - its .php and its .pad - as a pass, with the same isolation options. A <code>function</code> option runs the pass inside a PHP function body, but it still starts from the caller's variables and what it sets comes back out - a page whose .php half must not touch the caller's variables wants <code>clean</code> or <code>sandbox</code>:</p>
{example 'fragments/page_3'}
<h2>Stores cross the boundary by the same rules</h2>
<p>The data, content, bool and sequence stores follow the isolation form. A <code>clean</code> pass reads the request's stores; a <code>sandbox</code> or <code>reset</code> pass starts without them. On the way out, only a plain pass's pushes stay: each of the three isolated forms puts the request's stores back exactly as they were, its own pushes included:</p>
{example 'fragments/page_4'}
<h2>Engine state is always put back</h2>
<p>Whatever the isolation form, the engine itself returns to where it was: a loop the pass ran inside continues from the same row, and a request-lived counter such as <code>{switch}</code>'s rotation is rolled back with the rest - a pass takes its counting with it:</p>
{example 'fragments/page_5'}
<p>Both calls answer the first value: the rotation the pass advanced was restored when the pass returned.</p>
|
|
App: regression/framework Page: lenient/a_bare_pull_with_nothing_pushed_pulls_nothing
PHP
lenient/a_bare_pull_with_nothing_pushed_pulls_nothing.php
|
HTML
lenient/a_bare_pull_with_nothing_pushed_pulls_nothing.pad
|
Result
|
<?php
// The lenient walk under test: with the syntax check off, what cannot run passes the // value through or yields empty, and the walk carries on.
$padCheckSyntax = FALSE;
?>
|
[{pull}{$sequence}@else@none{/pull}]
|
|
App: regression/framework Page: lenient/a_count_that_is_no_whole_number_leaves_the_sequence_alone
PHP
lenient/a_count_that_is_no_whole_number_leaves_the_sequence_alone.php
|
HTML
lenient/a_count_that_is_no_whole_number_leaves_the_sequence_alone.pad
|
Result
|
<?php
// The lenient walk under test: with the syntax check off, what cannot run passes the // value through or yields empty, and the walk carries on.
$padCheckSyntax = FALSE;
?>
|
[{sequence '1..6', first=2.5}{$sequence} {/sequence}][{sequence '1..6', last=-1}{$sequence} {/sequence}][{sequence '1..6', push='p'}{pull:p pop='x'}{$sequence} {/pull:p}][{pull:p}{$sequence} {/pull:p}][{sequence '1..6', maximum=1.5}{$sequence} {/sequence}]
|
|
App: regression/framework Page: lenient/a_resume_prefix_is_no_type_and_leaves_the_store_alone
PHP
lenient/a_resume_prefix_is_no_type_and_leaves_the_store_alone.php
|
HTML
lenient/a_resume_prefix_is_no_type_and_leaves_the_store_alone.pad
|
Result
|
<?php
// The lenient walk under test: with the syntax check off, what cannot run passes the // value through or yields empty, and the walk carries on.
$padCheckSyntax = FALSE;
?>
|
[{sequence 5, push='x'}{resume:x add=1}][{pull:x}{$sequence} {/pull:x}]
|
|
App: regression/framework Page: lenient/a_shift_or_pop_of_a_store_never_pushed_takes_nothing
PHP
lenient/a_shift_or_pop_of_a_store_never_pushed_takes_nothing.php
|
HTML
lenient/a_shift_or_pop_of_a_store_never_pushed_takes_nothing.pad
|
Result
|
<?php
// The lenient walk under test: with the syntax check off, what cannot run passes the // value through or yields empty, and the walk carries on.
$padCheckSyntax = FALSE;
?>
|
[{sequence pull='nope', shift=2}{$sequence}@else@none{/sequence}][{sequence pull='nope', pop=1, toData='q'}{$sequence}@else@none{/sequence}]
|
|
App: regression/framework Page: lenient/a_store_never_pushed_pulls_nothing
PHP
lenient/a_store_never_pushed_pulls_nothing.php
|
HTML
lenient/a_store_never_pushed_pulls_nothing.pad
|
Result
|
<?php
// The lenient walk under test: with the syntax check off, what cannot run passes the // value through or yields empty, and the walk carries on.
$padCheckSyntax = FALSE;
?>
|
{resume reverse}[{sequence pull='nope'}{$sequence}@else@none{/sequence}]
|
|
App: regression/framework Page: passes/a_plain_pass_leaves_its_push_behind
PHP
|
HTML
passes/a_plain_pass_leaves_its_push_behind.pad
|
Result
|
|
{code}{sequence '7;8', push='psOut'/}in{/code} [{pull:psOut}{$sequence},{/pull:psOut}]
|
|
App: regression/framework Page: prefixes/pull_as_a_tag_reads_a_pushed_sequence
PHP
|
HTML
prefixes/pull_as_a_tag_reads_a_pushed_sequence.pad
|
Result
|
|
{sequence '1..3', push='s'/} {pull 's'} {$sequence}, {/pull}
|
|
App: regression/framework Page: prefixes/pull_names_a_stored_sequence
PHP
|
HTML
prefixes/pull_names_a_stored_sequence.pad
|
Result
|
|
{sequence '1..3', push='p'/} {pull:p} {$sequence}, {/pull:p}
|
|
App: regression/framework Page: sequence/a_first_parameter_an_action_does_not_take_is_the_store_the_type_or_the_count_it_names
PHP
|
HTML
sequence/a_first_parameter_an_action_does_not_take_is_the_store_the_type_or_the_count_it_names.pad
|
Result
|
|
{sequence '11..16', push='nums'/}[{reverse 'prime'}{$sequence} {/reverse}][{action:first 'prime'}{$sequence} {/action:first}][{action:splice 'nums', splice=2}{$sequence} {/action:splice}][{append 5}{$sequence} {/append}][{action:sort 'nums'}{$sequence} {/action:sort}][{action:shift 'nums', shift=2}{$sequence} {/action:shift}]
|
|
App: regression/framework Page: sequence/a_fraction_is_one_value_wherever_it_prints_alike
PHP
|
HTML
sequence/a_fraction_is_one_value_wherever_it_prints_alike.pad
|
Result
|
|
{sequence '0.3;1', push='b'/}[{sequence '0.1;0.2', make, add=0.1, merge='b'}{$sequence} {/sequence}][{sequence '1;1.0;2;2', dedup}{$sequence} {/sequence}][{sequence '1;1.0;2;x;x', distinct}{$sequence} {/sequence}][{sequence '0.1;0.2', make, add=0.1, push='c'/}{pull:c dedup='b'}{$sequence} {/pull:c}][{sequence '0.30000000000000004;0.3', unique}{$sequence} {/sequence}][{sequence '3;1;3;2;1', dedup}{$sequence} {/sequence}]
|
|
App: regression/framework Page: sequence/a_list_after_a_quoted_action_is_the_values_it_acts_on
PHP
|
HTML
sequence/a_list_after_a_quoted_action_is_the_values_it_acts_on.pad
|
Result
|
|
[{sequence 'reverse', [1, 2, 3]}{$sequence} {/sequence}][{sequence 'sort', [3, 1, 2]}{$sequence} {/sequence}][{sequence '1..5', push='s'/}{sequence 's', 'reverse', [9]}{$sequence} {/sequence}]
|
|
App: regression/framework Page: sequence/a_list_beside_a_store_pulled_is_the_parameter_of_an_action_that_takes_stores
PHP
|
HTML
sequence/a_list_beside_a_store_pulled_is_the_parameter_of_an_action_that_takes_stores.pad
|
Result
|
|
{sequence '1..3', push='a'/}[{action:append a, [7, 8]}{$sequence} {/action:append}][{a:append [7, 8]}{$sequence} {/a:append}][{action:intersection a, [2, 3, 9]}{$sequence} {/action:intersection}][{action:sort a, [0, 9]}{$sequence} {/action:sort}][{sequence [3, 1, 2], sort}{$sequence} {/sequence}]
|
|
App: regression/framework Page: sequence/a_list_beside_a_store_pulled_plays_over_it_as_a_semicolon_list_does_or_is_the_parameter_of_an_action_option
PHP
|
HTML
sequence/a_list_beside_a_store_pulled_plays_over_it_as_a_semicolon_list_does_or_is_the_parameter_of_an_action_option.pad
|
Result
|
|
{sequence '1..6', push='a'/}[{keep:a [2,3,9]}{$sequence} {/keep:a}][{remove:a [2,3,9]}{$sequence} {/remove:a}][{flag:a [2,3,9]}{$sequence} {/flag:a}][{make:a [2,3,9]}{$sequence} {/make:a}][{pull:a keep, [2,3,9]}{$sequence} {/pull:a}][{pull:a [7, 8]}{$sequence} {/pull:a}|{pull:a '7;8'}{$sequence} {/pull:a}][{sequence '7;8', push='b'/}{pull:b append, [9]}{$sequence} {/pull:b}][{pull:b [9], append}{$sequence} {/pull:b}][{sequence b, prepend, [9]}{$sequence} {/sequence}]
|
|
|