Commit Graph

10 Commits

Author SHA1 Message Date
Casey Rodarmor
6f42c8b737
Prefix parameters with $ to export to environment (#773)
If a parameter is prefixed with an `$`, it will be exported as an
environment variable.
2021-03-25 18:35:24 -07:00
Casey Rodarmor
19f7ad09a7
Add conditional expressions (#714)
Add conditional expressions of the form:

   foo := if lhs == rhs { then } else { otherwise }

`lhs`, `rhs`, `then`, and `otherwise` are all arbitrary expressions, and
can recursively include other conditionals. Conditionals short-circuit,
so the branch not taken isn't evaluated.

It is also possible to test for inequality with `==`.
2020-10-26 18:16:42 -07:00
Richard Berry
1ff619295c
Add variadic parameters that accept zero or more arguments (#645)
Add "star" variadic parameters that accept zero or more arguments,
distinguished with a `*` in front of the parameter name.
2020-06-13 01:49:13 -07:00
Casey Rodarmor
3ec7dea4a3
Use unstable rustfmt configuration options (#592) 2020-02-10 20:07:06 -08:00
Casey Rodarmor
598f1c3200
Refactor Compilation error to contain a Token (#535)
Use a `Token` to represent the error context, instead of a mess of
fields. Remove write_message_context in favor of `Token::write_context`.
2019-11-13 19:32:50 -08:00
Casey Rodarmor
e80bf34d9a
Add shell setting (#525)
Add a `set SETTING := VALUE` construct.

This construct is intended to be extended as needed with new settings,
but for now we're starting with `set shell := [COMMAND, ARG1, ...]`,
which allows setting the shell to use for recipe and backtick execution
in a justfile.

One of the primary reasons for adding this feature is to have a better
story on windows, where users are forced to scrounge up an `sh` binary
if they want to use `just`. This should allow them to use cmd.exe or
powershell in their justfiles, making just optionally dependency-free.
2019-11-10 23:17:47 -08:00
Casey Rodarmor
b2285ce0e0
Reform Parser (#509)
Just's first parser performed both parsing, i.e the transformation of a
token stream according to the language grammar, and a number of consistency
checks and analysis passes.

This made parsing and analysis quite complex, so this diff introduces a
new, much cleaner `Parser`, and moves existing analysis into a dedicated
`Analyzer`.
2019-11-07 10:55:15 -08:00
Casey Rodarmor
1cb90f4e65
Use pub(crate) instead of pub (#471)
Eventually, there will probably be a `crate` visibility specifier that
does the same thing as `pub(crate)`. This commit replaces `pub` with
`pub(crate)`, so when `crate` is available we can easily switch to it.
2019-09-21 15:35:03 -07:00
Casey Rodarmor
0ad5574ecc
Deprecate = in assignments, aliases, and exports in favor of := (#413) 2019-04-18 11:48:02 -07:00
Casey Rodarmor
596ea34460
Replace regex-based lexer with character-at-a-time lexer (#406) 2019-04-15 22:40:02 -07:00