You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Darin Kelkhoff <da...@sportingnews.com> on 2001/11/12 23:57:31 UTC

too few arguments to macro errors

using 1.2, RC2, we have a macro library file with close to 100 macros in it.  
when the library is parsed, in the log foreach macro we get a message like 
this:


Mon Nov 12 16:27:18 CST 2001   [info] Velocimacro : added new VM : 
#spacer( ) : source = build/com/tsn/templates/primary_macro_lib


there are ~100 lines just like this in sequence in our log.
Then, however, after all these lines a new series of lines appear in the log. 
 they are all in the format:


Mon Nov 12 16:27:18 CST 2001  [error] VM #spacer: error : too few arguments 
to macro. Wanted 3 got 0  -->


these lines always complain that macro had too few arguments, but all our 
templates are rendering fine, all our macro calls are not incorrect.  

when i further inspected the situation, i noticed that for each macro, it 
would generate the error message once for each time that macro was referred 
to in the library file before where that macro was defined.  here's an 
example:


#macro(A $a)
  #B(2)
  #C(3)
#end
#macro(B $b)
  #A(1)
  #C(3)
#end
#macro(C $c)
  #A(1)
  #B(2)
#end

this would generate in the log something like:

...added new VM : #A( )...
...added new VM : #B( )...
...added new VM : #C( )...
...VM #B: error : too few arguments...
...VM #C: error : too few arguments...
...VM #C: error : too few arguments...


at least, thats as closely as i can reproduce the situation.

does this sound like a problem with our code?  has anyone else seen something 
like this?  any ideas?

any help is appreciated,
--darin




-- 
Darin Kelkhoff
darink@sportingnews.com
Programmer
The Sporting News
www.sportingnews.com

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: too few arguments to macro errors

Posted by Nathan Bubna <na...@esha.com>.
i don't know any other way around it. (not that i've really looked or
tried), perhaps geir or some one could shed some light, but to me it seems
that this is a bug in the way the macros are parsed or loaded.  if there is
no syntactical error and the arguments DO line up correctly (as they did for
us too), then i don't think velocity should be giving an error or a warning
(as it also did for us).  or perhaps i am missing something...

Nathan Bubna

----- Original Message -----
From: "Darin Kelkhoff" <da...@sportingnews.com>
To: "Velocity Users List" <ve...@jakarta.apache.org>
Sent: Tuesday, November 13, 2001 3:27 PM
Subject: Re: too few arguments to macro errors


> yes, while i don't have math to prove it, i do believe our macros do call
> each other too much for us to just rearrange the macro library to avoid
these
> errors.
>
> so is there any way to get around this?  can some warning/error control
level
> be adjusted anywhere in velocity?  is it a known issue?  i don't want to
just
> have to tell everyone to just ignore those hundreds of lines of errors in
the
> log...
>
>
> thanks,
> --darin
>
>
>
> On Monday 12 November 2001 05:05 pm, Nathan Bubna wrote:
> > yeah, we ran into that.  i imagine it is due to the order macros are
added.
> > while it never seemed to cause any problems, we were able to eschew the
> > reported errors by rearranging the order in which our macros are
declared.
> > but that doesn't appear possible with the example you give.
> >
> > Nathan Bubna
> > nathan@esha.com
> >
> > ----- Original Message -----
> > From: "Darin Kelkhoff" <da...@sportingnews.com>
> > To: <ve...@jakarta.apache.org>
> > Sent: Monday, November 12, 2001 2:57 PM
> > Subject: too few arguments to macro errors
> >
> > > using 1.2, RC2, we have a macro library file with close to 100 macros
in
> >
> > it.
> >
> > > when the library is parsed, in the log foreach macro we get a message
> > > like this:
> > >
> > >
> > > Mon Nov 12 16:27:18 CST 2001   [info] Velocimacro : added new VM :
> > > #spacer( ) : source = build/com/tsn/templates/primary_macro_lib
> > >
> > >
> > > there are ~100 lines just like this in sequence in our log.
> > > Then, however, after all these lines a new series of lines appear in
the
> >
> > log.
> >
> > >  they are all in the format:
> > >
> > >
> > > Mon Nov 12 16:27:18 CST 2001  [error] VM #spacer: error : too few
> >
> > arguments
> >
> > > to macro. Wanted 3 got 0  -->
> > >
> > >
> > > these lines always complain that macro had too few arguments, but all
our
> > > templates are rendering fine, all our macro calls are not incorrect.
> > >
> > > when i further inspected the situation, i noticed that for each macro,
it
> > > would generate the error message once for each time that macro was
> >
> > referred
> >
> > > to in the library file before where that macro was defined.  here's an
> > > example:
> > >
> > >
> > > #macro(A $a)
> > >   #B(2)
> > >   #C(3)
> > > #end
> > > #macro(B $b)
> > >   #A(1)
> > >   #C(3)
> > > #end
> > > #macro(C $c)
> > >   #A(1)
> > >   #B(2)
> > > #end
> > >
> > > this would generate in the log something like:
> > >
> > > ...added new VM : #A( )...
> > > ...added new VM : #B( )...
> > > ...added new VM : #C( )...
> > > ...VM #B: error : too few arguments...
> > > ...VM #C: error : too few arguments...
> > > ...VM #C: error : too few arguments...
> > >
> > >
> > > at least, thats as closely as i can reproduce the situation.
> > >
> > > does this sound like a problem with our code?  has anyone else seen
> >
> > something
> >
> > > like this?  any ideas?
> > >
> > > any help is appreciated,
> > > --darin
> > >
> > >
> > >
> > >
> > > --
> > > Darin Kelkhoff
> > > darink@sportingnews.com
> > > Programmer
> > > The Sporting News
> > > www.sportingnews.com
> > >
> > > --
> > > To unsubscribe, e-mail:
> >
> > <ma...@jakarta.apache.org>
> >
> > > For additional commands, e-mail:
> >
> > <ma...@jakarta.apache.org>
>
> --
> Darin Kelkhoff
> darink@sportingnews.com
> Programmer
> The Sporting News
> www.sportingnews.com
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: too few arguments to macro errors

Posted by Darin Kelkhoff <da...@sportingnews.com>.
yes, while i don't have math to prove it, i do believe our macros do call 
each other too much for us to just rearrange the macro library to avoid these 
errors.

so is there any way to get around this?  can some warning/error control level 
be adjusted anywhere in velocity?  is it a known issue?  i don't want to just 
have to tell everyone to just ignore those hundreds of lines of errors in the 
log...


thanks,
--darin



On Monday 12 November 2001 05:05 pm, Nathan Bubna wrote:
> yeah, we ran into that.  i imagine it is due to the order macros are added.
> while it never seemed to cause any problems, we were able to eschew the
> reported errors by rearranging the order in which our macros are declared.
> but that doesn't appear possible with the example you give.
>
> Nathan Bubna
> nathan@esha.com
>
> ----- Original Message -----
> From: "Darin Kelkhoff" <da...@sportingnews.com>
> To: <ve...@jakarta.apache.org>
> Sent: Monday, November 12, 2001 2:57 PM
> Subject: too few arguments to macro errors
>
> > using 1.2, RC2, we have a macro library file with close to 100 macros in
>
> it.
>
> > when the library is parsed, in the log foreach macro we get a message
> > like this:
> >
> >
> > Mon Nov 12 16:27:18 CST 2001   [info] Velocimacro : added new VM :
> > #spacer( ) : source = build/com/tsn/templates/primary_macro_lib
> >
> >
> > there are ~100 lines just like this in sequence in our log.
> > Then, however, after all these lines a new series of lines appear in the
>
> log.
>
> >  they are all in the format:
> >
> >
> > Mon Nov 12 16:27:18 CST 2001  [error] VM #spacer: error : too few
>
> arguments
>
> > to macro. Wanted 3 got 0  -->
> >
> >
> > these lines always complain that macro had too few arguments, but all our
> > templates are rendering fine, all our macro calls are not incorrect.
> >
> > when i further inspected the situation, i noticed that for each macro, it
> > would generate the error message once for each time that macro was
>
> referred
>
> > to in the library file before where that macro was defined.  here's an
> > example:
> >
> >
> > #macro(A $a)
> >   #B(2)
> >   #C(3)
> > #end
> > #macro(B $b)
> >   #A(1)
> >   #C(3)
> > #end
> > #macro(C $c)
> >   #A(1)
> >   #B(2)
> > #end
> >
> > this would generate in the log something like:
> >
> > ...added new VM : #A( )...
> > ...added new VM : #B( )...
> > ...added new VM : #C( )...
> > ...VM #B: error : too few arguments...
> > ...VM #C: error : too few arguments...
> > ...VM #C: error : too few arguments...
> >
> >
> > at least, thats as closely as i can reproduce the situation.
> >
> > does this sound like a problem with our code?  has anyone else seen
>
> something
>
> > like this?  any ideas?
> >
> > any help is appreciated,
> > --darin
> >
> >
> >
> >
> > --
> > Darin Kelkhoff
> > darink@sportingnews.com
> > Programmer
> > The Sporting News
> > www.sportingnews.com
> >
> > --
> > To unsubscribe, e-mail:
>
> <ma...@jakarta.apache.org>
>
> > For additional commands, e-mail:
>
> <ma...@jakarta.apache.org>

-- 
Darin Kelkhoff
darink@sportingnews.com
Programmer
The Sporting News
www.sportingnews.com

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: too few arguments to macro errors

Posted by Nathan Bubna <na...@esha.com>.
yeah, we ran into that.  i imagine it is due to the order macros are added.
while it never seemed to cause any problems, we were able to eschew the
reported errors by rearranging the order in which our macros are declared.
but that doesn't appear possible with the example you give.

Nathan Bubna
nathan@esha.com

----- Original Message -----
From: "Darin Kelkhoff" <da...@sportingnews.com>
To: <ve...@jakarta.apache.org>
Sent: Monday, November 12, 2001 2:57 PM
Subject: too few arguments to macro errors


> using 1.2, RC2, we have a macro library file with close to 100 macros in
it.
> when the library is parsed, in the log foreach macro we get a message like
> this:
>
>
> Mon Nov 12 16:27:18 CST 2001   [info] Velocimacro : added new VM :
> #spacer( ) : source = build/com/tsn/templates/primary_macro_lib
>
>
> there are ~100 lines just like this in sequence in our log.
> Then, however, after all these lines a new series of lines appear in the
log.
>  they are all in the format:
>
>
> Mon Nov 12 16:27:18 CST 2001  [error] VM #spacer: error : too few
arguments
> to macro. Wanted 3 got 0  -->
>
>
> these lines always complain that macro had too few arguments, but all our
> templates are rendering fine, all our macro calls are not incorrect.
>
> when i further inspected the situation, i noticed that for each macro, it
> would generate the error message once for each time that macro was
referred
> to in the library file before where that macro was defined.  here's an
> example:
>
>
> #macro(A $a)
>   #B(2)
>   #C(3)
> #end
> #macro(B $b)
>   #A(1)
>   #C(3)
> #end
> #macro(C $c)
>   #A(1)
>   #B(2)
> #end
>
> this would generate in the log something like:
>
> ...added new VM : #A( )...
> ...added new VM : #B( )...
> ...added new VM : #C( )...
> ...VM #B: error : too few arguments...
> ...VM #C: error : too few arguments...
> ...VM #C: error : too few arguments...
>
>
> at least, thats as closely as i can reproduce the situation.
>
> does this sound like a problem with our code?  has anyone else seen
something
> like this?  any ideas?
>
> any help is appreciated,
> --darin
>
>
>
>
> --
> Darin Kelkhoff
> darink@sportingnews.com
> Programmer
> The Sporting News
> www.sportingnews.com
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>