From 3e1b1979edd5c05b0d1d7ba1d10d3b273002a568 Mon Sep 17 00:00:00 2001 From: James Strachan Date: Mon, 5 Mar 2012 16:10:42 +0000 Subject: [PATCH 1/2] Added detection for the Kotlin language --- lib/linguist/languages.yml | 6 +++++ test/fixtures/Foo.kt | 47 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+) create mode 100644 test/fixtures/Foo.kt diff --git a/lib/linguist/languages.yml b/lib/linguist/languages.yml index 7cdbd7ca..c640efe2 100644 --- a/lib/linguist/languages.yml +++ b/lib/linguist/languages.yml @@ -574,6 +574,12 @@ JavaScript: filenames: - Jakefile +Kotlin: + type: programming + lexer: Kotlin + extensions: + - .kt + LLVM: extensions: - .ll diff --git a/test/fixtures/Foo.kt b/test/fixtures/Foo.kt new file mode 100644 index 00000000..59291333 --- /dev/null +++ b/test/fixtures/Foo.kt @@ -0,0 +1,47 @@ +package addressbook + +class Contact( + val name : String, + val emails : List, + val addresses : List, + val phonenums : List +) + +class EmailAddress( + val user : String, + val host : String +) + +class PostalAddress( + val streetAddress : String, + val city : String, + val zip : String, + val state : USState?, + val country : Country +) { + assert {(state == null) xor (country == Countries["US"]) } +} + +class PhoneNumber( + val country : Country, + val areaCode : Int, + val number : Long +) + +object Countries { + fun get(id : CountryID) : Country = countryTable[id] + + private var table : Map? = null + private val countryTable : Map + get() { + if (table == null) { + table = HashMap() + for (line in TextFile("countries.txt").lines(stripWhiteSpace = true)) { + table[line] = Country(line) + } + } + return table + } +} + +class Country(val name : String) \ No newline at end of file From e0c9e6be1b34e4f473bef95a5a9c91748a2047b0 Mon Sep 17 00:00:00 2001 From: James Strachan Date: Wed, 21 Mar 2012 09:21:03 +0000 Subject: [PATCH 2/2] Added extra Kotlin file extensions for kotlin modules and scripts --- lib/linguist/languages.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/linguist/languages.yml b/lib/linguist/languages.yml index c640efe2..92784d1e 100644 --- a/lib/linguist/languages.yml +++ b/lib/linguist/languages.yml @@ -579,6 +579,8 @@ Kotlin: lexer: Kotlin extensions: - .kt + - .ktm + - .kts LLVM: extensions: