ZyX_I avatar ZyX_I committed e3076e4

@/fwc: Got rid of `filter' type. Now it is internally referenced only as `pipe'

Comments (0)

Files changed (3)

plugin/frawor/fwc/compiler.vim

     "▶2 `func' pipe
     if a:pipe[1][0] is 'func'
         let curargstr=self.argstr()
-        if a:type is 'check' || a:type is 'filter' || a:type is 'pipe'
+        if a:type is 'check' || a:type is 'pipe'
             call self.let(curargstr, self.getfunc(a:pipe[1],0, curargstr))
             let self.typechanged=1
         endif
     "▶2 `expr' pipe
     elseif a:pipe[1][0] is 'expr'
         let curargstr=self.argstr()
-        if a:type is 'check' || a:type is 'filter' || a:type is 'pipe'
+        if a:type is 'check' || a:type is 'pipe'
             call self.let(curargstr, self.getexpr(a:pipe[1], curargstr))
             let self.typechanged=1
         endif
     elseif a:pipe[1][0] is 'intfunc'
         let desc=a:pipe[1][1:]
         let dname=desc[0]
-        if a:type is 'check' || a:type is 'filter' || a:type is 'pipe'
+        if a:type is 'check' || a:type is 'pipe'
             if has_key(s:_r.FWC_intfuncs[dname], 'pipe')
                 call call(s:_r.FWC_intfuncs[dname].pipe,  [desc,a:idx, 'pipe'],
                             \self)
     "▲2
     return self
 endfunction
-let s:compiler.compilefilter=s:compiler.compilepipe
 "▶1 compilecheck    :: &self(checkcontext, idx, type)
 function s:compiler.compilecheck(check, idx, type)
     "▶2 `func' check
     if a:check[1][0] is 'func'
-        if a:type is 'check' || a:type is 'filter' || a:type is 'pipe'
+        if a:type is 'check' || a:type is 'pipe'
             call self.nextthrow(self.getfunc(a:check[1], 0, self.argstr()).
                         \                                               ' is 0',
                         \       'funcfail', a:idx)
         endif
     "▶2 `expr' check
     elseif a:check[1][0] is 'expr'
-        if a:type is 'check' || a:type is 'filter' || a:type is 'pipe'
+        if a:type is 'check' || a:type is 'pipe'
             call self.nextthrow(self.getexpr(a:check[1], self.argstr()).' is 0',
                         \       'exprfail', a:idx)
         endif
     else
         let desc=a:check[1][1:]
         let dname=desc[0]
-        if a:type is 'check' || a:type is 'filter' || a:type is 'pipe'
+        if a:type is 'check' || a:type is 'pipe'
             if !has_key(s:_r.FWC_intfuncs[dname], 'check')
                 call s:_f.throw('ucheck', dname)
             endif
 "▶1 compadescr      :: &self(adescr[, idx[, purgemax]])
 function s:compiler.compadescr(adescr, ...)
     let purgemax=get(a:000, 1, 0)
+    let type=self.type
     "▶2 Length checks, lagsstr and nextsub variables
     if !empty(self.subs)
         let largsstr=self.getlargsstr()
-        if self.type is 'check' || self.type is 'filter' || self.type is 'pipe'
+        if self.type is 'check' || self.type is 'pipe'
             if !has_key(a:adescr, 'minimum')
                 call s:F.getlenrange(a:adescr)
             endif
             endif
             let [newnextsub, addedsavemsgs]=
                         \call(s:_r.FWC_topconstructs[key].compile,
-                        \     [a:adescr, idx, caidxstr, largsstr, purgemax,
+                        \     [a:adescr,idx, caidxstr, largsstr, purgemax, type,
                         \      nextsub, addedsavemsgs],
                         \     self)
             unlet nextsub
                 \'defvals': [],
                 \'typechanged': 0,
             \})
+    if t.type is 'filter'
+        let t.type='pipe'
+    endif
     call extend(t, s:compiler, 'error')
-    if !(t.type is 'check' || t.type is 'filter')
+    if !(t.type is 'check' || t.type is 'pipe')
         let t.matcher=s:defcompletematcher
         let t.comparg=t.argbase.t.getsubs([-1])
         let t.joinlists=0
         let t.ldstrs=[]
     endif
     "▲2
-    let [t.o, tree]=s:F.cleanup(s:_r.fwc_parser(a:string, a:type)[1:])
+    let [t.o, tree]=s:F.cleanup(s:_r.fwc_parser(a:string)[1:])
     if a:doreturn is 1
         let t.failcal=['return', 0]
     else
     if !t.o.only
         call add(t.subs, 0)
     endif
-    if t.type is 'check' || t.type is 'filter'
+    if t.type is 'check' || t.type is 'pipe'
         call        t.let('@$@messages',  '[]')
                     \.let('@$@pmessages', '[]')
                     \.try()
     if a:doreturn is 1
         if t.type is 'check'
             call t.return(1)
-        elseif t.type is 'filter'
+        elseif t.type is 'pipe'
             call t.return('@@@')
         else
             call t.return('@-@')

plugin/frawor/fwc/parser.vim

 " Output: context(intfunc, {funcname}[, contexts])
 function s:parser.intfunc()
     let type=self.l[0]
-    if type is 'arg'
-        let type.=self.type
-    endif
     let func=self.readc()
     if !has_key(s:_r.FWC_intfuncs, func) "▶2
         call self.throw('ukfunc', func)
     return self
 endfunction
 "▶1 parsestr   :: String → SynTree
-function s:F.parsestr(string, type)
+function s:F.parsestr(string)
     "▶2 Setup self
     let s   =   {    's': a:string,
                 \ 'tree': ['top'],
-                \ 'type': a:type,
                 \'stack': [],
                 \'ungot': [],
                 \    'l': 0,

plugin/frawor/fwc/topconstructs.vim

     return self.conclose()
 endfunction
 "▶2 compile :: descr, idx, {rolvars}, {lvars} + self → {lvars}
-" {rolvars} :: caidxstr, largsstr, purgemax
+" {rolvars} :: caidxstr, largsstr, purgemax, type
 "   {lvars} :: nextsub, addedsavemsgs
-function s:r.optional.compile(adescr, idx, caidxstr, largsstr, purgemax,
+function s:r.optional.compile(adescr, idx, caidxstr, largsstr, purgemax, type,
             \                 nextsub, addedsavemsgs)
     let addedsavemsgs=a:addedsavemsgs
-    if self.type is 'complete'
+    if a:type is 'complete'
         let hasnext=s:F.hasnext(a:adescr, 'next')
         if !hasnext && len(a:adescr.optional)==1
             call self.compadescr(a:adescr.optional[0], a:idx.'.0(optional)')
     return self.conclose()
 endfunction
 "▶2 compile :: descr, idx, {rolvars}, {lvars} + self → {lvars}
-function s:r.prefixes.compile(adescr, idx, caidxstr, largsstr, purgemax,
+function s:r.prefixes.compile(adescr, idx, caidxstr, largsstr, purgemax, type,
             \                 nextsub, addedsavemsgs)
     "▶3 Define variables
     let addedsavemsgs=a:addedsavemsgs
     if haslist
         call self.let(lastliststr, 0)
     endif
-    if self.type is 'check' || self.type is 'filter'
+    if a:type is 'check' || a:type is 'pipe'
         "▶3 Add messages saving if required
         if hasnext
             if !addedsavemsgs
         call self.while(a:caidxstr.'<'.a:largsstr)
     endif
     "▶3 Get `astr' variable
-    if self.type is 'check' || self.type is 'filter'
+    if a:type is 'check' || a:type is 'pipe'
         if !self.o.onlystrings
             if haslist
                 call self.if('type('.self.argstr().')=='.type(''))
     call self.let(astr, self.getmatcher(get(a:adescr, 'prefixesmatcher',
                 \                           s:prefdefmatcher), plstr,
                 \                       self.argstr(), 0))
-    if self.type is 'check' || self.type is 'filter'
+    if a:type is 'check' || a:type is 'pipe'
         let removestr='remove('.base.', '.a:caidxstr.')'
         if hasnext
             let argorigstr=self.getd('argorig')
         "▲3
         let prefstr=prefdictstr.self.getsubs([prefix])
         let prefixstr=self.string(prefix)
-        if self.type is 'complete' && !prefopts.argnum
+        if a:type is 'complete' && !prefopts.argnum
             continue
         endif
         "▶3 Construct prefix condition
         endif
         call self.addif(cond)
         "▶3 Process prefix arguments
-        if self.type is 'check' || self.type is 'filter'
+        if a:type is 'check' || a:type is 'pipe'
             for i in range(1, prefopts.argnum)
                 call self.compilearg(args[i-1], idx.self.string(prefix))
                             \.incsub()
             call self.up().up()
         endif
         "▶3 Move prefix arguments to prefix dictionary
-        if self.type is 'complete'
+        if a:type is 'complete'
             call self.up()
         elseif prefopts.list
             let removestr='remove('.base.', '.a:caidxstr.', '.
         let self.subs[-1]=[a:caidxstr]
         call self.up()
         "▶3 Process `no{prefix}'
-        if self.type is 'check' || self.type is 'filter'
+        if a:type is 'check' || a:type is 'pipe'
             if prefopts.alt
                 call self.addif(astr.' is '.self.string('no'.prefix))
                             \.let(prefstr, 0)
         endif
         "▲3
     endfor
-    if self.type is 'complete'
+    if a:type is 'complete'
         call self.addif(astr.' is 0')
                     \.break()
                 \.up()
     endif
     call self.up()
-    if self.type is 'check' || self.type is 'filter'
+    if a:type is 'check' || a:type is 'pipe'
         if hasnext
             call self.unlet(argorigstr).up().up().addrestmsgs(1).popms()
                 \.catch(s:cfreg)
     return self.addcon('next').scan().conclose()
 endfunction
 "▶2 compile :: descr, idx, {rolvars}, {lvars} + self → {lvars}
-function s:r.next.compile(adescr, idx, caidxstr, largsstr, purgemax,
+function s:r.next.compile(adescr, idx, caidxstr, largsstr, purgemax, type,
             \             nextsub, addedsavemsgs)
     let addedsavemsgs=a:addedsavemsgs
     let hasnext=s:F.hasnext(a:adescr, 'next')
-    if self.type is 'complete'
+    if a:type is 'complete'
         call self.addif(a:largsstr.'>='.self.getlastsub())
                     \.compilearg(a:adescr.next[0], a:idx.'.(next)')
                 \.up()
     return self.conclose()
 endfunction
 "▶2 compile :: descr, idx, {rolvars}, {lvars} + self → {lvars}
-function s:r.actions.compile(adescr, idx, caidxstr, largsstr, purgemax,
+function s:r.actions.compile(adescr, idx, caidxstr, largsstr, purgemax, type,
             \                nextsub, addedsavemsgs)
     let actionstr=self.getlvarid('action')
     let actions=filter(copy(a:adescr.actions), 'v:val[0] isnot 0')
     let noact=get(filter(copy(a:adescr.actions), 'v:val[0] is 0'), 0, 0)
     let fsastr=self.getfunstatvar('actions', map(copy(actions), 'v:val[0]'))
-    if noact isnot 0 && self.type isnot 'complete'
+    if noact isnot 0 && a:type isnot 'complete'
         call self.try().pushms('throw')
     endif
     let idx=a:idx.'(actions)'
-    if !self.o.onlystrings && self.type isnot 'complete'
+    if !self.o.onlystrings && a:type isnot 'complete'
         call self.addtypecond([type('')], idx)
     endif
     let curargstr=self.argstr()
-    if self.type is 'complete'
+    if a:type is 'complete'
         call self.addif(self.getlargsstr().'-1 == '.self.getlastsub())
                         \.addmatches(fsastr, type([]))
         let savedsub=copy(self.subs[-1])
     call self.let(actionstr, self.getmatcher(get(a:adescr, 'actionsmatcher',
                 \                                s:actdefmatcher),
                 \                            fsastr, curargstr, 0))
-    if self.type isnot 'complete'
+    if a:type isnot 'complete'
         call self.nextthrow(actionstr.' is 0', 'anf', idx, curargstr)
     endif
-    if self.type is 'filter'
+    if a:type is 'pipe'
         call self.let(curargstr, actionstr)
     endif
     unlet curargstr
         let self.subs[-1]=copy(astartsub)
     endfor
     if noact isnot 0
-        if self.type is 'complete'
+        if a:type is 'complete'
             call self.else()
         else
             call self.popms().catch(s:cfreg)
         call self.up().up()
     endif
     let self.subs[-1]=[a:caidxstr]
-    if self.type is 'complete'
+    if a:type is 'complete'
         call self.up().up()
     endif
     return [[a:caidxstr], a:addedsavemsgs]
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.