For some more information: - http://docs.python.org/lib/re-syntax.html -> Complete regular expression syntax from official python documentation. Here you can also see that the dot doesn't match the newline character, except when the DOTALL flag is used.
- http://docs.python.org/lib/module-re.html -> All information about the Python re module (regular expression module), once again fromt the official Python documentation. - http://www.amk.ca/python/howto/regex/ -> A regular expression howto. Dennis Bruce Frederiksen wrote: >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 -~----------~----~----~----~------~----~------~--~---
