ZyX_I committed 8881718

@/checks: Renamed args.arg to args.check, improved getlist() function (it is now able to use variables, functions and expressions)

Comments (0)

Files changed (1)


 "▶2 pipe.earg
 " Replaces {argument} with the result of evaluating itself
 let s:args.pipe.earg=[]
-"▶1 arg
-let s:F.arg={}
-let s:args.arg={}
-"▶2 arg.func
+"▶1 check
+let s:F.check={}
+let s:args.check={}
+"▶2 check.func
 " Checks whether result of running {func}({argument}) isnot 0
-let s:args.arg.func=['func']
-"▶2 arg.eval
+let s:args.check.func=['func']
+"▶2 check.eval
 " Checks whether result of running eval({expr}) isnot 0
-let s:args.arg.eval=['expr']
-"▶2 arg.type
+let s:args.check.eval=['expr']
+"▶2 check.type
 " Checks whether {argument} has one of given types
-let s:args.arg.type=['*type']
-"▶2 arg.bool
+let s:args.check.type=['*type']
+"▶2 check.bool
 " Checks whether {argument} is either 0 or 1
-let s:args.arg.bool=[]
-"▶2 arg.range
+let s:args.check.bool=[]
+"▶2 check.range
 " Checks whether {argument} is in given range
-let s:args.arg.range=["number", "number"]
-"▶2 arg.keyof
+let s:args.check.range=["number", "number"]
+"▶2 check.keyof
 " Checks whether {argument} is a key of {var}
-let s:args.arg.keyof=['var']
-"▶2 arg.hkey
+let s:args.check.keyof=['var']
+"▶2 check.hkey
 " Checks whether {argument} is a dictionary with given keys
-let s:args.arg.hkey=['*string']
-"▶2 arg.isfunc
+let s:args.check.hkey=['*string']
+"▶2 check.isfunc
 " Checks whether {argument} is a callable function reference. Additional 
 " argument determines whether strings should be accepted
-let s:args.arg.isfunc=['?one']
-"▶2 arg.isreg
+let s:args.check.isfunc=['?one']
+"▶2 check.isreg
 " Checks whether {argument} is a valid regular expression
-let s:args.arg.isreg=[]
-"▶2 arg.match
+let s:args.check.isreg=[]
+"▶2 check.match
 " Checks whether {argument} is a string that matches {reg}
-let s:args.arg.match=['reg']
-"▶2 arg.dict
+let s:args.check.match=['reg']
+"▶2 check.dict
 " Checks whether {argument} is a dictionary matching given {ddescr}
-let s:args.arg.dict=['ddescr']
-"▶2 arg.tuple
+let s:args.check.dict=['ddescr']
+"▶2 check.tuple
 " Checks whether {argument} is a list with a fixed length and each element 
 " matching given specification
-let s:args.arg.tuple=['*arg']
-"▶2 arg.either
+let s:args.check.tuple=['*check']
+"▶2 check.either
 " Checks whether {argument} matches one of given specifications
-let s:args.arg.either=['*arg']
-"▶2 arg.path
+let s:args.check.either=['*check']
+"▶2 check.path
 " Checks whether {argument} is a path matching given specification
-let s:args.arg.path=['path']
-"▶2 arg._, arg.any
+let s:args.check.path=['path']
+"▶2 check._, check.any
 " Unconditionally accepts {argument}
-let s:args.arg._=[]
-let s:args.arg.any=s:args.arg._
+let s:args.check._=[]
+let s:args.check.any=s:args.check._
 "▶1 matcher
 let s:F.matcher={}
 let s:args.matcher={}
     return self.conclose()
 "▶2 scan.getlist    :: &self
+" Input: ( "$" {var} | "*" {func} | "=" {expr} | {str} | {wordchar}+ )* "]"?
+" Output: context(list, ({var}|{expr}|String)*)
 function s:F.scan.getlist()
     call self.addcon('list')
     while !self.eos
         let c=self.readc()
         if c is ']'
+        elseif c is '$'
+            call self.getvar()
+        elseif c is '='
+            call self.getexpr()
+        elseif c is '*'
+            call self.getfunc()
         elseif c is '"'
-            call self.add(self.nexstr())
-        else
+            call self.add(self.nextstr())
+        elseif c=~#'^\w'
             call self.add(c)
     let c=self.readc()
     if c=~#'^\w'
-        call self.addcon('plugvar').ungetc(c).getsubscr().conclose()
+        call self.addcon('plugvar', c).getsubscr().conclose()
     elseif c is '@'
         return self.getchvar()
     elseif c is '='
     elseif c is '<'
         return self.scanact()
-    call self.addcon('arg')
+    call self.addcon(self.type)
     let hasparen=0
     let hastext=0
     if c is '('
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
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.