From 5ae2d256d3836dea02f0907f622bdc8c05e6fcb7 Mon Sep 17 00:00:00 2001 From: Dustin Wilson Date: Tue, 29 Jun 2021 13:54:54 -0500 Subject: [PATCH] Cleaning up a bit --- lib/Data.php | 2 +- lib/Grammar.php | 16 ----------- lib/Grammar/Registry.php | 42 ++++++++++++++++++++-------- lib/Highlighter.php | 2 +- lib/Scope/Data.php | 2 +- lib/Scope/Exception.php | 4 +-- lib/Scope/Matcher.php | 2 +- lib/Scope/Matchers/AndMatcher.php | 2 +- lib/Scope/Matchers/GroupMatcher.php | 2 +- lib/Scope/Matchers/NegateMatcher.php | 2 +- lib/Scope/Matchers/OrMatcher.php | 2 +- lib/Scope/Matchers/PathMatcher.php | 2 +- lib/Scope/Matchers/ScopeMatcher.php | 2 +- lib/Scope/Parser.php | 2 +- lib/Tokenizer.php | 2 +- 15 files changed, 44 insertions(+), 42 deletions(-) delete mode 100644 lib/Grammar.php diff --git a/lib/Data.php b/lib/Data.php index 52f81fc..6250bb9 100644 --- a/lib/Data.php +++ b/lib/Data.php @@ -1,7 +1,7 @@ 0) { + if ($missingLen > 1) { + if ($missingLen > 2) { + $last = array_pop($missing); + $missing = implode(', ', $missing); + $missing .= ", and $last"; + } else { + $missing = implode(' and ', $missing); + } + + throw new \Exception("\"$jsonPath\" is missing the required $missing properties.".\PHP_EOL); + } + + throw new \Exception("\"$jsonPath\" is missing the required {$missing[0]} property.".\PHP_EOL); } - self::$grammars[$grammar['scopeName']] = $grammar; return true; } } \ No newline at end of file diff --git a/lib/Highlighter.php b/lib/Highlighter.php index 74573ec..e61097d 100644 --- a/lib/Highlighter.php +++ b/lib/Highlighter.php @@ -1,7 +1,7 @@