diff python/c3/lexer.py @ 163:8104fc8b5e90

Added visitor to c3
author Windel Bouwman
date Mon, 18 Mar 2013 20:13:57 +0100
parents b73bc14a3aa3
children 6b2bec5653f1
line wrap: on
line diff
--- a/python/c3/lexer.py	Sun Mar 10 11:36:55 2013 +0100
+++ b/python/c3/lexer.py	Mon Mar 18 20:13:57 2013 +0100
@@ -11,7 +11,7 @@
 
 keywords = ['and', 'or', 'not','true', 'false', \
    'else', 'if', 'while', 'return', \
-   'function', 'var', 'type', \
+   'function', 'var', 'type', 'const', \
    'import', 'package' ]
 
 def tokenize(s):
@@ -62,7 +62,7 @@
            val = float(val)
          elif typ == 'STRING':
            val = val[1:-1]
-         loc = SourceLocation(line, mo.start()-line_start)
+         loc = SourceLocation(line, mo.start()-line_start, mo.end() - mo.start())
          yield Token(typ, val, loc)
        pos = mo.end()
        mo = gettok(s, pos)