Commits

ZyX_I committed 105d589

@/fwc: Fixed unexpected error when prefix lacks required arguments

Comments (0)

Files changed (4)

plugin/frawor/fwc/compiler.vim

             \     'isnot': 'expected %s, but got %s',
             \       'anf': '`%s'' is not a valid action',
             \       'pnf': '`%s'' is not a valid prefix',
+            \ 'noprefarg': 'missing %u prefix arguments',
             \ 'noreqpref': 'some required prefixes are missing',
         \}, '"Error while processing check %s for %s: ".v:val'))
 let s:_messages._types=['number', 'string', 'function reference', 'list',

plugin/frawor/fwc/topconstructs.vim

         call self.addif(cond)
         "▶3 Process prefix arguments
         if a:type is# 'check' || a:type is# 'pipe'
+            if prefopts.argnum>0
+                call self.nextthrow(a:largsstr.'<'.
+                            \               a:caidxstr.'+'.prefopts.argnum,
+                            \     'noprefarg', idx,
+                            \     a:caidxstr.'+'.prefopts.argnum.'-'.a:largsstr)
+            endif
             for i in range(1, prefopts.argnum)
                 call self.compilearg(args[i-1], idx.self.string(prefix), a:type)
                 call self.incsub()
 plugin/frawor/fwc/compiler:pnf
 plugin/frawor/fwc/compiler:noreqpref
 plugin/frawor/fwc/compiler:pnf
+plugin/frawor/fwc/compiler:noprefarg
 ::: Section <Required, optional, actions, prefixes and next composition>
 plugin/frawor/fwc/compiler:tooshort
 <<< messages

test/fwctests.dat

 ['{?text - ?texthl -}',           'filter'], ['text'],    [{'text': 1}]
 ['{abc bool ?def bool}',          'filter'], ['def', {}], 0
 ['{*?ab isreg}',                  'filter'], ['b'],       0
+['{*?ab isreg}',                  'filter'], ['a'],       0
 ['{*b isreg !?a}', 'filter'], ['b', 'n', 'n'], [{'b': ['n'], 'a': 0}]
 ['{*b isreg !?a}', 'filter'], ['b', 'n', 'c'], [{'b': ['n', 'c']}]
 #▶1 Required, optional, actions, prefixes and next composition
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.