(
nestingLevel: number,
parentArgType: ArgType
)
| 393 | } |
| 394 | |
| 395 | private parseLiteral( |
| 396 | nestingLevel: number, |
| 397 | parentArgType: ArgType |
| 398 | ): Result<LiteralElement, ParserError> { |
| 399 | const start = this.clonePosition() |
| 400 | |
| 401 | let value = '' |
| 402 | while (true) { |
| 403 | const parseQuoteResult = this.tryParseQuote(parentArgType) |
| 404 | if (parseQuoteResult) { |
| 405 | value += parseQuoteResult |
| 406 | continue |
| 407 | } |
| 408 | |
| 409 | const parseUnquotedResult = this.tryParseUnquoted( |
| 410 | nestingLevel, |
| 411 | parentArgType |
| 412 | ) |
| 413 | if (parseUnquotedResult) { |
| 414 | value += parseUnquotedResult |
| 415 | continue |
| 416 | } |
| 417 | |
| 418 | const parseLeftAngleResult = this.tryParseLeftAngleBracket() |
| 419 | if (parseLeftAngleResult) { |
| 420 | value += parseLeftAngleResult |
| 421 | continue |
| 422 | } |
| 423 | |
| 424 | break |
| 425 | } |
| 426 | |
| 427 | const location = createLocation(start, this.clonePosition()) |
| 428 | return { |
| 429 | val: {type: TYPE.literal, value, location}, |
| 430 | err: null, |
| 431 | } |
| 432 | } |
| 433 | |
| 434 | tryParseLeftAngleBracket(): string | null { |
| 435 | if ( |
no test coverage detected