aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIvan Enderlin <ivan.enderlin@hoa-project.net>2016-08-14 16:27:01 +0200
committerIvan Enderlin <ivan.enderlin@hoa-project.net>2016-08-14 16:32:35 +0200
commit3f3ff18c9184c26ed62bb24868b642c01d1ace6e (patch)
tree8e431226be4ee3eb78001685f6d4c0c277ef7008
parent2e3d09918920c6b64522525773831edfdcdf0f97 (diff)
downloadCompiler-3f3ff18c9184c26ed62bb24868b642c01d1ace6e.zip
Compiler-3f3ff18c9184c26ed62bb24868b642c01d1ace6e.tar.gz
Compiler-3f3ff18c9184c26ed62bb24868b642c01d1ace6e.tar.bz2
Analyzer: More detailed exception messages.
-rw-r--r--Llk/Rule/Analyzer.php15
1 files changed, 8 insertions, 7 deletions
diff --git a/Llk/Rule/Analyzer.php b/Llk/Rule/Analyzer.php
index 63c3f54..77cdb57 100644
--- a/Llk/Rule/Analyzer.php
+++ b/Llk/Rule/Analyzer.php
@@ -369,9 +369,10 @@ class Analyzer
if (-1 != $max && $max < $min) {
throw new Compiler\Exception(
- 'Upper bound of iteration must be greater of ' .
- 'equal to lower bound',
- 2
+ 'Upper bound %d must be greater or ' .
+ 'equal to lower bound %d in rule %s.',
+ 2,
+ [$max, $min, $this->_ruleName]
);
}
@@ -438,7 +439,7 @@ class Analyzer
if (false == $exists) {
throw new Compiler\Exception(
- 'Token ::%s:: does not exist in %s.',
+ 'Token ::%s:: does not exist in rule %s.',
3,
[$tokenName, $this->_ruleName]
);
@@ -481,7 +482,7 @@ class Analyzer
if (false == $exists) {
throw new Compiler\Exception(
- 'Token <%s> does not exist in %s.',
+ 'Token <%s> does not exist in rule %s.',
4,
[$tokenName, $this->_ruleName]
);
@@ -507,9 +508,9 @@ class Analyzer
if (false === array_key_exists($tokenName, $this->_rules) &&
false === array_key_exists('#' . $tokenName, $this->_rules)) {
throw new Compiler\Exception\Rule(
- 'Rule %s() does not exist.',
+ 'Cannot call rule %s() in rule %s because it does not exist.',
5,
- $tokenName
+ [$tokenName, $this->_ruleName]
);
}