Skip to content

Commit

Permalink
ports #191 fix
Browse files Browse the repository at this point in the history
  • Loading branch information
eed3si9n committed Nov 8, 2014
1 parent 0207702 commit 51ce24a
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions cli/src/main/scala/scalaxb/compiler/xsd2/namer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -205,9 +205,19 @@ trait Namer extends ScalaNames { self: Lookup with Splitter =>
case _ => false
}

private def identifier(value: String) =
"""\W""".r.replaceAllIn(value, "")

def identifier(value: String) = {
val nonspace =
if (value.trim != "") """\s""".r.replaceAllIn(value, "")
else value
if ("""\W""".r.findFirstIn(nonspace).isDefined) {
(nonspace.toSeq map { c =>
if ("""\W""".r.findFirstIn(c.toString).isDefined) "u" + c.toInt.toString
else c.toString
}).mkString
}
else nonspace
}

def quote(value: Option[String]): String = value map {
"Some(\"" + _ + "\")"
} getOrElse { "None" }
Expand Down

0 comments on commit 51ce24a

Please sign in to comment.