aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2014-05-31 20:31:28 +0300
committerJussi Pakkanen <jpakkane@gmail.com>2014-05-31 20:31:28 +0300
commite8c6c09717bd4f3945161099796c58e25fd5a640 (patch)
tree64f6848e246a9f61fd412f1723444f24e037ca81 /tools
parentf64ba790334351c165550403961458b263eabf33 (diff)
downloadmeson-e8c6c09717bd4f3945161099796c58e25fd5a640.zip
meson-e8c6c09717bd4f3945161099796c58e25fd5a640.tar.gz
meson-e8c6c09717bd4f3945161099796c58e25fd5a640.tar.bz2
Count line and column numbers.
Diffstat (limited to 'tools')
-rwxr-xr-xtools/cmake2meson.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/tools/cmake2meson.py b/tools/cmake2meson.py
index 790f6aa..1c97282 100755
--- a/tools/cmake2meson.py
+++ b/tools/cmake2meson.py
@@ -50,11 +50,9 @@ class Lexer:
col = 0
while(loc < len(code)):
matched = False
- value = None
for (tid, reg) in self.token_specification:
mo = reg.match(code, loc)
if mo:
- curline = lineno
col = mo.start()-line_start
matched = True
loc = mo.end()
@@ -71,6 +69,9 @@ class Lexer:
yield(Token('id', match_text))
elif tid == 'eol':
#yield('eol')
+ lineno += 1
+ col = 1
+ line_start = mo.end()
pass
elif tid == 'varexp':
yield(Token('varexp', match_text[2:-1]))
@@ -78,7 +79,7 @@ class Lexer:
raise RuntimeError('Wharrgarbl')
break
if not matched:
- raise RuntimeError('Lexer got confused %d %d' % (lineno, col))
+ raise RuntimeError('Lexer got confused line %d column %d' % (lineno, col))
class Parser():
def __init__(self, code):