Bounds / Limits Literal
- Dominant language
- No language data
- Stars
- 328
- Forks
- 71
- PR merge metrics
- No merged PRs in 30d
Description
## Bound / Limits Literals
These allow the user to express a couple of values that are to be treated as a bounds or limits.
They can also express the (in/ex) clusivity of the each of those bounds or limits
### Examples
```
~[[1 To 10]] ' 1 <= x <= 10 eg 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
~[[1 To 10)] ' 1 <= x < 10 eg 1, 2, 3, 4, 5, 6, 7, 8, 9
~[(1 To 10]] ' 1 < x <= 10 eg 2, 3, 4, 5, 6, 7, 8, 9, 10
~[(1 To 10)] ' 1 < x < 10 eg 2, 3, 4, 5, 6, 7, 8, 9
~[[1 To 10 Step 2]] ' 1 <= x <= 10 eg 1, 3, 5, 7, 9
~[[1 To 10 Step 2)] ' 1 <= x < 10 eg 1, 3, 5, 7, 9
~[(1 To 10 Step 2]] ' 1 < x <= 10 eg 2, 4, 6, 8, 10
~[(1 To 10 Step 2)] ' 1 < x < 10 eg 2, 4, 6, 8
```
* It supports only two comparision operators *equal to* and *not equal to*.
* ` x = bounds` equates to is x within the bounds?
* ` x <> bounds` equates to is x not within the bounds?
* Implicitly convertable to an `IEnumerable(Of T)` `IReadOnlyCollection(Of T)`
### Grammar *[WIP]*
```BNF
tilde ::= '~'
range_op ::= 'To'
range_values ::= expr ws+ range_op ws+ expr range_step?
range_step ::= ws+ "Step" ws+ expr
range_box ::= '[' ws* clusivity_lower ws* range_values ws* clusivity_upper ws* ']'
inclusive_lower ::= '['
exclusive_lower ::= '('
clusivity_lower ::= ( inclusive_lower | exclusive_lower )
inclusive_upper ::= ']'
exclusive_upper ::= ')'
clusivity_upper ::= ( inclusive_upper | exclusive_upper )
literal ::= ( tilde range_box )
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.