-
Notifications
You must be signed in to change notification settings - Fork 15
Description
Ranges look like this: [1:3], [0:2:12]. Omitting the square brackets gives syntax errors like "missing semicolon", "expecting expression", etc. This is likely to be a common error. In many languages, for example a certain ancient scripting language whose name begins with "P", ranges have the same syntax, but without brackets.
Parsing the range as a range, eg. for int i in 0:10, and also recording a specific error would be useful. It would allow parsing to continue and the error would be more useful to the user.
How? The limits and step are expressions. Perhaps make : a binary operator. This can be flattened subsequently as a range, say in oq3_syntax. This is a fair amount of work. But it might be tied in with more general facilities like this. I have only the vaguest ideas at the moment.