<s> from devon . tags import * <EOL> import os . path , re <EOL> reExtraLine = re . compile ( r"<STR_LIT>" ) <EOL> class GCCParser : <EOL> def __init__ ( self ) : <EOL> patterns = r"""<STR_LIT>""" <EOL> self . patterns = re . compile ( patterns , re . M | re . VERBOSE ) <EOL> def parse ( self , text , project , out ) : <EOL> m = self . patterns . search ( text ) <EOL> if not m : <EOL> if text : <EOL> out << Block ( "<STR_LIT>" ) << text << Close << Flush <EOL> else : <EOL> while m : <EOL> groupdict = m . groupdict ( ) <EOL> groups = m . groups ( ) <EOL> offset = m . end ( ) <EOL> for name in groupdict : <EOL> if groupdict [ name ] : <EOL> extras = "<STR_LIT>" <EOL> m2 = reExtraLine . match ( text , offset + <NUM_LIT:1> ) <EOL> while m2 : <EOL> extras += m2 . groups ( ) [ <NUM_LIT:0> ] <EOL> offset = m2 . end ( ) <EOL> m2 = reExtraLine . match ( text , offset ) <EOL> handler = globals ( ) [ "<STR_LIT>" % name ] <EOL> if handler : <EOL> index = self . patterns . groupindex [ name ] <EOL> handler ( groups [ index : ] , extras , project , out ) <EOL> out . flush ( ) <EOL> m = self . patterns . search ( text , offset ) <EOL> out << Flush <EOL> def printInclude ( m , extras , project , out ) : <EOL> fileName = os . path . basename ( m [ <NUM_LIT:0> ] ) <EOL> out << Block ( "<STR_LIT>" ) << Span ( "<STR_LIT>" ) << "<STR_LIT>" << Close << FileLink ( "<STR_LIT>" , basePath = project . path , path = m [ <NUM_LIT:0> ] , lineNo = m [ <NUM_LIT:1> ] ) << "<STR_LIT>" % ( fileName , m [ <NUM_LIT:1> ] ) << Close << Close <EOL> def printFrom ( m , extras , project , out ) : <EOL> fileName = os . path . basename ( m [ <NUM_LIT:0> ] ) <EOL> out << Block ( "<STR_LIT>" ) << Span ( "<STR_LIT>" ) << message << Close << FileLink ( "<STR_LIT>" , basePath = project . path , path = m [ <NUM_LIT:0> ] , lineNo = m [ <NUM_LIT:1> ] , rowType = rowType ) << "<STR_LIT>" % ( fileName , m [ <NUM_LIT:1> ] ) << Close << Close <EOL> def printProblem ( m , extras , project , out ) : <EOL> fileName = os . path . basename ( m [ <NUM_LIT:0> ] ) <EOL> message = m [ <NUM_LIT:3> ] + extras <EOL> if m [ <NUM_LIT:2> ] == "<STR_LIT:error>" : <EOL> rowType = "<STR_LIT>" <EOL> else : <EOL> rowType = "<STR_LIT>" <EOL> out << Block ( "<STR_LIT>" % m [ <NUM_LIT:2> ] ) << Span ( "<STR_LIT>" ) << message << Close << FileLink ( "<STR_LIT>" , basePath = project . path , path = m [ <NUM_LIT:0> ] , lineNo = m [ <NUM_LIT:1> ] , rowType = rowType ) << "<STR_LIT>" % ( fileName , m [ <NUM_LIT:1> ] ) << Close << Close <EOL> def printUnknown ( m , extras , project , out ) : <EOL> fileName = os . path . basename ( m [ <NUM_LIT:0> ] ) <EOL> out << Block ( "<STR_LIT>" ) << Span ( "<STR_LIT>" ) << m [ <NUM_LIT:1> ] << Close << FileLink ( "<STR_LIT>" , basePath = project . path , path = m [ <NUM_LIT:0> ] , rowType = "<STR_LIT>" ) << fileName << Close << Close <EOL> def printUnknown2 ( m , extras , project , out ) : <EOL> fileName = os . path . basename ( m [ <NUM_LIT:0> ] ) <EOL> message = m [ <NUM_LIT:3> ] + extras <EOL> out << Block ( "<STR_LIT>" ) << Span ( "<STR_LIT>" ) << message << Close << FileLink ( "<STR_LIT>" , basePath = project . path , path = m [ <NUM_LIT:0> ] , lineNo = m [ <NUM_LIT:1> ] , rowType = "<STR_LIT>" ) << "<STR_LIT>" % ( fileName , m [ <NUM_LIT:1> ] ) << Close << Close </s>
