This is an automated email from the ASF dual-hosted git repository.

jtulach pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/netbeans.git


The following commit(s) were added to refs/heads/master by this push:
     new e9ecefd  Syntax coloring for .kt files (#1228)
e9ecefd is described below

commit e9ecefdbe6702af327fd89d4ad0233d0565b2e48
Author: Jaroslav Tulach <[email protected]>
AuthorDate: Fri May 3 13:25:52 2019 +0200

    Syntax coloring for .kt files (#1228)
---
 .../lexer/CreateRegistrationProcessor.java         |   2 +-
 java/kotlin.editor/build.xml                       |  25 +
 java/kotlin.editor/licenseinfo.xml                 |  31 +
 java/kotlin.editor/manifest.mf                     |   5 +
 java/kotlin.editor/nbproject/project.properties    |  19 +
 java/kotlin.editor/nbproject/project.xml           | 138 ++++
 .../modules/kotlin/editor/Bundle.properties        |  18 +
 .../modules/kotlin/editor/Kotlin.kt.template       |  32 +
 .../modules/kotlin/editor/Kotlin.tmLanguage.json   | 794 +++++++++++++++++++++
 .../modules/kotlin/editor/KtDataObject.java        | 133 ++++
 .../netbeans/modules/kotlin/editor/kotlin16.png    | Bin 0 -> 6183 bytes
 .../modules/kotlin/editor/package-info.java        |  26 +
 nbbuild/cluster.properties                         |   1 +
 13 files changed, 1223 insertions(+), 1 deletion(-)

diff --git 
a/ide/textmate.lexer/src/org/netbeans/modules/textmate/lexer/CreateRegistrationProcessor.java
 
b/ide/textmate.lexer/src/org/netbeans/modules/textmate/lexer/CreateRegistrationProcessor.java
index 9996d35..90db05b 100644
--- 
a/ide/textmate.lexer/src/org/netbeans/modules/textmate/lexer/CreateRegistrationProcessor.java
+++ 
b/ide/textmate.lexer/src/org/netbeans/modules/textmate/lexer/CreateRegistrationProcessor.java
@@ -98,7 +98,7 @@ public class CreateRegistrationProcessor extends 
LayerGeneratingProcessor {
         for (Entry<? extends ExecutableElement, ? extends AnnotationValue> e : 
mimeRegistration.getElementValues().entrySet()) {
             Name simpleName = e.getKey().getSimpleName();
             if (simpleName.contentEquals("grammar")) {
-                grammar = (String) e.getValue().getValue();
+                grammar = LayerBuilder.absolutizeResource(toRegister, (String) 
e.getValue().getValue());
                 continue;
             }
             if (simpleName.contentEquals("mimeType")) {
diff --git a/java/kotlin.editor/build.xml b/java/kotlin.editor/build.xml
new file mode 100644
index 0000000..6a8adf3
--- /dev/null
+++ b/java/kotlin.editor/build.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+
+-->
+<project basedir="." default="netbeans" name="java/kotlin.editor">
+    <description>Builds, tests, and runs the project 
org.netbeans.modules.kotlin.editor</description>
+    <import file="../../nbbuild/templates/projectized.xml"/>
+</project>
diff --git a/java/kotlin.editor/licenseinfo.xml 
b/java/kotlin.editor/licenseinfo.xml
new file mode 100644
index 0000000..3857786
--- /dev/null
+++ b/java/kotlin.editor/licenseinfo.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+
+-->
+
+<licenseinfo>
+    <fileset>
+        <file>src/org/netbeans/modules/kotlin/editor/kotlin16.png</file>
+        
<file>src/org/netbeans/modules/kotlin/editor/Kotlin.tmLanguage.json</file>
+        <license ref="Apache-2.0-ASF" />
+        <comment type="COMMENT_UNSUPPORTED" />
+    </fileset>
+</licenseinfo>
diff --git a/java/kotlin.editor/manifest.mf b/java/kotlin.editor/manifest.mf
new file mode 100644
index 0000000..c85a736
--- /dev/null
+++ b/java/kotlin.editor/manifest.mf
@@ -0,0 +1,5 @@
+Manifest-Version: 1.0
+AutoUpdate-Show-In-Client: true
+OpenIDE-Module: org.netbeans.modules.kotlin.editor
+OpenIDE-Module-Localizing-Bundle: 
org/netbeans/modules/kotlin/editor/Bundle.properties
+OpenIDE-Module-Specification-Version: 1.0
diff --git a/java/kotlin.editor/nbproject/project.properties 
b/java/kotlin.editor/nbproject/project.properties
new file mode 100644
index 0000000..7c940c4
--- /dev/null
+++ b/java/kotlin.editor/nbproject/project.properties
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+javac.source=1.7
+javac.compilerargs=-Xlint -Xlint:-serial
diff --git a/java/kotlin.editor/nbproject/project.xml 
b/java/kotlin.editor/nbproject/project.xml
new file mode 100644
index 0000000..b05317c
--- /dev/null
+++ b/java/kotlin.editor/nbproject/project.xml
@@ -0,0 +1,138 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+
+-->
+<project xmlns="http://www.netbeans.org/ns/project/1";>
+    <type>org.netbeans.modules.apisupport.project</type>
+    <configuration>
+        <data xmlns="http://www.netbeans.org/ns/nb-module-project/3";>
+            <code-name-base>org.netbeans.modules.kotlin.editor</code-name-base>
+            <module-dependencies>
+                <dependency>
+                    <code-name-base>org.netbeans.api.templates</code-name-base>
+                    <build-prerequisite/>
+                    <compile-dependency/>
+                    <run-dependency>
+                        <specification-version>1.13</specification-version>
+                    </run-dependency>
+                </dependency>
+                <dependency>
+                    
<code-name-base>org.netbeans.core.multiview</code-name-base>
+                    <build-prerequisite/>
+                    <compile-dependency/>
+                    <run-dependency>
+                        <release-version>1</release-version>
+                        <specification-version>1.49</specification-version>
+                    </run-dependency>
+                </dependency>
+                <dependency>
+                    <code-name-base>org.openide.awt</code-name-base>
+                    <build-prerequisite/>
+                    <compile-dependency/>
+                    <run-dependency>
+                        <specification-version>7.73</specification-version>
+                    </run-dependency>
+                </dependency>
+                <dependency>
+                    <code-name-base>org.openide.dialogs</code-name-base>
+                    <build-prerequisite/>
+                    <compile-dependency/>
+                    <run-dependency>
+                        <specification-version>7.47</specification-version>
+                    </run-dependency>
+                </dependency>
+                <dependency>
+                    <code-name-base>org.openide.filesystems</code-name-base>
+                    <build-prerequisite/>
+                    <compile-dependency/>
+                    <run-dependency>
+                        <specification-version>9.15</specification-version>
+                    </run-dependency>
+                </dependency>
+                <dependency>
+                    <code-name-base>org.openide.loaders</code-name-base>
+                    <build-prerequisite/>
+                    <compile-dependency/>
+                    <run-dependency>
+                        <specification-version>7.72</specification-version>
+                    </run-dependency>
+                </dependency>
+                <dependency>
+                    <code-name-base>org.openide.nodes</code-name-base>
+                    <build-prerequisite/>
+                    <compile-dependency/>
+                    <run-dependency>
+                        <specification-version>7.50</specification-version>
+                    </run-dependency>
+                </dependency>
+                <dependency>
+                    <code-name-base>org.openide.text</code-name-base>
+                    <build-prerequisite/>
+                    <compile-dependency/>
+                    <run-dependency>
+                        <specification-version>6.72</specification-version>
+                    </run-dependency>
+                </dependency>
+                <dependency>
+                    <code-name-base>org.openide.util</code-name-base>
+                    <build-prerequisite/>
+                    <compile-dependency/>
+                    <run-dependency>
+                        <specification-version>9.12</specification-version>
+                    </run-dependency>
+                </dependency>
+                <dependency>
+                    <code-name-base>org.openide.util.lookup</code-name-base>
+                    <build-prerequisite/>
+                    <compile-dependency/>
+                    <run-dependency>
+                        <specification-version>8.38</specification-version>
+                    </run-dependency>
+                </dependency>
+                <dependency>
+                    <code-name-base>org.openide.util.ui</code-name-base>
+                    <build-prerequisite/>
+                    <compile-dependency/>
+                    <run-dependency>
+                        <specification-version>9.13</specification-version>
+                    </run-dependency>
+                </dependency>
+                <dependency>
+                    <code-name-base>org.openide.windows</code-name-base>
+                    <build-prerequisite/>
+                    <compile-dependency/>
+                    <run-dependency>
+                        <specification-version>6.81</specification-version>
+                    </run-dependency>
+                </dependency>
+                <dependency>
+                    
<code-name-base>org.netbeans.modules.textmate.lexer</code-name-base>
+                    <build-prerequisite/>
+                    <compile-dependency/>
+                    <run-dependency>
+                        <release-version>0</release-version>
+                        <specification-version>1.2</specification-version>
+                    </run-dependency>
+                </dependency>
+            </module-dependencies>
+            <public-packages/>
+        </data>
+    </configuration>
+</project>
diff --git 
a/java/kotlin.editor/src/org/netbeans/modules/kotlin/editor/Bundle.properties 
b/java/kotlin.editor/src/org/netbeans/modules/kotlin/editor/Bundle.properties
new file mode 100644
index 0000000..295e10f
--- /dev/null
+++ 
b/java/kotlin.editor/src/org/netbeans/modules/kotlin/editor/Bundle.properties
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+OpenIDE-Module-Name=Kotlin Editor
diff --git 
a/java/kotlin.editor/src/org/netbeans/modules/kotlin/editor/Kotlin.kt.template 
b/java/kotlin.editor/src/org/netbeans/modules/kotlin/editor/Kotlin.kt.template
new file mode 100644
index 0000000..201ed99
--- /dev/null
+++ 
b/java/kotlin.editor/src/org/netbeans/modules/kotlin/editor/Kotlin.kt.template
@@ -0,0 +1,32 @@
+<#-- FreeMarker template (see http://freemarker.org/) 
+
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+
+-->
+<#assign licenseFirst = "/*">
+<#assign licensePrefix = " * ">
+<#assign licenseLast = " */">
+<#include "${project.licensePath}">
+
+<#if package?? && package != "">
+package ${package};
+
+</#if>
+fun main(args: Array<String>) {
+  println("Hello World!")
+}
\ No newline at end of file
diff --git 
a/java/kotlin.editor/src/org/netbeans/modules/kotlin/editor/Kotlin.tmLanguage.json
 
b/java/kotlin.editor/src/org/netbeans/modules/kotlin/editor/Kotlin.tmLanguage.json
new file mode 100644
index 0000000..c511df9
--- /dev/null
+++ 
b/java/kotlin.editor/src/org/netbeans/modules/kotlin/editor/Kotlin.tmLanguage.json
@@ -0,0 +1,794 @@
+{   "name": "Kotlin",
+    "scopeName": "source.Kotlin",
+    "fileTypes": ["kt", "kts"],
+    "patterns": [
+        {
+            "include": "#comments"
+        },
+        {
+            "captures": {
+                "1": {
+                    "name": "keyword.other.kotlin"
+                }, 
+                "2": {
+                    "name": "entity.name.package.kotlin"
+                }
+            }, 
+            "match": "^\\s*(package)\\b(?:\\s*([^ ;$]+)\\s*)?"
+        },
+        {
+            "include": "#imports"
+        },
+        {
+            "include": "#statements"
+        }
+    ],
+    "repository": {
+        "statements": {
+            "patterns": [
+                {
+                    "include": "#namespaces"
+                },
+                {
+                    "include": "#typedefs"
+                },
+                {
+                    "include": "#classes"
+                },
+                {
+                    "include": "#functions"
+                },
+                {
+                    "include": "#variables"
+                },
+                {
+                    "include": "#getters-and-setters"
+                },
+                {
+                    "include": "#expressions"
+                }
+            ]
+        },
+        "comments": {
+            "patterns": [
+                {
+                    "begin": "/\\*", 
+                    "captures": {
+                        "0": {
+                            "name": "punctuation.definition.comment.kotlin"
+                        }
+                    }, 
+                    "end": "\\*/", 
+                    "name": "comment.block.kotlin"
+                }, 
+                {
+                    "captures": {
+                        "1": {
+                            "name": "comment.line.double-slash.kotlin"
+                        }, 
+                        "2": {
+                            "name": "punctuation.definition.comment.kotlin"
+                        }
+                    }, 
+                    "match": "\\s*((//).*$\\n?)"
+                }
+            ]
+        },
+        "imports": {
+            "patterns": [
+                {
+                    "captures": {
+                        "1": {
+                            "name": "keyword.other.kotlin"
+                        },
+                        "2": {
+                            "name": "keyword.other.kotlin"
+                        }
+                },
+                "match": "^\\s*(import)\\s+[^ $]+\\s+(as)?"
+                }
+            ]
+        },
+        "namespaces": {
+            "patterns": [
+                {
+                    "match": "\\b(namespace)\\b",
+                    "name": "keyword.other.kotlin"
+                },
+                {
+                    "begin": "\\{",
+                    "end": "\\}",
+                    "patterns": [
+                        {
+                            "include": "#statements" 
+                        }
+                    ]
+                }
+            ]
+        },
+        "types": {
+            "patterns": [
+                {
+                    "match": 
"\\b(Nothing|Any|Unit|String|CharSequence|Int|Boolean|Char|Long|Double|Float|Short|Byte|dynamic)\\b",
 
+                    "name": "storage.type.buildin.kotlin"
+                },
+                {
+                    "match": 
"\\b(IntArray|BooleanArray|CharArray|LongArray|DoubleArray|FloatArray|ShortArray|ByteArray)\\b",
 
+                    "name": "storage.type.buildin.array.kotlin"
+                },
+                {
+                    "begin": 
"\\b(Array|Collection|List|Map|Set|MutableList|MutableMap|MutableSet|Sequence)<\\b",
+                    "beginCaptures": {
+                        "1": {
+                            "name": "storage.type.buildin.collection.kotlin"
+                        }
+                    },
+                    "end": ">",
+                    "patterns": [
+                        { 
+                            "include": "#types" 
+                        },
+                        {
+                            "include": "#keywords" 
+                        }
+                    ]
+                },
+                {
+                    "begin": "\\w+<",
+                    "end": ">",
+                    "patterns": [
+                        {
+                            "include": "#types"
+                        },
+                        {
+                            "include": "#keywords" 
+                        }
+                    ]
+                },
+                {
+                    "begin": "\\{",
+                    "end": "\\}",
+                    "patterns": [
+                        { 
+                            "include": "#statements"
+                        }
+                    ]
+                },
+                {
+                    "begin": "\\(",
+                    "end": "\\)",
+                    "patterns": [
+                        { 
+                            "include": "#types" 
+                        }
+                    ]
+                },
+                {
+                    "match": "(->)",
+                    "name": "keyword.operator.declaration.kotlin"
+                }
+            ]
+        },
+        "generics": {
+            "patterns": [
+                {
+                    "begin": "(:)",
+                    "beginCaptures": {
+                        "1": {
+                            "name": "keyword.operator.declaration.kotlin"
+                        }
+                    },
+                    "end": "(?=,|>)",
+                    "patterns": [
+                        { 
+                            "include": "#types" 
+                        }
+                    ]
+                },
+                { 
+                    "include": "#keywords"
+                },
+                {
+                    "match": "\\w+",
+                    "name": "storage.type.generic.kotlin"
+                }
+            ]
+        },
+        "typedefs": {
+            "begin": "(?=\\s*(?:type))",
+            "end": "(?=$)",
+            "patterns": [
+                {
+                    "match": "\\b(type)\\b",
+                    "name": "keyword.other.kotlin"
+                },
+                {
+                    "begin": "<",
+                    "end": ">",
+                    "patterns": [
+                        { 
+                            "include": "#generics" 
+                        }
+                    ]
+                },
+                {
+                    "include": "#expressions"
+                }
+            ]
+        },
+        "classes": {
+            "begin": "(?<!::)(?=\\b(?:companion|class|object|interface)\\b)",
+            "end": "(?=$|\\})",
+            "patterns": [
+                {
+                    "include" : "#comments"
+                },
+                {
+                    "begin": "\\b(companion\\s*)?(class|object|interface)\\b",
+                    "beginCaptures": {
+                        "1": {
+                            "name": "storage.modifier.kotlin"
+                        },
+                        "2": {
+                            "name": "storage.modifier.kotlin"
+                        }
+                    },
+                    "end": "(?=<|\\{|\\(|:|$)",
+                    "patterns": [
+                        {
+                            "include" : "#comments"
+                        },
+                        {
+                            "match": "\\w+",
+                            "name": "entity.name.type.class.kotlin"
+                        }
+                    ]
+                },
+                {
+                    "begin": "<",
+                    "end": ">",
+                    "patterns": [
+                        { 
+                            "include": "#generics" 
+                        }
+                    ]
+                },
+                {
+                    "begin": "\\(", 
+                    "end": "\\)", 
+                    "patterns": [
+                        {
+                            "include": "#parameters"
+                        }
+                    ]
+                },
+                {
+                    "begin": "(:)",
+                    "beginCaptures": {
+                        "1": {
+                            "name": "keyword.operator.declaration.kotlin"
+                        }
+                    },
+                    "end": "(?={|$)",
+                    "patterns": [
+                        {
+                            "match": "\\w+",
+                            "name": "entity.other.inherited-class.kotlin"
+                        },
+                        {
+                            "begin": "\\(",
+                            "end": "\\)",
+                            "patterns": [
+                                {
+                                    "include": "#expressions"
+                                }
+                            ]
+                        }
+                    ]
+                },
+                {
+                    "begin": "\\{",
+                    "end": "\\}",
+                    "patterns": [
+                        {
+                            "include": "#statements"
+                        }
+                    ]
+                }
+            ]
+        },
+        "variables": {
+            "begin": "(?=\\s*\\b(?:var|val)\\b)",
+            "end": "(?=:|=|(\\b(by)\\b)|$)",
+            "patterns": [
+                {
+                    "begin": "\\b(var|val)\\b",
+                    "beginCaptures": {
+                        "1": {
+                            "name": "keyword.other.kotlin" 
+                        }
+                    },
+                    "end": "(?=:|=|(\\b(by)\\b)|$)",
+                    "patterns": [
+                        {
+                            "begin": "<",
+                            "end": ">",
+                            "patterns": [
+                                {
+                                    "include": "#generics"
+                                }
+                            ]
+                        },
+                        {
+                            "captures": {
+                                "2": { 
+                                    "name": "entity.name.variable.kotlin"
+                                }
+                            },
+                            "match": "([\\.<\\?>\\w]+\\.)?(\\w+)"
+                        }
+                    ]
+                },
+                {
+                    "begin": "(:)",
+                    "beginCaptures": {
+                        "1": {
+                            "name": "keyword.operator.declaration.kotlin"
+                        }
+                    },
+                    "end": "(?==|$)",
+                    "patterns": [
+                        {
+                            "include": "#types"
+                        },
+                        { 
+                            "include": "#getters-and-setters" 
+                        }
+                    ]
+                },
+                {
+                    "begin": "\\b(by)\\b",
+                    "beginCaptures": {
+                        "1": {
+                            "name": "keyword.other.kotlin"
+                        }
+                    },
+                    "end": "(?=$)",
+                    "patterns": [
+                        {
+                            "include": "#expressions"
+                        }
+                    ]
+                },
+                {
+                    "begin": "(=)",
+                    "beginCaptures": {
+                        "1": {
+                            "name": "keyword.operator.assignment.kotlin"
+                        }
+                    },
+                    "end": "(?=$)",
+                    "patterns": [
+                        {
+                            "include": "#expressions"
+                        },
+                        {
+                            "include": "#getters-and-setters"
+                        }
+                    ]
+                }
+            ]
+        },
+        "getters-and-setters": {
+            "patterns": [
+                {
+                    "begin": "\\b(get)\\b\\s*\\(\\s*\\)",
+                    "beginCaptures": {
+                        "1": {
+                            "name": "entity.name.function.kotlin"
+                        }
+                    },
+                    "end": "\\}|(?=\\bset\\b)|$",
+                    "patterns": [
+                        {
+                            "begin": "(=)",
+                            "beginCaptures": {
+                                "1": {
+                                    "name": 
"keyword.operator.assignment.kotlin"
+                                }
+                            },
+                            "end": "(?=$|\\bset\\b)",
+                            "patterns": [
+                                {
+                                    "include": "#expressions"
+                                }
+                            ]
+                        },
+                        {
+                            "begin": "\\{",
+                            "end": "\\}",
+                            "patterns": [
+                                { 
+                                    "include": "#expressions" 
+                                }
+                            ]
+                        }
+                    ]
+                },
+                {
+                    "begin": "\\b(set)\\b\\s*(?=\\()",
+                    "beginCaptures": {
+                        "1": {
+                            "name": "entity.name.function.kotlin"
+                        }
+                    },
+                    "end": "\\}|(?=\\bget\\b)|$",
+                    "patterns": [
+                        {
+                            "begin": "\\(",
+                            "end": "\\)",
+                            "patterns": [
+                                {
+                                    "include": "#parameters"
+                                }
+                             ] 
+                        },
+                        {
+                            "begin": "(=)",
+                            "beginCaptures": {
+                                "1": {
+                                    "name": 
"keyword.operator.assignment.kotlin"
+                                }
+                            },
+                            "end": "(?=$|\\bset\\b)",
+                            "patterns": [
+                                {
+                                    "include": "#expressions"
+                                }
+                            ]
+                        },
+                        {
+                            "begin": "\\{",
+                            "end": "\\}",
+                            "patterns": [
+                                { 
+                                    "include": "#expressions" 
+                                }
+                            ]
+                        }
+                    ]
+                }
+            ]
+        },
+        "functions": {
+            "begin": "(?=\\s*\\b(?:fun)\\b)",
+            "end": "(?=$|\\})",
+            "patterns": [
+                {
+                    "begin": "\\b(fun)\\b",
+                    "beginCaptures": {
+                        "1": {
+                            "name": "keyword.other.kotlin"
+                        }
+                    },
+                    "end": "(?=\\()",
+                    "patterns": [
+                        {
+                            "begin": "<",
+                            "end": ">",
+                            "patterns": [
+                                {
+                                    "include": "#generics"
+                                }
+                            ]
+                        },
+                        {
+                            "captures": {
+                                "2": { 
+                                    "name": "entity.name.function.kotlin"
+                                }
+                            },
+                            "match": "([\\.<\\?>\\w]+\\.)?(\\w+)"
+                        }
+                    ]
+                },
+                {
+                    "begin": "\\(", 
+                    "end": "\\)", 
+                    "patterns": [
+                        {
+                            "include": "#parameters"
+                        }
+                    ]
+                },
+                {
+                    "begin": "(:)",
+                    "beginCaptures": {
+                        "1": {
+                            "name": "keyword.operator.declaration.kotlin"
+                        }
+                    },
+                    "end": "(?={|=|$)", 
+                    "patterns": [
+                        {
+                            "include": "#types"
+                        }
+                    ]
+                },
+                {
+                    "begin": "\\{", 
+                    "end": "(?=\\})", 
+                    "patterns": [
+                        {
+                            "include": "#statements"
+                        }
+                    ]  
+                },
+                {
+                    "begin": "(=)", 
+                    "beginCaptures": {
+                        "1": {
+                            "name": "keyword.operator.assignment.kotlin"
+                        }
+                    },
+                    "end": "(?=$)", 
+                    "patterns": [
+                        {
+                            "include": "#expressions"
+                        }
+                    ]  
+                }
+            ]
+        },
+        "parameters": {
+            "patterns": [
+                {
+                    "begin": "(:)",
+                    "beginCaptures": {
+                        "1": {
+                            "name": "keyword.operator.declaration.kotlin"
+                        }
+                    },
+                    "end": "(?=,|\\)|=)", 
+                    "patterns": [
+                        {
+                            "include": "#types"
+                        }
+                    ]
+                },
+                {
+                    "begin": "(=)",
+                    "beginCaptures": {
+                        "1": {
+                            "name": "keyword.operator.declaration.kotlin"
+                        }
+                    },
+                    "end": "(?=,|\\))",
+                    "patterns": [
+                        {
+                            "include" : "#expressions"
+                        }
+                    ]
+                },
+                {
+                    "include": "#keywords"
+                },
+                {
+                    "match": "\\w+",
+                    "name": "variable.parameter.function.kotlin"
+                }
+            ]
+        },
+        "expressions": {
+            "patterns": [
+                {
+                    "begin": "\\(",
+                    "end": "\\)",
+                    "patterns": [
+                        { 
+                            "include": "#expressions" 
+                        }
+                    ]
+                },
+                {
+                    "include": "#types"
+                },
+                {
+                    "include": "#strings"
+                },
+                {
+                    "include": "#constants"
+                },
+                {
+                    "include": "#comments"
+                },
+                {
+                    "include": "#keywords"
+                }
+            ]
+        },
+        "strings": {
+            "patterns": [
+                {
+                    "begin": "\"\"\"", 
+                    "beginCaptures": {
+                        "0": {
+                            "name": 
"punctuation.definition.string.begin.kotlin"
+                        }
+                    }, 
+                    "end": "\"\"\"", 
+                    "endCaptures": {
+                        "0": {
+                            "name": "punctuation.definition.string.end.kotlin"
+                        }
+                    }, 
+                    "name": "string.quoted.third.kotlin", 
+                    "patterns": [
+                        {
+                            "match": "(\\$\\w+|\\$\\{[^\\}]+\\})",
+                            "name": "variable.parameter.template.kotlin"
+                        },
+                        {
+                            "match": "\\\\.", 
+                            "name": "constant.character.escape.kotlin"
+                        }
+                    ]
+                },
+                {
+                    "begin": "\"", 
+                    "beginCaptures": {
+                        "0": {
+                            "name": 
"punctuation.definition.string.begin.kotlin"
+                        }
+                    }, 
+                    "end": "\"", 
+                    "endCaptures": {
+                        "0": {
+                            "name": "punctuation.definition.string.end.kotlin"
+                        }
+                    }, 
+                    "name": "string.quoted.double.kotlin", 
+                    "patterns": [
+                        {
+                            "match": "(\\$\\w+|\\$\\{[^\\}]+\\})",
+                            "name": "variable.parameter.template.kotlin"
+                        },
+                        {
+                            "match": "\\\\.", 
+                            "name": "constant.character.escape.kotlin"
+                        }
+                    ]
+                }, 
+                {
+                    "begin": "'", 
+                    "beginCaptures": {
+                        "0": {
+                            "name": 
"punctuation.definition.string.begin.kotlin"
+                        }
+                    }, 
+                    "end": "'", 
+                    "endCaptures": {
+                        "0": {
+                            "name": "punctuation.definition.string.end.kotlin"
+                        }
+                    }, 
+                    "name": "string.quoted.single.kotlin", 
+                    "patterns": [
+                        {
+                            "match": "\\\\.", 
+                            "name": "constant.character.escape.kotlin"
+                        }
+                    ]
+                },
+                {
+                    "begin": "`", 
+                    "beginCaptures": {
+                        "0": {
+                            "name": 
"punctuation.definition.string.begin.kotlin"
+                        }
+                    }, 
+                    "end": "`", 
+                    "endCaptures": {
+                        "0": {
+                            "name": "punctuation.definition.string.end.kotlin"
+                        }
+                    }, 
+                    "name": "string.quoted.single.kotlin"
+                }
+            ]
+        },
+        "constants": {
+            "patterns": [
+                {
+                    "match": "\\b(true|false|null|this|super)\\b", 
+                    "name": "constant.language.kotlin"
+                }, 
+                {
+                    "match": 
"\\b((0(x|X)[0-9a-fA-F]*)|(([0-9]+\\.?[0-9]*)|(\\.[0-9]+))((e|E)(\\+|-)?[0-9]+)?)([LlFf])?\\b",
 
+                    "name": "constant.numeric.kotlin"
+                },
+                {
+                    "match": "\\b([A-Z][A-Z0-9_]+)\\b",
+                    "name": "constant.other.kotlin"
+                }
+            ]
+        },
+        "keywords": {
+            "patterns": [
+                {
+                    "match": 
"\\b(var|val|public|private|protected|abstract|final|sealed|enum|open|attribute|annotation|override|inline|vararg|in|out|internal|data|tailrec|operator|infix|const|yield|typealias|typeof|reified|suspend)\\b",
+                    "name": "storage.modifier.kotlin"
+                },
+                {
+                    "match": "\\b(try|catch|finally|throw)\\b", 
+                    "name": "keyword.control.catch-exception.kotlin"
+                },
+                {
+                    "match": 
"\\b(if|else|while|for|do|return|when|where|break|continue)\\b", 
+                    "name": "keyword.control.kotlin"
+                },
+                {
+                    "match": "\\b(in|is|!in|!is|as|as\\?|assert)\\b", 
+                    "name": "keyword.operator.kotlin"
+                },
+                {
+                    "match": "(==|!=|===|!==|<=|>=|<|>)", 
+                    "name": "keyword.operator.comparison.kotlin"
+                }, 
+                {
+                    "match": "(=)", 
+                    "name": "keyword.operator.assignment.kotlin"
+                },
+                {
+                    "match": "(::)", 
+                    "name": "keyword.operator.kotlin"
+                },
+                {
+                    "match": "(:)", 
+                    "name": "keyword.operator.declaration.kotlin"
+                },
+                {
+                    "match": "\\b(by)\\b", 
+                    "name": "keyword.other.by.kotlin"
+                },
+                {
+                    "match": "(\\?\\.)", 
+                    "name": "keyword.operator.safenav.kotlin"
+                }, 
+                {
+                    "match": "(\\.)", 
+                    "name": "keyword.operator.dot.kotlin"
+                }, 
+                {
+                    "match": "(\\?:)", 
+                    "name": "keyword.operator.elvis.kotlin"
+                }, 
+                {
+                    "match": "(\\-\\-|\\+\\+)", 
+                    "name": "keyword.operator.increment-decrement.kotlin"
+                }, 
+                {
+                    "match": "(\\+=|\\-=|\\*=|\\/=)",
+                    "name": "keyword.operator.arithmetic.assign.kotlin"
+                },
+                {
+                    "match": "(\\.\\.)",
+                    "name": "keyword.operator.range.kotlin"
+                },
+                {
+                    "match": "(\\-|\\+|\\*|\\/|%)", 
+                    "name": "keyword.operator.arithmetic.kotlin"
+                }, 
+                {
+                    "match": "(!|&&|\\|\\|)", 
+                    "name": "keyword.operator.logical.kotlin"
+                },
+                {
+                    "match": "(;)", 
+                    "name": "punctuation.terminator.kotlin"
+                }
+            ]
+        }
+    },
+    "uuid": "d508c059-a938-4779-b2bc-ff43a5078907"
+}
diff --git 
a/java/kotlin.editor/src/org/netbeans/modules/kotlin/editor/KtDataObject.java 
b/java/kotlin.editor/src/org/netbeans/modules/kotlin/editor/KtDataObject.java
new file mode 100644
index 0000000..89c889d
--- /dev/null
+++ 
b/java/kotlin.editor/src/org/netbeans/modules/kotlin/editor/KtDataObject.java
@@ -0,0 +1,133 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.kotlin.editor;
+
+import java.io.IOException;
+import org.netbeans.core.spi.multiview.MultiViewElement;
+import org.netbeans.core.spi.multiview.text.MultiViewEditorElement;
+import org.netbeans.modules.textmate.lexer.api.GrammarRegistration;
+import org.openide.awt.ActionID;
+import org.openide.awt.ActionReference;
+import org.openide.awt.ActionReferences;
+import org.openide.filesystems.FileObject;
+import org.openide.filesystems.MIMEResolver;
+import org.openide.loaders.DataObject;
+import org.openide.loaders.DataObjectExistsException;
+import org.openide.loaders.MultiDataObject;
+import org.openide.loaders.MultiFileLoader;
+import org.openide.util.Lookup;
+import org.openide.util.NbBundle.Messages;
+import org.openide.windows.TopComponent;
+
+@GrammarRegistration(
+    mimeType="text/x-kotlin",
+    grammar="Kotlin.tmLanguage.json"
+)
+@Messages({
+    "LBL_Kt_LOADER=Kotlin Files"
+})
[email protected](
+        displayName = "#LBL_Kt_LOADER",
+        mimeType = "text/x-kotlin",
+        extension = {"kt", "kts"}
+)
[email protected](
+        mimeType = "text/x-kotlin",
+        iconBase = "org/netbeans/modules/kotlin/editor/kotlin16.png",
+        displayName = "#LBL_Kt_LOADER",
+        position = 300
+)
+@ActionReferences({
+    @ActionReference(
+            path = "Loaders/text/x-kotlin/Actions",
+            id = @ActionID(category = "System", id = 
"org.openide.actions.OpenAction"),
+            position = 100,
+            separatorAfter = 200
+    ),
+    @ActionReference(
+            path = "Loaders/text/x-kotlin/Actions",
+            id = @ActionID(category = "Edit", id = 
"org.openide.actions.CutAction"),
+            position = 300
+    ),
+    @ActionReference(
+            path = "Loaders/text/x-kotlin/Actions",
+            id = @ActionID(category = "Edit", id = 
"org.openide.actions.CopyAction"),
+            position = 400,
+            separatorAfter = 500
+    ),
+    @ActionReference(
+            path = "Loaders/text/x-kotlin/Actions",
+            id = @ActionID(category = "Edit", id = 
"org.openide.actions.DeleteAction"),
+            position = 600
+    ),
+    @ActionReference(
+            path = "Loaders/text/x-kotlin/Actions",
+            id = @ActionID(category = "System", id = 
"org.openide.actions.RenameAction"),
+            position = 700,
+            separatorAfter = 800
+    ),
+    @ActionReference(
+            path = "Loaders/text/x-kotlin/Actions",
+            id = @ActionID(category = "System", id = 
"org.openide.actions.SaveAsTemplateAction"),
+            position = 900,
+            separatorAfter = 1000
+    ),
+    @ActionReference(
+            path = "Loaders/text/x-kotlin/Actions",
+            id = @ActionID(category = "System", id = 
"org.openide.actions.FileSystemAction"),
+            position = 1100,
+            separatorAfter = 1200
+    ),
+    @ActionReference(
+            path = "Loaders/text/x-kotlin/Actions",
+            id = @ActionID(category = "System", id = 
"org.openide.actions.ToolsAction"),
+            position = 1300
+    ),
+    @ActionReference(
+            path = "Loaders/text/x-kotlin/Actions",
+            id = @ActionID(category = "System", id = 
"org.openide.actions.PropertiesAction"),
+            position = 1400
+    )
+})
+public class KtDataObject extends MultiDataObject {
+
+    public KtDataObject(FileObject pf, MultiFileLoader loader) throws 
DataObjectExistsException, IOException {
+        super(pf, loader);
+        registerEditor("text/x-kotlin", true);
+    }
+
+    @Override
+    protected int associateLookup() {
+        return 1;
+    }
+
+    @MultiViewElement.Registration(
+            displayName = "#LBL_Kt_EDITOR",
+            iconBase = "org/netbeans/modules/kotlin/editor/kotlin16.png",
+            mimeType = "text/x-kotlin",
+            persistenceType = TopComponent.PERSISTENCE_ONLY_OPENED,
+            preferredID = "Kt",
+            position = 1000
+    )
+    @Messages("LBL_Kt_EDITOR=Source")
+    public static MultiViewEditorElement createEditor(Lookup lkp) {
+        return new MultiViewEditorElement(lkp);
+    }
+
+}
diff --git 
a/java/kotlin.editor/src/org/netbeans/modules/kotlin/editor/kotlin16.png 
b/java/kotlin.editor/src/org/netbeans/modules/kotlin/editor/kotlin16.png
new file mode 100644
index 0000000..0b9c243
Binary files /dev/null and 
b/java/kotlin.editor/src/org/netbeans/modules/kotlin/editor/kotlin16.png differ
diff --git 
a/java/kotlin.editor/src/org/netbeans/modules/kotlin/editor/package-info.java 
b/java/kotlin.editor/src/org/netbeans/modules/kotlin/editor/package-info.java
new file mode 100644
index 0000000..21e374d
--- /dev/null
+++ 
b/java/kotlin.editor/src/org/netbeans/modules/kotlin/editor/package-info.java
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+@TemplateRegistration(
+    scriptEngine = "freemarker", targetName = "Kotlin",
+    category = "java-classes", folder = "Classes",
+    content = "Kotlin.kt.template"
+)
+package org.netbeans.modules.kotlin.editor;
+
+import org.netbeans.api.templates.TemplateRegistration;
diff --git a/nbbuild/cluster.properties b/nbbuild/cluster.properties
index 89d29c7..3e2389a 100644
--- a/nbbuild/cluster.properties
+++ b/nbbuild/cluster.properties
@@ -655,6 +655,7 @@ nb.cluster.java=\
         junit.ant,\
         junit.ant.ui,\
         junit.ui,\
+        kotlin.editor,\
         lib.jshell.agent,\
         lib.nbjavac,\
         lib.nbjshell,\


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to