MCPcopy Create free account
hub / github.com/aiscript-dev/aiscript / parseLabel

Function parseLabel

src/parser/syntaxes/common.ts:143–155  ·  view source on GitHub ↗
(s: ITokenStream)

Source from the content-addressed store, hash-verified

141 * ```
142*/
143export function parseLabel(s: ITokenStream): string {
144 s.expect(TokenKind.Sharp);
145 s.next();
146
147 if (s.getToken().hasLeftSpacing) {
148 throw new AiScriptSyntaxError('cannot use spaces in a label', s.getPos());
149 }
150 s.expect(TokenKind.Identifier);
151 const label = s.getTokenValue();
152 s.next();
153
154 return label;
155}
156
157/**
158 * ```abnf

Callers 4

parseStatementWithLabelFunction · 0.85
parseBreakFunction · 0.85
parseContinueFunction · 0.85
parseExprWithLabelFunction · 0.85

Calls 5

expectMethod · 0.65
nextMethod · 0.65
getTokenMethod · 0.65
getPosMethod · 0.65
getTokenValueMethod · 0.65

Tested by

no test coverage detected