% $Id: AtomStringRep.oz,v 1.2 2012/01/11 22:19:10 leavens Exp $ declare fun {IsOzKeyword A} %% ENSURES: Result is true if A is a keyword of Oz, and false otherwise case A of 'andthen' then true [] 'at' then true [] 'attr' then true [] 'case' then true [] 'catch' then true [] 'choice' then true [] 'class' then true [] 'cond' then true [] 'declare' then true [] 'define' then true [] 'dis' then true [] 'else' then true [] 'elsecase' then true [] 'elseif' then true [] 'elseof' then true [] 'end' then true [] 'export' then true [] 'fail' then true [] 'false' then true [] 'feat' then true [] 'finally' then true [] 'from' then true [] 'fun' then true [] 'functor' then true [] 'if' then true [] 'import' then true [] 'in' then true [] 'local' then true [] 'lock' then true [] 'meth' then true [] 'not' then true [] 'of' then true [] 'or' then true [] 'orelse' then true [] 'prepare' then true [] 'proc' then true [] 'prop' then true [] 'raise' then true [] 'require' then true [] 'self' then true [] 'skip' then true [] 'then' then true [] 'thread' then true [] 'true' then true [] 'try' then true [] 'unit' then true else false end end fun {AtomStringRep Atom} %% ENSURES: Result is a String that would be parsed back into the atom Atom Str = {AtomToString Atom} in if {Length Str} >= 1 andthen {Char.isLower Str.1} andthen {Not {IsOzKeyword Atom}} then Str else {Append "'" {Append Str "'"}} end end