1. ZyX_I
  2. frawor


ZyX_I  committed 105d589

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

  • Participants
  • Parent commits 5e56d13
  • Branches default

Comments (0)

Files changed (4)

File plugin/frawor/fwc/compiler.vim

View file
  • Ignore whitespace
             \     '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

View file
  • Ignore whitespace
         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

View file
  • Ignore whitespace
 ::: Section <Required, optional, actions, prefixes and next composition>
 <<< messages

File test/fwctests.dat

View file
  • Ignore whitespace
 ['{?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