updated flow types [ci skip]
This commit is contained in:
parent
08a0a31128
commit
f5a6d10ce4
@ -11,9 +11,11 @@
|
||||
.*/stress/.*
|
||||
|
||||
.*/demo/browser.js
|
||||
.*/shim.js
|
||||
|
||||
[include]
|
||||
printj.flow.js
|
||||
.*/bin/.*.njs
|
||||
lib/loop_code.js
|
||||
lib/loop_char.js
|
||||
lib/index_code.js
|
||||
@ -24,3 +26,5 @@ lib/regex.js
|
||||
bits/flow.js
|
||||
|
||||
[options]
|
||||
module.file_ext=.js
|
||||
module.file_ext=.njs
|
||||
|
@ -47,13 +47,13 @@ function parse_arg(arg/*:string*/)/*:any*/ {
|
||||
var args/*:Array<any>*/ = [];
|
||||
var fmt = "", n = 0;
|
||||
for(var i = 2; i < argv.length; ++i) switch(argv[i]) {
|
||||
case "--help": case "-h": return help();
|
||||
case "--dump": case "-d": if(fmt.length==0) fmt = argv[++i]; return dump(fmt);
|
||||
case "--help": case "-h": process.exit(help());
|
||||
case "--dump": case "-d": if(fmt.length==0) fmt = argv[++i]; process.exit(dump(fmt));
|
||||
default: if(n++ == 0) fmt = argv[i]; else args.push(parse_arg(argv[i]));
|
||||
}
|
||||
|
||||
console.log(X.vsprintf(fmt, args));
|
||||
return 0;
|
||||
process.exit(0);
|
||||
|
||||
function dump(fmt) {
|
||||
if(!fmt) { console.error("printj: missing format argument"); return 1; }
|
||||
|
12
bits/flow.js
12
bits/flow.js
@ -2,10 +2,12 @@
|
||||
type ParsedFmt = Array<Array<any>>;
|
||||
type Args = Array<any>;
|
||||
declare module "exit-on-epipe" { };
|
||||
declare module "./" {
|
||||
declare function sprintf(fmt:string, ...args:any):string;
|
||||
declare function vsprintf(fmt:string, args:Args):string;
|
||||
declare function _doit(t:ParsedFmt, args:Args):string;
|
||||
declare function _tokenize(fmt:string):ParsedFmt;
|
||||
declare class PRINTJModule {
|
||||
sprintf(fmt:string, ...args:any):string;
|
||||
vsprintf(fmt:string, args:Args):string;
|
||||
_doit(t:ParsedFmt, args:Args):string;
|
||||
_tokenize(fmt:string):ParsedFmt;
|
||||
};
|
||||
declare module "./" { declare var exports:PRINTJModule };
|
||||
declare module "../" { declare var exports:PRINTJModule };
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user