]>
git.kianting.info Git - clo/blob - src/index.ts
1 var fs
= require('fs');
2 import jsTokens from
"js-tokens";
3 import * as util from
'util';
5 /**inspect the inner of the representation. */
6 let repr
= (x
: any)=>{return util
.inspect(x
, {depth
: null})};
9 * like `m ==> f` in ocaml
10 * @param m matchee wrapped
11 * @param f matching function
12 * @returns wrapped result
14 function thenDo(m
: tk
.Maybe
<TokenMatcheePair
>, f
: Function){
15 if (m
._tag
== "None"){
18 var a
: tk
.Maybe
<TokenMatcheePair
> = f(m
.value
);
19 if (a
._tag
== "Some"){
20 a
.value
.ast
= concat(m
.value
.ast
, a
.value
.ast
);
27 const tokens
= Array.from(jsTokens(`
28 import foo from\t 'bar';
29 import * as util from 'util';
32 花非花,霧\\{非霧 。{{foo();}}下
36 console
.log("RESULT="+repr(tokens
));