951
952
constructor(
953
>
private readonly tokens: Token[],
yaml.ts
954
>
private readonly input: string,
955
>
private readonly errors: YamlParseError[],
956
>
private readonly options: ParseOptions,
957
>
) { }
958
959
parse(): YamlNode | undefined {
960
>
this.skipNewlinesAndComments();
yaml.ts
961
>
// Skip document start marker (---) if present
962
>
if (this.currentToken().type === TokenType.DocumentStart) {
963
this.advance();
964
this.skipNewlinesAndComments();
965
}
966
>
if (this.currentToken().type === TokenType.EOF || this.currentToken().type === TokenType.DocumentEnd) {
yaml.ts
967
return undefined;
968
}
969
const result = this.parseValue(-1);
970
return result;
972
973
// -- helpers ----------------------------------------------------------
974
975
private currentToken(): Token {
976
>
return this.tokens[this.pos];
yaml.ts
977
>
}
978
979
private peek(offset = 0): Token {