Skip to content

Commit

Permalink
SQUASHME docs/yul: replace all code with code-block
Browse files Browse the repository at this point in the history
Surfaced:

    Warning, treated as error:
    /root/project/docs/yul.rst:130:Could not lex literal_block as "yul". Highlighting skipped.

Line 130 is the JSON code block. :/

Strange: is this because of `highlight` being `yul` instead of
`Yul`?..
  • Loading branch information
veox committed Apr 26, 2020
1 parent 2216da2 commit bbcc396
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions docs/yul.rst
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ This will use the :ref:`Yul object notation <yul-object>` so that it is possible
to code as data to deploy contracts. This Yul mode is available for the commandline compiler
(use ``--strict-assembly``) and for the :ref:`standard-json interface <compiler-api>`:

.. code:: json
.. code-block:: json
{
"language": "Yul",
Expand Down Expand Up @@ -182,14 +182,14 @@ bitwise ``and`` with the string "abc" is computed.
The final value is assigned to a local variable called ``x``.
Strings are stored left-aligned and cannot be longer than 32 bytes.

.. code::
.. code-block::
let x := and("abc", add(3, 2))
Unless it is the default type, the type of a literal
has to be specified after a colon:

.. code::
.. code-block::
let x := and("abc":uint32, add(3:uint256, 2:uint256))
Expand All @@ -203,7 +203,7 @@ If the function returns a single value, it can be directly used
inside an expression again. If it returns multiple values,
they have to be assigned to local variables.

.. code::
.. code-block::
mstore(0x80, add(mload(0x80), 3))
// Here, the user-defined function `f` returns
Expand Down Expand Up @@ -244,7 +244,7 @@ Future dialects migh introduce specific types for such pointers.
When a variable is referenced, its current value is copied.
For the EVM, this translates to a ``DUP`` instruction.

.. code::
.. code-block::
{
let zero := 0
Expand All @@ -262,7 +262,7 @@ you denote that following a colon. You can also declare multiple
variables in one statement when you assign from a function call
that returns multiple values.

.. code::
.. code-block::
{
let zero:uint32 := 0:uint32
Expand All @@ -285,7 +285,7 @@ values have to match.
If you want to assign the values returned from a function that has
multiple return parameters, you have to provide multiple variables.

.. code::
.. code-block::
let v := 0
// re-assign v
Expand All @@ -303,7 +303,7 @@ The if statement can be used for conditionally executing code.
No "else" block can be defined. Consider using "switch" instead (see below) if
you need multiple alternatives.

.. code::
.. code-block::
if eq(value, 0) { revert(0, 0) }
Expand All @@ -319,7 +319,7 @@ Contrary to other programming languages, for safety reasons, control flow does
not continue from one case to the next. There can be a fallback or default
case called ``default`` which is taken if none of the literal constants matches.

.. code::
.. code-block::
{
let x := 0
Expand Down Expand Up @@ -351,7 +351,7 @@ or skip to the post-part, respectively.

The following example computes the sum of an area in memory.

.. code::
.. code-block::
{
let x := 0
Expand All @@ -363,7 +363,7 @@ The following example computes the sum of an area in memory.
For loops can also be used as a replacement for while loops:
Simply leave the initialization and post-iteration parts empty.

.. code::
.. code-block::
{
let x := 0
Expand Down Expand Up @@ -406,7 +406,7 @@ the current yul function.

The following example implements the power function by square-and-multiply.

.. code::
.. code-block::
{
function power(base, exponent) -> result {
Expand Down Expand Up @@ -929,7 +929,7 @@ Above, ``Block`` refers to ``Block`` in the Yul code grammar explained in the pr

An example Yul Object is shown below:

.. code::
.. code-block::
// A contract consists of a single object with sub-objects representing
// the code to be deployed or other contracts it can create.
Expand Down Expand Up @@ -1012,7 +1012,7 @@ for more details about its internals.

If you want to use Solidity in stand-alone Yul mode, you activate the optimizer using ``--optimize``:

.. code:: sh
.. code-block:: sh
solc --strict-assembly --optimize
Expand Down

0 comments on commit bbcc396

Please sign in to comment.