progs/lexer/lexer.sc
changeset 970 1d4659dd83fe
parent 969 0dfa2923a7c6
child 971 51e00f223792
equal deleted inserted replaced
969:0dfa2923a7c6 970:1d4659dd83fe
   236 // Bigger Tests
   236 // Bigger Tests
   237 //==============
   237 //==============
   238 
   238 
   239 // escapes strings and prints them out as "", "\n" and so on
   239 // escapes strings and prints them out as "", "\n" and so on
   240 def esc(raw: String): String = {
   240 def esc(raw: String): String = {
   241   raw
   241   "\"" + raw.replaceAll("\\n", "\\\\n").replaceAll ("\\t", "\\\\t") + "\""
   242   //import scala.reflect.runtime.universe._
       
   243   //Literal(Constant(raw)).toString
       
   244 }
   242 }
   245 
   243 
   246 def escape(tks: List[(String, String)]) =
   244 def escape(tks: List[(String, String)]) =
   247   tks.map{ case (s1, s2) => (s1, esc(s2))}
   245   tks.map{ case (s1, s2) => (s1, esc(s2))}
   248 
   246