Skip to content

Commit

Permalink
revamp_define.md
Browse files Browse the repository at this point in the history
  • Loading branch information
xonixx committed Oct 29, 2023
1 parent 15d1670 commit 9fd7fda
Showing 1 changed file with 27 additions and 10 deletions.
37 changes: 27 additions & 10 deletions docs/revamp_define.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,20 @@ We won't support interpolation for `@args` values. That is we only support:
@depends_on pg2 @args PARAM VAR 'literal1' $'literal2'
```
### Upd. Resolution
We **will** only support interpolating the `@define`-d vars, not PG params to allow this:
```shell
@define GOAWK_VERSION '1.24.0'
@define GOAWK "./soft/goawk$GOAWK_VERSION"
@goal tested_by_goawk
@depends_on installed_goawk
@depends_on tested_by @args 'tush' "$GOAWK -f ./fhtagn.awk"
@depends_on tested_by @args 'fhtagn' "$GOAWK -f ./fhtagn.awk"
```
## Q. Detect unset variable as an error?
### Cons
Expand Down Expand Up @@ -142,6 +156,8 @@ $ export VAR=hello
$ ./makesure
```
This behavior will be preserved.
## Q. How do we know when to parse with `'`/`$'`/`"` - quoted strings or unquoted?
Need to come up with the simplest approach to parse and error on wrong quoting of particular word.
Expand All @@ -154,15 +170,16 @@ Lets define string quoting types:
- `"` for `"string"`
We need to parse two cases separately
We need to limit parsing to these cases:
1. `@define VAR "value"`
- allowing only unquoted in 1st and 2nd position and **any quote** in 3rd
2. `@depends_on $'goal name' @args A "str $VAR1 ${VAR2}" 'literal'`
- `u'$` in 2nd, **any quote** in 4+
3. 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
- `@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 9fd7fda

Please sign in to comment.