Skip to content

Commit c80b2fe

Browse files
committed
finished rough main, started removing typos in the code
1 parent 59c4e2f commit c80b2fe

File tree

4 files changed

+788
-783
lines changed

4 files changed

+788
-783
lines changed

SparqlPHPParserMain.php

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,26 @@
44
include 'lib/sparql.php';
55

66
class SparqlPHPParserMain {
7-
public $error = null;
8-
public $parser = new SparqlPHPParserParser($this);
7+
//root gets set in the parser
8+
public $root = null;
9+
public $parser = null;
910

1011
private function parse($fp) {
12+
if (!isset($parser)) {
13+
$this->parser = new SparqlPHPParserParser($this);
14+
}
1115
$scanner = new SparqlLexer($fp);
1216
while ($x = $scanner->nextToken())
1317
{
1418
if($x->type != SparqlPHPParser::TK_FAIL) {
15-
19+
$this->parser->SparqlPHP($x->type, $x);
1620
} else {
17-
throw Exception('...');
21+
$err = 'Invalid Input in line ' . $x->line . '. Problem with: ' . $x->value . fgets($fp, 15);
22+
throw Exception($err);
1823
}
1924
}
25+
$this->parser->SparqlPHP(0);
26+
2027
}
2128

2229
function parseString($string) {
@@ -30,4 +37,8 @@ function parseFile($file) {
3037
$fp = fopen($file, 'r+') or die('Unable to open file with path: ' . $file);
3138
return $this->parse($fp);
3239
}
40+
41+
function resetParser() {
42+
//TODO
43+
}
3344
}

0 commit comments

Comments
 (0)