@@ -8,7 +8,7 @@ class PrgmCompiler(object):
88 program files
99 """
1010
11- def compile (raw_text ):
11+ def compile (self , raw_text = None ):
1212 """
1313 Compiles to 8Xp format. This logic works, but the TIFile class is
1414 incomplete so the file may not work properly on the TI calculator.
@@ -18,6 +18,14 @@ def compile(raw_text):
1818 Returns:
1919 TIFile
2020 """
21+ # To be compatible with Python 2.7 without changing
22+ # the public class API, we do some gross magic. This
23+ # has a side effect that we can use this method either
24+ # as a static method or not.
25+ # FIXME
26+ if not isinstance (self , PrgmCompiler ):
27+ raw_text = self
28+
2129 tifile = TIPrgmFile ()
2230 tifile .prgmdata = []
2331 tokens = get_inverse_tokens ()
@@ -45,7 +53,7 @@ def compile(raw_text):
4553 return tifile
4654
4755
48- def decompile (tifile ):
56+ def decompile (self , tifile = None ):
4957 """
5058 Decompiles to plaintext.
5159
@@ -54,6 +62,15 @@ def decompile(tifile):
5462 Returns:
5563 Array[string]
5664 """
65+
66+ # To be compatible with Python 2.7 without changing
67+ # the public class API, we do some gross magic. This
68+ # has a side effect that we can use this method either
69+ # as a static method or not.
70+ # FIXME
71+ if not isinstance (self , PrgmCompiler ):
72+ tifile = self
73+
5774 prgm_data = tifile .prgmdata
5875 plaintext = []
5976 tokens = get_tokens ()
0 commit comments