while-parser.js 488 B

123456789101112131415161718
  1. /** 语句:while 循环(解析在此,执行在 sequence-runner) */
  2. const types = ['while']
  3. function parse(action, parseContext) {
  4. const { parseActions } = parseContext
  5. const parsed = {
  6. type: 'while',
  7. condition: action.condition,
  8. body: (action.body || action.ture) ? parseActions(action.body || action.ture) : [],
  9. }
  10. return Object.assign({}, action, parsed)
  11. }
  12. async function execute() {
  13. return { success: true }
  14. }
  15. module.exports = { types, parse, execute }