-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
QualifiedName is now composed of a base name and an indirection expression. Elements in an indirection expression are either ".<name>", ".*" or "[<begin>:<end>]". Fixes #1810.
- Loading branch information
1 parent
f25413d
commit b7b792b
Showing
21 changed files
with
5,993 additions
and
5,924 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
// Copyright 2015 The Cockroach Authors. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or | ||
// implied. See the License for the specific language governing | ||
// permissions and limitations under the License. See the AUTHORS file | ||
// for names of contributors. | ||
// | ||
// Author: Peter Mattis ([email protected]) | ||
|
||
package parser | ||
|
||
import ( | ||
"bytes" | ||
"fmt" | ||
) | ||
|
||
// IndirectionElem is a single element in an indirection expression. | ||
type IndirectionElem interface { | ||
indirectionElem() | ||
String() string | ||
} | ||
|
||
func (NameIndirection) indirectionElem() {} | ||
func (StarIndirection) indirectionElem() {} | ||
func (*ArrayIndirection) indirectionElem() {} | ||
|
||
// Indirection represents an indirection expression composed of a series of | ||
// indirection elements. | ||
type Indirection []IndirectionElem | ||
|
||
func (i Indirection) String() string { | ||
var buf bytes.Buffer | ||
for _, e := range i { | ||
_, _ = buf.WriteString(e.String()) | ||
} | ||
return buf.String() | ||
} | ||
|
||
// NameIndirection represents ".<name>" in an indirection expression. | ||
type NameIndirection Name | ||
|
||
func (n NameIndirection) String() string { | ||
return fmt.Sprintf(".%s", Name(n)) | ||
} | ||
|
||
// StarIndirection represents ".*" in an indirection expression. | ||
type StarIndirection struct{} | ||
|
||
func (StarIndirection) String() string { | ||
return ".*" | ||
} | ||
|
||
// ArrayIndirection represents "[<begin>:<end>]" in an indirection expression. | ||
type ArrayIndirection struct { | ||
Begin Expr | ||
End Expr | ||
} | ||
|
||
func (a *ArrayIndirection) String() string { | ||
var buf bytes.Buffer | ||
_, _ = buf.WriteString("[") | ||
_, _ = buf.WriteString(a.Begin.String()) | ||
if a.End != nil { | ||
_, _ = buf.WriteString(":") | ||
_, _ = buf.WriteString(a.End.String()) | ||
} | ||
_, _ = buf.WriteString("]") | ||
return buf.String() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.