Custom DSL on Hadi's page, how is this implemented? "name" .. "Mr. Jones"


#1

Hi, There is a JSON DSL on Hadi's page: http://hadihariri.com/2013/05/29/creating-builders-in-kotlin-the-results-of-the-kotlin-workshop/ Please how is following DSL implemented ? http://hadihariri.com/images/image_thumb1.png What is ".." double dot?

json {
  “name” … “Mr. Jones”
  “age” … 5   
}

Many thanks,
Jan


#2

That was one of the solutions proposed and Rob was overriding the rangeTo operator. Here's the code. Haven't tried compiling it recently.

https://github.com/robashton/kotbuilder/blob/master/src/builder.kt


#3

Got it. Thank you! J.