UNPKG

@whisklabs/grpc

Version:

gRPC generator and http library for typescript

31 lines 968 B
import { next } from '../comment'; import { Thrower } from '../thrower'; import { ch, check, cut } from '../utils'; import { isText } from '../validators'; import { ParseField } from './field'; export function ParseOneOf(tokens) { var fields = []; var _a = check({ type: 'oneof', tokens: tokens, rules: [ch('oneof'), ch(isText, { result: true }), ch('{')], }), len = _a.len, results = _a.results; cut(tokens, len); var fieldName = results[0]; while (tokens.length > 0) { switch (next(tokens)) { case '}': cut(tokens, 1); return fields; case undefined: continue; default: { var field = ParseField(tokens, true); field.oneof = fieldName; fields.push(field); } } } throw new Thrower('oneof', [['no close tag "}"', 0]]); } //# sourceMappingURL=oneof.js.map