File tree Expand file tree Collapse file tree 2 files changed +10
-2
lines changed
cli/src/main/scala/scalaxb/compiler/xsd
integration/src/test/resources Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change 11package scalaxb .compiler .xsd
22
3- import scalaxb .compiler .Config
3+ import scalaxb .compiler .{ Config , ScalaNames }
44
55trait GenLens { self : ContextProcessor =>
66 def buildImport : String
@@ -32,6 +32,8 @@ trait GenLens { self: ContextProcessor =>
3232 * @param config
3333 */
3434class GenMonocleLens (var config : Config ) extends GenLens with ContextProcessor {
35+ lazy val scalaNames : ScalaNames = new ScalaNames {}
36+ def escapeKeyWord (name : String ) = if (scalaNames.isKeyword(name)) s " ` $name` " else name
3537
3638 def buildImport : String = {
3739 " "
@@ -40,7 +42,7 @@ class GenMonocleLens(var config: Config) extends GenLens with ContextProcessor {
4042 def buildDefLens (className : String , param : Params # Param ) : String = {
4143 s " def ${param.toParamName}: monocle.Lens[ $className, ${param.typeName}] = " +
4244 s " monocle.Lens[ $className, ${param.typeName}](_. ${param.toParamName}) " +
43- s " ((_ ${param.toParamName}: ${param.typeName}) => ( ${className.toLowerCase}: $className) => ${className.toLowerCase}.copy( ${param.toParamName} = _ ${param.toParamName})) "
45+ s " ((_ ${param.toParamName}: ${param.typeName}) => ( ${escapeKeyWord( className.toLowerCase) }: $className) => ${escapeKeyWord( className.toLowerCase) }.copy( ${param.toParamName} = _ ${param.toParamName})) "
4446 }
4547
4648 def buildDefComposeLens (className : String , param : Params # Param ) : String = {
Original file line number Diff line number Diff line change 318318 </extension >
319319 </simpleContent >
320320 </complexType >
321+
322+ <complexType name =" Case" >
323+ <sequence >
324+ <element type =" string" name =" Id" />
325+ </sequence >
326+ </complexType >
321327</schema >
You can’t perform that action at this time.
0 commit comments