- Avoid lifetime parameter for Source, Span. Use Rc instead.
- Engine for simplified API

Signed-off-by: Anand Krishnamoorthi <anakrish@microsoft.com>
This commit is contained in:
Anand Krishnamoorthi
2023-11-07 23:15:28 -08:00
committed by GitHub
parent a751cd69e1
commit d69b413c8e
15 changed files with 721 additions and 690 deletions

View File

@@ -28,7 +28,7 @@ fn match_span(s: &Span, v: &Value) -> Result<()> {
match &v {
Value::String(vs) => {
my_assert_eq!(
s.text(),
*s.text(),
vs,
"{}",
s.source
@@ -37,7 +37,7 @@ fn match_span(s: &Span, v: &Value) -> Result<()> {
}
_ => {
my_assert_eq!(
s.text(),
*s.text(),
serde_json::to_string_pretty(v)?,
"{}",
s.source
@@ -629,11 +629,7 @@ fn yaml_test_impl(file: &str) -> Result<()> {
for case in &test.cases {
print!("\ncase {} ", case.note);
let source = Source {
file: "case.rego",
contents: case.rego.as_str(),
lines: case.rego.split('\n').collect(),
};
let source = Source::new("case.rego".to_string(), case.rego.clone());
let mut parser = Parser::new(&source)?;
match parser.parse() {
Ok(module) => {