ZyX_I avatar ZyX_I committed 3ea3721

@fwc/constructor: Renamed self.tree and self.stack to self._tree and self._stack

Comments (0)

Files changed (4)

     1.0: Renamed some functions so that they now have “_” at the start of 
          their names
     1.1: Made block compiling functions be located in self._comp now
+    2.0: Renamed self.tree and self.stack to self._tree and self._stack
 @/os:
     0.1: Added |frawor-r-os.path.relpath|
          Made |frawor-r-os.path.normpath| also simplify its argument

plugin/frawor/fwc/compiler.vim

 "▶1 Header
 scriptencoding utf-8
 execute frawor#Setup('0.0', {'@/fwc/parser'       : '0.0',
-            \                '@/fwc/constructor'  : '1.0',
+            \                '@/fwc/constructor'  : '2.0',
             \                '@/fwc/intfuncs'     : '0.0',
             \                '@/fwc/topconstructs': '0.0',
             \                '@/resources'        : '0.0'}, 1)
 endfunction
 "▶1 getlvarid       :: varname + self → varname
 function s:compiler.getlvarid(v)
-    return printf('@$@%s%X', a:v, len(self.stack))
+    return printf('@$@%s%X', a:v, len(self._stack))
 endfunction
 "▶1 getulvarid      :: varname + self → varname
 function s:compiler.getulvarid(v)
-    let lvarid=printf('@$@%s%X', a:v, len(self.stack))
+    let lvarid=printf('@$@%s%X', a:v, len(self._stack))
     let i=0
     while has_key(self.lvars, printf('%s_%X', lvarid, i))
         let i+=1

plugin/frawor/fwc/constructor.vim

 "▶1 Header
 scriptencoding utf-8
-execute frawor#Setup('1.1', {'@/resources': '0.0'}, 1)
+execute frawor#Setup('2.0', {'@/resources': '0.0'}, 1)
 let s:constructor={}
 let s:comp={}
 let s:constructor._comp=s:comp
 endfunction
 "▶1 _up        :: &self
 function s:constructor._up()
-    call remove(self.stack, -1)
-    let self.l=self.stack[-1]
+    call remove(self._stack, -1)
+    let self.l=self._stack[-1]
     return self
 endfunction
 "▶1 _down      :: &self(list)
 function s:constructor._down(list)
-    call add(self.stack, a:list)
+    call add(self._stack, a:list)
     let self.l=a:list
     return self
 endfunction
 "▶1 _tolist    :: () + self → [String]
 function s:constructor._tolist()
     let r=[]
-    let items=map(deepcopy(self.tree), '[0, v:val]')
+    let items=map(deepcopy(self._tree), '[0, v:val]')
     let toextend=[]
     while !empty(items)
         let [indent, item]=remove(items, 0)
     return r
 endfunction
 "▶1 new
-call extend(s:constructor, {'tree': [], 'stack': [],})
+call extend(s:constructor, {'_tree': [], '_stack': [],})
 function s:F.new()
     let r=deepcopy(s:constructor)
-    call add(r.stack, r.tree)
-    let r.l=r.stack[-1]
+    call add(r._stack, r._tree)
+    let r.l=r._stack[-1]
     return r
 endfunction
 call s:_f.postresource('new_constructor', s:F.new)

plugin/frawor/fwc/topconstructs.vim

     if len(self.l)==2 && self.l[1][0] is# 'if'
                 \&& (len(self.l[1])==3 ||
                 \    (len(self.l[1])==4 && self.l[-1] is# 'endif'))
-                \&& len(self.stack[-2])==3
-                \&& self.stack[-2][0] is# 'if'
-                \&& self.l[1][1] is# self.stack[-2][1]
+                \&& len(self._stack[-2])==3
+                \&& self._stack[-2][0] is# 'if'
+                \&& self.l[1][1] is# self._stack[-2][1]
         call extend(self.l, self.l[1][2])
         call remove(self.l, 1)
     elseif len(self.l)==3 && self.l[1][0] is# 'let'
                 \&& self.l[2][0] is# 'if'
                 \&& (len(self.l[2])==3 ||
                 \    (len(self.l[2])==4 && self.l[-1] is# 'endif'))
-                \&& len(self.stack[-2])==3
-                \&& self.stack[-2][0] is# 'if'
+                \&& len(self._stack[-2])==3
+                \&& self._stack[-2][0] is# 'if'
                 \&& self.l[2][1][:(-1-len(self.l[1][1]))] is
-                \   self.stack[-2][1][:(-1-len(a:caidxstr))]
+                \   self._stack[-2][1][:(-1-len(a:caidxstr))]
         call extend(self.l, self.l[2][2])
         call remove(self.l, 1, 2)
     endif
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.