X-Git-Url: https://code.kerkeslager.com/?p=fur;a=blobdiff_plain;f=tokenization.py;h=bc8cf85a8f5a12aa556095f905bb190ef292c446;hp=914d05a4701f2f0cd2de56e50c566ab6d1390cfa;hb=1f2895250c61aeb81c0f0ba7efed156c9386dfac;hpb=ad72a3204cb66766dcebb847b42512494199d15a diff --git a/tokenization.py b/tokenization.py index 914d05a..bc8cf85 100644 --- a/tokenization.py +++ b/tokenization.py @@ -32,16 +32,21 @@ def _make_token_matcher(definition): return token_matcher _TOKEN_MATCHERS = [ - ('keyword', r'(def|do|end)(?![a-z_])'), + ('keyword', r'(def|do|else|end|if)(?![a-z_])'), + ('open_bracket', r'\['), + ('close_bracket', r'\]'), ('open_parenthese', r'\('), ('close_parenthese', r'\)'), ('comma', r','), + ('colon', r':'), + ('period', r'\.'), ('integer_literal', r'\d+'), ('symbol', r'[a-z_]+'), ('single_quoted_string_literal', r"'.*?'"), - ('comparison_level_operator', r'(<=|>=|==|!=|<|>)'), + ('double_quoted_string_literal', r'".*?"'), + ('comparison_level_operator', r'(<=|>=|==|!=|<|>)'), ('assignment_operator', r'='), - ('addition_level_operator', r'(\+|-)'), + ('addition_level_operator', r'(\+\+|\+|-)'), ('multiplication_level_operator', r'(\*|//|%)'), ('newline', r'\n'), ]