pulumi/pkg/workspace/settings.go
joeduffy 7b0dc8ee8d Overhaul names versus tokens
I was sloppy in my use of names versus tokens in the original AST.
Now that we're actually binding things to concrete symbols, etc., we
need to be more precise.  In particular, names are just identifiers
that must be "interpreted" in a given lexical context for them to
make any sense; whereas, tokens stand alone and can be resolved without
context other than the set of imported packages, modules, and overall
module structure.  As such, names are much simpler than tokens.

As explained in the comments, tokens.Names are simple identifiers:

    Name = [A-Za-z_][A-Za-z0-9_]*

and tokens.QNames are fully qualified identifiers delimited by "/":

    QName = [ <Name> "/" ]* <Name>

The legal grammar for a token depends on the subset of symbols that
token is meant to represent.  However, the most general case, that
accepts all specializations of tokens, is roughly as follows:

    Token       = <Name> |
                  <PackageName>
                    [ ":" <ModuleName>
                        [ "/" <ModuleMemberName>
                            [ "." <Class MemberName> ]
                        ]
                    ]

where:

    PackageName         = <QName>
    ModuleName          = <QName>
    ModuleMemberName    = <Name>
    ClassMemberName     = <Name>

Please refer to the comments in pkg/tokens/tokens.go for more details.
2017-01-19 17:57:20 -08:00

27 lines
890 B
Go

// Copyright 2016 Marapongo, Inc. All rights reserved.
package workspace
import (
"github.com/marapongo/mu/pkg/config"
"github.com/marapongo/mu/pkg/diag"
"github.com/marapongo/mu/pkg/pack"
)
// Workspace defines workspace settings shared amongst many related projects.
type Workspace struct {
Namespace string `json:"namespace,omitempty"` // an optional namespace for this workspace.
Clusters Clusters `json:"clusters,omitempty"` // an optional set of predefined target clusters.
Dependencies pack.Dependencies `json:"dependencies,omitempty"`
Doc *diag.Document `json:"-"` // the document from which this came.
}
var _ diag.Diagable = (*Workspace)(nil)
func (s *Workspace) Where() (*diag.Document, *diag.Location) {
return s.Doc, nil
}
// Clusters is a map of target names to metadata about those targets.
type Clusters map[string]*config.Cluster