progs/lexer/lexer.sc
changeset 969 140bf7b1c548
parent 968 79cfee5e170b
child 970 e15be5466802
equal deleted inserted replaced
968:79cfee5e170b 969:140bf7b1c548
   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