diff options
Diffstat (limited to 'lexer.py')
| -rw-r--r-- | lexer.py | 8 | 
1 files changed, 6 insertions, 2 deletions
| @@ -67,9 +67,10 @@ def lex(data):              current += length          # strings          elif char == '"': -            tok, length = get_string(data[current+1:], line) +            tok, length, offset = get_string(data[current+1:], line)              tokens.append(tok)              current += length +            line += offset          # bools          elif char == "#":              tok, length = get_bool(data[current+1:], line) @@ -118,14 +119,17 @@ def get_number(data, line):  def get_string(data, line): +    offset = 0      counter = 0      string = ""      while data[counter] != '"': +        if data[counter] == "\n": +            offset += 1          string += data[counter]          counter += 1          if counter >= len(data):              raise Exception("couldn't parse string") -    return Token(TokenType.STRING, string, string, line), counter + 1 +    return Token(TokenType.STRING, string, string, line), counter + 1, offset  def get_bool(data, line):      if len(data) >= 4 and data[:4] == "true": | 
