@@ -51,16 +51,16 @@ function Read-YamlStreamCore {
5151 $implicitDocumentSeen = $false
5252
5353 while ($context.LineIndex -lt $lines.Count ) {
54- Read-YamlDocumentByteOrderMark - Context $context
55- Skip-YamlBlockTrivia - Context $context
54+ Skip-YamlDocumentPrefix - Context $context
5655 if ($context.LineIndex -ge $lines.Count ) {
5756 break
5857 }
5958 if ($lines [$context.LineIndex ] -match ' ^\.\.\.(?:[ \t]|$)' ) {
60- $suffix = Get-YamlContentWithoutComment - Text $lines [$context.LineIndex ].Substring(3 )
59+ $mark = New-YamlMark - Index ($lineStarts [$context.LineIndex ] + 3 ) `
60+ - Line $context.LineIndex - Column 3
61+ $suffix = Get-YamlContentWithoutComment `
62+ - Text $lines [$context.LineIndex ].Substring(3 ) - Mark $mark
6163 if ($suffix.Trim (' ' , " `t " ).Length -gt 0 ) {
62- $mark = New-YamlMark - Index ($lineStarts [$context.LineIndex ] + 3 ) `
63- - Line $context.LineIndex - Column 3
6464 throw (New-YamlException - Start $mark - End $mark - ErrorId ' YamlInvalidDocumentEnd' - Message (
6565 ' Unexpected content follows the document end marker.'
6666 ))
@@ -109,7 +109,12 @@ function Read-YamlStreamCore {
109109 $leading = $afterMarker.Length - $afterMarker.TrimStart (' ' , " `t " ).Length
110110 $segment = $afterMarker.TrimStart (' ' , " `t " )
111111 $segmentColumn = 3 + $leading
112- if ([string ]::IsNullOrEmpty((Get-YamlContentWithoutComment - Text $segment ))) {
112+ $segmentMark = New-YamlMark - Index (
113+ $lineStarts [$context.LineIndex ] + $segmentColumn
114+ ) - Line $context.LineIndex - Column $segmentColumn
115+ if ([string ]::IsNullOrEmpty((
116+ Get-YamlContentWithoutComment - Text $segment - Mark $segmentMark
117+ ))) {
113118 $markerLine = $context.LineIndex
114119 $context.LineIndex ++
115120 Skip-YamlBlockTrivia - Context $context
@@ -164,24 +169,23 @@ function Read-YamlStreamCore {
164169 }
165170 $documents.Add ($document )
166171
167- Skip-YamlBlockTrivia - Context $context
168- Read-YamlDocumentByteOrderMark - Context $context - RequireDocumentStart
169- Skip-YamlBlockTrivia - Context $context
172+ Skip-YamlDocumentPrefix - Context $context - RequireDocumentStart
170173 $explicitEnd = $false
171174 if ($context.LineIndex -lt $lines.Count -and
172175 $lines [$context.LineIndex ] -match ' ^\.\.\.(?:[ \t]|$)' ) {
173176 $explicitEnd = $true
174177 $endLine = $lines [$context.LineIndex ]
175- if ((Get-YamlContentWithoutComment - Text $endLine.Substring (3 )).
178+ $endMark = New-YamlMark - Index ($lineStarts [$context.LineIndex ] + 3 ) `
179+ - Line $context.LineIndex - Column 3
180+ if ((Get-YamlContentWithoutComment - Text $endLine.Substring (3 ) - Mark $endMark ).
176181 Trim(' ' , " `t " ).Length -gt 0 ) {
177- $mark = New-YamlMark - Index ($lineStarts [$context.LineIndex ] + 3 ) `
178- - Line $context.LineIndex - Column 3
179- throw (New-YamlException - Start $mark - End $mark - ErrorId ' YamlInvalidDocumentEnd' - Message (
182+ throw (New-YamlException - Start $endMark - End $endMark `
183+ - ErrorId ' YamlInvalidDocumentEnd' - Message (
180184 ' Unexpected content follows the document end marker.'
181185 ))
182186 }
183187 $context.LineIndex ++
184- Skip-YamlBlockTrivia - Context $context
188+ Skip-YamlDocumentPrefix - Context $context
185189 $implicitDocumentSeen = $false
186190 }
187191 if (-not $explicitEnd -and $context.LineIndex -lt $lines.Count -and
0 commit comments