aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/grammar.txt
diff options
context:
space:
mode:
authorRhett Aultman <roadriverrail@gmail.com>2016-07-30 15:13:05 +0800
committerRhett Aultman <roadriverrail@gmail.com>2016-11-10 23:07:25 +0800
commit4524ad08701939cc22d28494c57dda1cdfba9e10 (patch)
tree70ff8928bf6a84f50e2ca54d355be81db01e7bcd /libsolidity/grammar.txt
parentdc8a5f4ef5505f2aeb017dfa4c9aca77a9fd93aa (diff)
downloaddexon-solidity-4524ad08701939cc22d28494c57dda1cdfba9e10.tar.gz
dexon-solidity-4524ad08701939cc22d28494c57dda1cdfba9e10.tar.zst
dexon-solidity-4524ad08701939cc22d28494c57dda1cdfba9e10.zip
Add support for do/while loops
This commit adds support for a standard do <statement> while <expr>; form of statement. While loops were already being supported; supporting a do/while loop mostly involves reusing code from while loops but putting the conditional checking last.
Diffstat (limited to 'libsolidity/grammar.txt')
-rw-r--r--libsolidity/grammar.txt3
1 files changed, 2 insertions, 1 deletions
diff --git a/libsolidity/grammar.txt b/libsolidity/grammar.txt
index d84ee10c..586c41e9 100644
--- a/libsolidity/grammar.txt
+++ b/libsolidity/grammar.txt
@@ -41,7 +41,7 @@ ArrayTypeName = TypeName StorageLocation? '[' Expression? ']'
StorageLocation = 'memory' | 'storage'
Block = '{' Statement* '}'
-Statement = IfStatement | WhileStatement | ForStatement | Block |
+Statement = IfStatement | WhileStatement | DoWhileStatement | ForStatement | Block |
( PlaceholderStatement | Continue | Break | Return |
Throw | SimpleStatement ) ';'
@@ -51,6 +51,7 @@ WhileStatement = 'while' '(' Expression ')' Statement
PlaceholderStatement = '_'
SimpleStatement = VariableDefinition | ExpressionStatement
ForStatement = 'for' '(' (SimpleStatement)? ';' (Expression)? ';' (ExpressionStatement)? ')' Statement
+DoWhileStatement = 'do' Statement 'while' '(' Expression ')' ';'
Continue = 'continue'
Break = 'break'
Return = 'return' Expression?