-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlanguage_kotlin.go
More file actions
23 lines (21 loc) · 1.14 KB
/
language_kotlin.go
File metadata and controls
23 lines (21 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package flourite
import "regexp"
var kotlin = []languagePattern{
{expression: regexp.MustCompile(`fun main\([^)]*\)\s*\{`), patternType: keywordFunction},
{
expression: regexp.MustCompile(`(inline|private|public|protected|override|operator\s+)?fun\s+[A-Za-z0-9_]+\s*\(.*\)\s*(\{|=|:)`),
patternType: keywordFunction,
},
{expression: regexp.MustCompile(`println\([^)]*\)`), patternType: keywordPrint},
{expression: regexp.MustCompile(`(else )?if\s*\(.+\)`), patternType: keywordControl},
{expression: regexp.MustCompile(`while\s+\(.+\)`), patternType: keywordControl},
{
expression: regexp.MustCompile(`(const\s+)?val\s+[A-Za-z0-9_]+(\s*:\s*[A-Za-z0-9_<>,\s\[\]?]+)?\s*=`),
patternType: keywordVariable,
},
{expression: regexp.MustCompile(`^\s*?(inner|open|data)\s+class`), patternType: keyword},
{expression: regexp.MustCompile(`^import\s+(.*)$`), patternType: metaImport, nearTop: true},
{expression: regexp.MustCompile(`typealias\s+(.*)\s+=`), patternType: keywordControl},
{expression: regexp.MustCompile(`companion\s+object`), patternType: keyword},
{expression: regexp.MustCompile(`when\s*(\([^)]*\)\s*)?\{`), patternType: keywordControl},
}