X-Git-Url: https://git.kianting.info/?a=blobdiff_plain;f=src%2Findex.ts;h=8cbd145671c4508ca55759035ba2da57c1edcccb;hb=e2668789e238707fa38ce3e724e3b64fba5d53b3;hp=e22fdbbdd6550fe81c5779546472dd388927d95a;hpb=c236ca23a513d0a456add8c98401af10cfbdb295;p=clo diff --git a/src/index.ts b/src/index.ts index e22fdbb..8cbd145 100644 --- a/src/index.ts +++ b/src/index.ts @@ -27,10 +27,13 @@ export type Maybe = Some | None; /** * @description * the pair of the string to be matched later and the string that have been matched - * @param matched : string have been matched - * @param remained : string will be tested whether it'll be matched. - */ -export type MatcheePair = {matched : string; remained : string}; +*/ +export interface MatcheePair { + /** have been matched */ + matched : string + /** will be tested whether it'll be matched. */ + remained : string +} /** * @description @@ -231,7 +234,7 @@ export function tokenize(input : string){ {matched:"", remained: input}); - // integer = ([+]|[-])\d\d? + // integer = ([+]|[-])?\d\d* let integer = (x : MatcheePair) => { let wrapped_x = toSome(x); let plusMinus = orDo(match1Char('+'), match1Char('-')); // ([+]|[-]) @@ -250,4 +253,4 @@ tokenize("+123"); tokenize("123"); tokenize("-123"); tokenize(" 123"); -tokenize("c123"); \ No newline at end of file +tokenize("c123");