由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Programming版 - The future of Javascript module management finally comes
相关主题
Any difference between class and typename identifier?javascript function-ask for help
operator overloading (C++)functional programming?
typescript要搞什么?唉,看来scala已经废了
据说现在流行Isomorphic JavaScript为啥允许这样的const设计
JavaScript 比python优雅很多参加scala days的唯一感受
哈哈, 不喜欢typescript 是不是都是新手?gofmt - 但是,没有牛X的通用布局算法
关于在c++ member function里用signal( )倡议使用 半空格 为分隔符 做为 中文的书写方式。
char *p = "string literal"; 和 char a[] = "string liter (转载)实现一个parser可以解析给定的几种sql语句,怎么做? (转载)
相关话题的讨论汇总
话题: type话题: javascript话题: identifier话题: ast话题: management
进入Programming版参与讨论
1 (共1页)
l**********n
发帖数: 8443
1
https://github.com/rollup/rollup/wiki/jsnext:main
The dark days of JavaScript dependency management are coming to an end, but
it won't happen by itself.
https://github.com/rollup/rollup
l**********n
发帖数: 8443
2
https://github.com/ternjs/acorn
npm install acorn
https://github.com/MatAtBread/acorn-es7-plugin/
var code = "async function x(){ if (x) return await(x-1) ; return 0 ; }\n";
var ast = acorn.parse(code,{
// Specify use of the plugin
plugins:{asyncawait:true},
// Specify the ecmaVersion
ecmaVersion:7
}) ;
// Show the AST
console.log(JSON.stringify(ast,null,2)) ;
output:
{
"type": "Program",
"body": [
{
"type": "FunctionDeclaration",
"id": {
"type": "Identifier",
"name": "x"
},
"generator": false,
"expression": false,
"params": [],
"body": {
"type": "BlockStatement",
"body": [
{
"type": "IfStatement",
"test": {
"type": "Identifier",
"name": "x"
},
"consequent": {
"type": "ReturnStatement",
"argument": {
"type": "AwaitExpression",
"operator": "await",
"argument": {
"type": "BinaryExpression",
"left": {
"type": "Identifier",
"name": "x"
},
"operator": "-",
"right": {
"type": "Literal",
"value": 1,
"raw": "1"
}
}
}
},
"alternate": null
},
{
"type": "ReturnStatement",
"argument": {
"type": "Literal",
"value": 0,
"raw": "0"
}
}
]
},
"async": true
}
],
"sourceType": "script"
}
d*******r
发帖数: 3299
3
又是个没听说过的 T_T
l**********n
发帖数: 8443
4
这个是金光大道。

【在 d*******r 的大作中提到】
: 又是个没听说过的 T_T
1 (共1页)
进入Programming版参与讨论
相关主题
实现一个parser可以解析给定的几种sql语句,怎么做? (转载)JavaScript 比python优雅很多
王垠:我和 Google 的故事(2015 修订版) (转载)哈哈, 不喜欢typescript 是不是都是新手?
太子还是挺厉害的:我为什么选择scala.js关于在c++ member function里用signal( )
问个GSL的问题char *p = "string literal"; 和 char a[] = "string liter (转载)
Any difference between class and typename identifier?javascript function-ask for help
operator overloading (C++)functional programming?
typescript要搞什么?唉,看来scala已经废了
据说现在流行Isomorphic JavaScript为啥允许这样的const设计
相关话题的讨论汇总
话题: type话题: javascript话题: identifier话题: ast话题: management