Permalink
Browse files

Change schema for {100..50..-5}.

It avoids both negative numbers and optional integers.

Since it's a lossless syntax tree, we want to distinguish {1..5} from
{1..5..0}.  The latter is invalid!
  • Loading branch information...
Andy Chu
Andy Chu committed Nov 26, 2017
1 parent 1557dfa commit cd38f4a590b1477c8a9139a3905dc67dc8165617
Showing with 5 additions and 2 deletions.
  1. +5 −2 osh/osh.asdl
View
@@ -47,6 +47,9 @@ module osh
-- NOTE: identical strings can shared, if we care.
token = (id id, string val, int? span_id)
-- Optional step for {100..50..-15}
braced_step = (int val, int negated)
bracket_op =
WholeArray(id op_id) -- * or @
| ArrayIndex(arith_expr expr)
@@ -81,9 +84,9 @@ module osh
-- {a,b,c}
| BracedAltPart(word* words)
-- {1..10} or {1..10..2}
| BracedIntRangePart(int start, int end, int? step)
| BracedIntRangePart(int start, int end, braced_step? step)
-- {a..f} or {a..f..2} or {a..f..-2}
| BracedCharRangePart(string start, string end, int? step)
| BracedCharRangePart(string start, string end, braced_step? step)
-- extended globs are parsed statically, unlike globs
| ExtGlobPart(token op, word* arms)

0 comments on commit cd38f4a

Please sign in to comment.