ligo/src/test/contracts/website2.religo
Christian Rinderknecht 46eecb4027 Marked the errors that should be skipped (because catched by the
LIGO lexer later). Added field [is_file] to the state of the
lexer to know if the input is a file or not (insert or not a
first line directive). Fixed ReasonLIGO comments in
entrypoints-contracts.md and website2.religo. WIP on the LIGO
lexer to properly handle comments for all the syntaxes.
2020-04-08 20:24:34 +02:00

26 lines
672 B
Plaintext

/* IF YOU CHANGE THIS, CHANGE THE EXAMPLE ON THE FRONT PAGE OF THE WEBSITE */
type storage = int;
/* variant defining pseudo multi-entrypoint actions */
type parameter =
| Increment (int)
| Decrement (int);
let add = ((a,b): (int, int)): int => a + b;
let sub = ((a,b): (int, int)): int => a - b;
/* real entrypoint that re-routes the flow based on the parameter provided */
let main = ((p,storage): (parameter, storage)) => {
let storage =
switch (p) {
| Increment(n) => add ((storage, n))
| Decrement(n) => sub ((storage, n))
};
([]: list (operation), storage);
};
/* IF YOU CHANGE THIS, CHANGE THE EXAMPLE ON THE FRONT PAGE OF THE WEBSITE */