Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include_once( 'php/bootstrap.php' );
- bootstrap( array( 'php::frontend', 'php::mk constants' ) );
- echo perform_swaps( str_replace( '{{content}}', vars_rip(), page_create() ) );
- exit;
- function vars_rip( $subject = '' )
- {
- $nen = nen_ini();
- $pagedata = '';
- $subject=file_get_contents($nen['root'].'source/MR97 ProcGen Core.bas');
- $pattern = '/(?<var>([A-Za-z][A-Za-z0-9]*))(\$|\!|\&|\#|\%|)/';
- $match_count=preg_match_all($pattern, $subject, $matches, PREG_SET_ORDER );
- trk_echo2('match', $matches);
- $matches = array_unique( $matches[ 0 ], PREG_PATTERN_ORDER );
- for ( $index = 0; $index < $match_count; $index++ )
- {
- if( strlen( $matches[ $index ][ 1 ] ) > 0 )
- {
- $pagedata.= '<tr><td>'. $matches[ $index ][ 1 ]. '</td></tr>';
- }
- }
- if( strlen( $pagedata ) > 0 ){
- $pagedata = '<table>'. $pagedata. '</table>';
- }
- return $pagedata;
- }
- //var_dump( jpp_build( 'qbasic vocabulary.dat' ) );
- function regex_vars( $page = '' )
- {
- $nen = nen_ini();
- $pagedata = '';
- $page = file_get_contents( $nen[ 'root' ]. 'qbasic vocabulary.dat' );
- $var_pattern = '/^
- (?<var>
- (?<prefix>\$|)
- (?<name>[A-Z]+)
- (?:(\s|\.{3})
- (?<suffix>[A-Z]+)
- |)
- (?<ext>[%&!#$]|)
- (?:\s
- (?<spec>(^\s|)\([A-Za-z \/]+\)(^\s|))
- |)
- (?:\s
- (?<format>([A-Z][a-z]*))
- )
- )
- $/mx';
- $ret_groups = array( 'var', 'prefix', 'name', 'suffix', 'ext', 'spec', 'format' );
- // assign replacement (unused)
- $var_replace = "$0\n";
- // create desination folder if it does not exist
- create_destination( 'vars out data' );
- // perform current page data regex
- $e = explode( "\r\n", $page );
- for( $eindex = 0; $eindex < count( $e ); $eindex++ )
- {
- if(
- preg_match(
- $var_pattern,
- $e[ $eindex ],
- $var_groups
- )
- )
- {
- $temp = '<tr><td colspan="2"><div style="font-size:160%;">'.$var_groups[ 'name' ]. ( strlen( $var_groups[ 'suffix' ] ) > 0 ? ' '. $var_groups[ 'suffix' ] : '' ). '</div></td></tr>';
- for( $index = 0; $index < count( $ret_groups ); $index++ )
- {
- $temp.= '<tr><td style="width:196px;text-align:center;">'. $ret_groups[ $index ]. '</td><td><b>'. $var_groups[ $ret_groups[ $index ] ]. '</b></td></tr>';
- }
- $temp = '<table style="width:100%;text-align:left;">'.$temp.'</table>';
- $pagedata.= $temp;
- }
- }
- return $pagedata;
- }
- function qb_keywords()
- {
- $nen = nen_ini();
- $temp = '';
- $page = file_get_contents( $nen[ 'root' ]. 'qbasic vocabulary.dat' );
- $var_pattern = '/^
- (?<var>
- (?<prefix>\$|)
- (?<name>[A-Z]+)
- (?:(\s|\.{3})
- (?<suffix>[A-Z]+)
- |)
- (?<ext>[%&!#$]|)
- (?:\s
- (?<spec>(^\s|)\([A-Za-z \/]+\)(^\s|))
- |)
- (?:\s
- (?<format>([A-Z][a-z]*))
- )
- )
- $/mx';
- $ret_groups = array( 'var', 'prefix', 'name', 'suffix', 'ext', 'spec', 'format' );
- // assign replacement (unused)
- $var_replace = "$0\n";
- // create desination folder if it does not exist
- create_destination( 'vars out data' );
- // perform current page data regex
- $e = explode( "\r\n", $page );
- for( $eindex = 0; $eindex < count( $e ); $eindex++ )
- {
- if(
- preg_match(
- $var_pattern,
- $e[ $eindex ],
- $var_groups
- )
- )
- {
- $temp[$var_groups[ 'name' ]] = array(
- 'name' -> $var_groups[ 'name' ],
- 'suffix' -> strlen( $var_groups[ 'suffix' ] ) > 0 ? ' '. $var_groups[ 'suffix' ] : '',
- 'index' -> $ret_groups[ $index ],
- 'index' -> $var_groups[ $ret_groups[ $index ] ]
- );
- }
- }
- sort( $temp );
- return $temp;
- }
- function quick_attribute(&$v, $var_matches, $var_index, $tags = array( 'var' ) )
- {
- foreach( $tags as $tag )
- {
- $v = append_attribute ( $v, $var_matches[ 'var' ][ $var_index ], $var_matches[ $tag ][ $var_index ], $tag );
- }
- }
- function append_attribute ( $v, $var, $group, $tag )
- {
- $v[ $var ][ $tag ] = $group;
- return $v;
- }
- function create_destination( $path = '' )
- {
- $nen = nen_ini();
- $e = explode( '/', $path );
- $i = 0;
- $s = '';
- while( $i < count( $e ) )
- {
- if($i > 0)
- {
- $s.= '/';
- }
- $s.= $e[ $i ];
- if( !is_dir( $nen[ 'root' ]. $s ) )
- {
- mkdir ( $nen[ 'root' ]. $s );
- }
- $i++;
- }
- }
- ?>
Add Comment
Please, Sign In to add comment