diff options
author | Mattias Andrée <maandree@operamail.com> | 2013-08-17 10:43:09 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@operamail.com> | 2013-08-17 10:43:09 +0200 |
commit | 5a04e1e1ebd926f348c74edb1dde587329d52f40 (patch) | |
tree | 908d291510a657f1f04d9446adbdc0098e8058fe /auto-auto-complete.py | |
parent | update year (diff) | |
download | auto-auto-complete-5a04e1e1ebd926f348c74edb1dde587329d52f40.tar.gz auto-auto-complete-5a04e1e1ebd926f348c74edb1dde587329d52f40.tar.bz2 auto-auto-complete-5a04e1e1ebd926f348c74edb1dde587329d52f40.tar.xz |
keep track of line, column and character
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to '')
-rwxr-xr-x | auto-auto-complete.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/auto-auto-complete.py b/auto-auto-complete.py index d07d7fc..8fb7710 100755 --- a/auto-auto-complete.py +++ b/auto-auto-complete.py @@ -63,6 +63,10 @@ class Parser: quote = None buf = None + col = 0 + char = 0 + line = 1 + for charindex in range(0, len(code)): c = code[charindex] if comment: @@ -118,6 +122,15 @@ class Parser: quote = c else: buf += c + + if c == '\t': + col |= 7 + col += 1 + char += 1 + if c in '\n\r\f': + line += 1 + col = 0 + char = 0 raise Exception('premature end of file') |