File tree Expand file tree Collapse file tree 4 files changed +788
-783
lines changed Expand file tree Collapse file tree 4 files changed +788
-783
lines changed Original file line number Diff line number Diff line change 4
4
include 'lib/sparql.php ' ;
5
5
6
6
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 ;
9
10
10
11
private function parse ($ fp ) {
12
+ if (!isset ($ parser )) {
13
+ $ this ->parser = new SparqlPHPParserParser ($ this );
14
+ }
11
15
$ scanner = new SparqlLexer ($ fp );
12
16
while ($ x = $ scanner ->nextToken ())
13
17
{
14
18
if ($ x ->type != SparqlPHPParser::TK_FAIL ) {
15
-
19
+ $ this -> parser -> SparqlPHP ( $ x -> type , $ x );
16
20
} else {
17
- throw Exception ('... ' );
21
+ $ err = 'Invalid Input in line ' . $ x ->line . '. Problem with: ' . $ x ->value . fgets ($ fp , 15 );
22
+ throw Exception ($ err );
18
23
}
19
24
}
25
+ $ this ->parser ->SparqlPHP (0 );
26
+
20
27
}
21
28
22
29
function parseString ($ string ) {
@@ -30,4 +37,8 @@ function parseFile($file) {
30
37
$ fp = fopen ($ file , 'r+ ' ) or die ('Unable to open file with path: ' . $ file );
31
38
return $ this ->parse ($ fp );
32
39
}
40
+
41
+ function resetParser () {
42
+ //TODO
43
+ }
33
44
}
You can’t perform that action at this time.
0 commit comments