Make "do" a keyword
authorDavid Kerkeslager <kerkeslager@gmail.com>
Mon, 14 Aug 2017 06:34:41 +0000 (02:34 -0400)
committerDavid Kerkeslager <kerkeslager@gmail.com>
Mon, 14 Aug 2017 06:34:41 +0000 (02:34 -0400)
parsing.py
tokenization.py

index b2a14a8..e2bd9d0 100644 (file)
@@ -399,7 +399,7 @@ def _function_definition_statement_parser(index, tokens):
             tokens[index].line,
         ))
 
-    if tokens[index].type == 'symbol' and tokens[index].match == 'do':
+    if tokens[index].match == 'do':
         index += 1
     else:
         return failure
index 3c4dc6f..914d05a 100644 (file)
@@ -32,7 +32,7 @@ def _make_token_matcher(definition):
     return token_matcher
 
 _TOKEN_MATCHERS = [
-    ('keyword',                         r'(def|end)(?![a-z_])'),
+    ('keyword',                         r'(def|do|end)(?![a-z_])'),
     ('open_parenthese',                 r'\('),
     ('close_parenthese',                r'\)'),
     ('comma',                           r','),