MCPcopy
hub / github.com/formatjs/formatjs / tryParseUnquoted

Method tryParseUnquoted

packages/icu-messageformat-parser/parser.ts:507–528  ·  view source on GitHub ↗
(
    nestingLevel: number,
    parentArgType: ArgType
  )

Source from the content-addressed store, hash-verified

505 }
506
507 private tryParseUnquoted(
508 nestingLevel: number,
509 parentArgType: ArgType
510 ): string | null {
511 if (this.isEOF()) {
512 return null
513 }
514 const ch = this.char()
515
516 if (
517 ch === 60 /* `<` */ ||
518 ch === 123 /* `{` */ ||
519 (ch === 35 /* `#` */ &&
520 (parentArgType === 'plural' || parentArgType === 'selectordinal')) ||
521 (ch === 125 /* `}` */ && nestingLevel > 0)
522 ) {
523 return null
524 } else {
525 this.bump()
526 return String.fromCodePoint(ch)
527 }
528 }
529
530 private parseArgument(
531 nestingLevel: number,

Callers 1

parseLiteralMethod · 0.95

Calls 3

isEOFMethod · 0.95
charMethod · 0.95
bumpMethod · 0.95

Tested by

no test coverage detected