Skip to content

Escaping special tokens (e.g. colon) in command name? #1074

Answered by casey
joshuatz asked this question in Q&A
Discussion options

You must be logged in to vote

Good question!

Currently, recipe names must be valid just identifiers, which are of the form [a-zA-Z_][a-zA-Z0-9_-]*, so it isn't possible to use : in a recipe name.

Since the package.json file is JSON, and script names are Javascript strings, there aren't any restrictions on their contents, whereas just recipe names have to be distinguished from other parts of the just language, i.e. the lexer needs to be able to tell where a recipe name ends and the : after the name begins, so there are more restrictions on recipe name contents.

I would suggest using dashes, i.e., foo-bar. It's a pinky reach, but you don't have to press the shift key, so it's kind of a wash.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@joshuatz
Comment options

Answer selected by joshuatz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants