Skip to content

Commit

Permalink
codeseparator
Browse files Browse the repository at this point in the history
  • Loading branch information
xhliu committed Feb 11, 2020
1 parent 9349b6b commit f949083
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion docs/syntax.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Formal Specification
&\ \ \ |\ \ \mathrm{if}\ (expr)\ stmt\ [\mathrm{else}\ stmt]\\
&\ \ \ |\ \ \mathrm{loop}\ (intConst)\ stmt\\
&\ \ \ |\ \ \{\ [stmt]^*\ \}\\
&\ \ \ |\ \ \mathrm{CODESEPARATOR}\\
expr &::= \mathsf{UnaryOp}\ expr\\
&\ \ \ |\ \ expr\ \mathsf{BinaryOp}\ expr\\
&\ \ \ |\ \ \mathrm{ID}(expr[,\ expr]^*)\\
Expand Down Expand Up @@ -118,7 +119,7 @@ exit()

.. code-block:: solidity
contract TestPositive {
contract TestSeparator {
int x;
constructor(int x) {
Expand All @@ -134,6 +135,26 @@ exit()
}
Code Separator
==============
Three or more ``*`` in a line inserts an `OP_CODESEPARATOR <https://en.bitcoin.it/wiki/OP_CHECKSIG#How_it_works>`_. It is used to exclude what comes before (and including itself) it from being part of the signature.
Note there is no ``;`` at the end.

.. code-block:: solidity
contract TestPositive {
public function equal(int y) {
int a = 0;
// separator 1
***
int b = 2;
// separator 2
*****
require(y > 0);
}
}
Operators
=========

Expand Down

0 comments on commit f949083

Please sign in to comment.