( def: string, ctx: BaseParseContext )
| 69 | } |
| 70 | |
| 71 | export const parseString = ( |
| 72 | def: string, |
| 73 | ctx: BaseParseContext |
| 74 | ): InnerParseResult => { |
| 75 | const aliasResolution = maybeResolveReference(def, ctx) |
| 76 | if (aliasResolution) return aliasResolution |
| 77 | |
| 78 | if (def.endsWith("[]")) { |
| 79 | const possibleElementResolution = maybeResolveReference( |
| 80 | def.slice(0, -2), |
| 81 | ctx |
| 82 | ) |
| 83 | if (possibleElementResolution) return possibleElementResolution.rawArray() |
| 84 | } |
| 85 | |
| 86 | const s = new RuntimeState(new Scanner(def), ctx) |
| 87 | |
| 88 | const node = fullStringParse(s) |
| 89 | |
| 90 | if (s.finalizer === ">") { |
| 91 | const beforeGt = s.sc.scanned.trimEnd().slice(0, -1).trimEnd() |
| 92 | throwParseError( |
| 93 | s.trailingRightBounded || beforeGt.endsWith(">") ? |
| 94 | writeUnexpectedCharacterMessage(">") |
| 95 | : writeMissingRightOperandMessage(">") |
| 96 | ) |
| 97 | } |
| 98 | |
| 99 | return node |
| 100 | } |
| 101 | |
| 102 | /** |
| 103 | * Try to parse the definition from right to left using the most common syntax. |
no test coverage detected