Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14863149
D10159.id24440.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
13 KB
Referenced Files
None
Subscribers
None
D10159.id24440.diff
View Options
diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -177,7 +177,9 @@
'PhutilInRequestKeyValueCache' => 'cache/PhutilInRequestKeyValueCache.php',
'PhutilInfrastructureTestCase' => '__tests__/PhutilInfrastructureTestCase.php',
'PhutilInteractiveEditor' => 'console/PhutilInteractiveEditor.php',
+ 'PhutilInvalidRuleParserGeneratorException' => 'parser/generator/exception/PhutilInvalidRuleParserGeneratorException.php',
'PhutilInvisibleSyntaxHighlighter' => 'markup/syntax/highlighter/PhutilInvisibleSyntaxHighlighter.php',
+ 'PhutilIrreducibleRuleParserGeneratorException' => 'parser/generator/exception/PhutilIrreducibleRuleParserGeneratorException.php',
'PhutilJIRAAuthAdapter' => 'auth/PhutilJIRAAuthAdapter.php',
'PhutilJSON' => 'parser/PhutilJSON.php',
'PhutilJSONParser' => 'parser/PhutilJSONParser.php',
@@ -231,12 +233,7 @@
'PhutilPHPObjectProtocolChannelTestCase' => 'channel/__tests__/PhutilPHPObjectProtocolChannelTestCase.php',
'PhutilParserGenerator' => 'parser/PhutilParserGenerator.php',
'PhutilParserGeneratorException' => 'parser/generator/exception/PhutilParserGeneratorException.php',
- 'PhutilParserGeneratorInvalidRuleException' => 'parser/generator/exception/PhutilParserGeneratorInvalidRuleException.php',
- 'PhutilParserGeneratorIrreducibleRuleException' => 'parser/generator/exception/PhutilParserGeneratorIrreducibleRuleException.php',
'PhutilParserGeneratorTestCase' => 'parser/__tests__/PhutilParserGeneratorTestCase.php',
- 'PhutilParserGeneratorUnknownSymbolException' => 'parser/generator/exception/PhutilParserGeneratorUnknownSymbolException.php',
- 'PhutilParserGeneratorUnreachableRuleException' => 'parser/generator/exception/PhutilParserGeneratorUnreachableRuleException.php',
- 'PhutilParserGeneratorUnreachableTerminalException' => 'parser/generator/exception/PhutilParserGeneratorUnreachableTerminalException.php',
'PhutilPayPalAPIFuture' => 'future/paypal/PhutilPayPalAPIFuture.php',
'PhutilPerson' => 'internationalization/PhutilPerson.php',
'PhutilPersonTest' => 'internationalization/__tests__/PhutilPersonTest.php',
@@ -322,6 +319,9 @@
'PhutilURITestCase' => 'parser/__tests__/PhutilURITestCase.php',
'PhutilUTF8StringTruncator' => 'utils/PhutilUTF8StringTruncator.php',
'PhutilUTF8TestCase' => 'utils/__tests__/PhutilUTF8TestCase.php',
+ 'PhutilUnknownSymbolParserGeneratorException' => 'parser/generator/exception/PhutilUnknownSymbolParserGeneratorException.php',
+ 'PhutilUnreachableRuleParserGeneratorException' => 'parser/generator/exception/PhutilUnreachableRuleParserGeneratorException.php',
+ 'PhutilUnreachableTerminalParserGeneratorException' => 'parser/generator/exception/PhutilUnreachableTerminalParserGeneratorException.php',
'PhutilUrisprintfTestCase' => 'xsprintf/__tests__/PhutilUrisprintfTestCase.php',
'PhutilUtilsTestCase' => 'utils/__tests__/PhutilUtilsTestCase.php',
'PhutilWordPressAuthAdapter' => 'auth/PhutilWordPressAuthAdapter.php',
@@ -595,6 +595,8 @@
'PhutilHgsprintfTestCase' => 'PhutilTestCase',
'PhutilInRequestKeyValueCache' => 'PhutilKeyValueCache',
'PhutilInfrastructureTestCase' => 'PhutilTestCase',
+ 'PhutilInvalidRuleParserGeneratorException' => 'PhutilParserGeneratorException',
+ 'PhutilIrreducibleRuleParserGeneratorException' => 'PhutilParserGeneratorException',
'PhutilJIRAAuthAdapter' => 'PhutilOAuth1AuthAdapter',
'PhutilJSONParserException' => 'Exception',
'PhutilJSONParserTestCase' => 'PhutilTestCase',
@@ -635,12 +637,7 @@
'PhutilPHPObjectProtocolChannel' => 'PhutilProtocolChannel',
'PhutilPHPObjectProtocolChannelTestCase' => 'PhutilTestCase',
'PhutilParserGeneratorException' => 'Exception',
- 'PhutilParserGeneratorInvalidRuleException' => 'PhutilParserGeneratorException',
- 'PhutilParserGeneratorIrreducibleRuleException' => 'PhutilParserGeneratorException',
'PhutilParserGeneratorTestCase' => 'PhutilTestCase',
- 'PhutilParserGeneratorUnknownSymbolException' => 'PhutilParserGeneratorException',
- 'PhutilParserGeneratorUnreachableRuleException' => 'PhutilParserGeneratorException',
- 'PhutilParserGeneratorUnreachableTerminalException' => 'PhutilParserGeneratorException',
'PhutilPayPalAPIFuture' => 'FutureProxy',
'PhutilPersonTest' => 'PhutilPerson',
'PhutilPersonaAuthAdapter' => 'PhutilAuthAdapter',
@@ -704,6 +701,9 @@
'PhutilURITestCase' => 'PhutilTestCase',
'PhutilUTF8StringTruncator' => 'Phobject',
'PhutilUTF8TestCase' => 'PhutilTestCase',
+ 'PhutilUnknownSymbolParserGeneratorException' => 'PhutilParserGeneratorException',
+ 'PhutilUnreachableRuleParserGeneratorException' => 'PhutilParserGeneratorException',
+ 'PhutilUnreachableTerminalParserGeneratorException' => 'PhutilParserGeneratorException',
'PhutilUrisprintfTestCase' => 'PhutilTestCase',
'PhutilUtilsTestCase' => 'PhutilTestCase',
'PhutilWordPressAuthAdapter' => 'PhutilOAuthAuthAdapter',
diff --git a/src/parser/PhutilParserGenerator.php b/src/parser/PhutilParserGenerator.php
--- a/src/parser/PhutilParserGenerator.php
+++ b/src/parser/PhutilParserGenerator.php
@@ -207,7 +207,7 @@
} else {
foreach ($variant as $symbol) {
if (($symbol === null) && count($variant) > 1) {
- throw new PhutilParserGeneratorInvalidRuleException(
+ throw new PhutilInvalidRuleParserGeneratorException(
"Rule '{$rule_name}' contains a production '{$vkey}' which ".
"is nonempty but has a null in it. A rule with other symbols ".
"may not contain null.");
@@ -237,7 +237,7 @@
continue;
}
$production_string = implode(' ', $production);
- throw new PhutilParserGeneratorUnknownSymbolException(
+ throw new PhutilUnknownSymbolParserGeneratorException(
"Symbol '{$symbol}' in production '{$production_name}' ".
"('{$production_string}') of rule '{$rule}' does not name a rule ".
"or terminal. Did you misspell a symbol, fail to specify a ".
@@ -254,7 +254,7 @@
private function validateStartRule() {
$start_rule = $this->getStartRule();
if (!$this->isRule($start_rule)) {
- throw new PhutilParserGeneratorUnknownSymbolException(
+ throw new PhutilUnknownSymbolParserGeneratorException(
"Start rule '{$start_rule}' does not appear in the rules for the ".
"grammar. Use setStartRule() to choose a different start rule, or ".
"add a rule named '{$start_rule}'.");
@@ -318,7 +318,7 @@
if ($missing) {
$missing_terminals = array_keys($missing);
$missing_terminals = implode(', ', $missing_terminals);
- throw new PhutilParserGeneratorUnreachableTerminalException(
+ throw new PhutilUnreachableTerminalParserGeneratorException(
'Some terminals do not appear in any rule: '.
$missing_terminals);
}
@@ -338,7 +338,7 @@
if ($missing) {
$missing_rules = array_keys($missing);
$missing_rules = implode(', ', $missing_rules);
- throw new PhutilParserGeneratorUnreachableRuleException(
+ throw new PhutilUnreachableRuleParserGeneratorException(
'Some rules can never be reached from any production: '.
$missing_rules);
}
@@ -375,7 +375,7 @@
$reducible = array();
foreach ($this->rules as $rule => $productions) {
if (!$this->isRuleReducible($rule, $reducible)) {
- throw new PhutilParserGeneratorIrreducibleRuleException(
+ throw new PhutilIrreducibleRuleParserGeneratorException(
"Rule '{$rule}' can never be reduced: it recurses indefinitely ".
"and reaches no production of terminals.");
}
diff --git a/src/parser/__tests__/PhutilParserGeneratorTestCase.php b/src/parser/__tests__/PhutilParserGeneratorTestCase.php
--- a/src/parser/__tests__/PhutilParserGeneratorTestCase.php
+++ b/src/parser/__tests__/PhutilParserGeneratorTestCase.php
@@ -15,7 +15,7 @@
try {
// Expect "b is not a rule or terminal".
$generator->processGrammar();
- } catch (PhutilParserGeneratorUnknownSymbolException $ex) {
+ } catch (PhutilUnknownSymbolParserGeneratorException $ex) {
$caught = $ex;
}
@@ -35,7 +35,7 @@
try {
// Expect "no start rule Q".
$generator->processGrammar();
- } catch (PhutilParserGeneratorUnknownSymbolException $ex) {
+ } catch (PhutilUnknownSymbolParserGeneratorException $ex) {
$caught = $ex;
}
@@ -107,7 +107,7 @@
$caught = null;
try {
$generator->processGrammar();
- } catch (PhutilParserGeneratorUnreachableTerminalException $ex) {
+ } catch (PhutilUnreachableTerminalParserGeneratorException $ex) {
$caught = $ex;
}
@@ -128,7 +128,7 @@
$caught = null;
try {
$generator->processGrammar();
- } catch (PhutilParserGeneratorUnreachableRuleException $ex) {
+ } catch (PhutilUnreachableRuleParserGeneratorException $ex) {
$caught = $ex;
}
@@ -180,7 +180,7 @@
$caught = null;
try {
$generator->processGrammar();
- } catch (PhutilParserGeneratorIrreducibleRuleException $ex) {
+ } catch (PhutilIrreducibleRuleParserGeneratorException $ex) {
$caught = $ex;
}
diff --git a/src/parser/generator/exception/PhutilInvalidRuleParserGeneratorException.php b/src/parser/generator/exception/PhutilInvalidRuleParserGeneratorException.php
new file mode 100644
--- /dev/null
+++ b/src/parser/generator/exception/PhutilInvalidRuleParserGeneratorException.php
@@ -0,0 +1,4 @@
+<?php
+
+final class PhutilInvalidRuleParserGeneratorException
+ extends PhutilParserGeneratorException {}
diff --git a/src/parser/generator/exception/PhutilIrreducibleRuleParserGeneratorException.php b/src/parser/generator/exception/PhutilIrreducibleRuleParserGeneratorException.php
new file mode 100644
--- /dev/null
+++ b/src/parser/generator/exception/PhutilIrreducibleRuleParserGeneratorException.php
@@ -0,0 +1,4 @@
+<?php
+
+final class PhutilIrreducibleRuleParserGeneratorException
+ extends PhutilParserGeneratorException {}
diff --git a/src/parser/generator/exception/PhutilParserGeneratorException.php b/src/parser/generator/exception/PhutilParserGeneratorException.php
--- a/src/parser/generator/exception/PhutilParserGeneratorException.php
+++ b/src/parser/generator/exception/PhutilParserGeneratorException.php
@@ -1,5 +1,3 @@
<?php
-abstract class PhutilParserGeneratorException extends Exception {
-
-}
+abstract class PhutilParserGeneratorException extends Exception {}
diff --git a/src/parser/generator/exception/PhutilParserGeneratorInvalidRuleException.php b/src/parser/generator/exception/PhutilParserGeneratorInvalidRuleException.php
deleted file mode 100644
--- a/src/parser/generator/exception/PhutilParserGeneratorInvalidRuleException.php
+++ /dev/null
@@ -1,6 +0,0 @@
-<?php
-
-final class PhutilParserGeneratorInvalidRuleException
- extends PhutilParserGeneratorException {
-
-}
diff --git a/src/parser/generator/exception/PhutilParserGeneratorIrreducibleRuleException.php b/src/parser/generator/exception/PhutilParserGeneratorIrreducibleRuleException.php
deleted file mode 100644
--- a/src/parser/generator/exception/PhutilParserGeneratorIrreducibleRuleException.php
+++ /dev/null
@@ -1,6 +0,0 @@
-<?php
-
-final class PhutilParserGeneratorIrreducibleRuleException
- extends PhutilParserGeneratorException {
-
-}
diff --git a/src/parser/generator/exception/PhutilParserGeneratorUnknownSymbolException.php b/src/parser/generator/exception/PhutilParserGeneratorUnknownSymbolException.php
deleted file mode 100644
--- a/src/parser/generator/exception/PhutilParserGeneratorUnknownSymbolException.php
+++ /dev/null
@@ -1,6 +0,0 @@
-<?php
-
-final class PhutilParserGeneratorUnknownSymbolException
- extends PhutilParserGeneratorException {
-
-}
diff --git a/src/parser/generator/exception/PhutilParserGeneratorUnreachableRuleException.php b/src/parser/generator/exception/PhutilParserGeneratorUnreachableRuleException.php
deleted file mode 100644
--- a/src/parser/generator/exception/PhutilParserGeneratorUnreachableRuleException.php
+++ /dev/null
@@ -1,6 +0,0 @@
-<?php
-
-final class PhutilParserGeneratorUnreachableRuleException
- extends PhutilParserGeneratorException {
-
-}
diff --git a/src/parser/generator/exception/PhutilParserGeneratorUnreachableTerminalException.php b/src/parser/generator/exception/PhutilParserGeneratorUnreachableTerminalException.php
deleted file mode 100644
--- a/src/parser/generator/exception/PhutilParserGeneratorUnreachableTerminalException.php
+++ /dev/null
@@ -1,6 +0,0 @@
-<?php
-
-final class PhutilParserGeneratorUnreachableTerminalException
- extends PhutilParserGeneratorException {
-
-}
diff --git a/src/parser/generator/exception/PhutilUnknownSymbolParserGeneratorException.php b/src/parser/generator/exception/PhutilUnknownSymbolParserGeneratorException.php
new file mode 100644
--- /dev/null
+++ b/src/parser/generator/exception/PhutilUnknownSymbolParserGeneratorException.php
@@ -0,0 +1,4 @@
+<?php
+
+final class PhutilUnknownSymbolParserGeneratorException
+ extends PhutilParserGeneratorException {}
diff --git a/src/parser/generator/exception/PhutilUnreachableRuleParserGeneratorException.php b/src/parser/generator/exception/PhutilUnreachableRuleParserGeneratorException.php
new file mode 100644
--- /dev/null
+++ b/src/parser/generator/exception/PhutilUnreachableRuleParserGeneratorException.php
@@ -0,0 +1,4 @@
+<?php
+
+final class PhutilUnreachableRuleParserGeneratorException
+ extends PhutilParserGeneratorException {}
diff --git a/src/parser/generator/exception/PhutilUnreachableTerminalParserGeneratorException.php b/src/parser/generator/exception/PhutilUnreachableTerminalParserGeneratorException.php
new file mode 100644
--- /dev/null
+++ b/src/parser/generator/exception/PhutilUnreachableTerminalParserGeneratorException.php
@@ -0,0 +1,4 @@
+<?php
+
+final class PhutilUnreachableTerminalParserGeneratorException
+ extends PhutilParserGeneratorException {}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Feb 8, 10:14 PM (2 h, 26 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7100532
Default Alt Text
D10159.id24440.diff (13 KB)
Attached To
Mode
D10159: Rename `PhutilParserGeneratorException` subclasses
Attached
Detach File
Event Timeline
Log In to Comment