MCPcopy Create free account
hub / github.com/arktypeio/arktype / fullStringParse

Function fullStringParse

ark/type/parser/string.ts:70–88  ·  view source on GitHub ↗
(s: RuntimeState)

Source from the content-addressed store, hash-verified

68 | otherSuggestions
69
70export const fullStringParse = (s: RuntimeState): InnerParseResult => {
71 s.parseOperand()
72 let result: InnerParseResult = parseUntilFinalizer(s).root
73 if (!result) {
74 return throwInternalError(
75 `Root was unexpectedly unset after parsing string '${s.scanner.scanned}'`
76 )
77 }
78
79 if (s.finalizer === "=") result = parseDefault(s as RootedRuntimeState)
80 else if (s.finalizer === "?") result = [result, "?"]
81
82 s.scanner.shiftUntilNonWhitespace()
83 if (s.scanner.lookahead) {
84 // throw a parse error if non-whitespace characters made it here without being parsed
85 throwParseError(writeUnexpectedCharacterMessage(s.scanner.lookahead))
86 }
87 return result
88}
89
90type fullStringParse<s extends StaticState, $, args> = extractFinalizedResult<
91 parseUntilFinalizer<s, $, args>

Callers 1

parseStringFunction · 0.85

Calls 7

throwInternalErrorFunction · 0.90
parseDefaultFunction · 0.90
throwParseErrorFunction · 0.90
parseUntilFinalizerFunction · 0.85
parseOperandMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…