Mercurial Hosting > luan
changeset 1645:0af6a9d6d12f
minor - keywords
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Thu, 03 Mar 2022 22:41:07 -0700 |
parents | 5c676385284b |
children | 1828ed4ee75d |
files | src/luan/impl/LuanParser.java website/src/diff.html website/src/manual.html |
diffstat | 3 files changed, 56 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/src/luan/impl/LuanParser.java Sat Jan 29 18:33:18 2022 -0700 +++ b/src/luan/impl/LuanParser.java Thu Mar 03 22:41:07 2022 -0700 @@ -1544,7 +1544,7 @@ "finally", "for", "function", - "goto", +// "goto", "if", "in", "local", @@ -1555,6 +1555,7 @@ "return", "then", "true", + "try", "until", "while" ));
--- a/website/src/diff.html Sat Jan 29 18:33:18 2022 -0700 +++ b/website/src/diff.html Thu Mar 03 22:41:07 2022 -0700 @@ -138,6 +138,8 @@ <p>The Luan <b>if</b>, <b>while</b>, and <b>repeat</b> statement are the same as in Lua except that the condition expression must return a boolean value. Any other value type will produce an error. This helps catch errors and makes code more readable.</p> +<p>Luan adds the <b>continue</b> statement which is used inside loops.</p> + <p>Luan does not have a <b>goto</b> statement.</p> <h4 heading><a name="for" href="#for">For Statement</a></h4>
--- a/website/src/manual.html Sat Jan 29 18:33:18 2022 -0700 +++ b/website/src/manual.html Thu Mar 03 22:41:07 2022 -0700 @@ -5,6 +5,16 @@ <meta name="viewport" content="width=device-width, initial-scale=1"> <style> @import "site.css"; + + p[keywords] { + font-family: monospace; + margin-left: 40px; + max-width: 700px; + } + p[keywords] span { + display: inline-block; + width: 100px; + } </style> </head> <body> @@ -530,13 +540,38 @@ and cannot be used as names: -<pre> - and break do else elseif end - end_do end_for end_function end_if end_while - false for function goto if in - local nil not or repeat return - then true until while -</pre> +<p keywords> + <span>and</span> + <span>break</span> + <span>catch</span> + <span>continue</span> + <span>do</span> + <span>else</span> + <span>elseif</span> + <span>end_do</span> + <span>end_for</span> + <span>end_function</span> + <span>end_if</span> + <span>end_try</span> + <span>end_while</span> + <span>false</span> + <span>finally</span> + <span>for</span> + <span>function</span> + <span>if</span> + <span>in</span> + <span>local</span> + <span>nil</span> + <span>not</span> + <span>or</span> + <span>repeat</span> + <span>return</span> + <span>then</span> + <span>true</span> + <span>try</span> + <span>until</span> + <span>while</span> +</p> <p> Luan is a case-sensitive language: @@ -952,7 +987,6 @@ <b>while</b>, <b>repeat</b>, or <b>for</b> loop, skipping to the next statement after the loop: - <pre> stat ::= <b>break</b> </pre> @@ -962,6 +996,16 @@ <p> +The <b>continue</b> statement jumps to the beginning of a +<b>while</b>, <b>repeat</b>, or <b>for</b> loop for next iteration, +skipping the execution of statements inside the body of loop for the current iteration: + +<pre> + stat ::= <b>continue</b> +</pre> + + +<p> The <b>return</b> statement is used to return values from a function or a chunk (which is an anonymous function).