git.delta.rocks / jrsonnet / refs/commits / 5a21a2e9327c

difftreelog

refactor(parser)! remove intrinsic syntax

Yaroslav Bolyukin2022-07-23parent: #146d9d9.patch.diff
in: master
There was special support to refer to native functions for stdlib, as
otherwise `std.native` was not implementable.
However, now evaluator contains support for fancy builtins, and it is
possible to reimplement standard library without any parser magic.

BREAKING CHANGE: This syntax no longer works: $intrinsic(name),
$intrinsicId, $intrinsicThisFile

3 files changed

modifiedcrates/jrsonnet-parser/src/expr.rsdiffbeforeafterboth
341 Index(LocExpr, LocExpr),341 Index(LocExpr, LocExpr),
342 /// function(x) x342 /// function(x) x
343 Function(ParamsDesc, LocExpr),343 Function(ParamsDesc, LocExpr),
344 /// std.thisFile
345 IntrinsicThisFile,
346 /// std.id,
347 IntrinsicId,
348 /// std.primitiveEquals
349 Intrinsic(IStr),
350 /// if true == false then 1 else 2344 /// if true == false then 1 else 2
351 IfElse {345 IfElse {
352 cond: IfSpecData,346 cond: IfSpecData,
modifiedcrates/jrsonnet-parser/src/lib.rsdiffbeforeafterboth
--- a/crates/jrsonnet-parser/src/lib.rs
+++ b/crates/jrsonnet-parser/src/lib.rs
@@ -252,10 +252,6 @@
 		pub rule expr_basic(s: &ParserSettings) -> Expr
 			= literal(s)
 
-			/ quiet!{"$intrinsicThisFile" {Expr::IntrinsicThisFile}}
-			/ quiet!{"$intrinsicId" {Expr::IntrinsicId}}
-			/ quiet!{"$intrinsic(" name:id() ")" {Expr::Intrinsic(name)}}
-
 			/ string_expr(s) / number_expr(s)
 			/ array_expr(s)
 			/ obj_expr(s)
modifiedcrates/jrsonnet-parser/src/source.rsdiffbeforeafterboth
--- a/crates/jrsonnet-parser/src/source.rs
+++ b/crates/jrsonnet-parser/src/source.rs
@@ -51,12 +51,6 @@
 	pub fn short_display(&self) -> ShortDisplay {
 		ShortDisplay(self.clone())
 	}
-	pub fn full_path(&self) -> String {
-		match self.inner() {
-			Inner::Real(r) => r.display().to_string(),
-			Inner::Virtual(v) => v.to_string(),
-		}
-	}
 
 	/// Returns None if file is virtual
 	pub fn path(&self) -> Option<&Path> {