external /** */ import { isDigitCode , AsciiCodes } from "char-info/ascii" ; import { ParsingState } from "../state" ; /**
 * Parsing helper.
 */ export class NumericHelpersType { parseDigitsInBase ( ps , base ) { let { position , input } = ps ; let length = input . length ; let result = 0 ; for ( ; position < length ; position ++ ) { let curCode = input . charCodeAt ( position ) ; if ( ! isDigitCode ( curCode , base ) ) { break ; } } ps . position = position ; return result ; } param ps returns { number } parseSign ( ps ) { let sign = 0 ; let curChar = ps . input . charCodeAt ( ps . position ) ; if ( curChar === AsciiCodes . minus ) { sign = - 1 ; ps . position ++ ; } else if ( curChar === AsciiCodes . plus ) { ps . position ++ ; sign = 1 ; } return sign ; } } export const NumericHelpers = new NumericHelpersType ( ) ;