doc/ref: added field attributes

Field attributes are like Go struct tags.

Attributes are needed for maintaining meta data for mapping
CUE to other languages like protobuf, Go, XML, and even JSON,
as well as preserving information when converting such languages
to CUE.

This proposal does not use back quotes for tags, like Go,
as this would be ambiguous if back quotes are used as
identifier literals.

The use of @ has a precedence in other languages, like Swift.

Change-Id: I618caad6b43d598a7462872c484509be9b00047f
Reviewed-on: https://cue-review.googlesource.com/c/cue/+/1662
Reviewed-by: Marcel van Lohuizen <mpvl@google.com>
diff --git a/cue/ast.go b/cue/ast.go
index 9bfc98e..b6924b4 100644
--- a/cue/ast.go
+++ b/cue/ast.go
@@ -280,12 +280,16 @@
 			}
 
 		case *ast.BasicLit, *ast.Ident:
+			attrs, err := createAttrs(v.ctx(), newNode(n), n.Attrs)
+			if err != nil {
+				return err
+			}
 			f, ok := v.nodeLabel(x)
 			if !ok {
 				return v.error(n.Label, "invalid field name: %v", n.Label)
 			}
 			if f != 0 {
-				v.object.insertValue(v.ctx(), f, v.walk(n.Value))
+				v.object.insertValue(v.ctx(), f, v.walk(n.Value), attrs)
 			}
 
 		default: