From: <kea...@na...> - 2003-02-12 22:27:04
|
I guess I was a bit hasty in my post ... it appears the solution is not quite as trivial as I had thought. The problem is how to recreate the original template text after it has already been parsed, with all the = proper whitespace, etc. This seems like a parser hack, i.e., if the = MacroBuilder spews a NoSuchDirectiveException, then the parser needs to push back = all the whitespace and the # directive name. =20 Bleck! Keats > -----Original Message----- > From: Keats Kirsch=20 > Sent: Wednesday, February 12, 2003 5:10 PM > To: 'Eric B. Ridge'; Keats Kirsch > Cc: la...@op...; br...@qu...; ma...@an...; > web...@li... > Subject: RE: [Webmacro-devel] Handling Dreamweaver stuff >=20 >=20 > You're right, I was mislead by some apparently dead code in=20 > the parser: >=20 > throw new ParseException("No such directive #" + directive); >=20 > Apparently, this now gets handled by the=20 > MacroBuilder.build(), which throws: >=20 > throw new BuildException ("#" + name + ": no such=20 > Macro or Directive"); > =20 > This should make things much simpler. >=20 > So you could just say: >=20 > bc.getEvaluationExceptionHandler().evaluate(null, bc,=20 > new BuildException ("#" + name + ": no such Macro=20 > or Directive")); >=20 > This would actually fail with the DefaultEEH, as it currently=20 > doesn't check for a null variable arg. Easily fixed, but=20 > better would be to create a new PropertyException, like=20 > PropertyException.NoSuchDirectiveOrMacro and throw that. >=20 > I could try to make these changes if you'd like. >=20 > Keats >=20 > > -----Original Message----- > > From: Eric B. Ridge [mailto:eb...@tc...] > > Sent: Wednesday, February 12, 2003 4:36 PM > > To: kea...@na... > > Cc: la...@op...; br...@qu...; ma...@an...; > > web...@li... > > Subject: Re: [Webmacro-devel] Handling Dreamweaver stuff > >=20 > >=20 > > On Wednesday, February 12, 2003, at 04:01 PM,=20 > > kea...@na... wrote: > >=20 > > > I think using the EEH would be great, but it does present some=20 > > > challenges as Eric has pointed out.=A0 The unknown directive=20 > > exceptions=20 > > > are thrown by the parser.=A0 The parser does have a=20 > reference to the=20 > > > broker, so it should be able to get the EEH and pass=20 > > exceptions back=20 > > > to it. > >=20 > > Technically, it's a BuildException, not a ParseException. > >=20 > > > > > > Unfortunately the EEH interface was designed to handle evaluation = > > > exceptions (hence the name).=A0 To handle parse exceptions we = would=20 > > > probably want a new method in the interface (like=20 > "parse()").=A0 This=20 > > > would require a change in all existing EEH implementations.=A0 > > Probably=20 > > > not a huge problem, but something to consider.=A0 > > > > > > Also the name wouldn't be quite appropriate if we expand=20 > > the scope of=20 > > > this.=A0 It should probably be just ExceptionHandler or=20 > > > WMExceptionHandler.=A0 Maybe an o.w.ExceptionHandler=20 > interface could=20 > > > extend EvaluationExceptionHandler and add the new method.=A0=20 > > Then if you=20 > > > configure an ExceptionHandler, it would automatically set=20 > > the EEH as=20 > > > well.=A0 This should preserve backwards compatability. > >=20 > > I don't think we'll need to change the interface for EEH. But we=20 > > could/should change the name... > >=20 > > > > > > In any case, someone would need to tweek the parser -- and=20 > > I know of=20 > > > only two candidates ... > >=20 > > The parser won't need to be touched. I don't believe. > >=20 > > > > > > Keats > > > > > > > -----Original Message----- > > > > From: Eric B. Ridge [mailto:eb...@tc...] > > > > Sent: Tuesday, February 11, 2003 8:05 PM > > > > To: la...@op... > > > > Cc: Brian Goetz; ma...@an...; > > > > web...@li... > > > > Subject: Re: [Webmacro-devel] Handling Dreamweaver stuff > > > > > > > > > > > > On Tuesday, February 11, 2003, at 04:12=A0 PM, Lane Sharman = wrote: > > > > > > > > > ebr: > > > > > > > > > > Can you make a stab at modifying eeh so that we can try=20 > > this out? > > > > > > > > I can, yes... when I find the time. > > > > > > > > The issue here is that EEH is used as a "runtime" thing, not a > > > > "buildtime" thing, so I'm not sure how it will interact with = the > > > > BuildContext (if it all). > > > > > > > > Assuming I can work that out, I guess we want: > > > > =A0=A0=A0=A0=A0 CrankyEEH to *always* throw on #unknown = directives > > > > =A0=A0=A0=A0=A0 DefaultEEH to *always* pass #unknown directives = to the > > > > stream as > > > > string literals > > > >=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 MarcEEH to do whatever Marc = wants, to be=20 > > written by him.=A0=20 > > > :) > > > > > > > > eric > > > > > > > > > > > > > > -l > > > > > > > > > > Eric B. Ridge wrote: > > > > > > > > > >> On Tuesday, February 11, 2003, at 03:35=A0 PM, Brian=20 > Goetz wrote: > > > > >> > > > > >>>> This problem is elegantly solved thru the introduction of = a > > > > >>>> property, > > > > >>>> StrictDirectiveTypeChecking. Invariably, there will be > > > > times when > > > > >>>> you > > > > >>>> cannot "include as text" a DW file because you will=20 > > want to add > > > > >>>> some WM > > > > >>>> var reference to it! > > > > >>> > > > > >>> > > > > >>> I'd rather see "strict directive checking" rolled in with > > > > other forms > > > > >>> of strict checking (like the Cranky EEH), rather than=20 > > have seven > > > > >>> different > > > > >>> things a user would have to do to get strict checking. > > > > >> > > > > >> > > > > >> Better yet (maybe), roll this thing through EEH... if=20 > > that's even > > > > >> possible. > > > > >> > > > > >> eric > > > > >> > > > > >> > > > > >> > > > > >> ------------------------------------------------------- > > > > >> This SF.NET email is sponsored by: > > > > >> SourceForge Enterprise Edition + IBM + LinuxWorld =3D > > > > Something 2 See! > > > > >> http://www.vasoftware.com > > > > >> _______________________________________________ > > > > >> Webmacro-devel mailing list > > > > >> Web...@li... > > > > >> https://lists.sourceforge.net/lists/listinfo/webmacro-devel > > > > >> > > > > > > > > > > -- > > > > > Lane Sharman > > > > > http://opendoors.com Conga, GoodTimes and Application > > > > Hosting Services > > > > > http://opendoors.com/lane.pdf BIO > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > ------------------------------------------------------- > > > > > This SF.NET email is sponsored by: > > > > > SourceForge Enterprise Edition + IBM + LinuxWorld =3D=20 > Something 2=20 > > > See! > > > > > http://www.vasoftware.com > > > > > _______________________________________________ > > > > > Webmacro-devel mailing list > > > > > Web...@li... > > > > > https://lists.sourceforge.net/lists/listinfo/webmacro-devel > > > > > > > > > > > > > > > > ------------------------------------------------------- > > > > This SF.NET email is sponsored by: > > > > SourceForge Enterprise Edition + IBM + LinuxWorld =3D=20 > > Something 2 See! > > > > http://www.vasoftware.com > > > > _______________________________________________ > > > > Webmacro-devel mailing list > > > > Web...@li... > > > > https://lists.sourceforge.net/lists/listinfo/webmacro-devel > > > > > > > > >=20 >=20 |