cnescatlab / cnescatlab/i-CodeCNES
Bad support of # and ## operator
- Dominant language
- Fortran
- Stars
- 63
- Forks
- 18
- PR merge metrics
- No merged PRs in 30d
Description
### Expected behavior
i-Code should support usage of # and ## operators as described below:
> `${#parameter}`
>
> The length in characters of the expanded value of parameter is substituted. If parameter is ‘*’ or ‘@’, the value substituted is the number of positional parameters. If parameter is an array name subscripted by ‘*’ or ‘@’, the value substituted is the number of elements in the array. If parameter is an indexed array name subscripted by a negative number, that number is interpreted as relative to one greater than the maximum index of parameter, so negative indices count back from the end of the array, and an index of -1 references the last element.
>
> `${parameter#word}`
> `${parameter##word}`
>
> The word is expanded to produce a pattern just as in filename expansion (see Filename Expansion). If the pattern matches the beginning of the expanded value of parameter, then the result of the expansion is the expanded value of parameter with the shortest matching pattern (the ‘#’ case) or the longest matching pattern (the ‘##’ case) deleted. If parameter is ‘@’ or ‘*’, the pattern removal operation is applied to each positional parameter in turn, and the expansion is the resultant list. If parameter is an array variable subscripted with ‘@’ or ‘*’, the pattern removal operation is applied to each member of the array in turn, and the expansion is the resultant list.
>
> https://www.gnu.org/software/bash/manual/html_node/Shell-Parameter-Expansion.html
### Actual behavior
i-Code handle these operator as comment operators, for example in SH.MET.Nesting.
### Steps to reproduce behavior
Analyze following code:
```
T1=${#parameter}
T2=${parameter#word}
T3=${parameter##word}
```
### Detection version
3.0.1
Contributor guide
Assessment
This issue has not been assessed yet.