Skip to content

Commit

Permalink
#6 improves oilParser to remove C comments
Browse files Browse the repository at this point in the history
  • Loading branch information
jcecconi committed Mar 26, 2015
1 parent 13145ce commit f88dc7d
Showing 1 changed file with 7 additions and 16 deletions.
23 changes: 7 additions & 16 deletions oilParser.php
Expand Up @@ -109,19 +109,12 @@ function removeComments()
$this->lines[$l] = $tmp[0];
}

/* remove c comments */
/* to do */
#if ( strpos($this->lines[$l], "/*") !== false )
#{
# $tmp = array ( substr ($this->lines[$l],0, strpos($this->lines[$l], "/*")-1),
# substr ($this->lines[$l],strpos($this->lines[$l], "/*")+2), strlen($this->lines[$l]));
# print "t1:" . $tmp[0] . "t2:" . $tmp[1] . "\n";
# $this->lines[$l] = $tmp[0];
# if ( strpos($tmp[1], "*/") !== false )
# {
# $this->lines[$l] .= " " . substr($tmp[1], strpos("*/", $tmp[1])+2, strlen($tmp[1]));
# }
#}
/* remove c comments in a complete line*/
/* to do...remove complex comments */
if ( strpos($this->lines[$l], "/*") == 0 && strpos($this->lines[$l], "*/") == strlen($this->lines[$l])-2)
{
$this->lines[$l] = "";
}
}
}

Expand Down Expand Up @@ -152,16 +145,14 @@ function getDefinition()
$ret = array ( "", "", false);

$tmp = $this->lines[$this->line];

if ( strpos($tmp, "{") !== false )
{
$ret[2] = true;
$tmp = split("{",$tmp);
$tmp = $tmp[0];
}

if ($tmp != "")
{
{
if ( strpos($tmp, "=") !== false )
{
$tmp = split("=", $tmp);
Expand Down

0 comments on commit f88dc7d

Please sign in to comment.