DOCS: Add quoted fields for tuples to the documentation.

This commit is contained in:
Jeremy Wall 2018-11-25 12:44:04 -06:00
parent 89694f957e
commit 9524cd9d25
2 changed files with 9 additions and 0 deletions

View File

@ -32,6 +32,7 @@ let tuple = {
field = "value", field = "value",
}, },
list = [1, 2, 3], list = [1, 2, 3],
"quoted field" = "quoted value",
}; };
// reference the field in the inner tuple in our tuple defined above. // reference the field in the inner tuple in our tuple defined above.
@ -41,6 +42,12 @@ tuple.inner.field;
tuple.list.0; tuple.list.0;
``` ```
Selectors can quote fields in the selector if there are quoted fields with spaces in them.
```
tuple."quoted field";
```
### The environment Selector ### The environment Selector
There is a special selector in ucg for obtaining a value from the environment. There is a special selector in ucg for obtaining a value from the environment.

View File

@ -65,6 +65,7 @@ UCG also has two complex types.
Tuples are an ordered set of name value pairs. They are delimited by braces and should Tuples are an ordered set of name value pairs. They are delimited by braces and should
contain 1 or more `name = expression` pairs separated by commas. Trailing commas are allowed. contain 1 or more `name = expression` pairs separated by commas. Trailing commas are allowed.
Field names can be barewords with no spaces or they can be quoted strings.
``` ```
let tuple = { let tuple = {
@ -72,6 +73,7 @@ let tuple = {
inner = { inner = {
number = 1, number = 1,
}, },
"quoted field" = "quotd value",
}; };
``` ```