Skip to content

Commit 6f5fb74

Browse files
committed
[Tolk] Make a semicolon optional for top-level declarations
After declaring type aliases, constants, etc. semicolon is now optional. Struct fields can also be separated with a newline only.
1 parent 63670d2 commit 6f5fb74

23 files changed

+402
-438
lines changed

crypto/smartcont/tolk-stdlib/common.tolk

Lines changed: 214 additions & 247 deletions
Large diffs are not rendered by default.

crypto/smartcont/tolk-stdlib/gas-payments.tolk

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,64 +7,64 @@ tolk 0.99
77

88
/// Returns amount of gas (in gas units) consumed in current Computation Phase.
99
fun getGasConsumedAtTheMoment(): int
10-
asm "GASCONSUMED";
10+
asm "GASCONSUMED"
1111

1212
/// This function is required to be called when you process an external message (from an outer world)
1313
/// and "accept" it to blockchain.
1414
/// Without calling this function, an external message would be discarded.
1515
/// As an effect, the current smart contract agrees to buy some gas to finish the current transaction.
1616
/// For more details, check [accept_message effects](https://ton.org/docs/#/smart-contracts/accept).
1717
fun acceptExternalMessage(): void
18-
asm "ACCEPT";
18+
asm "ACCEPT"
1919

2020
/// When processing an internal message, by default, the limit of gas consumption is determined by incoming message.
2121
/// Functions [setGasLimit] and [setGasLimitToMaximum] allow you to change this behavior.
2222
/// Sets current gas limit `gl` to its maximal allowed value `gm`, and resets the gas credit `gc` to zero,
2323
/// decreasing the value of `gr` by `gc` in the process.
2424
fun setGasLimitToMaximum(): void
25-
asm "ACCEPT";
25+
asm "ACCEPT"
2626

2727
/// When processing an internal message, by default, the limit of gas consumption is determined by incoming message.
2828
/// Functions [setGasLimit] and [setGasLimitToMaximum] allow you to change this behavior.
2929
/// Sets current gas limit `gl` to the minimum of limit and `gm`, and resets the gas credit `gc` to zero.
3030
/// If the gas consumed so far (including the present instruction) exceeds the resulting value of `gl`,
3131
/// an (unhandled) out of gas exception is thrown before setting new gas limits.
3232
fun setGasLimit(limit: int): void
33-
asm "SETGASLIMIT";
33+
asm "SETGASLIMIT"
3434

3535
/// Calculates fee (amount in nanotoncoins to be paid) for a transaction which consumed [gasUsed] gas units.
3636
fun calculateGasFee(workchain: int8, gasUsed: int): coins
37-
asm(gasUsed workchain) "GETGASFEE";
37+
asm(gasUsed workchain) "GETGASFEE"
3838

3939
/// Same as [calculateGasFee], but without flat price (you have supposed to read https://docs.ton.org/develop/howto/fees-low-level)
4040
fun calculateGasFeeWithoutFlatPrice(workchain: int8, gasUsed: coins): coins
41-
asm(gasUsed workchain) "GETGASFEESIMPLE";
41+
asm(gasUsed workchain) "GETGASFEESIMPLE"
4242

4343
/// Calculates amount of nanotoncoins you should pay for storing a contract of provided size for [seconds].
4444
/// [bits] and [cells] represent contract state (code + data).
4545
fun calculateStorageFee(workchain: int8, seconds: int, bits: int, cells: int): coins
46-
asm(cells bits seconds workchain) "GETSTORAGEFEE";
46+
asm(cells bits seconds workchain) "GETSTORAGEFEE"
4747

4848
/// Calculates amount of nanotoncoins you should pay to send a message of a specified size.
4949
fun calculateForwardFee(workchain: int8, bits: int, cells: int): coins
50-
asm(cells bits workchain) "GETFORWARDFEE";
50+
asm(cells bits workchain) "GETFORWARDFEE"
5151

5252
/// Same as [calculateForwardFee], but without lump price (you have supposed to read https://docs.ton.org/develop/howto/fees-low-level)
5353
fun calculateForwardFeeWithoutLumpPrice(workchain: int8, bits: int, cells: int): coins
54-
asm(cells bits workchain) "GETFORWARDFEESIMPLE";
54+
asm(cells bits workchain) "GETFORWARDFEESIMPLE"
5555

5656
/// Calculates fee that was paid by the sender of an incoming internal message.
5757
@deprecated("use modern `onInternalMessage` and access `in.originalForwardFee` directly")
5858
fun calculateOriginalForwardFee(workchain: int8, incomingFwdFee: coins): coins
59-
asm(incomingFwdFee workchain) "GETORIGINALFWDFEE";
59+
asm(incomingFwdFee workchain) "GETORIGINALFWDFEE"
6060

6161
/// Returns the amount of nanotoncoins current contract debts for storage. ("due" and "debt" are synonyms)
6262
/// If it has no debt, `0` is returned.
6363
fun contract.getStorageDuePayment(): coins
64-
asm "DUEPAYMENT";
64+
asm "DUEPAYMENT"
6565

6666
/// Returns the amount of nanotoncoins charged for storage.
6767
/// (during storage phase preceeding to current computation phase)
6868
@pure
6969
fun contract.getStoragePaidPayment(): coins
70-
asm "STORAGEFEES";
70+
asm "STORAGEFEES"

crypto/smartcont/tolk-stdlib/lisp-lists.tolk

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,25 +9,25 @@ tolk 0.99
99

1010
@pure
1111
fun createEmptyList(): tuple
12-
asm "PUSHNULL";
12+
asm "PUSHNULL"
1313

1414
/// Adds an element to the beginning of lisp-style list.
1515
/// Note, that it does not mutate the list: instead, it returns a new one (it's a lisp pattern).
1616
@pure
1717
fun listPrepend<X>(head: X, tail: tuple?): tuple
18-
asm "CONS";
18+
asm "CONS"
1919

2020
/// Extracts the head and the tail of lisp-style list.
2121
@pure
2222
fun listSplit<X>(list: tuple): (X, tuple?)
23-
asm "UNCONS";
23+
asm "UNCONS"
2424

2525
/// Returns the head of lisp-style list.
2626
@pure
2727
fun listGetHead<X>(list: tuple): X
28-
asm "CAR";
28+
asm "CAR"
2929

3030
/// Returns the tail of lisp-style list.
3131
@pure
3232
fun listGetTail(list: tuple): tuple?
33-
asm "CDR";
33+
asm "CDR"

0 commit comments

Comments
 (0)