Update of /cvsroot/binaryphp/binaryphp
In directory sc8-pr-cvs1:/tmp/cvs-serv14779
Modified Files:
testfile.php tokenflow.php tokenizer.php
Log Message:
Added new parser, broke everything except echo (yay\! :) )
Index: testfile.php
===================================================================
RCS file: /cvsroot/binaryphp/binaryphp/testfile.php,v
retrieving revision 1.45
retrieving revision 1.46
diff -C2 -d -r1.45 -r1.46
*** testfile.php 5 Aug 2003 23:25:55 -0000 1.45
--- testfile.php 8 Aug 2003 05:10:53 -0000 1.46
***************
*** 1,23 ****
<?php
! $sock = socket_create(AF_INET, SOCK_STREAM, 0);
! $connection = socket_connect($sock, 'irc.freenode.net', 6667);
!
! socket_write($sock, "USER TestBOT TestBOT TestBOT :TestBOT\r\n");
! socket_write($sock, "NICK TestBOT \r\n");
! socket_write($sock,"JOIN #binaryphp \r\n");
! while ($data = socket_read($sock, 2046))
! {
! echo $data, "\n";
! $temp = explode(':', $data);
! $temp2 = explode('!', $temp[1]);
! $temp3 = explode(' ', $temp2[1]);
! if(strpos('TestBOT: PING?', $temp[2]) !== false)
! socket_write($sock, 'PRIVMSG ' . $temp3[2] . ' :' . $temp2[0] . ": PONG!\r\n");
!
! if(strpos('!quit', $temp[2]) !== false)
! {
! if($temp2[0] == 'Amaranth')
! socket_write($sock, 'QUIT :Seeya ' . $temp3[2] . "\r\n");
! }
! }
?>
--- 1,3 ----
<?php
! echo 'Bleh!';
?>
Index: tokenflow.php
===================================================================
RCS file: /cvsroot/binaryphp/binaryphp/tokenflow.php,v
retrieving revision 1.50
retrieving revision 1.51
diff -C2 -d -r1.50 -r1.51
*** tokenflow.php 6 Aug 2003 14:09:55 -0000 1.50
--- tokenflow.php 8 Aug 2003 05:10:53 -0000 1.51
***************
*** 1,784 ****
<?php
class Generator
{
! var $functions = array('main');
! var $curfunction = 0;
! var $code;
! var $prototypes;
! var $includes = array();
! var $defines = array();
! var $cppincludes = array();
[...992 lines suppressed...]
foreach($this->includes as $include)
+ $code .= '#include <' . $include . '>' . "\n";
+ foreach($this->code as $func => $arr)
{
! list($name, $return, $args) = $this->functions[$func];
! $code .= $return . ' ' . $name . '(';
! $args2 = array();
! foreach($args as $arg)
! $args2[] = $arg[0];
! $code .= implode(', ', $args2) . ')' . "\n";
$code .= '{' . "\n";
! foreach($arr as $line)
! $code .= $line . "\n";
$code .= '}' . "\n";
}
! return array($code, (string) null);
}
}
! ?>
\ No newline at end of file
Index: tokenizer.php
===================================================================
RCS file: /cvsroot/binaryphp/binaryphp/tokenizer.php,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** tokenizer.php 22 Jul 2003 07:37:27 -0000 1.1.1.1
--- tokenizer.php 8 Aug 2003 05:10:53 -0000 1.2
***************
*** 11,15 ****
function Tokenize()
{
! $this->tokens = token_get_all($this->code);
}
function Strip()
--- 11,22 ----
function Tokenize()
{
! $tokens = token_get_all($this->code);
! foreach($tokens as $token)
! {
! if(is_array($token))
! $this->tokens[] = $token;
! else
! $this->tokens[] = array($token, null);
! }
}
function Strip()
***************
*** 19,29 ****
foreach($this->tokens as $token)
{
! if(is_array($token))
! {
! if(!in_array($token[0], $strip))
$tokens[] = $token;
- }
- else
- $tokens[] = $token;
}
$this->tokens = $tokens;
--- 26,31 ----
foreach($this->tokens as $token)
{
! if(!in_array($token[0], $strip))
$tokens[] = $token;
}
$this->tokens = $tokens;
|