@@ -167,6 +167,8 @@ class EndOfFile(Builtin):
167167 </dl>
168168 """
169169
170+ SymbolEndOfFile = Symbol ("EndOfFile" )
171+
170172
171173# TODO: Improve docs for these Read[] arguments.
172174class Byte (Builtin ):
@@ -612,12 +614,12 @@ def reader(stream, word_separators, accepted=None):
612614 nextline = next (read_record )
613615 tmp = tmp + "\n " + nextline
614616 except EOFError :
615- expr = Symbol ( "EndOfFile" )
617+ expr = SymbolEndOfFile
616618 break
617619 except Exception as e :
618620 print (e )
619621
620- if expr == Symbol ( "EndOfFile" ) :
622+ if expr == SymbolEndOfFile :
621623 evaluation .message (
622624 "Read" , "readt" , tmp , Expression ("InputSteam" , name , n )
623625 )
@@ -626,6 +628,9 @@ def reader(stream, word_separators, accepted=None):
626628 if typ == Symbol ("HoldExpression" ):
627629 expr = Expression ("Hold" , expr )
628630 result .append (expr )
631+ # else:
632+ # TO: Supposedly we can't get here
633+ # what code should we put here?
629634
630635 elif typ == Symbol ("Number" ):
631636 tmp = next (read_number )
@@ -663,7 +668,7 @@ def reader(stream, word_separators, accepted=None):
663668 result .append (next (read_word ))
664669
665670 except EOFError :
666- return Symbol ( "EndOfFile" )
671+ return SymbolEndOfFile
667672 except UnicodeDecodeError :
668673 evaluation .message ("General" , "ucdec" )
669674
@@ -1695,7 +1700,7 @@ def apply(self, name, n, typ, evaluation):
16951700 try :
16961701 result .append (self .readers [t ](stream .io ))
16971702 except struct .error :
1698- result .append (Symbol ( "EndOfFile" ) )
1703+ result .append (SymbolEndOfFile )
16991704
17001705 if typ .has_form ("List" , None ):
17011706 return Expression ("List" , * result )
@@ -2324,7 +2329,7 @@ def apply(self, channel, types, evaluation, options):
23242329 if tmp == SymbolFailed :
23252330 return
23262331
2327- if tmp == Symbol ( "EndOfFile" ) :
2332+ if tmp == SymbolEndOfFile :
23282333 break
23292334 result .append (tmp )
23302335 return from_python (result )
@@ -2686,7 +2691,7 @@ def apply(self, name, n, types, m, evaluation, options):
26862691 return
26872692 for i in range (py_m ):
26882693 result = super (Skip , self ).apply (channel , types , evaluation , options )
2689- if result == Symbol ( "EndOfFile" ) :
2694+ if result == SymbolEndOfFile :
26902695 return result
26912696 return SymbolNull
26922697
0 commit comments