1. ZyX_I
  2. frawor

Commits

ZyX_I  committed 7609fc2

Renamed next* to read*

  • Participants
  • Parent commits 18c2f7e
  • Branches default

Comments (0)

Files changed (1)

File plugin/frawor/checks.vim

View file
  • Ignore whitespace
     let self.eos=0
     return self
 endfunction
-"▶2 scan.nextc      :: () + self → String + self(s)
+"▶2 scan.readc      :: () + self → String + self(s)
 " Gets next character or word
-function s:F.scan.nextc()
+function s:F.scan.readc()
     if self.eos
         call self.throw('eos')
     endif
     let self.eos=empty(self.s)
     return c
 endfunction
-"▶2 scan.nextstr    :: () + self → String + self(s)
+"▶2 scan.readstr    :: () + self → String + self(s)
 " Gets next double-quoted string. Backslash just escapes next character, no 
 " other translations are done
-function s:F.scan.nextstr()
+function s:F.scan.readstr()
     if !empty(self.ungot)
         call self.throw('int', 'strungetc')
     endif
     let self.eos=empty(self.s)
     return substitute(c[:-2], '\\\(.\)', '\1', 'g')
 endfunction
-"▶2 scan.nextreg    :: endstr + self → String + self(s)
+"▶2 scan.readreg    :: endstr + self → String + self(s)
 " Gets the next regular expression. {endstr} determines border character
-function s:F.scan.nextreg(endstr)
+function s:F.scan.readreg(endstr)
     if !empty(self.ungot)
         call self.throw('int', 'regungetc')
     endif
     let self.eos=empty(self.s)
     return c[:-2]
 endfunction
-"▶2 scan.nextflt    :: () + self → String + self(s)
-function s:F.scan.nextflt()
+"▶2 scan.readflt    :: () + self → String + self(s)
+function s:F.scan.readflt()
     if !empty(self.ungot)
         call self.throw('int', 'fltungetc')
     endif
 function s:F.scan.scanlist(farg)
     call self.addcon()
     if !self.eos
-        let c=self.nextc()
+        let c=self.readc()
         if c is '('
             while !self.eos
-                let c=self.nextc()
+                let c=self.readc()
                 if c is ')'
                     break
                 elseif c isnot ','
             while !self.eos
                 call call(self['get'.a:farg], [], self)
                 if !self.eos
-                    let c=self.nextc()
+                    let c=self.readc()
                     if c isnot ','
                         call self.ungetc(c)
                         break
     if self.eos
         call self.throw('funcmis', type)
     endif
-    let c=self.nextc()
+    let c=self.readc()
     let func=s:F.getmatch(s:args[type], c)
     if func is 0
         call self.throw("ukfunc", c)
 " Consumes a word and adds 1 to context if next word is "1", otherwise adds 0. 
 " If next word is "0", it is consumed.
 function s:F.scan.getone()
-    let c=self.nextc()
+    let c=self.readc()
     if c is '1'
         call self.add(1)
     else
     if self.eos
         call self.throw('typemis')
     endif
-    let c=self.nextc()
+    let c=self.readc()
     if has_key(s:typechars, c)
         call self.add(s:typechars[c][0])
         if !self.eos
-            let nextchar=s:typechars[c][1]
-            let c=self.nextc()
-            if c isnot nextchar
+            let readchar=s:typechars[c][1]
+            let c=self.readc()
+            if c isnot readchar
                 call self.ungetc(c)
             endif
         endif
 " Gets either a string or variable name
 " {string} :: '"' ( ( ! '"' "\" ) | "\" ( '"' | "\" ) ) '"'
 function s:F.scan.getstring()
-    let c=self.nextc()
+    let c=self.readc()
     if c is '"'
-        call self.add(self.nextstr())
+        call self.add(self.readstr())
     elseif c is '$'
         call self.getvar()
     elseif c=~#'^\w'
 "        will be accepted),
 " 4. "x" for executable file (not directory)
 function s:F.scan.getpath()
-    let c=self.nextc()
+    let c=self.readc()
     if c=~#'^[df]\=r\=[wWp]\=x\=$' && c!~#'^d\%(.\{,2}x\|r\)'
         call self.add(c)
     else
 " {valuedescr} :: {arg}
 function s:F.scan.getddescr()
     call self.addcon('ddescr')
-    call self.nextc() " Skip `{'
+    call self.readc() " Skip `{'
     while !self.eos
-        let c=self.nextc()
+        let c=self.readc()
         if c is '}'
             break
         elseif c is '"'
-            call self.addcon('eq', self.nextstr()).scan().conclose()
+            call self.addcon('eq', self.readstr()).scan().conclose()
         elseif c is '/'
-            call self.addcon('regex', self.nextreg('/')).scan().conclose()
+            call self.addcon('regex', self.readreg('/')).scan().conclose()
         else
             call self.addcon('check').ungetc(c).scan().scan().conclose()
         endif
         \}
 function s:F.scan.getreg()
     call self.addcon('regex')
-    let c=self.nextc()
+    let c=self.readc()
     if c is '$'
         call self.getvar()
     else
-        call self.add(self.nextreg(get(s:pairs, c, c)))
+        call self.add(self.readreg(get(s:pairs, c, c)))
     endif
     return self.conclose()
 endfunction
 "▶2 scan.getnumber  :: &self
 function s:F.scan.getnumber()
-    let f=self.nextflt()
+    let f=self.readflt()
     if f[-3:] is 'inf'
         return self.addcon('inf').conclose()
     endif
     call self.addcon('expr')
     let parens=[]
     while !self.eos
-        let c=self.nextc()
+        let c=self.readc()
         if has_key(s:parens, c)
             call add(parens, s:parens[c])
         elseif c is '"'
-            let c.=substitute(escape(self.nextstr(),'\"'), "\n", '\\n', 'g').'"'
+            let c.=substitute(escape(self.readstr(),'\"'), "\n", '\\n', 'g').'"'
         elseif has_key(s:revparens, c)
             if empty(parens)
                 call self.ungetc(c)
 function s:F.scan.getchvar()
     call self.addcon('this', 0)
     if !self.eos
-        let c=self.nextc()
+        let c=self.readc()
         if c is '<'
             let self.l[-1]+=1
             while !self.eos
-                let c=self.nextc()
+                let c=self.readc()
                 if c is '<'
                     let self.l[-1]+=1
                 else
         if c is '.'
             call self.addcon('subscript', [])
             while !self.eos
-                let c=self.nextc()
+                let c=self.readc()
                 if c is '"'
-                    call add(self.l[-1], self.nextstr())
+                    call add(self.l[-1], self.readstr())
                 elseif c=~#'^\d'
                     call add(self.l[-1], +c)
                 elseif c=~#'^\w'
                         if self.eos
                             call self.throw('subsmis')
                         endif
-                        let v=self.nextc()
+                        let v=self.readc()
                         if v is '-'
                             if self.eos
                                 call self.throw('nonum')
                             endif
-                            let v.=self.nextc()
+                            let v.=self.readc()
                         endif
                         call self.add(+v)
                     endfor
 function s:F.scan.getlist()
     call self.addcon('list')
     while !self.eos
-        let c=self.nextc()
+        let c=self.readc()
         if c is ']'
             break
         elseif c is '"'
     if self.eos
         call self.throw('varmis')
     endif
-    let c=self.nextc()
+    let c=self.readc()
     if c=~#'^\w'
         call self.addcon('plugvar', c)
         while !self.eos
-            let c=self.nextc()
+            let c=self.readc()
             if c=~#'^\w'
                 let self.l[-1].=".".c
             elseif c isnot '.'
     elseif c is '='
         return self.getexpr()
     elseif c is '"'
-        call self.addcon('string', self.nextstr()).conclose()
+        call self.addcon('string', self.readstr()).conclose()
     elseif c is '['
         call self.getlist()
     else
     endif
     call self.getvar()
     if !self.eos
-        let c=self.nextc()
+        let c=self.readc()
         if c is '('
             while !self.eos
-                let c=self.nextc()
+                let c=self.readc()
                 if c is ')'
                     break
                 elseif c is '$'
         call self.throw('pipemis')
     endif
     call self.addcon('pipe')
-    let c=self.nextc()
+    let c=self.readc()
     if c is '*'
         call self.getfunc()
     else
     if self.eos
         call self.throw('msgmis')
     endif
-    call self.addcon('msg', self.nextc())
+    call self.addcon('msg', self.readc())
     if !self.eos
-        let c=self.nextc()
+        let c=self.readc()
         if self.c is '('
             while !self.eos
-                let c=self.nextc()
+                let c=self.readc()
                 if c is ')'
                     break
                 elseif c is '.'
 function s:F.scan.scanopt()
     call self.addcon('optional')
     while !self.eos
-        let c=self.nextc()
+        let c=self.readc()
         if c is ']'
             break
         endif
     if self.eos
         call self.throw('prefmis')
     endif
-    let c=self.nextc()
+    let c=self.readc()
     if c is '~'
         call self.getmatcher()
     else
         call self.ungetc(c)
     endif
     while !self.eos
-        let c=self.nextc()
+        let c=self.readc()
         if !exists('pref')
             if !exists('prefopts')
                 let prefopts={}
             endif
             if c is '"'
-                let c=self.nextstr()
+                let c=self.readstr()
                 let pref=c
             elseif c=~#'^\w'
                 let pref=c
     if self.eos
         call self.throw('actmis')
     endif
-    let c=self.nextc()
+    let c=self.readc()
     if c is '~'
         call self.getmatcher()
     else
         call self.ungetc(c)
     endif
     while !self.eos
-        let c=self.nextc()
+        let c=self.readc()
         if !exists('action')
             if c is '"'
-                let c=self.nextstr()
+                let c=self.readstr()
                 let action=c
             elseif c=~#'^\w'
                 let action=c
                 call self.addcon(action)
                 unlet action
                 while !self.eos
-                    let c=self.nextc()
+                    let c=self.readc()
                     if c is ')'
                         break
                     endif
 endfunction
 "▶2 scan.scan       :: &self
 function s:F.scan.scan()
-    let c=self.nextc()
+    let c=self.readc()
     if c is '['
         return self.scanopt()
     elseif c is '{'
         call self.ungetc(c)
     endif
     while !self.eos
-        let c=self.nextc()
+        let c=self.readc()
         if c is '|'
             call self.scanpipe()
         elseif c is '#'
 "▶2 scan.scanopts   :: &self
 let s:options={'only': 0,}
 function s:F.scan.scanopts()
-    let c=self.nextc()
+    let c=self.readc()
     if c is '-'
-        call self.nextc()  " Here must be a parenthesis
+        call self.readc()  " Here must be a parenthesis
         while !self.eos
-            let c=self.nextc()
+            let c=self.readc()
             if c is ')'
                 break
             elseif has_key(self.o, c)     " -(option)