KtorZ 78d34f7f76 Fix parsing of negative int patterns and constants
This was trickier than expected as the expression parser, and in particular the bin-op parser will interpret negative patterns as a continuation of a binary operation and eventually choke on the next right-arrow symbol. This is due to how we actually completely erase newlines once we're done with the lexer. The newline separating when clause is actually semantically important. In principle, we could only parse an expression until the next newline.

  Ideally, we would keep that newline in the list of token but it's difficult to figure out which newline to keep between two right arrows since a clause guard can be written over multiple lines. Though, since we know that this is only truly a problem for negative integers, we can use the same trick as for tuples and define a new 'NewLineMinus' token. That token CANNOT be part of a binop expression. That means it's impossible to write a binary operation with a minus over multiple lines, or more specifically, with the '-' symbol on a newline. This sounds like a fair limitation. What we get in exchange is less ambiguity when parsing patterns following expressions in when clause cases.

  Another more cumbersome option could be to preserve the first newline encountered after a 'right-arrow' symbol and before any parenthesis or curly brace is found (which would otherwise signal the beginning of a new block). That requires to traverse, at least partially, the list of tokens twice. This feels unnecessary for now and until we do face a similar issue with a binary operator.
2023-07-06 16:10:46 -04:00
2023-02-07 13:16:17 +01:00
2023-07-04 17:19:28 -04:00
2023-07-04 17:19:28 -04:00
2023-07-05 18:58:21 +02:00
2023-07-04 08:33:15 -04:00
2023-04-30 20:32:24 -04:00
2023-06-07 17:16:56 -04:00
2023-05-23 10:40:26 -04:00
2023-05-23 10:40:26 -04:00

Aiken Aiken

A modern smart contract platform for Cardano

Licence Crates.io Tests


Installation

How to use

For more information please see the user manual.

Contributing

Want to contribute? See CONTRIBUTING.md to know how.


Note

The name comes from Howard Aiken, an American physicist and a pioneer in computing.

Description
No description provided
Readme 14 MiB
Languages
Rust 96.6%
JavaScript 1.1%
HTML 1%
CSS 0.9%
Shell 0.3%
Other 0.1%