diff --git a/mathematica/lexer.py b/mathematica/lexer.py index a5840ec..4da95bb 100644 --- a/mathematica/lexer.py +++ b/mathematica/lexer.py @@ -13,7 +13,7 @@ class Regex: IDENTIFIER = r'[a-zA-Z\$][a-zA-Z0-9\$]*' NAMED_CHARACTER = r'\\[{identifier}]'.format(identifier=IDENTIFIER) - SYMBOLS = (r'[`]?({identifier}|{named_character})(`({identifier}|{named_character}))*' + SYMBOLS = (r'[`]?({identifier}|{named_character})(`({identifier}|{named_character}))*[`]?' .format(identifier=IDENTIFIER, named_character=NAMED_CHARACTER)) INTEGER = r'[0-9]+' FLOAT = r'({integer})?\.[0-9]+|{integer}\.'.format(integer=INTEGER) diff --git a/setup.py b/setup.py index 1fac11c..6a4813f 100644 --- a/setup.py +++ b/setup.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- # Copyright (c) 2016 rsmenon # Licensed under the MIT License (https://opensource.org/licenses/MIT) diff --git a/tests/test_lexer.py b/tests/test_lexer.py index a74149c..40e6222 100644 --- a/tests/test_lexer.py +++ b/tests/test_lexer.py @@ -171,6 +171,20 @@ def test_symbols(self): expected = [[(MToken.SYMBOL, sym)] for sym in code] self.verify_all(code, expected) + def test_get(self): + code = ['<