MCPcopy Index your code
hub / github.com/aiscript-dev/aiscript / parseUnionType

Function parseUnionType

src/parser/syntaxes/types.ts:66–81  ·  view source on GitHub ↗

* ```abnf * UnionType = UnionTypeInner *("|" UnionTypeInner) * ```

(s: ITokenStream)

Source from the content-addressed store, hash-verified

64 * ```
65*/
66function parseUnionType(s: ITokenStream): Ast.TypeSource {
67 const startPos = s.getPos();
68
69 const first = parseUnionTypeInner(s);
70 if (!s.is(TokenKind.Or)) {
71 return first;
72 }
73
74 const inners = [first];
75 do {
76 s.next();
77 inners.push(parseUnionTypeInner(s));
78 } while (s.is(TokenKind.Or));
79
80 return NODE('unionTypeSource', { inners }, startPos, s.getPos());
81}
82
83/**
84 * ```abnf

Callers 1

parseTypeFunction · 0.85

Calls 5

parseUnionTypeInnerFunction · 0.85
NODEFunction · 0.85
getPosMethod · 0.65
isMethod · 0.65
nextMethod · 0.65

Tested by

no test coverage detected