]> git.kianting.info Git - clo/blobdiff - src/index.ts
thx kuanyui for the advice
[clo] / src / index.ts
index bcd3e10cc153cc9ee1495f29aaecce30401465ee..8cbd145671c4508ca55759035ba2da57c1edcccb 100644 (file)
@@ -27,10 +27,13 @@ export type Maybe<T> = Some<T> | 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('-')); // ([+]|[-])
@@ -242,6 +245,7 @@ export function tokenize(input : string){
     }
     console.log(input+", result: ");
     console.log(thenDo(input_matchee_pair, integer));
+    // TODO: id, string, space, basic operator, 3 marks: @, {, }.
 
 }
 
@@ -249,4 +253,4 @@ tokenize("+123");
 tokenize("123");
 tokenize("-123");
 tokenize(" 123");
-tokenize("c123");
\ No newline at end of file
+tokenize("c123");