Eric Raymond:
Add a convenience function to generate C-compiler style error leaders.
This commit is contained in:
parent
eb4e11ae44
commit
4b83ecbbaa
|
@ -158,6 +158,14 @@ class shlex:
|
||||||
newfile = newfile[1:-1]
|
newfile = newfile[1:-1]
|
||||||
return (newfile, open(newfile, "r"))
|
return (newfile, open(newfile, "r"))
|
||||||
|
|
||||||
|
def error_leader(self, infile=None, lineno=None):
|
||||||
|
"Emit a C-compiler-like, Emacs-friendly error-message leader."
|
||||||
|
if not infile:
|
||||||
|
infile = self.infile
|
||||||
|
if not lineno:
|
||||||
|
lineno = self.lineno
|
||||||
|
return "\"%s\", line %d: " % (infile, lineno)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
||||||
lexer = shlex()
|
lexer = shlex()
|
||||||
|
|
Loading…
Reference in New Issue