Mercurial Hosting > luan
comparison website/src/manual.html.luan @ 604:b73f005f3735 0.13
table constructor now uses end_of_line as a delimiter
| author | Franklin Schmidt <fschmidt@gmail.com> |
|---|---|
| date | Tue, 24 Nov 2015 16:29:27 -0700 |
| parents | 97c8ae330efe |
| children | 53a50c70c5e2 |
comparison
equal
deleted
inserted
replaced
| 603:862d6bb8124c | 604:b73f005f3735 |
|---|---|
| 524 | 524 |
| 525 <p> | 525 <p> |
| 526 Luan ignores spaces and comments | 526 Luan ignores spaces and comments |
| 527 between lexical elements (tokens), | 527 between lexical elements (tokens), |
| 528 except as delimiters between names and keywords. | 528 except as delimiters between names and keywords. |
| 529 Luan generally considers the end of a line to be the end of a statement. This catches errors and encourages readability. The exception to this is in paranthesis ( <em>(...)</em>, <em>[...]</em>, and <em>{...}</em> ) where the end of line is treated as white space. | 529 Luan generally considers the end of a line to be the end of a statement. This catches errors and encourages readability. The exception to this is in paranthesis <em>(...)</em> where the end of line is treated as white space. |
| 530 | 530 |
| 531 <p> | 531 <p> |
| 532 <em>Names</em> | 532 <em>Names</em> |
| 533 (also called <em>identifiers</em>) | 533 (also called <em>identifiers</em>) |
| 534 in Luan can be any string of letters, | 534 in Luan can be any string of letters, |
| 1421 A constructor can be used to create an empty table | 1421 A constructor can be used to create an empty table |
| 1422 or to create a table and initialize some of its fields. | 1422 or to create a table and initialize some of its fields. |
| 1423 The general syntax for constructors is | 1423 The general syntax for constructors is |
| 1424 | 1424 |
| 1425 <pre> | 1425 <pre> |
| 1426 tableconstructor ::= ‘<b>{</b>’ [fieldlist] ‘<b>}</b>’ | 1426 tableconstructor ::= ‘<b>{</b>’ fieldlist ‘<b>}</b>’ |
| 1427 fieldlist ::= field {fieldsep field} [fieldsep] | 1427 fieldlist ::= [field] {fieldsep [field]} |
| 1428 field ::= ‘<b>[</b>’ exp ‘<b>]</b>’ ‘<b>=</b>’ exp | Name ‘<b>=</b>’ exp | exp | 1428 field ::= ‘<b>[</b>’ exp ‘<b>]</b>’ ‘<b>=</b>’ exp | Name ‘<b>=</b>’ exp | exp |
| 1429 fieldsep ::= ‘<b>,</b>’ | ‘<b>;</b>’ | 1429 fieldsep ::= ‘<b>,</b>’ | ‘<b>;</b>’ | <b>end_of_line</b> |
| 1430 </pre> | 1430 </pre> |
| 1431 | 1431 |
| 1432 <p> | 1432 <p> |
| 1433 Each field of the form <code>[exp1] = exp2</code> adds to the new table an entry | 1433 Each field of the form <code>[exp1] = exp2</code> adds to the new table an entry |
| 1434 with key <code>exp1</code> and value <code>exp2</code>. | 1434 with key <code>exp1</code> and value <code>exp2</code>. |
