Commits

ZyX_I committed 2accded

@/frawor/fwc/constructor: Added .endfor() and .endwhile()

Comments (0)

Files changed (3)

 for :: var, expr -> + self                                      *FWC-cf-for*
     Adds |FWC-cb-while| or |FWC-cb-for| with given arguments and an empty tree 
     and pushes added block and this tree to |FWC-ck-_stack|.
+endwhile :: () -> + self                                     *FWC-cf-endwhile*
+endfor :: () -> + self                                       *FWC-cf-endfor*
+    Finds outer "for" or "while" section and goes up one level.
 execute :: expr -> + self                                     *FWC-cf-execute*
 call :: expr -> + self                                        *FWC-cf-call*
 echo :: expr -> + self                                        *FWC-cf-echo*
     3.0: Renamed self.l to self._l
     3.1: Made self.continue and self.break go up one level.
     4.0: Splitted self.addif(expr?) into self.addif(expr) and self.addelse()
+    4.1: Added self.endfor() and self.endwhile().
 @/os:
     0.1: Added |frawor-r-os.path.relpath|
          Made |frawor-r-os.path.normpath| also simplify its argument

plugin/frawor/fwc/constructor.vim

 "▶1 Header
 scriptencoding utf-8
-execute frawor#Setup('4.0', {'@/resources': '0.0'}, 1)
+execute frawor#Setup('4.1', {'@/resources': '0.0'}, 1)
 let s:constructor={}
 let s:comp={}
 let s:constructor._comp=s:comp
 function s:constructor.while(expr)
     return self._out()._deeper('while', a:expr)._deeper()
 endfunction
+"▶2 endwhile   :: &self()
+function s:constructor.endwhile()
+    return self._toblock('while')._up()
+endfunction
 "▶2 comp.for
 function s:comp.for(r, toextend, indent, item)
     call add(a:r, repeat(' ', &sw*a:indent).'for '.remove(a:item, 0).' in '.
 function s:constructor.for(var, expr)
     return self._out()._deeper('for', a:var, a:expr)._deeper()
 endfunction
+"▶2 endfor     :: &self()
+function s:constructor.endfor()
+    return self._toblock('for')._up()
+endfunction
 "▶1 execute: call, throw, return
 "▶2 comp.execute
 function s:comp.execute(r, toextend, indent, item)