Add official Kotlin ANTLR grammar files, copy and rename some more from Swift

This commit is contained in:
jborgers 2021-09-08 18:37:00 +02:00
parent 1fda7a0782
commit 2780560b36
8 changed files with 3283 additions and 458 deletions

View File

@ -33,7 +33,7 @@
</goals>
<configuration>
<target>
<ant antfile="${antlr4.ant.wrapper}" target="cpd-language">
<ant antfile="${antlr4.ant.wrapper}" target="pmd-language">
<property name="lang-name" value="Kotlin" />
<property name="lang-terse-name" value="kotlin" />
<property name="root-node-name" value="TopLevel" />

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,290 @@
UNICODE_CLASS_LL=1
UNICODE_CLASS_LM=2
UNICODE_CLASS_LO=3
UNICODE_CLASS_LT=4
UNICODE_CLASS_LU=5
UNICODE_CLASS_ND=6
UNICODE_CLASS_NL=7
ShebangLine=8
DelimitedComment=9
LineComment=10
WS=11
NL=12
RESERVED=13
DOT=14
COMMA=15
LPAREN=16
RPAREN=17
LSQUARE=18
RSQUARE=19
LCURL=20
RCURL=21
MULT=22
MOD=23
DIV=24
ADD=25
SUB=26
INCR=27
DECR=28
CONJ=29
DISJ=30
EXCL_WS=31
EXCL_NO_WS=32
COLON=33
SEMICOLON=34
ASSIGNMENT=35
ADD_ASSIGNMENT=36
SUB_ASSIGNMENT=37
MULT_ASSIGNMENT=38
DIV_ASSIGNMENT=39
MOD_ASSIGNMENT=40
ARROW=41
DOUBLE_ARROW=42
RANGE=43
COLONCOLON=44
DOUBLE_SEMICOLON=45
HASH=46
AT_NO_WS=47
AT_POST_WS=48
AT_PRE_WS=49
AT_BOTH_WS=50
QUEST_WS=51
QUEST_NO_WS=52
LANGLE=53
RANGLE=54
LE=55
GE=56
EXCL_EQ=57
EXCL_EQEQ=58
AS_SAFE=59
EQEQ=60
EQEQEQ=61
SINGLE_QUOTE=62
RETURN_AT=63
CONTINUE_AT=64
BREAK_AT=65
THIS_AT=66
SUPER_AT=67
FILE=68
FIELD=69
PROPERTY=70
GET=71
SET=72
RECEIVER=73
PARAM=74
SETPARAM=75
DELEGATE=76
PACKAGE=77
IMPORT=78
CLASS=79
INTERFACE=80
FUN=81
OBJECT=82
VAL=83
VAR=84
TYPE_ALIAS=85
CONSTRUCTOR=86
BY=87
COMPANION=88
INIT=89
THIS=90
SUPER=91
TYPEOF=92
WHERE=93
IF=94
ELSE=95
WHEN=96
TRY=97
CATCH=98
FINALLY=99
FOR=100
DO=101
WHILE=102
THROW=103
RETURN=104
CONTINUE=105
BREAK=106
AS=107
IS=108
IN=109
NOT_IS=110
NOT_IN=111
OUT=112
DYNAMIC=113
PUBLIC=114
PRIVATE=115
PROTECTED=116
INTERNAL=117
ENUM=118
SEALED=119
ANNOTATION=120
DATA=121
INNER=122
VALUE=123
TAILREC=124
OPERATOR=125
INLINE=126
INFIX=127
EXTERNAL=128
SUSPEND=129
OVERRIDE=130
ABSTRACT=131
FINAL=132
OPEN=133
CONST=134
LATEINIT=135
VARARG=136
NOINLINE=137
CROSSINLINE=138
REIFIED=139
EXPECT=140
ACTUAL=141
RealLiteral=142
FloatLiteral=143
DoubleLiteral=144
IntegerLiteral=145
HexLiteral=146
BinLiteral=147
UnsignedLiteral=148
LongLiteral=149
BooleanLiteral=150
NullLiteral=151
CharacterLiteral=152
Identifier=153
IdentifierOrSoftKey=154
FieldIdentifier=155
QUOTE_OPEN=156
TRIPLE_QUOTE_OPEN=157
QUOTE_CLOSE=158
LineStrRef=159
LineStrText=160
LineStrEscapedChar=161
LineStrExprStart=162
TRIPLE_QUOTE_CLOSE=163
MultiLineStringQuote=164
MultiLineStrRef=165
MultiLineStrText=166
MultiLineStrExprStart=167
Inside_Comment=168
Inside_WS=169
Inside_NL=170
ErrorCharacter=171
'...'=13
'.'=14
','=15
'('=16
')'=17
'['=18
']'=19
'{'=20
'}'=21
'*'=22
'%'=23
'/'=24
'+'=25
'-'=26
'++'=27
'--'=28
'&&'=29
'||'=30
'!'=32
':'=33
';'=34
'='=35
'+='=36
'-='=37
'*='=38
'/='=39
'%='=40
'->'=41
'=>'=42
'..'=43
'::'=44
';;'=45
'#'=46
'@'=47
'?'=52
'<'=53
'>'=54
'<='=55
'>='=56
'!='=57
'!=='=58
'as?'=59
'=='=60
'==='=61
'\''=62
'file'=68
'field'=69
'property'=70
'get'=71
'set'=72
'receiver'=73
'param'=74
'setparam'=75
'delegate'=76
'package'=77
'import'=78
'class'=79
'interface'=80
'fun'=81
'object'=82
'val'=83
'var'=84
'typealias'=85
'constructor'=86
'by'=87
'companion'=88
'init'=89
'this'=90
'super'=91
'typeof'=92
'where'=93
'if'=94
'else'=95
'when'=96
'try'=97
'catch'=98
'finally'=99
'for'=100
'do'=101
'while'=102
'throw'=103
'return'=104
'continue'=105
'break'=106
'as'=107
'is'=108
'in'=109
'out'=112
'dynamic'=113
'public'=114
'private'=115
'protected'=116
'internal'=117
'enum'=118
'sealed'=119
'annotation'=120
'data'=121
'inner'=122
'value'=123
'tailrec'=124
'operator'=125
'inline'=126
'infix'=127
'external'=128
'suspend'=129
'override'=130
'abstract'=131
'final'=132
'open'=133
'const'=134
'lateinit'=135
'vararg'=136
'noinline'=137
'crossinline'=138
'reified'=139
'expect'=140
'actual'=141
'null'=151
'"""'=157

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,7 @@
UNICODE_CLASS_LL=1
UNICODE_CLASS_LM=2
UNICODE_CLASS_LO=3
UNICODE_CLASS_LT=4
UNICODE_CLASS_LU=5
UNICODE_CLASS_ND=6
UNICODE_CLASS_NL=7

View File

@ -0,0 +1 @@
net.sourceforge.pmd.lang.kotlin.KotlinLanguageModule

View File

@ -0,0 +1,19 @@
#
# BSD-style license; for more info see http://pmd.sourceforge.net/license.html
#
rulesets.filenames=
#
# categories without rules
#
# category/kotlin/bestpractices.xml,\
# category/kotlin/errorprone.xml
# category/kotlin/codestyle.xml
# category/kotlin/design.xml
# category/kotlin/documentation.xml
# category/kotlin/multithreading.xml
# category/kotlin/performance.xml
# category/kotlin/security.xml