Commit 5eb36240 authored by Robert Griesemer's avatar Robert Griesemer

- added syntax for conversions (was missing)

- added TODO for syntax for built-ins (require type as first argument)
- removed duplicate definition of Index

DELTA=13  (11 added, 1 deleted, 1 changed)
OCL=34668
CL=34688
parent 0ee18ca8
...@@ -1809,7 +1809,6 @@ ElementList = Element { "," Element } [ "," ] . ...@@ -1809,7 +1809,6 @@ ElementList = Element { "," Element } [ "," ] .
Element = [ Key ":" ] Value . Element = [ Key ":" ] Value .
Key = FieldName | Index . Key = FieldName | Index .
FieldName = identifier . FieldName = identifier .
Index = Expression .
Value = Expression . Value = Expression .
</pre> </pre>
...@@ -1996,6 +1995,7 @@ as they are accessible. ...@@ -1996,6 +1995,7 @@ as they are accessible.
<pre class="ebnf"> <pre class="ebnf">
PrimaryExpr = PrimaryExpr =
Operand | Operand |
Conversion |
PrimaryExpr Selector | PrimaryExpr Selector |
PrimaryExpr Index | PrimaryExpr Index |
PrimaryExpr Slice | PrimaryExpr Slice |
...@@ -3906,7 +3906,7 @@ space allocated in the underlying array (for a slice) or map. For a slice ...@@ -3906,7 +3906,7 @@ space allocated in the underlying array (for a slice) or map. For a slice
Conversions look like function calls of the form Conversions look like function calls of the form
</p> </p>
<pre class="grammar"> <pre>
T(value) T(value)
</pre> </pre>
...@@ -3915,6 +3915,12 @@ where <code>T</code> is a type ...@@ -3915,6 +3915,12 @@ where <code>T</code> is a type
and <code>value</code> is an expression and <code>value</code> is an expression
that can be converted to a value that can be converted to a value
of result type <code>T</code>. of result type <code>T</code>.
</p>
<pre class="ebnf">
Conversion = ( TypeName | "(" Type ")" ) Expression .
</pre>
<p> <p>
The following conversion rules apply: The following conversion rules apply:
</p> </p>
...@@ -4058,6 +4064,10 @@ c := make(chan int, 10); # channel with a buffer size of 10 ...@@ -4058,6 +4064,10 @@ c := make(chan int, 10); # channel with a buffer size of 10
m := make(map[string] int, 100); # map with initial space for 100 elements m := make(map[string] int, 100); # map with initial space for 100 elements
</pre> </pre>
<p>
<font color=red>TODO: Need syntax that permits a type as first argument for built-ins.</font>
</p>
<hr/> <hr/>
<h2 id="Packages">Packages</h2> <h2 id="Packages">Packages</h2>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment