curlz
curlz copied to clipboard
feat(experimental:template-language): start an own template language
CAUTION! This is an experiment
The whole reason for this experiment is to get closer to the http plugin template syntax as linked in #5
There the vscode plugin has this concept of system variables that follow the syntax of a mix of expression and function e.g.
- {{$randomInt min max}}: Returns a random integer between min (included) and max (excluded)
- {{$dotenv [%]variableName}}: Returns the environment value stored in the .env file which exists in the same directory of your .http file.
Both examples show that $<ident> is similar to a function name and then a variable argument list is passed without any braces like ().
This experiment focuses on the ability to register functions for this very system variable syntax at compile time in an extensible fashion.
done so far:
- lexing and parsing of very basic templates with an expression
{{ var }} - basic runtime to interpret the AST
- some tests added
- design of a Visitor pattern for the AST
yet open
- [ ] tests for unhappy path are to less
- [ ] runtime is very incomplete yet,
SysVarhooked functions are missing e.g.hello {{ $processEnv HOME }}
Codecov Report
Attention: Patch coverage is 0% with 153 lines in your changes missing coverage. Please review.
Project coverage is 64.23%. Comparing base (
1d18d4a) to head (8c69da2).
Additional details and impacted files
@@ Coverage Diff @@
## main #27 +/- ##
===========================================
- Coverage 74.50% 64.23% -10.27%
===========================================
Files 37 43 +6
Lines 957 1110 +153
===========================================
Hits 713 713
- Misses 244 397 +153
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.