Skip to content

Commit

Permalink
Revamp @define #140
Browse files Browse the repository at this point in the history
  • Loading branch information
xonixx committed Aug 24, 2023
1 parent 950080b commit c6ebf85
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions docs/revamp_define.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
@define ENV_VAR "$ENV_VAR"
@define ENV_VAR_WITH_DEFAULT "${ENV_VAR:-default_val}"
@define HELLO 'hello'
@define HELLO1 $'hello'
@define HW "$HELLO world"
```

Expand Down Expand Up @@ -140,4 +141,26 @@ Now this is achieved by
$ export VAR=hello
$ ./makesure
```
## Q. How do we know when to parse with `'`/`$'`/`"` - quoted strings or unquoted?
Lets defile string quoting types:
- `u` for `string`
- `'` for `'string'`
- `$` for `$'string'`
- `"` for `"string"`
We need to parse two cases separately
- `@define VAR "value"`
- allowing only unquoted in 1st and 2nd position and any quote in 3rd
- All others re-parsed cases like
- `@goal $'goal name' @params A B @private`
- `u'$` in 2nd, `u` in all other pos
- `@depends_on $'goal name' 'goal name2'`
- `u'$` in 2+ pos
- `@depends_on $'goal name' @args A 'literal' $'literal2'`
- `u'$` in 2nd, `u'$` in 4+

0 comments on commit c6ebf85

Please sign in to comment.