Of course, the code block has to be indented more

master
Richard van Velzen 2011-12-29 13:11:38 +01:00
parent 00127ed53c
commit 9ca1b6ef16
1 changed files with 19 additions and 20 deletions

View File

@ -41,27 +41,26 @@ understanding how to use Lime.
6. Integrate your parser as follows: 6. Integrate your parser as follows:
require 'lime/parse_engine.php'; require 'lime/parse_engine.php';
require 'my_parser.php'; require 'my_parser.php';
// //
// Later: // Later:
// //
$parser = new parse_engine(new my_parser()); $parser = new parse_engine(new my_parser());
// //
// And still later: // And still later:
// //
try { try {
while (..something..) { while (..something..) {
$parser->eat($type, $val); $parser->eat($type, $val);
// You figure out how to get the parameters. // You figure out how to get the parameters.
}
// And after the last token has been eaten:
$parser->eat_eof();
} catch (parse_error $e) {
die($e->getMessage());
} }
// And after the last token has been eaten: return $parser->semantic;
$parser->eat_eof();
} catch (parse_error $e) {
die($e->getMessage());
}
return $parser->semantic;
7. You now have the computed semantic value of whatever you parsed. Add salt 7. You now have the computed semantic value of whatever you parsed. Add salt
and pepper to taste, and serve. and pepper to taste, and serve.