ok/jj
1
0
Fork 0
forked from mirrors/jj
Commit graph

13 commits

Author SHA1 Message Date
Yuya Nishihara
9613ec4f82 revset: drop Eq/PartialEq from RevsetExpression and related types
It was convenient that expression nodes can be compared in tests, but no
equivalence property is needed at runtime. Let's remove Eq/PartialEq to
simplify the extension support.
2024-06-28 10:28:51 +09:00
Yuya Nishihara
9f33d13dfd revset: replace ParseState with &RevsetParseContext
There's no longer a mutable state to be tracked.
2024-06-05 10:39:32 +09:00
Yuya Nishihara
89ac3a1851 revset: split AST-level parsing and expression lowering stages
This will allows us to parse "file(..)" arguments as fileset expression by
transforming AST for example. I'm not sure if that's good or bad, but we'll
probably want to embed fileset expressions without quoting.

parse_expression_rule() is split to the first str->ExpressionNode stage and
the second ExpressionNode->RevsetExpression stage. The latter is called
"resolve_*()" in fileset, but we have another "symbol" resolution stage in
revset. So I choose "lower_*()" instead.
2024-06-02 10:28:54 +09:00
Yuya Nishihara
04efac3a51 templater: implement expect_*_arguments() as methods
I'm thinking of moving them to dsl_util, but we'll probably want to avoid
importing dsl_util at call sites.
2024-05-22 10:18:05 +09:00
dploch
20af8c79ef revset: support custom filter extensions 2024-05-06 10:42:01 -04:00
dploch
586ab1f076 revset: add a SymbolResolverExtension trait to provide custom resolvers 2024-04-26 10:55:34 -04:00
dploch
0cef90f4f4 examples: simplify commit templater example with Default 2024-04-26 10:55:34 -04:00
dploch
57a5d7dd64 cli_util: support multiple extensions consistently
If we ever implement some sort of ABI for dynamic extension loading, we'll need these underlying APIs to support multiple extensions, so we might as well do that first.
2024-04-12 14:07:33 -04:00
Yuya Nishihara
76f3b80e8a templater: consolidate "unexpected expression" error constructors
I also renamed "UnexpectedExpression" to just "Expression" because "unexpected"
doesn't apply to "immutable" revset parse/evaluation errors.
2024-03-30 23:53:17 +09:00
Yuya Nishihara
fad712811c templater: leverage TemplateProperty::map/and_then() helpers 2024-03-23 16:22:17 +09:00
Yuya Nishihara
2916bbbec5 templater: allow use of wrap_<type>() functions without borrowing &language
These .wrap_<type>() functions aren't supposed to capture resources from the
language instance. It was convenient that wrap_() could be called without fully
spelling the language type, but doing that would introduce lifetime issue in
later patches.

I added type alias L to several places because the language type is usually
called L in generic code.
2024-03-22 11:51:15 +09:00
dploch
84118e1edd commit_templater: add an AnyMap for extensions to cache their own info 2024-03-12 16:52:49 -04:00
dploch
570fd29ba3 commit_templater: support extensions of the template language 2024-03-01 10:42:51 -05:00