
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.
26 lines
672 B
Plaintext
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 */
|