From b6eca8dfc054e2aadc683cb85a18680cb48c36bd Mon Sep 17 00:00:00 2001 From: Thomas Mashek Date: Tue, 12 Mar 2013 12:46:20 -0700 Subject: [PATCH] Earmuff stuff. --- hy/lex/states.py | 3 +++ tests/native_tests/language.hy | 7 +++++++ 2 files changed, 10 insertions(+) diff --git a/hy/lex/states.py b/hy/lex/states.py index dad9389..dcc14e7 100644 --- a/hy/lex/states.py +++ b/hy/lex/states.py @@ -61,6 +61,9 @@ def _resolve_atom(obj): if obj in table: return HySymbol(table[obj]) + if obj.startswith("*") and obj.endswith("*") and obj != "*": + obj = obj[1:-1].upper() + if "-" in obj and obj != "-": obj = obj.replace("-", "_") diff --git a/tests/native_tests/language.hy b/tests/native_tests/language.hy index 26cf266..9c079f4 100644 --- a/tests/native_tests/language.hy +++ b/tests/native_tests/language.hy @@ -124,3 +124,10 @@ (catch KeyError (do (+ 1 1) (assert (= 1 1)))))) + +(defn test-earmuffs [] + "NATIVE: Test earmuffs" + (def *foo* "2") + (def foo "3") + (assert (= *foo* FOO)) + (assert (!= *foo* foo)))