Skip to content

Commit

Permalink
Merge pull request #776 from vmware-tanzu/v0.40.x-go-fmt
Browse files Browse the repository at this point in the history
Reformatting comments as per go fmt
  • Loading branch information
pivotaljohn authored Dec 5, 2022
2 parents f64d2ae + b76aa1a commit 9c3b305
Show file tree
Hide file tree
Showing 8 changed files with 139 additions and 121 deletions.
2 changes: 1 addition & 1 deletion pkg/schema/annotations.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ type TitleAnnotation struct {
pos *filepos.Position
}

//DeprecatedAnnotation is a wrapper for a value provided via @schema/deprecated annotation
// DeprecatedAnnotation is a wrapper for a value provided via @schema/deprecated annotation
type DeprecatedAnnotation struct {
notice string
pos *filepos.Position
Expand Down
2 changes: 1 addition & 1 deletion pkg/yamlmeta/internal/yaml.v2/apic.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ func yamlEmitterSetCanonical(emitter *yamlEmitterT, canonical bool) {
emitter.canonical = canonical
}

//// Set the indentation increment.
// // Set the indentation increment.
func yamlEmitterSetIndent(emitter *yamlEmitterT, indent int) {
if indent < 2 || indent > 9 {
indent = 2
Expand Down
7 changes: 3 additions & 4 deletions pkg/yamlmeta/internal/yaml.v2/emitterc.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,9 @@ func yamlEmitterEmit(emitter *yamlEmitterT, event *yamlEventT) bool {
// Check if we need to accumulate more events before emitting.
//
// We accumulate extra
// - 1 event for DOCUMENT-START
// - 2 events for SEQUENCE-START
// - 3 events for MAPPING-START
//
// - 1 event for DOCUMENT-START
// - 2 events for SEQUENCE-START
// - 3 events for MAPPING-START
func yamlEmitterNeedMoreEvents(emitter *yamlEmitterT) bool {
if emitter.eventsHead == len(emitter.events) {
return true
Expand Down
140 changes: 78 additions & 62 deletions pkg/yamlmeta/internal/yaml.v2/parserc.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,8 @@ func yamlParserStateMachine(parser *yamlParserT, event *yamlEventT) bool {

// Parse the production:
// stream ::= STREAM-START implicit_document? explicit_document* STREAM-END
// ************
//
// ************
func yamlParserParseStreamStart(parser *yamlParserT, event *yamlEventT) bool {
token := peekToken(parser)
if token == nil {
Expand All @@ -195,9 +196,12 @@ func yamlParserParseStreamStart(parser *yamlParserT, event *yamlEventT) bool {

// Parse the productions:
// implicit_document ::= block_node DOCUMENT-END*
// *
//
// *
//
// explicit_document ::= DIRECTIVE* DOCUMENT-START block_node? DOCUMENT-END*
// *************************
//
// *************************
func yamlParserParseDocumentStart(parser *yamlParserT, event *yamlEventT, implicit bool) bool {

token := peekToken(parser)
Expand Down Expand Up @@ -280,8 +284,8 @@ func yamlParserParseDocumentStart(parser *yamlParserT, event *yamlEventT, implic

// Parse the productions:
// explicit_document ::= DIRECTIVE* DOCUMENT-START block_node? DOCUMENT-END*
// ***********
//
// ***********
func yamlParserParseDocumentContent(parser *yamlParserT, event *yamlEventT) bool {
token := peekToken(parser)
if token == nil {
Expand All @@ -302,9 +306,10 @@ func yamlParserParseDocumentContent(parser *yamlParserT, event *yamlEventT) bool

// Parse the productions:
// implicit_document ::= block_node DOCUMENT-END*
// *************
// explicit_document ::= DIRECTIVE* DOCUMENT-START block_node? DOCUMENT-END*
//
// *************
//
// explicit_document ::= DIRECTIVE* DOCUMENT-START block_node? DOCUMENT-END*
func yamlParserParseDocumentEnd(parser *yamlParserT, event *yamlEventT) bool {
token := peekToken(parser)
if token == nil {
Expand Down Expand Up @@ -335,30 +340,41 @@ func yamlParserParseDocumentEnd(parser *yamlParserT, event *yamlEventT) bool {

// Parse the productions:
// block_node_or_indentless_sequence ::=
// ALIAS
// *****
// | properties (block_content | indentless_block_sequence)?
// ********** *
// | block_content | indentless_block_sequence
// *
//
// ALIAS
// *****
// | properties (block_content | indentless_block_sequence)?
// ********** *
// | block_content | indentless_block_sequence
// *
//
// block_node ::= ALIAS
// *****
// | properties block_content?
// ********** *
// | block_content
// *
//
// *****
// | properties block_content?
// ********** *
// | block_content
// *
//
// flow_node ::= ALIAS
// *****
// | properties flow_content?
// ********** *
// | flow_content
// *
//
// *****
// | properties flow_content?
// ********** *
// | flow_content
// *
//
// properties ::= TAG ANCHOR? | ANCHOR TAG?
// *************************
//
// *************************
//
// block_content ::= block_collection | flow_collection | SCALAR
// ******
//
// ******
//
// flow_content ::= flow_collection | SCALAR
// ******
//
// ******
func yamlParserParseNode(parser *yamlParserT, event *yamlEventT, block, indentlessSequence bool) bool {
//defer trace("yaml_parser_parse_node", "block:", block, "indentless_sequence:", indentless_sequence)()

Expand Down Expand Up @@ -577,8 +593,8 @@ func yamlParserParseNode(parser *yamlParserT, event *yamlEventT, block, indentle

// Parse the productions:
// block_sequence ::= BLOCK-SEQUENCE-START (BLOCK-ENTRY block_node?)* BLOCK-END
// ******************** *********** * *********
//
// ******************** *********** * *********
func yamlParserParseBlockSequenceEntry(parser *yamlParserT, event *yamlEventT, first bool) bool {
if first {
token := peekToken(parser)
Expand Down Expand Up @@ -633,7 +649,8 @@ func yamlParserParseBlockSequenceEntry(parser *yamlParserT, event *yamlEventT, f

// Parse the productions:
// indentless_sequence ::= (BLOCK-ENTRY block_node?)+
// *********** *
//
// *********** *
func yamlParserParseIndentlessSequenceEntry(parser *yamlParserT, event *yamlEventT) bool {
token := peekToken(parser)
if token == nil {
Expand Down Expand Up @@ -674,14 +691,14 @@ func yamlParserParseIndentlessSequenceEntry(parser *yamlParserT, event *yamlEven

// Parse the productions:
// block_mapping ::= BLOCK-MAPPING_START
// *******************
// ((KEY block_node_or_indentless_sequence?)?
// *** *
// (VALUE block_node_or_indentless_sequence?)?)*
//
// BLOCK-END
// *********
// *******************
// ((KEY block_node_or_indentless_sequence?)?
// *** *
// (VALUE block_node_or_indentless_sequence?)?)*
//
// BLOCK-END
// *********
func yamlParserParseBlockMappingKey(parser *yamlParserT, event *yamlEventT, first bool) bool {
if first {
token := peekToken(parser)
Expand Down Expand Up @@ -732,13 +749,11 @@ func yamlParserParseBlockMappingKey(parser *yamlParserT, event *yamlEventT, firs
// Parse the productions:
// block_mapping ::= BLOCK-MAPPING_START
//
// ((KEY block_node_or_indentless_sequence?)?
//
// (VALUE block_node_or_indentless_sequence?)?)*
// ***** *
// BLOCK-END
//
// ((KEY block_node_or_indentless_sequence?)?
//
// (VALUE block_node_or_indentless_sequence?)?)*
// ***** *
// BLOCK-END
func yamlParserParseBlockMappingValue(parser *yamlParserT, event *yamlEventT) bool {
token := peekToken(parser)
if token == nil {
Expand Down Expand Up @@ -766,16 +781,18 @@ func yamlParserParseBlockMappingValue(parser *yamlParserT, event *yamlEventT) bo

// Parse the productions:
// flow_sequence ::= FLOW-SEQUENCE-START
// *******************
// (flow_sequence_entry FLOW-ENTRY)*
// * **********
// flow_sequence_entry?
// *
// FLOW-SEQUENCE-END
// *****************
//
// *******************
// (flow_sequence_entry FLOW-ENTRY)*
// * **********
// flow_sequence_entry?
// *
// FLOW-SEQUENCE-END
// *****************
//
// flow_sequence_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)?
// *
//
// *
func yamlParserParseFlowSequenceEntry(parser *yamlParserT, event *yamlEventT, first bool) bool {
if first {
token := peekToken(parser)
Expand Down Expand Up @@ -842,11 +859,10 @@ func yamlParserParseFlowSequenceEntry(parser *yamlParserT, event *yamlEventT, fi
return true
}

//
// Parse the productions:
// flow_sequence_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)?
// *** *
//
// *** *
func yamlParserParseFlowSequenceEntryMappingKey(parser *yamlParserT, event *yamlEventT) bool {
token := peekToken(parser)
if token == nil {
Expand All @@ -866,8 +882,8 @@ func yamlParserParseFlowSequenceEntryMappingKey(parser *yamlParserT, event *yaml

// Parse the productions:
// flow_sequence_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)?
// ***** *
//
// ***** *
func yamlParserParseFlowSequenceEntryMappingValue(parser *yamlParserT, event *yamlEventT) bool {
token := peekToken(parser)
if token == nil {
Expand All @@ -890,8 +906,8 @@ func yamlParserParseFlowSequenceEntryMappingValue(parser *yamlParserT, event *ya

// Parse the productions:
// flow_sequence_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)?
// *
//
// *
func yamlParserParseFlowSequenceEntryMappingEnd(parser *yamlParserT, event *yamlEventT) bool {
token := peekToken(parser)
if token == nil {
Expand All @@ -908,16 +924,17 @@ func yamlParserParseFlowSequenceEntryMappingEnd(parser *yamlParserT, event *yaml

// Parse the productions:
// flow_mapping ::= FLOW-MAPPING-START
// ******************
// (flow_mapping_entry FLOW-ENTRY)*
// * **********
// flow_mapping_entry?
// ******************
// FLOW-MAPPING-END
// ****************
// flow_mapping_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)?
// * *** *
//
// ******************
// (flow_mapping_entry FLOW-ENTRY)*
// * **********
// flow_mapping_entry?
// ******************
// FLOW-MAPPING-END
// ****************
//
// flow_mapping_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)?
// - *** *
func yamlParserParseFlowMappingKey(parser *yamlParserT, event *yamlEventT, first bool) bool {
if first {
token := peekToken(parser)
Expand Down Expand Up @@ -981,8 +998,7 @@ func yamlParserParseFlowMappingKey(parser *yamlParserT, event *yamlEventT, first

// Parse the productions:
// flow_mapping_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)?
// * ***** *
//
// - ***** *
func yamlParserParseFlowMappingValue(parser *yamlParserT, event *yamlEventT, empty bool) bool {
token := peekToken(parser)
if token == nil {
Expand Down
34 changes: 18 additions & 16 deletions pkg/yamlmeta/internal/yaml.v2/scannerc.go
Original file line number Diff line number Diff line change
Expand Up @@ -1506,11 +1506,11 @@ func yamlParserScanToNextToken(parser *yamlParserT) bool {
// Scan a YAML-DIRECTIVE or TAG-DIRECTIVE token.
//
// Scope:
// %YAML 1.1 # a comment \n
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
// %TAG !yaml! tag:yaml.org,2002: \n
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
//
// %YAML 1.1 # a comment \n
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
// %TAG !yaml! tag:yaml.org,2002: \n
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
func yamlParserScanDirective(parser *yamlParserT, token *yamlTokenT) bool {
// Eat '%'.
startMark := parser.mark
Expand Down Expand Up @@ -1607,11 +1607,11 @@ func yamlParserScanDirective(parser *yamlParserT, token *yamlTokenT) bool {
// Scan the directive name.
//
// Scope:
// %YAML 1.1 # a comment \n
// ^^^^
// %TAG !yaml! tag:yaml.org,2002: \n
// ^^^
//
// %YAML 1.1 # a comment \n
// ^^^^
// %TAG !yaml! tag:yaml.org,2002: \n
// ^^^
func yamlParserScanDirectiveName(parser *yamlParserT, startMark yamlMarkT, name *[]byte) bool {
// Consume the directive name.
if parser.unread < 1 && !yamlParserUpdateBuffer(parser, 1) {
Expand Down Expand Up @@ -1646,8 +1646,9 @@ func yamlParserScanDirectiveName(parser *yamlParserT, startMark yamlMarkT, name
// Scan the value of VERSION-DIRECTIVE.
//
// Scope:
// %YAML 1.1 # a comment \n
// ^^^^^^
//
// %YAML 1.1 # a comment \n
// ^^^^^^
func yamlParserScanVersionDirectiveValue(parser *yamlParserT, startMark yamlMarkT, major, minor *int8) bool {
// Eat whitespaces.
if parser.unread < 1 && !yamlParserUpdateBuffer(parser, 1) {
Expand Down Expand Up @@ -1685,10 +1686,11 @@ const maxNumberLength = 2
// Scan the version number of VERSION-DIRECTIVE.
//
// Scope:
// %YAML 1.1 # a comment \n
// ^
// %YAML 1.1 # a comment \n
// ^
//
// %YAML 1.1 # a comment \n
// ^
// %YAML 1.1 # a comment \n
// ^
func yamlParserScanVersionDirectiveNumber(parser *yamlParserT, startMark yamlMarkT, number *int8) bool {

// Repeat while the next character is digit.
Expand Down Expand Up @@ -1722,9 +1724,9 @@ func yamlParserScanVersionDirectiveNumber(parser *yamlParserT, startMark yamlMar
// Scan the value of a TAG-DIRECTIVE token.
//
// Scope:
// %TAG !yaml! tag:yaml.org,2002: \n
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
//
// %TAG !yaml! tag:yaml.org,2002: \n
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
func yamlParserScanTagDirectiveValue(parser *yamlParserT, startMark yamlMarkT, handle, prefix *[]byte) bool {
var handleValue, prefixValue []byte

Expand Down
Loading

0 comments on commit 9c3b305

Please sign in to comment.