Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

more comments to syntax.go #723

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 15 additions & 6 deletions build/syntax.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ func (p Position) add(s string) Position {
return p
}

// An Expr represents an input element.
// An Expr represents an input element (things like, go_binary, java_library,
// and so on).
type Expr interface {
// Span returns the start and end position of the expression,
// excluding leading or trailing comments.
Expand Down Expand Up @@ -380,11 +381,19 @@ func (x *BinaryExpr) Span() (start, end Position) {
// An AssignExpr represents a binary expression with `=`: LHS = RHS.
type AssignExpr struct {
Comments
LHS Expr
OpPos Position
Op string
LineBreak bool // insert line break between Op and RHS
RHS Expr
// LHS is the left hand side operation. For example, if the expression is
// "default_visibility = [:foo]", the LHS is "default_visibility".
LHS Expr
// OpPos is the position of the Op.
OpPos Position
// Op is the operation of the expression. For example, if the expression
// is "default_visibility = [:foo]", the Op is "="".
Op string
// LineBreak is whether there is a linebreak between Op and RHS.
LineBreak bool
// RHS is the left hand side operation. For example, if the expression is
// "default_visibility = [:foo]", the RHS is "[:foo]".
RHS Expr
}

func (x *AssignExpr) Span() (start, end Position) {
Expand Down