Skip to content

overridable parser#522

Merged
stephenamar-db merged 3 commits intodatabricks:masterfrom
jam01:confparser
Oct 20, 2025
Merged

overridable parser#522
stephenamar-db merged 3 commits intodatabricks:masterfrom
jam01:confparser

Conversation

@jam01
Copy link
Copy Markdown
Contributor

@jam01 jam01 commented Oct 11, 2025

Allow the ability to provide a different parser

@He-Pin
Copy link
Copy Markdown
Contributor

He-Pin commented Oct 11, 2025

Seems it's been used in https://github.com/jam01/xtrasonnet

@jam01
Copy link
Copy Markdown
Contributor Author

jam01 commented Oct 11, 2025

Hey! Docs added.

I'm the author of xtrasonnet and I don't currently make use of a custom Parser there, but I have written one that I'm hoping to use. I'm maintaining a clone of sjsonnet where I add a couple of operators, but I think this feature fits cleanly in the project as it doesn't deviate from the jsonnet spec.

The work you all have done to modularize std and add extension libraries will make the xtrasonnet code sooo much cleaner, I was doing some hacks in order to provide another library than std.

Looking fwd to 1.0.0 release!

@He-Pin
Copy link
Copy Markdown
Contributor

He-Pin commented Oct 11, 2025

I think the ? and ?? are quite nice, you may upstream it here, and enable that behind a parserSetting of sjsonnet. wdyt

We are using this sjsonnet at work too

@jam01
Copy link
Copy Markdown
Contributor Author

jam01 commented Oct 11, 2025

You're using my fork at work?

I'd have to think of exactly how to feature flag it in the parser, but I'm happy to give that a try if it'd be welcome.

@He-Pin
Copy link
Copy Markdown
Contributor

He-Pin commented Oct 11, 2025

  private def variableResolver(name: String): Option[Expr] = {
    if (name == "tb" || name == "$tb") {
      Some(FunctionRegistry.module)
    } else {
      None
    }
  }

@jam01 Yes, I have something like this, to have tb redirect to our extensions, and I think it should be xtr in xtrasonnet.

@jam01
Copy link
Copy Markdown
Contributor Author

jam01 commented Oct 11, 2025

Yes! I'm definitely switching to using this as soon as 1.0.0 goes live. Hopefully soon!

@jam01
Copy link
Copy Markdown
Contributor Author

jam01 commented Oct 14, 2025

I'll defer the ?? and ?. operators for another PR because those cut across Parser, Expr, Optimizer, and Evaluator.

So please consider merging this in independently if it's OK.

Out of curiosity, is 1.0.0 expected to be released soon?

@He-Pin
Copy link
Copy Markdown
Contributor

He-Pin commented Oct 14, 2025

@jam01 I think only @stephenamar-db can tell you this:)

@stephenamar-db
Copy link
Copy Markdown
Collaborator

I'm very focused on getting the current version (0.5.6) imported inside Databricks. Once this is done and stable, then I'll resume work on wrapping up 1.0.0.
Probably sometime in November I guess

@He-Pin
Copy link
Copy Markdown
Contributor

He-Pin commented Oct 17, 2025

@jam01 I think you need rebase this.

@jam01
Copy link
Copy Markdown
Contributor Author

jam01 commented Oct 17, 2025

Formatting wasn't cooperating before, should be all good now.

@stephenamar-db stephenamar-db merged commit cf12058 into databricks:master Oct 20, 2025
6 checks passed
@jam01 jam01 deleted the confparser branch October 20, 2025 21:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants