You might try r'\|(.|\n)*?\|' since '.' doesn't match '\n'.  Also try 
r'\|[^|]*\|'.

Francesco Bochicchio wrote:
> Hi all,
>
> I'd like to use PLY to parse a grammar which includes multi-line
> comments bounded by the '|' symbol.
> The following scanner rule only works for single-line comments:
>
> t_DOCSTRING = r'\|.*\|'
>
> Anybody knows if it is possible to define multi-line tokens in
> ply.lex? I also tried removing '\n' from t_ignore
> and making it a special token (which I'm not sure is suitable for me,
> since it would make the syntax rules
> way too complicate), but still does not work.
>
> BTW, the syntax I'm trying to parse is the one of 'Petal
> files' (extension PTL). If anybody knows a module
> that already does the job, I would appreciate a pointer to it :-)
>
> Thanks in advance for any suggestion.
>
>
> Ciao
> -------
> FB
> >
>
>   


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"ply-hack" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/ply-hack?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to