Exemplo n.º 1
0
def processMessages():
    # Matches just the error messages from the compiler:
    # a file name, followed by a colon and line number, an optional column number,
    # and then the error message.
    # Since BBEdit doesn't accept column numbers, it doesn't try to parse
    # other positional feedback from the compiler.
    # To avoid false matches, this version doesn't allow spaces in file names.
    pat = re.compile(r"^([^: ]+):(\d+)(?:[.:-]\d+)*[:\s]+(.+)$")

    # Distinguish warning from errors.
    warning = re.compile(r"warning", re.IGNORECASE)
    warning_kind = NSAppleEventDescriptor.descriptorWithEnumCode_(
        fourCharCode('Wrng'))
    error_kind = NSAppleEventDescriptor.descriptorWithEnumCode_(
        fourCharCode('Err '))

    # Accumulate the set of errors found on stdin.
    entries = []
    for line in sys.stdin:
        sys.stdout.write(line)  # echo everything
        match = pat.match(line)
        if match:
            file, line, message = match.groups()
            kind = warning_kind if warning.match(message) else error_kind
            file = os.path.abspath(file)
            # BBEdit returns error -1701 for nonexistent files.
            if os.path.exists(file):
                entries.append(
                    dict(result_kind=kind,
                         result_file=file,
                         result_line=int(line),
                         message=message))
    return entries
Exemplo n.º 2
0
 def packenum(self, val):
     return NSAppleEventDescriptor.descriptorWithEnumCode_(
         fourcharcode(val.code))
Exemplo n.º 3
0
 def pack_enum(val):
     return NSAppleEventDescriptor.descriptorWithEnumCode_(four_characters_code(val.code))
Exemplo n.º 4
0
	def packenum(self, val): 
		return NSAppleEventDescriptor.descriptorWithEnumCode_(fourcharcode(val.code))