ZyX_I committed 105d589

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

  • Participants
  • Parent commits 5e56d13

Comments (0)

Files changed (4)

File 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',

File 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()

File test/fwccheck.ok

 ::: Section <Required, optional, actions, prefixes and next composition>
 <<< messages

File 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