Skip to content

Commit

Permalink
refactor: add diagnostics for validation
Browse files Browse the repository at this point in the history
1. Add new sdml_error crate.
2. Add new diagnostic functions and reporters.
3. Start wiring in error messages to the Validate trait.
4. Separate MaybeIncomplete trait from Validate.
5. Add i18n support for error text.
  • Loading branch information
johnstonskj committed Feb 15, 2024
1 parent 01dcdd6 commit fc02d43
Show file tree
Hide file tree
Showing 97 changed files with 3,710 additions and 2,021 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ resolver = "2"

members = [
"sdml-core",
"sdml_error",
"sdml-parse",
"sdml-generate",
"sdml-cli",
Expand Down
5 changes: 5 additions & 0 deletions examples/errors/e0101.sdm
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module example <https://example.com/api> is

import other

end
5 changes: 5 additions & 0 deletions examples/errors/e0102.sdm
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module example <https://example.com/api> is

import nonversioned_other <https://example.com/api/v2>

end
5 changes: 5 additions & 0 deletions examples/errors/e0103.sdm
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module example <https://example.com/api> is

import versioned_other <https://example.com/api/v3>

end
9 changes: 9 additions & 0 deletions examples/errors/e0104.sdm
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module example <https://example.com/api> is

structure Foo

structure Bar

structure Foo

end
9 changes: 9 additions & 0 deletions examples/errors/e0105.sdm
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module example <https://example.com/api> is

structure Foo is
foo -> string
bar -> integer
foo -> boolean
end

end
9 changes: 9 additions & 0 deletions examples/errors/e0106-enum.sdm
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module example <https://example.com/api> is

enum EnumFoo of
Foo
Bar
Foo
end

end
9 changes: 9 additions & 0 deletions examples/errors/e0106-rename.sdm
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module example <https://example.com/api> is

union UnionFoo of
Foo
Bar
Boo as Foo
end

end
9 changes: 9 additions & 0 deletions examples/errors/e0106-union.sdm
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module example <https://example.com/api> is

union UnionFoo of
Foo
Bar
Foo
end

end
5 changes: 5 additions & 0 deletions examples/errors/i0500.sdm
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module example <https://example.com/api> is

structure Foo

end
5 changes: 5 additions & 0 deletions examples/errors/i0501.sdm
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module example <https://example.com/api> is

structure Foo

end
7 changes: 7 additions & 0 deletions examples/errors/i0502.sdm
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module example <https://example.com/api> is

structure Foo is
bar -> unknown
end

end
2 changes: 2 additions & 0 deletions examples/errors/nonversioned_other.sdm
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
module nonversioned_other <https://example.com/api> is
end
3 changes: 3 additions & 0 deletions examples/errors/versioned_other.sdm
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module versioned_other <https://example.com/api>
version "v2" <https://example.com/api/v2> is
end
7 changes: 7 additions & 0 deletions examples/errors/w0301.sdm
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module example <https://example.com/api> is

import owl

import [ dc xsd owl owl ]

end
7 changes: 7 additions & 0 deletions examples/errors/w0302.sdm
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module example <https://example.com/api> is

import owl:Class

import [ dc xsd owl:Class ]

end
9 changes: 5 additions & 4 deletions sdml-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@ targets = ["x86_64-unknown-linux-gnu"]
all-features = true

[dependencies]
clap = { version = "4.4.18", features = ["derive", "env", "wrap_help"] }
clap-verbosity-flag = "2.1.2"
sdml-core = { version = "0.2.10", path = "../sdml-core" }
sdml-parse = { version = "0.2.8", path = "../sdml-parse" }
clap = { version = "4.5", features = ["derive", "env", "wrap_help"] }
human-panic = "1.2.3"
sdml-core = { version = "0.2.10", features = ["serde"], path = "../sdml-core" }
sdml_error = { version = "0.1.0", path = "../sdml_error" }
sdml-generate = { version = "0.2.7", path = "../sdml-generate" }
sdml-parse = { version = "0.2.8", path = "../sdml-parse" }
tracing = "0.1.40"
tracing-subscriber = { version = "0.3.18", features = ["env-filter"] }
tree-sitter-sdml = "0.2.12"

0 comments on commit fc02d43

Please sign in to comment.