mirror of
https://github.com/flynx/pWiki.git
synced 2026-08-24 00:06:43 +00:00
Merge branch 'master' of github.com:flynx/pWiki
This commit is contained in:
commit
60af0b4e44
@ -566,14 +566,27 @@ module.BaseParser = {
|
|||||||
// ...
|
// ...
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
|
// .expand(..) will call all macros encountered in AST, in order of
|
||||||
|
// occurance and will place their return values in AST.
|
||||||
|
// .expand(..) always returns sync.
|
||||||
|
//
|
||||||
|
// Macros can run either sync or return a promise and run async.
|
||||||
|
// Macros can synchronize by awaiting on local state.waitNested or
|
||||||
|
// state.waitNested they receive in state.
|
||||||
|
//
|
||||||
// NOTE: this is always sync, but some of the items in the returned
|
// NOTE: this is always sync, but some of the items in the returned
|
||||||
// array may be promises.
|
// array may be promises.
|
||||||
// NOTE: .waitNested and .waitAll are "live", i.e. while expanding,
|
// NOTE: each macro call will receive a "local" state cotaining
|
||||||
// at any given time they contain the promise of the last async
|
// specific to it .waitNested, .waitAll (not affexted by
|
||||||
// element upto the point of read. .wait however is set at the
|
// subsequent expansion), and references to .parent and .root
|
||||||
// end of .expand(..), i.e. it has no meaning until .expand(..)
|
// state.
|
||||||
// finishes, and represents the last .waitAll but will return
|
// NOTE: macros should never await on .wait as this will create a
|
||||||
// the whole expanded ast.
|
// deadlock, use the local .waitNested and/or .waitAll instead.
|
||||||
|
// .wait is intended for client code, patser sequencing, and
|
||||||
|
// extensions.
|
||||||
|
// NOTE: .waitAll and .waitNested are "live", each updated for every
|
||||||
|
// promise returned while expanding, while .wait is global and
|
||||||
|
// will resolve only when all other promises are resolved.
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
// XXX the parser is always sync
|
// XXX the parser is always sync
|
||||||
@ -596,7 +609,6 @@ module.BaseParser = {
|
|||||||
//
|
//
|
||||||
// XXX Q: do we need generators?
|
// XXX Q: do we need generators?
|
||||||
// XXX Handle errors...
|
// XXX Handle errors...
|
||||||
// XXX BUG: awaiting on .wait* can deadlock...
|
|
||||||
expand: function(page, ast, state={}, nested_handlers={}){
|
expand: function(page, ast, state={}, nested_handlers={}){
|
||||||
var that = this
|
var that = this
|
||||||
ast = typeof(ast) != 'object' ?
|
ast = typeof(ast) != 'object' ?
|
||||||
@ -782,6 +794,7 @@ module.BaseParser = {
|
|||||||
// ---- C
|
// ---- C
|
||||||
// ...looks like we are still getting a deadlock...
|
// ...looks like we are still getting a deadlock...
|
||||||
// -> the issue seems to be in a nested call to .execNested(..) -> .finalize(..)
|
// -> the issue seems to be in a nested call to .execNested(..) -> .finalize(..)
|
||||||
|
// XXX make this an actual test...
|
||||||
resolve: function(page, ast, state={}, nested_handlers={}){
|
resolve: function(page, ast, state={}, nested_handlers={}){
|
||||||
var that = this
|
var that = this
|
||||||
ast = typeof(ast) != 'object' ?
|
ast = typeof(ast) != 'object' ?
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user