MCPcopy Create free account
hub / github.com/RtlZeroMemory/Rezi / consumeNumber

Function consumeNumber

packages/core/src/widgets/codeEditorSyntax.ts:834–862  ·  view source on GitHub ↗
(scanner: Scanner)

Source from the content-addressed store, hash-verified

832}
833
834function consumeNumber(scanner: Scanner): string {
835 const source = scanner.source;
836 const start = scanner.index;
837 scanner.index += 1;
838
839 while (scanner.index < source.length) {
840 const ch = asChar(source, scanner.index);
841 if (isDigit(ch) || ch === "_") {
842 scanner.index += 1;
843 continue;
844 }
845 if (
846 (ch === "." ||
847 ch === "x" ||
848 ch === "X" ||
849 ch === "b" ||
850 ch === "B" ||
851 ch === "o" ||
852 ch === "O") &&
853 scanner.index > start
854 ) {
855 scanner.index += 1;
856 continue;
857 }
858 break;
859 }
860
861 return source.slice(start, scanner.index);
862}
863
864function consumeString(scanner: Scanner, quote: string): string {
865 const source = scanner.source;

Callers 1

tokenizeLineWithGrammarFunction · 0.85

Calls 2

asCharFunction · 0.85
isDigitFunction · 0.70

Tested by

no test coverage detected