@@ -24,7 +24,9 @@ function Read-YamlFlowNode {
2424 [AllowEmptyString ()]
2525 [string ] $PendingAnchor = ' ' ,
2626
27- [switch ] $InFlowCollection
27+ [switch ] $InFlowCollection ,
28+
29+ [switch ] $InImplicitKey
2830 )
2931
3032 Skip-YamlFlowTrivia - Cursor $Cursor - Context $Context
@@ -85,8 +87,9 @@ function Read-YamlFlowNode {
8587 -not (Test-YamlWhiteSpace - Character $Context.Text [$Cursor.Index ]) -and
8688 $Context.Text [$Cursor.Index ] -cne " `n " -and
8789 $Context.Text [$Cursor.Index ] -notin @ (' ,' , ' [' , ' ]' , ' {' , ' }' ) -and
88- -not ($InFlowCollection -and
89- (Test-YamlMappingValueIndicator - Text $Context.Text - Index $Cursor.Index - Flow))) {
90+ -not (($InFlowCollection -or $InImplicitKey ) -and
91+ (Test-YamlMappingValueIndicator - Text $Context.Text `
92+ - Index $Cursor.Index - Flow:$InFlowCollection ))) {
9093 Move-YamlCursor - Cursor $Cursor - Context $Context
9194 }
9295 $anchor = $Context.Text.Substring ($anchorStart , $Cursor.Index - $anchorStart )
@@ -133,8 +136,9 @@ function Read-YamlFlowNode {
133136 -not (Test-YamlWhiteSpace - Character $Context.Text [$Cursor.Index ]) -and
134137 $Context.Text [$Cursor.Index ] -cne " `n " -and
135138 $Context.Text [$Cursor.Index ] -notin @ (' ,' , ' [' , ' ]' , ' {' , ' }' ) -and
136- -not ($InFlowCollection -and
137- (Test-YamlMappingValueIndicator - Text $Context.Text - Index $Cursor.Index - Flow))) {
139+ -not (($InFlowCollection -or $InImplicitKey ) -and
140+ (Test-YamlMappingValueIndicator - Text $Context.Text `
141+ - Index $Cursor.Index - Flow:$InFlowCollection ))) {
138142 Move-YamlCursor - Cursor $Cursor - Context $Context
139143 }
140144 $alias = $Context.Text.Substring ($aliasStart , $Cursor.Index - $aliasStart )
@@ -192,7 +196,8 @@ function Read-YamlFlowNode {
192196 if ($Cursor.Index -lt $Context.Text.Length -and $Context.Text [$Cursor.Index ] -eq ' :' ) {
193197 if (-not $explicitPair -and (
194198 $Cursor.Line -ne $itemStartLine -or
195- (Get-YamlImplicitKeyLength - Node $item - Context $Context ) -gt 1024
199+ (Get-YamlImplicitKeyLength - Node $item - Context $Context `
200+ - EndIndex $Cursor.Index ) -gt 1024
196201 )) {
197202 $mark = New-YamlMark - Index $Cursor.Index - Line $Cursor.Line - Column $Cursor.Column
198203 throw (New-YamlException - Start $mark - End $mark - ErrorId ' YamlInvalidImplicitKey' - Message (
@@ -271,14 +276,6 @@ function Read-YamlFlowNode {
271276 }
272277 }
273278 Skip-YamlFlowTrivia - Cursor $Cursor - Context $Context
274- if (-not $explicit -and (
275- (Get-YamlImplicitKeyLength - Node $key - Context $Context ) -gt 1024
276- )) {
277- $mark = New-YamlMark - Index $Cursor.Index - Line $Cursor.Line - Column $Cursor.Column
278- throw (New-YamlException - Start $mark - End $mark - ErrorId ' YamlInvalidImplicitKey' - Message (
279- ' An implicit mapping key must fit on one line and cannot exceed 1024 Unicode scalar values.'
280- ))
281- }
282279 if ($Cursor.Index -ge $Context.Text.Length -or $Context.Text [$Cursor.Index ] -ne ' :' ) {
283280 if (-not $explicit ) {
284281 if ($Cursor.Index -lt $Context.Text.Length -and
0 commit comments