[antlr-interest] How to have strings enclosed in " and/or "

matthew ford Matthew.Ford at forward.com.au
Thu Dec 9 11:42:20 PST 2004


Thanks for the suggestion but the language I am parsing is a pre-processor
to HTML
WebStringTemplates and might be edited by an HTML Editor and then notepad
leading to " and " combined
also you can have strings like
!![" this is a " in a string"]

the output is pure html
 this is a " in a string
but the valid input has mixed " and &quote just because the user type it in
notepad
after the HTML editor had done its conversion

I cannot pre-convert all " to " as this breaks what the user wants to
output.
matthew
----- Original Message ----- 
From: "Akhilesh Mritunjai" <virtualaspirin at yahoo.com>
To: <antlr-interest at yahoogroups.com>
Sent: Friday, December 10, 2004 5:04 AM
Subject: Re: [antlr-interest] How to have strings enclosed in " and/or
&quot;


>
> Matthew
>
> Though it has been quite some time for me, I think
> your problem is lot simpler.
>
> A HTML string in any tag can't start/end with
> "&quot;".  However, in HTML text, "&quot;" is supposed
> to be used instead of literal double quotes. So the
> two don't clash.
>
> I suggest you write a preprocessor that "cleans" up
> the code using a lexer grammar to clean up all the
> special marks outside tags into their respective
> symbolic representation, and then use the standard
> grammar to parse/lex various language entities in the
> cleaned-up HTML.
>
> So something like
>
> <font size="+1">Hello "tom & susie&quot;</font>
>
> should be cleaned into
>
> <font size="+1">Hello &quot;tom &amp;
> susie&quot;</font>
>
> which is more convenient to write grammar for.
>
> - akhilesh
>
>
> --- matthew ford <Matthew.Ford at forward.com.au> wrote:
> >
> > Hi all,
> > I am having trouble in the lexer handling strings
> > that start and end with "
> > or &quot;
> > (might start with " and end with &quot;)
> > Some html editors kindly replace " with &quot; when
> > you load the file.
>
>
>
>
> __________________________________
> Do you Yahoo!?
> The all-new My Yahoo! - Get yours free!
> http://my.yahoo.com
>
>
>
>
>
> Yahoo! Groups Links
>
>
>
>
>
>
>



 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/antlr-interest/

<*> To unsubscribe from this group, send an email to:
    antlr-interest-unsubscribe at yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 





More information about the antlr-interest mailing list