-## Analyzing the current contract
+## Analyzing the Current Contract
### **`taco-shop.ligo`**
-```pascaligo group=a
-type taco_supply is record
- current_stock : nat;
- max_price : tez;
-end
-type taco_shop_storage is map(nat, taco_supply);
-function buy_taco (const taco_kind_index: nat ; var taco_shop_storage : taco_shop_storage) :
- (list(operation) * taco_shop_storage) is
- begin
- // Retrieve the taco_kind from the contract's storage
- const taco_kind : taco_supply = get_force(taco_kind_index, taco_shop_storage);
-
- const current_purchase_price : tez = taco_kind.max_price / taco_kind.current_stock;
+```pascaligo group=a
+type taco_supply is record [
+ current_stock : nat;
+ max_price : tez
+]
+
+type taco_shop_storage is map (nat, taco_supply)
+
+type return is list (operation) * taco_shop_storage
+
+function buy_taco (const taco_kind_index : nat ; var taco_shop_storage : taco_shop_storage) : return is
+ block {
+ // Retrieve the taco_kind from the contract's storage or fail
+ const taco_kind : taco_supply =
+ case taco_shop_storage[taco_kind_index] of
+ Some (kind) -> kind
+ | None -> (failwith ("Unknown kind of taco.") : taco_supply)
+ end;
+
+ const current_purchase_price : tez =
+ taco_kind.max_price / taco_kind.current_stock;
if amount =/= current_purchase_price then
- // we won't sell tacos if the amount isn't correct
- failwith("Sorry, the taco you're trying to purchase has a different price");
- else
- // Decrease the stock by 1n, because we've just sold one
- taco_kind.current_stock := abs(taco_kind.current_stock - 1n);
+ // We won't sell tacos if the amount is not correct
+ failwith ("Sorry, the taco you are trying to purchase has a different price");
+ else skip;
+
+ // Decrease the stock by 1n, because we have just sold one
+ taco_kind.current_stock := abs (taco_kind.current_stock - 1n);
// Update the storage with the refreshed taco_kind
- taco_shop_storage[taco_kind_index] := taco_kind;
- end with ((nil : list(operation)), taco_shop_storage)
+ taco_shop_storage[taco_kind_index] := taco_kind
+ } with ((nil : list (operation)), taco_shop_storage)
```
-### Purchase price formula
-Pedro's Taco Shop contract currently enables customers to buy tacos, at a computed price based on a simple formula.
+### Purchase Price Formula
+
+Pedro's Taco Shop contract currently enables customers to buy tacos,
+at a price based on a simple formula.
```pascaligo skip
-const current_purchase_price : tez = taco_kind.max_price / taco_kind.current_stock;
+const current_purchase_price : tez =
+ taco_kind.max_price / taco_kind.current_stock
```
-### Replacing *spendable* smart contracts
-However, due to the [recent protocol upgrade](http://tezos.gitlab.io/mainnet/protocols/004_Pt24m4xi.html) of the Tezos mainnet, Pedro can't access the tokens stored in his Shop's contract directly. This was previously possible via `spendable` smart contracts, which are no longer available in the new protocol. We will have to implement a solution to access tokens from the contract programatically.
+### Replacing *spendable* Smart Contracts
+
+However, due to the
+[recent protocol upgrade](http://tezos.gitlab.io/mainnet/protocols/004_Pt24m4xi.html)
+of the Tezos `mainnet`, Pedro cannot access the tokens stored in his
+shop's contract directly. This was previously possible via *spendable
+smart contracts*, which are no longer available in the new
+protocol. We will have to implement a solution to access tokens from
+the contract programatically.
---
-## Designing a payout scheme
+## Designing a Payout Scheme
-Pedro is a standalone bussines owner, and in our case, he doesn't have to split profits / earnings of the taco shop with anyone. So for the sake of simplicity, we'll payout all the earned XTZ directly to Pedro right after a succesful taco purchase.
+Pedro is a standalone bussines owner, and in our case, he does not
+have to split profits and earnings of the taco shop with anyone. So
+for the sake of simplicity, we will payout all the earned XTZ directly
+to Pedro right after a succesful purchase.
-This means that after all the *purchase conditions* of our contract are met - e.g. correct amount is sent to the contract - we'll not only decrease the supply of the individual purchased *taco kind*, but we'll also transfer this amount in a *subsequent transaction* to Pedro's personal address.
+This means that after all the *purchase conditions* of our contract
+are met, e.g., the correct amount is sent to the contract, we will not
+only decrease the supply of the individual purchased *taco kind*, but
+we will also transfer this amount in a *subsequent transaction* to
+Pedro's personal address.
-## Forging a payout transaction
+## Forging a Payout Transaction
-### Defining the recipient
-In order to send tokens, we will need a receiver address - which in our case will be Pedro's personal account. Additionally we'll wrap the given address as a *`contract(unit)`* - which represents either a contract with no parameters, or an implicit account.
+### Defining the Recipient
+
+In order to send tokens, we will need a receiver address, which, in
+our case, will be Pedro's personal account. Additionally we will wrap
+the given address as a *`contract (unit)`*, which represents either a
+contract with no parameters, or an implicit account.
```pascaligo group=ex1
const ownerAddress : address = ("tz1TGu6TN5GSez2ndXXeDX6LgUDvLzPLqgYV" : address);
-const receiver : contract(unit) = get_contract(ownerAddress);
+const receiver : contract (unit) = get_contract (ownerAddress);
```
-> Would you like to learn more about addresses, contracts and operations in LIGO? Check out the [LIGO cheat sheet](api/cheat-sheet.md)
+> Would you like to learn more about addresses, contracts and
+> operations in LIGO? Check out the
+> [LIGO cheat sheet](api/cheat-sheet.md)
-### Adding the transaction to the list of output operations
-Now we can transfer the `amount` received by `buy_taco` to Pedro's `ownerAddress`. We will do so by forging a `transaction(unit, amount, receiver)` within a list of operations returned at the end of our contract.
+### Adding the Transaction to the List of Output Operations
+Now we can transfer the amount received by `buy_taco` to Pedro's
+`ownerAddress`. We will do so by forging a `transaction (unit, amount,
+receiver)` within a list of operations returned at the end of our
+contract.
```pascaligo group=ex1
-const payoutOperation : operation = transaction(unit, amount, receiver) ;
-const operations : list(operation) = list
- payoutOperation
-end;
+const payoutOperation : operation = transaction (unit, amount, receiver) ;
+const operations : list (operation) = list [payoutOperation];
```
---
-## Finalizing the contract
+## Finalizing the Contract
### **`taco-shop.ligo`**
+
```pascaligo group=b
-type taco_supply is record
- current_stock : nat;
- max_price : tez;
-end
-type taco_shop_storage is map(nat, taco_supply);
+type taco_supply is record [
+ current_stock : nat;
+ max_price : tez
+]
-const ownerAddress: address = ("tz1TGu6TN5GSez2ndXXeDX6LgUDvLzPLqgYV" : address);
+type taco_shop_storage is map (nat, taco_supply)
-function buy_taco (const taco_kind_index: nat ; var taco_shop_storage : taco_shop_storage) : (list(operation) * taco_shop_storage) is
- begin
- // Retrieve the taco_kind from the contract's storage
- const taco_kind : taco_supply = get_force(taco_kind_index, taco_shop_storage);
-
- const current_purchase_price : tez = taco_kind.max_price / taco_kind.current_stock;
+type return is list (operation) * taco_shop_storage
+
+const ownerAddress : address =
+ ("tz1TGu6TN5GSez2ndXXeDX6LgUDvLzPLqgYV" : address)
+
+function buy_taco (const taco_kind_index : nat ; var taco_shop_storage : taco_shop_storage) : return is
+ block {
+ // Retrieve the taco_kind from the contract's storage or fail
+ const taco_kind : taco_supply =
+ case taco_shop_storage[taco_kind_index] of
+ Some (kind) -> kind
+ | None -> (failwith ("Unknown kind of taco.") : taco_supply)
+ end;
+
+ const current_purchase_price : tez =
+ taco_kind.max_price / taco_kind.current_stock;
if amount =/= current_purchase_price then
- // we won't sell tacos if the amount isn't correct
- failwith("Sorry, the taco you're trying to purchase has a different price");
- else
- // Decrease the stock by 1n, because we've just sold one
- taco_kind.current_stock := abs(taco_kind.current_stock - 1n);
+ // We won't sell tacos if the amount is not correct
+ failwith ("Sorry, the taco you are trying to purchase has a different price");
+ else skip;
+
+ // Decrease the stock by 1n, because we have just sold one
+ taco_kind.current_stock := abs (taco_kind.current_stock - 1n);
// Update the storage with the refreshed taco_kind
taco_shop_storage[taco_kind_index] := taco_kind;
- const receiver : contract(unit) = get_contract(ownerAddress);
- const payoutOperation : operation = transaction(unit, amount, receiver);
- const operations : list(operation) = list
- payoutOperation
- end;
-
- end with (operations, taco_shop_storage)
+ const receiver : contract(unit) = get_contract (ownerAddress);
+ const payoutOperation : operation = transaction (unit, amount, receiver);
+ const operations : list(operation) = list [payoutOperation]
+ } with ((nil : list (operation)), taco_shop_storage)
```
+### Dry-run the Contract
-### Dry-run the contract
-
-To confirm that our contract is valid, we can dry run it. As a result we see a *new operation* in the list of returned operations to be executed subsequently.
+To confirm that our contract is valid, we can dry-run it. As a result,
+we see a *new operation* in the list of returned operations to be
+executed subsequently.
```pascaligo skip
-ligo dry-run taco-shop.ligo --syntax pascaligo --amount 1 buy_taco 1n "map
- 1n -> record
- current_stock = 50n;
- max_price = 50000000mutez;
- end;
- 2n -> record
- current_stock = 20n;
- max_price = 75000000mutez;
- end;
-end"
+ligo dry-run taco-shop.ligo --syntax pascaligo --amount 1 buy_taco 1n "map [
+ 1n -> record [
+ current_stock = 50n;
+ max_price = 50tez
+ ];
+ 2n -> record [
+ current_stock = 20n;
+ max_price = 75tez
+ ];
+]"
```
+
Operation(...bytes) included in the output
-**Done! Our tokens are no longer locked in the contract, and instead they are sent to Pedro's personal account/wallet.**
+**Done! Our tokens are no longer locked in the contract, and instead
+ they are sent to Pedro's personal account/wallet.**
---
-## 👼 Bonus: donating part of the profits
+## 👼 Bonus: Donating Part of the Profits
-Because Pedro is a member of the (STA) Specialty Taco Association, he has decided to donate **10%** of the earnings to the STA. We'll just add a `donationAddress` to the contract, and compute a 10% donation sum from each taco purchase.
+Because Pedro is a member of the Specialty Taco Association (STA), he
+has decided to donate **10%** of the earnings to the STA. We will just
+add a `donationAddress` to the contract, and compute a 10% donation
+sum from each taco purchase.
```pascaligo group=bonus
-const ownerAddress: address = ("tz1TGu6TN5GSez2ndXXeDX6LgUDvLzPLqgYV" : address);
-const donationAddress: address = ("tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx" : address);
-```
+const ownerAddress : address = ("tz1TGu6TN5GSez2ndXXeDX6LgUDvLzPLqgYV" : address);
+const donationAddress : address = ("tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx" : address);
-```pascaligo group=bonus
-const receiver : contract(unit) = get_contract(ownerAddress);
-const donationReceiver : contract(unit) = get_contract(donationAddress);
+const receiver : contract (unit) = get_contract (ownerAddress);
+const donationReceiver : contract(unit) = get_contract (donationAddress);
-const donationAmount: tez = amount / 10n;
+const donationAmount : tez = amount / 10n;
-const operations : list(operation) = list
+const operations : list (operation) = list [
// Pedro will get 90% of the amount
- transaction(unit, amount - donationAmount, receiver);
- transaction(unit, donationAmount, donationReceiver);
-end;
+ transaction (unit, amount - donationAmount, receiver);
+ transaction (unit, donationAmount, donationReceiver)
+];
```
This will result into two operations being subsequently executed on the blockchain:
- Donation transfer (10%)
-- Pedro's profits (90%)
\ No newline at end of file
+- Pedro's profits (90%)
diff --git a/gitlab-pages/docs/tutorials/get-started/tezos-taco-shop-smart-contract.ligo b/gitlab-pages/docs/tutorials/get-started/tezos-taco-shop-smart-contract.ligo
index b51460bde..8871a9c87 100644
--- a/gitlab-pages/docs/tutorials/get-started/tezos-taco-shop-smart-contract.ligo
+++ b/gitlab-pages/docs/tutorials/get-started/tezos-taco-shop-smart-contract.ligo
@@ -1,23 +1,33 @@
-type taco_supply is record
+type taco_supply is
+ record [
current_stock : nat;
- max_price : tez;
-end
-type taco_shop_storage is map(nat, taco_supply);
+ max_price : tez
+ ]
-function buy_taco (const taco_kind_index: nat ; var taco_shop_storage : taco_shop_storage) : (list(operation) * taco_shop_storage) is
- begin
- // Retrieve the taco_kind from the contract's storage
- const taco_kind : taco_supply = get_force(taco_kind_index, taco_shop_storage);
-
- const current_purchase_price : tez = taco_kind.max_price / taco_kind.current_stock;
+type taco_shop_storage is map (nat, taco_supply)
+
+type return is list (operation) * taco_shop_storage
+
+function buy_taco (const taco_kind_index : nat ; var taco_shop_storage : taco_shop_storage) : return is
+ block {
+ // Retrieve the taco_kind from the contract's storage or fail
+ const taco_kind : taco_supply =
+ case taco_shop_storage[taco_kind_index] of
+ Some (kind) -> kind
+ | None -> (failwith ("Unknown kind of taco.") : taco_supply)
+ end;
+
+ const current_purchase_price : tez =
+ taco_kind.max_price / taco_kind.current_stock;
if amount =/= current_purchase_price then
- // we won't sell tacos if the amount isn't correct
- fail("Sorry, the taco you're trying to purchase has a different price");
- else
- // Decrease the stock by 1n, because we've just sold one
- taco_kind.current_stock := abs(taco_kind.current_stock - 1n);
+ // We won't sell tacos if the amount is not correct
+ failwith ("Sorry, the taco you are trying to purchase has a different price");
+ else skip;
+
+ // Decrease the stock by 1n, because we have just sold one
+ taco_kind.current_stock := abs (taco_kind.current_stock - 1n);
// Update the storage with the refreshed taco_kind
- taco_shop_storage[taco_kind_index] := taco_kind;
- end with ((nil : list(operation)), taco_shop_storage)
\ No newline at end of file
+ taco_shop_storage[taco_kind_index] := taco_kind
+ } with ((nil : list (operation)), taco_shop_storage)
diff --git a/gitlab-pages/docs/tutorials/get-started/tezos-taco-shop-smart-contract.md b/gitlab-pages/docs/tutorials/get-started/tezos-taco-shop-smart-contract.md
index 9d2bf5ab2..986888889 100644
--- a/gitlab-pages/docs/tutorials/get-started/tezos-taco-shop-smart-contract.md
+++ b/gitlab-pages/docs/tutorials/get-started/tezos-taco-shop-smart-contract.md
@@ -1,112 +1,147 @@
---
id: tezos-taco-shop-smart-contract
-title: Taco shop smart contract
+title: The Taco Shop Smart Contract
---
-Meet **Pedro**, our *artisan taco chef* who has decided to open a Taco shop on the Tezos blockchain, using a smart contract. He sells two different kinds of tacos, the **el clásico** and the **especial del chef**.
+Meet **Pedro**, our *artisan taco chef*, who has decided to open a
+Taco shop on the Tezos blockchain, using a smart contract. He sells
+two different kinds of tacos: **el Clásico** and the **Especial
+del Chef**.
-To help Pedro open his dream taco shop, we'll implement a smart contract, that will manage supply, pricing & sales of his tacos to the consumers.
+To help Pedro open his dream taco shop, we will implement a smart
+contract that will manage supply, pricing & sales of his tacos to the
+consumers.
![](/img/tutorials/get-started/tezos-taco-shop-smart-contract/taco-stand.svg)
-
+
---
## Pricing
-Pedro's tacos are a rare delicacy, so their **price goes up**, as the **stock for the day begins to deplete**.
+Pedro's tacos are a rare delicacy, so their **price goes up** as the
+**stock for the day begins to deplete**.
-Each taco kind, has its own `max_price` that it sells for, and a finite supply for the current sales lifecycle.
+Each taco kind, has its own `max_price` that it sells for, and a
+finite supply for the current sales lifecycle.
-> For the sake of simplicity, we won't implement replenishing of the supply after it runs out.
+> For the sake of simplicity, we will not implement the replenishing
+> of the supply after it has run out.
-### Daily offer
+### Daily Offer
|**kind** |id |**available_stock**| **max_price**|
|---|---|---|---|
-|el clásico | `1n` | `50n` | `50000000mutez` |
-|especial del chef | `2n` | `20n` | `75000000mutez` |
+|Clásico | `1n` | `50n` | `50tez` |
+|Especial del Chef | `2n` | `20n` | `75tez` |
-### Calculating the current purchase price
+### Calculating the Current Purchase Price
-Current purchase price is calculated with the following equation:
+The current purchase price is calculated with the following formula:
```pascaligo skip
current_purchase_price = max_price / available_stock
```
-#### El clásico
+#### El Clásico
|**available_stock**|**max_price**|**current_purchase_price**|
|---|---|---|
-| `50n` | `50000000mutez` | `1tz`|
-| `20n` | `50000000mutez` | `2.5tz` |
-| `5n` | `50000000mutez` | `10tz` |
+| `50n` | `50tez` | `1tez`|
+| `20n` | `50tez` | `2.5tez` |
+| `5n` | `50tez` | `10tez` |
#### Especial del chef
|**available_stock**|**max_price**|**current_purchase_price**|
|---|---|---|
-| `20n` | `75000000mutez` | `3.75tz` |
-| `10n` | `75000000mutez` | `7.5tz`|
-| `5n` | `75000000mutez` | `15tz` |
+| `20n` | `75tez` | `3.75tez` |
+| `10n` | `75tez` | `7.5tez`|
+| `5n` | `75tez` | `15tez` |
---
## Installing LIGO
-In this tutorial, we'll use LIGO's dockerized version for the sake of simplicity. You can find the installation instructions [here](intro/installation.md#dockerized-installation-recommended).
+In this tutorial, we will use LIGO's dockerized version, for the sake
+of simplicity. You can find the installation instructions
+[here](intro/installation.md#dockerized-installation-recommended).
-The best way to install the dockerized LIGO is as a **global executable** through the installation script, as shown in the screenshot below:
+The best way to install the dockerized LIGO is as a **global
+executable** through the installation script, as shown in the
+screenshot below:
![](/img/tutorials/get-started/tezos-taco-shop-smart-contract/install-ligo.png)
-
Installing the next version of LIGO's CLI
+
Installing the next version of LIGO's CLI
-## Implementing our first entry point
+## Implementing our First `main` Function
-> From now on we'll get a bit more technical. If you run into something we have not covered yet - please try checking out the [LIGO cheat sheet](api/cheat-sheet.md) for some extra tips & tricks.
+> From now on we will get a bit more technical. If you run into
+> something we have not covered yet - please try checking out the
+> [LIGO cheat sheet](api/cheat-sheet.md) for some extra tips & tricks.
-To begin implementing our smart contract, we need an entry point. We'll call it `main` and it'll specify our contract's storage (`int`) and input parameter (`int`). Of course this is not the final storage/parameter of our contract, but it is something to get us started and test our LIGO installation as well.
+To begin implementing our smart contract, we need a *main function*,
+that is the first function being executed. We will call it `main` and
+it will specify our contract's storage (`int`) and input parameter
+(`int`). Of course this is not the final storage/parameter of our
+contract, but it is something to get us started and test our LIGO
+installation as well.
### `taco-shop.ligo`
+
```pascaligo group=a
-function main (const parameter: int; const contractStorage: int) : (list(operation) * int) is
- block {skip} with ((nil : list(operation)), contractStorage + parameter)
+function main (const parameter : int; const contractStorage : int) :
+list (operation) * int is
+ ((nil : list (operation)), contractStorage + parameter)
```
-Let's break down the contract above to make sure we understand each bit of the LIGO syntax:
+Let us break down the contract above to make sure we understand each
+bit of the LIGO syntax:
-- **`function main`** - definition of a function that serves as an entry point
-- **`(const parameter : int; const contractStorage : int)`** - parameters passed to the function
- - **`const parameter : int`** - parameter provided by a transaction that invokes our contract
- - **`const contractStorage : int`** - definition of our storage (`int`)
-- **`(list(operation) * int)`** - return type of our function, in our case a touple with a list of operations, and an int
-- **`block {skip}`** - our function has no body, so we instruct LIGO to `skip` it
-- **`with ((nil : list(operation)), contractStorage + parameter)`** - essentially a return statement
- - **`(nil : list(operation))`** - a `nil` value annotated as a list of operations, because that's required by our return type specified above
- - **`contractStorage + parameter`** - a new storage value for our contract, sum of previous storage and a transaction parameter
-### Running LIGO for the first time
+- **`function main`** - definition of the main function, which takes
+ a the parameter of the contract and the storage
+- **`(const parameter : int; const contractStorage : int)`** -
+ parameters passed to the function: the first is called `parameter`
+ because it denotes the parameter of a specific invocation of the
+ contract, the second is the storage
+- **`(list (operation) * int)`** - return type of our function, in our
+ case a tuple with a list of operations, and an `int` (new value for
+ the storage after a succesful run of the contract)
+- **`((nil : list (operation)), contractStorage + parameter)`** -
+ essentially a return statement
+- **`(nil : list (operation))`** - a `nil` value annotated as a list
+ of operations, because that is required by our return type specified
+ above
+ - **`contractStorage + parameter`** - a new storage value for our
+ contract, sum of previous storage and a transaction parameter
-To test that we've installed LIGO correctly, and that `taco-shop.ligo` is a valid contract, we'll dry-run it.
+### Running LIGO for the First Time
-> Dry-running is a simulated execution of the smart contract, based on a mock storage value and a parameter.
+To test that we have installed LIGO correctly, and that
+`taco-shop.ligo` is a valid contract, we will dry-run it.
-Our contract has a storage of `int` and accepts a parameter that is also an `int`.
+> Dry-running is a simulated execution of the smart contract, based on
+> a mock storage value and a parameter.
+
+Our contract has a storage of `int` and accepts a parameter that is
+also an `int`.
The `dry-run` command requires a few parameters:
- **contract** *(file path)*
-- **entrypoint** *(name of the entrypoint function in the contract)*
+- **entrypoint** *(name of the main function in the contract)*
- **parameter** *(parameter to execute our contract with)*
- **storage** *(starting storage before our contract's code is executed)*
-
-And outputs what's returned from our entrypoint - in our case a touple containing an empty list (of operations to apply) and the new storage value - which in our case is the sum of the previous storage and the parameter we've used.
+It outputs what is returned from our main function: in our case a
+tuple containing an empty list (of operations to apply) and the new
+storage value, which, in our case, is the sum of the previous storage
+and the parameter we have used for the invocation.
```zsh
# Contract: taco-shop.ligo
-# Entry point: main
+# Main function: main
# Parameter: 4
# Storage: 3
ligo dry-run taco-shop.ligo --syntax pascaligo main 4 3
@@ -116,7 +151,7 @@ ligo dry-run taco-shop.ligo --syntax pascaligo main 4 3
```
![](/img/tutorials/get-started/tezos-taco-shop-smart-contract/dry-run-1.png)
-
Simulating contract execution with the CLI
+
Simulating contract execution with the CLI
@@ -124,197 +159,257 @@ ligo dry-run taco-shop.ligo --syntax pascaligo main 4 3
---
-## Designing Taco shop's contract storage
+## Designing the Taco Shop's Contract Storage
-We know that Pedro's Taco Shop serves two kinds of tacos, so we'll need to manage stock individually, per kind. Let's define a type, that will keep the `stock` & `max_price` per kind - in a record with two fields. Additionally, we'll want to combine our `taco_supply` type into a map, consisting of the entire offer of Pedro's shop.
+We know that Pedro's Taco Shop serves two kinds of tacos, so we will
+need to manage stock individually, per kind. Let us define a type,
+that will keep the `stock` & `max_price` per kind in a record with two
+fields. Additionally, we will want to combine our `taco_supply` type
+into a map, consisting of the entire offer of Pedro's shop.
**Taco shop's storage**
-```pascaligo group=b
-type taco_supply is record
- current_stock : nat;
- max_price : tez;
-end
-type taco_shop_storage is map(nat, taco_supply);
+```pascaligo group=b
+type taco_supply is record [
+ current_stock : nat;
+ max_price : tez
+]
+
+type taco_shop_storage is map (nat, taco_supply)
```
-Next step is to update the `main` entry point to include `taco_shop_storage` in its storage - while doing that let's set the `parameter` to `unit` as well to clear things up.
+Next step is to update the `main` function to include
+`taco_shop_storage` in its storage. In the meanwhile, let us set the
+`parameter` to `unit` as well to clear things up.
**`taco-shop.ligo`**
-```pascaligo group=b+
-type taco_supply is record
- current_stock : nat;
- max_price : tez;
-end
-type taco_shop_storage is map(nat, taco_supply);
-function main (const parameter: unit ; const taco_shop_storage : taco_shop_storage) : (list(operation) * taco_shop_storage) is
- block {skip} with ((nil : list(operation)), taco_shop_storage)
+```pascaligo group=b+
+type taco_supply is record [
+ current_stock : nat;
+ max_price : tez
+]
+
+type taco_shop_storage is map (nat, taco_supply)
+
+type return is list (operation) * taco_shop_storage
+
+function main (const parameter : unit; const taco_shop_storage : taco_shop_storage) : return is
+ ((nil : list (operation)), taco_shop_storage)
```
-### Populating our storage in a dry-run
+### Populating our Storage in a dry-run
-When dry-running a contract, it is crucial to provide a correct initial storage value - in our case the storage is type-checked as `taco_shop_storage`. Reflecting [Pedro's daily offer](tutorials/get-started/tezos-taco-shop-smart-contract.md#daily-offer), our storage's value will be defined as following:
+When dry-running a contract, it is crucial to provide a correct
+initial storage value. In our case the storage is type-checked as
+`taco_shop_storage`. Reflecting
+[Pedro's daily offer](tutorials/get-started/tezos-taco-shop-smart-contract.md#daily-offer),
+our storage's value will be defined as follows:
**Storage value**
+
```zsh
-map
- 1n -> record
- current_stock = 50n;
- max_price = 50000000mutez;
- end;
- 2n -> record
- current_stock = 20n;
- max_price = 75000000mutez;
- end;
-end
+map [
+ 1n -> record [
+ current_stock = 50n;
+ max_price = 50tez
+ ];
+ 2n -> record [
+ current_stock = 20n;
+ max_price = 75tez
+ ]
+]
```
-> Storage value is a map, with two items in it, both items are records identified by natural numbers `1n` & `2n`.
+> The storage value is a map with two bindings (entries) distinguished
+> by their keys `1n` and `2n`.
**Dry run command with a multi-line storage value**
+
```zsh
-ligo dry-run taco-shop.ligo --syntax pascaligo main unit "map
- 1n -> record
- current_stock = 50n;
- max_price = 50000000mutez;
- end;
- 2n -> record
- current_stock = 20n;
- max_price = 75000000mutez;
- end;
-end"
+ligo dry-run taco-shop.ligo --syntax pascaligo main unit "map [
+ 1n -> record [
+ current_stock = 50n;
+ max_price = 50tez
+ ];
+ 2n -> record [
+ current_stock = 20n;
+ max_price = 75tez
+ ]
+]"
```
![](/img/tutorials/get-started/tezos-taco-shop-smart-contract/dry-run-2.png)
-
Dry-run with a complex storage value
+
Dry-run with a complex storage value
-*If everything went as expected, the `dry-run` command will return an empty list of operations and the contract's current storage, which is the map of products we've defined based on the daily offer of Pedro's taco shop.*
+*If everything went as expected, the `dry-run` command will return an
+ empty list of operations and the contract's current storage, which is
+ the map of the products we have defined based on the daily offer of
+ Pedro's taco shop.*
---
-## Providing an entrypoint for buying tacos
+## Providing another Access Function for Buying Tacos
-Now that we have our stock well defined in form of storage, we can move on to the actual sales. We'll replace the `main` entrypoint with `buy_taco`, that takes an `id` - effectively a key from our `taco_shop_storage` map. This will allow us to calculate pricing, and if the sale is successful - then we can reduce our stock - because we have sold a taco!
+Now that we have our stock well defined in form of storage, we can
+move on to the actual sales. The `main` function will take a key `id`
+from our `taco_shop_storage` map and will be renamed `buy_taco` for
+more readability. This will allow us to calculate pricing, and if the
+sale is successful, we will be able to reduce our stock because we
+have sold a taco!
-### Selling the tacos for free
+### Selling the Tacos for Free
-Let's start by customizing our contract a bit, we will:
+Let is start by customizing our contract a bit, we will:
-- rename the entrypoint from `main` to `buy_taco`
- rename `parameter` to `taco_kind_index`
-- change `taco_shop_storage` to a `var` instead of a `const`, because we'll want to modify it
+- change `taco_shop_storage` to a `var` instead of a `const`, because
+ we will want to modify it
**`taco-shop.ligo`**
+
```pascaligo group=c
-type taco_supply is record
+type taco_supply is record [
current_stock : nat;
- max_price : tez;
-end
-type taco_shop_storage is map(nat, taco_supply);
+ max_price : tez
+]
+type taco_shop_storage is map (nat, taco_supply)
-function buy_taco (const taco_kind_index: nat ; var taco_shop_storage : taco_shop_storage) : (list(operation) * taco_shop_storage) is
- block { skip } with ((nil : list(operation)), taco_shop_storage)
+type return is list (operation) * taco_shop_storage
+
+function buy_taco (const taco_kind_index : nat; var taco_shop_storage : taco_shop_storage) : return is
+ ((nil : list (operation)), taco_shop_storage)
```
-#### Decreasing `current_stock` when a taco is sold
+#### Decreasing `current_stock` when a Taco is Sold
-In order to decrease the stock in our contract's storage for a specific taco kind, a few things needs to happen:
+In order to decrease the stock in our contract's storage for a
+specific taco kind, a few things needs to happen:
-- retrieve the `taco_kind` from our storage, based on the `taco_kind_index` provided
-- subtract the `taco_kind.current_stock` by `1n`
- - we can find the absolute (`nat`) value of the subtraction above by using `abs`, otherwise we'd be left with an `int`
-- update the storage, and return it
+- retrieve the `taco_kind` from our storage, based on the
+ `taco_kind_index` provided;
+- subtract the `taco_kind.current_stock` by `1n`;
+- we can find the absolute value of the subtraction above by
+ calling `abs` (otherwise we would be left with an `int`);
+- update the storage, and return it.
**`taco-shop.ligo`**
```pascaligo group=d
-type taco_supply is record
- current_stock : nat;
- max_price : tez;
-end
-type taco_shop_storage is map(nat, taco_supply);
+type taco_supply is record [
+ current_stock : nat;
+ max_price : tez
+]
+
+type taco_shop_storage is map (nat, taco_supply)
+
+type return is list (operation) * taco_shop_storage
+
+function buy_taco (const taco_kind_index : nat; var taco_shop_storage : taco_shop_storage) : return is
+ block {
+ // Retrieve the taco_kind from the contract's storage or fail
+ const taco_kind : taco_supply =
+ case taco_shop_storage[taco_kind_index] of
+ Some (kind) -> kind
+ | None -> (failwith ("Unknown kind of taco.") : taco_supply)
+ end;
+
+ // Decrease the stock by 1n, because we have just sold one
+ taco_kind.current_stock := abs (taco_kind.current_stock - 1n);
-function buy_taco (const taco_kind_index: nat ; var taco_shop_storage : taco_shop_storage) : (list(operation) * taco_shop_storage) is
- begin
- // Retrieve the taco_kind from the contract's storage
- const taco_kind : taco_supply = get_force(taco_kind_index, taco_shop_storage);
- // Decrease the stock by 1n, because we've just sold one
- taco_kind.current_stock := abs(taco_kind.current_stock - 1n);
// Update the storage with the refreshed taco_kind
- taco_shop_storage[taco_kind_index] := taco_kind;
- end with ((nil : list(operation)), taco_shop_storage)
+ taco_shop_storage[taco_kind_index] := taco_kind
+ } with ((nil : list (operation)), taco_shop_storage)
```
![](/img/tutorials/get-started/tezos-taco-shop-smart-contract/dry-run-3.png)
-
Stock decreases after selling a taco
+
Stock decreases after selling a taco
-### Making sure we get paid for our tacos
+### Making Sure We Get Paid for Our Tacos
-In order to make Pedro's taco shop profitable, he needs to stop giving away tacos for free. When a contract is invoked via a transaction, an amount of tezzies to be sent can be specified as well. This amount is accessible within LIGO as `amount`.
+In order to make Pedro's taco shop profitable, he needs to stop giving
+away tacos for free. When a contract is invoked via a transaction, an
+amount of tezzies to be sent can be specified as well. This amount is
+accessible within LIGO as `amount`.
To make sure we get paid, we will:
-- calculate a `current_purchase_price` based on the [equation specified earlier](tutorials/get-started/tezos-taco-shop-smart-contract.md#calculating-the-current-purchase-price)
-- check if the sent `amount` matches the `current_purchase_price`
- - if not, then our contract will `fail` and stop executing
- - if yes, stock for the given `taco_kind` will be decreased and the payment accepted
+- calculate a `current_purchase_price` based on the
+ [equation specified earlier](tutorials/get-started/tezos-taco-shop-smart-contract.md#calculating-the-current-purchase-price)
+- check if the sent `amount` matches the `current_purchase_price`:
+ - if not, then our contract will fail (`failwith`)
+ - otherwise, stock for the given `taco_kind` will be decreased and
+ the payment accepted
**`taco-shop.ligo`**
-```pascaligo group=e
-type taco_supply is record
- current_stock : nat;
- max_price : tez;
-end
-type taco_shop_storage is map(nat, taco_supply);
-function buy_taco (const taco_kind_index: nat ; var taco_shop_storage : taco_shop_storage) : (list(operation) * taco_shop_storage) is
- begin
- // Retrieve the taco_kind from the contract's storage
- const taco_kind : taco_supply = get_force(taco_kind_index, taco_shop_storage);
-
- const current_purchase_price : tez = taco_kind.max_price / taco_kind.current_stock;
+```pascaligo group=e
+type taco_supply is record [
+ current_stock : nat;
+ max_price : tez
+]
+
+type taco_shop_storage is map (nat, taco_supply)
+
+type return is list (operation) * taco_shop_storage
+
+function buy_taco (const taco_kind_index : nat ; var taco_shop_storage : taco_shop_storage) : return is
+ block {
+ // Retrieve the taco_kind from the contract's storage or fail
+ const taco_kind : taco_supply =
+ case taco_shop_storage[taco_kind_index] of
+ Some (kind) -> kind
+ | None -> (failwith ("Unknown kind of taco.") : taco_supply)
+ end;
+
+ const current_purchase_price : tez =
+ taco_kind.max_price / taco_kind.current_stock;
if amount =/= current_purchase_price then
- // we won't sell tacos if the amount isn't correct
- failwith("Sorry, the taco you're trying to purchase has a different price");
- else
- // Decrease the stock by 1n, because we've just sold one
- taco_kind.current_stock := abs(taco_kind.current_stock - 1n);
+ // We won't sell tacos if the amount is not correct
+ failwith ("Sorry, the taco you are trying to purchase has a different price");
+ else skip;
+
+ // Decrease the stock by 1n, because we have just sold one
+ taco_kind.current_stock := abs (taco_kind.current_stock - 1n);
// Update the storage with the refreshed taco_kind
- taco_shop_storage[taco_kind_index] := taco_kind;
- end with ((nil : list(operation)), taco_shop_storage)
+ taco_shop_storage[taco_kind_index] := taco_kind
+ } with ((nil : list (operation)), taco_shop_storage)
```
-In order to test the `amount` sent, we'll use the `--amount` option of `dry-run`:
+In order to test the `amount` sent, we will use the `--amount` option
+of `dry-run`:
```zsh
-ligo dry-run taco-shop.ligo --syntax pascaligo --amount 1 buy_taco 1n "map
- 1n -> record
- current_stock = 50n;
- max_price = 50000000mutez;
- end;
- 2n -> record
- current_stock = 20n;
- max_price = 75000000mutez;
- end;
-end"
+ligo dry-run taco-shop.ligo --syntax pascaligo --amount 1 buy_taco 1n "map [
+ 1n -> record [
+ current_stock = 50n;
+ max_price = 50tez
+ ];
+ 2n -> record [
+ current_stock = 20n;
+ max_price = 75tez
+ ]
+]"
```
-**Purchasing a taco with 1.0tz**
+
+** Purchasing a Taco with 1tez **
![](/img/tutorials/get-started/tezos-taco-shop-smart-contract/dry-run-4.png)
-
Stock decreases after selling a taco, if the right amount of tezzies is provided
+
Stock decreases after selling a taco, if the right amount of tezzies is provided
-**Attempting to purchase a taco with 0.7tz**
+**Attempting to Purchase a Taco with 0.7tez**
![](/img/tutorials/get-started/tezos-taco-shop-smart-contract/dry-run-5.png)
-
Stock does not decrease after a purchase attempt with a lower than required amount.
+
Stock does not decrease after a purchase attempt
+with an insufficient payment.
@@ -322,16 +417,19 @@ end"
---
-## 💰 Bonus: *Accepting tips above the taco purchase price*
+## 💰 Bonus: *Accepting Tips above the Taco Purchase Price*
-If you'd like to accept tips in your contract as well, simply change the following line, depending on your preference.
+If you would like to accept tips in your contract, simply change the
+following line, depending on your preference.
**Without tips**
+
```pascaligo skip
if amount =/= current_purchase_price then
```
**With tips**
+
```pascaligo skip
if amount >= current_purchase_price then
```
diff --git a/gitlab-pages/examples/counter.ligo b/gitlab-pages/examples/counter.ligo
deleted file mode 100644
index 45ce7462a..000000000
--- a/gitlab-pages/examples/counter.ligo
+++ /dev/null
@@ -1,10 +0,0 @@
-type action is
-| Increment of int
-| Decrement of int
-
-function main (const p : action ; const s : int) : (list(operation) * int) is
- block {skip} with ((nil : list(operation)),
- case p of
- | Increment n -> s + n
- | Decrement n -> s - n
- end)
diff --git a/gitlab-pages/examples/functions.ligo b/gitlab-pages/examples/functions.ligo
deleted file mode 100644
index 4f8e4dae1..000000000
--- a/gitlab-pages/examples/functions.ligo
+++ /dev/null
@@ -1,10 +0,0 @@
-function multiply (const a : int ; const b : int) : int is
- begin
- const result : int = a * b ;
- end with result
-
-function add (const a : int ; const b : int) : int is
- block { skip } with a + b
-
-function main (const p : unit ; const s : unit) : (list(operation) * unit) is
- block {skip} with ((nil : list(operation)), s)
\ No newline at end of file
diff --git a/gitlab-pages/examples/multiple-entrypoints.ligo b/gitlab-pages/examples/multiple-entrypoints.ligo
deleted file mode 100644
index 3b77ff009..000000000
--- a/gitlab-pages/examples/multiple-entrypoints.ligo
+++ /dev/null
@@ -1,16 +0,0 @@
-type action is
-| Increment of int
-| Decrement of int
-
-function add (const a : int ; const b : int) : int is
- block { skip } with a + b
-
-function subtract (const a : int ; const b : int) : int is
- block { skip } with a - b
-
-function main (const p : action ; const s : int) : (list(operation) * int) is
- block {skip} with ((nil : list(operation)),
- case p of
- | Increment n -> add(s, n)
- | Decrement n -> subtract(s, n)
- end)
diff --git a/gitlab-pages/examples/variables.ligo b/gitlab-pages/examples/variables.ligo
deleted file mode 100644
index 09254da96..000000000
--- a/gitlab-pages/examples/variables.ligo
+++ /dev/null
@@ -1,5 +0,0 @@
-const four : int = 4;
-const name : string = "John Doe";
-
-function main (const p : unit ; const s : unit) : (list(operation) * unit) is
- block {skip} with ((nil : list(operation)), s)
\ No newline at end of file
diff --git a/gitlab-pages/owner.pp.ligo b/gitlab-pages/owner.pp.ligo
deleted file mode 100644
index e69de29bb..000000000
diff --git a/gitlab-pages/timestamp.pp.ligo b/gitlab-pages/timestamp.pp.ligo
deleted file mode 100644
index e69de29bb..000000000
diff --git a/gitlab-pages/website/.gitignore b/gitlab-pages/website/.gitignore
new file mode 100644
index 000000000..1b34df512
--- /dev/null
+++ b/gitlab-pages/website/.gitignore
@@ -0,0 +1,20 @@
+# dependencies
+/node_modules
+
+# production
+/build
+
+# generated files
+.docusaurus
+.cache-loader
+
+# misc
+.DS_Store
+.env.local
+.env.development.local
+.env.test.local
+.env.production.local
+
+npm-debug.log*
+yarn-debug.log*
+yarn-error.log*
\ No newline at end of file
diff --git a/gitlab-pages/website/blog/2019-06-13-public-launch-of-ligo.md b/gitlab-pages/website/blog/2019-06-13-public-launch-of-ligo.md.old
similarity index 100%
rename from gitlab-pages/website/blog/2019-06-13-public-launch-of-ligo.md
rename to gitlab-pages/website/blog/2019-06-13-public-launch-of-ligo.md.old
diff --git a/gitlab-pages/website/blog/2019-07-11-ligo-update.md b/gitlab-pages/website/blog/2019-07-11-ligo-update.md.old
similarity index 100%
rename from gitlab-pages/website/blog/2019-07-11-ligo-update.md
rename to gitlab-pages/website/blog/2019-07-11-ligo-update.md.old
diff --git a/gitlab-pages/website/core/CodeExamples.js b/gitlab-pages/website/core/CodeExamples.js
index 9cdf27c1c..289d14a73 100644
--- a/gitlab-pages/website/core/CodeExamples.js
+++ b/gitlab-pages/website/core/CodeExamples.js
@@ -1,8 +1,12 @@
-const React = require('react');
+import React from 'react';
+import Highlight, { defaultProps } from "prism-react-renderer";
+import Tabs from '@theme/Tabs';
+import TabItem from '@theme/TabItem';
+import useThemeContext from '@theme/hooks/useThemeContext';
+import defaultTheme from 'prism-react-renderer/themes/palenight';
+import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
-const pre = '```';
-
-const PASCALIGO_EXAMPLE = `${pre}pascaligo
+const PASCALIGO_EXAMPLE = `
type storage is int
type parameter is
@@ -14,8 +18,11 @@ type return is list (operation) * storage
// Two entrypoints
-function add (const store : storage; const delta : int) : storage is store + delta
-function sub (const store : storage; const delta : int) : storage is store - delta
+function add (const store : storage; const delta : int) : storage is
+ store + delta
+
+function sub (const store : storage; const delta : int) : storage is
+ store - delta
(* Main access point that dispatches to the entrypoints according to
the smart contract parameter. *)
@@ -27,9 +34,9 @@ function main (const action : parameter; const store : storage) : return is
| Decrement (n) -> sub (store, n)
| Reset -> 0
end)
-${pre}`;
+`;
-const CAMELIGO_EXAMPLE = `${pre}ocaml
+const CAMELIGO_EXAMPLE = `
type storage = int
type parameter =
@@ -53,10 +60,10 @@ let main (action, store : parameter * storage) : return =
Increment (n) -> add (store, n)
| Decrement (n) -> sub (store, n)
| Reset -> 0)
-${pre}`;
+`;
-const REASONLIGO_EXAMPLE = `${pre}reasonligo
+const REASONLIGO_EXAMPLE = `
type storage = int;
type parameter =
@@ -81,40 +88,82 @@ let main = ((action, store) : (parameter, storage)) : return => {
| Decrement (n) => sub ((store, n))
| Reset => 0}))
};
-${pre}`;
+`;
-module.exports = props => {
- const MarkdownBlock = props.MarkdownBlock;
+function CodeExamples (props) {
+ const {
+ siteConfig: {
+ themeConfig: {prism = {}},
+ },
+ } = useDocusaurusContext();
+ const {isDarkTheme} = useThemeContext();
+ const lightModeTheme = prism.theme || defaultTheme;
+ const darkModeTheme = prism.darkTheme || lightModeTheme;
+ const prismTheme = isDarkTheme ? darkModeTheme : lightModeTheme;
return (
-
-
-
- PascaLIGO
-
-
- CameLIGO
-
-
- ReasonLIGO
-
-
-
-
- {PASCALIGO_EXAMPLE}
-
-
- {CAMELIGO_EXAMPLE}
-
-
- {REASONLIGO_EXAMPLE}
-
-
-
+
+
+
+
+ {({ className, style, tokens, getLineProps, getTokenProps }) => (
+
+ {tokens.map((line, i) => (
+
+ {line.map((token, key) => (
+
+ ))}
+
+ ))}
+
+ )}
+
+
+
+
+
+ {({ className, style, tokens, getLineProps, getTokenProps }) => (
+
+ {tokens.map((line, i) => (
+
+ {line.map((token, key) => (
+
+ ))}
+
+ ))}
+
+ )}
+
+
+
+
+
+ {({ className, style, tokens, getLineProps, getTokenProps }) => (
+
+ {tokens.map((line, i) => (
+
+ {line.map((token, key) => (
+
+ ))}
+
+ ))}
+
+ )}
+
+
+
+
+
+
);
};
+
+export default CodeExamples
\ No newline at end of file
diff --git a/gitlab-pages/website/core/Footer.js b/gitlab-pages/website/core/Footer.js
index c40de4b0a..3aae1cda0 100644
--- a/gitlab-pages/website/core/Footer.js
+++ b/gitlab-pages/website/core/Footer.js
@@ -1,3 +1,5 @@
+// deprecated.
+
const React = require('react');
const docUrl = require(`${process.cwd()}/core/UrlUtils`).docUrl;
diff --git a/gitlab-pages/website/docusaurus.config.js b/gitlab-pages/website/docusaurus.config.js
new file mode 100644
index 000000000..5fd7c6ddd
--- /dev/null
+++ b/gitlab-pages/website/docusaurus.config.js
@@ -0,0 +1,226 @@
+
+const repoUrl = 'https://gitlab.com/ligolang/ligo';
+
+// let reasonHighlightJs = require('reason-highlightjs');
+
+const siteConfig = {
+ title: 'LIGO', // Title for your website.
+ tagline: 'LIGO is a friendly smart contract language for Tezos',
+ // taglineSub: 'Michelson was never so easy',
+ url: 'https://ligolang.org', // Your website URL
+ baseUrl: '/', // Base URL for your project */
+ // For github.io type URLs, you would set the url and baseUrl like:
+ // url: 'https://facebook.github.io',
+ // baseUrl: '/test-site/',
+
+ // Used for publishing and more
+ projectName: 'ligo',
+ organizationName: 'TBN',
+ // For top-level user or org sites, the organization is still the same.
+ // e.g., for the https://JoelMarcey.github.io site, it would be set like...
+ // organizationName: 'JoelMarcey'
+
+ // For no header links in the top nav bar -> headerLinks: [],
+
+
+ // footerLinks: {
+ // docs: [
+ // { doc: 'intro/installation', label: 'Install' },
+ // { doc: 'api/cli-commands', label: 'CLI Commands' },
+ // { doc: 'contributors/origin', label: 'Contribute' },
+ // { href: '/odoc', label: 'API Documentation' }
+ // ],
+ // community: [
+ // {
+ // href: 'https://forum.tezosagora.org/tag/ligo',
+ // label: 'Tezos Agora Forum',
+ // blankTarget: true
+ // },
+ // {
+ // href: 'https://tezos.stackexchange.com/questions/tagged/ligo',
+ // label: 'Tezos Stack Exchange',
+ // blankTarget: true
+ // },
+ // {
+ // href: 'https://t.me/LigoLang',
+ // label: 'Telegram',
+ // blankTarget: true
+ // },
+ // {
+ // href: 'https://discord.gg/9rhYaEt',
+ // label: 'Discord',
+ // blankTarget: true
+ // }
+ // ],
+ // more: [
+ // {
+ // doc: 'tutorials/get-started/tezos-taco-shop-smart-contract',
+ // label: 'Tutorials'
+ // },
+ // { href: repoUrl, label: 'GitLab' }
+ // ]
+ // },
+
+ favicon: 'img/circle.svg',
+
+ /* highlight: {
+ // Highlight.js theme to use for syntax highlighting in code blocks.
+ theme: 'default',
+ hljs: function (hljs) {
+ hljs.registerLanguage('reasonligo', reasonHighlightJs);
+ hljs.registerLanguage('pascaligo', function (hljs) {
+ return {
+ // case_insensitive: true,
+ beginKeywords: '',
+ keywords: {
+ keyword:
+ 'and attributes begin big_map block case const contains else'
+ + ' end False for from function if in is list map mod nil'
+ + ' not of or patch record remove set skip then to True type'
+ + ' var while with',
+ literal: 'true false unit int string Some None bool nat list'
+ },
+ lexemes: '[a-zA-Z][a-zA-Z0-9_]*',
+ contains: [
+ hljs.C_LINE_COMMENT_MODE,
+
+ {
+ className: 'type',
+ begin: /[A-Z][a-z]+/
+ },
+ {
+ begin: /[*+-:;\(\)\{\}|\>\<]/
+ // className: 'ignore'
+ }
+ ]
+ };
+ });
+ }
+ },*/
+
+ // Add custom scripts here that would be placed in