From a8a4b54b90e6433cf4a25a88a4765243f831ebef Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sun, 9 Aug 2026 11:20:24 +0900 Subject: refactor(seld-json-lint): extract seld/json_lint into the shirabe-seld-json-lint crate Move `Seld\JsonLint` out of shirabe-external-packages and into its own crate, so the path is `shirabe_seld_json_lint::ParsingException` instead of `shirabe_external_packages::seld::json_lint::ParsingException`. Co-Authored-By: Claude Opus 5 (1M context) --- .../src/parsing_exception.rs | 45 ++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 crates/shirabe-seld-json-lint/src/parsing_exception.rs (limited to 'crates/shirabe-seld-json-lint/src/parsing_exception.rs') diff --git a/crates/shirabe-seld-json-lint/src/parsing_exception.rs b/crates/shirabe-seld-json-lint/src/parsing_exception.rs new file mode 100644 index 00000000..9d3eaa57 --- /dev/null +++ b/crates/shirabe-seld-json-lint/src/parsing_exception.rs @@ -0,0 +1,45 @@ +//! ref: composer/vendor/seld/jsonlint/src/Seld/JsonLint/ParsingException.php + +#[derive(Debug, Clone, Default)] +pub struct ParsingExceptionLoc { + pub first_line: i64, + pub first_column: i64, + pub last_line: i64, + pub last_column: i64, +} + +#[derive(Debug, Clone)] +pub enum ParsingExceptionToken { + Name(String), + Symbol(i64), +} + +#[derive(Debug, Clone, Default)] +pub struct ParsingExceptionDetails { + pub text: Option, + pub token: Option, + pub line: Option, + pub loc: Option, + pub expected: Option>, +} + +#[derive(Debug)] +pub struct ParsingException { + inner: shirabe_php_shim::Exception, + pub(crate) details: Box, +} + +impl ParsingException { + pub fn new(message: String, details: ParsingExceptionDetails) -> Self { + Self { + inner: shirabe_php_shim::Exception::new(message), + details: Box::new(details), + } + } + + pub fn get_details(&self) -> &ParsingExceptionDetails { + &self.details + } +} + +shirabe_php_shim::impl_php_exception!(ParsingException, inner, r"Seld\JsonLint\ParsingException"); -- cgit v1.3.1-4-g156e