Skip to content

Commit f6d40ac

Browse files
committed
支持 ---@field [1] string 和 ---@field [string] string 的形式
1 parent d447b3d commit f6d40ac

File tree

15 files changed

+754
-577
lines changed

15 files changed

+754
-577
lines changed

EmmyLua-Common/src/main/gen/com/tang/intellij/lua/comment/lexer/_LuaDocLexer.java

Lines changed: 456 additions & 431 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

EmmyLua-Common/src/main/gen/com/tang/intellij/lua/comment/parser/LuaDocParser.java

Lines changed: 59 additions & 84 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

EmmyLua-Common/src/main/gen/com/tang/intellij/lua/comment/psi/LuaDocFieldIndex.java

Lines changed: 16 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

EmmyLua-Common/src/main/gen/com/tang/intellij/lua/comment/psi/LuaDocTagField.java

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

EmmyLua-Common/src/main/gen/com/tang/intellij/lua/comment/psi/LuaDocTypes.java

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

EmmyLua-Common/src/main/gen/com/tang/intellij/lua/comment/psi/LuaDocVisitor.java

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

EmmyLua-Common/src/main/gen/com/tang/intellij/lua/comment/psi/impl/LuaDocFieldIndexImpl.java

Lines changed: 42 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

EmmyLua-Common/src/main/gen/com/tang/intellij/lua/comment/psi/impl/LuaDocTagFieldImpl.java

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

EmmyLua-Common/src/main/java/com/tang/intellij/lua/doc.bnf

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535

3636
tokens = [
3737
ID="regexp:[A-Za-z0-9_]+"
38+
NUM="regexp:[0-9]+"
3839
AT = '@'
3940
SHARP = '#'
4041
EQ = '='
@@ -49,6 +50,8 @@
4950
RCURLY = "}"
5051
STRING_LITERAL = "STRING_LITERAL"
5152
ARR = '[]'
53+
LBRACK = '['
54+
RBRACK = ']'
5255
QM = '?'
5356
FUN = 'fun'
5457
VARARG = 'vararg'
@@ -182,7 +185,9 @@ union_ty ::= ty ('|' ty)+ {
182185
}
183186
access_modifier ::= PRIVATE | PUBLIC | PROTECTED | TAG_NAME_PRIVATE | TAG_NAME_PUBLIC | TAG_NAME_PROTECTED
184187

185-
tag_field ::= TAG_NAME_FIELD access_modifier? ('<' class_name_ref '>')? ID nullable? ty comment_string? {
188+
field_index ::= ID | NUM
189+
190+
tag_field ::= TAG_NAME_FIELD access_modifier? ((('<' class_name_ref '>')? ID nullable?)| '[' field_index ']') ty comment_string? {
186191
pin = 1
187192
implements = [
188193
"com.tang.intellij.lua.psi.LuaClassField"

EmmyLua-Common/src/main/java/com/tang/intellij/lua/doc.flex

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ LINE_WS=[\ \t\f]
4646
WHITE_SPACE=({LINE_WS}|{EOL})+
4747
STRING=[^\r\n\t\f]*
4848
ID=[:jletter:] ([:jletterdigit:]|\.)*
49+
NUM=[0-9]+
4950
AT=@
5051
//三个-以上
5152
DOC_DASHES = --+
@@ -65,6 +66,7 @@ SINGLE_QUOTED_STRING='([^\\\']|\\\S|\\[\r\n])*'? //'([^\\'\r\n]|\\[^\r\n])*'?
6566
%state xFIELD
6667
%state xFIELD_ID
6768
%state xFIELD_ID_NULLABLE
69+
%state xFIELD_INDEX
6870
%state xGENERIC
6971
%state xALIAS
7072
%state xSUPPRESS
@@ -150,10 +152,12 @@ SINGLE_QUOTED_STRING='([^\\\']|\\\S|\\[\r\n])*'? //'([^\\'\r\n]|\\[^\r\n])*'?
150152
"private" { yybegin(xFIELD_ID); return PRIVATE; }
151153
"protected" { yybegin(xFIELD_ID); return PROTECTED; }
152154
"public" { yybegin(xFIELD_ID); return PUBLIC; }
155+
"[" { yybegin(xFIELD_INDEX); return LBRACK; }
153156
{ID} { yybegin(xFIELD_ID_NULLABLE); return ID; }
154157
}
155158

156159
<xFIELD_ID> {
160+
"[" { yybegin(xFIELD_INDEX); return LBRACK; }
157161
{ID} { yybegin(xFIELD_ID_NULLABLE); return ID; }
158162
}
159163

@@ -162,6 +166,12 @@ SINGLE_QUOTED_STRING='([^\\\']|\\\S|\\[\r\n])*'? //'([^\\'\r\n]|\\[^\r\n])*'?
162166
[^] { beginType(); yypushback(yylength());}
163167
}
164168

169+
<xFIELD_INDEX>{
170+
{NUM} { return NUM; }
171+
{ID} { return ID; }
172+
"]" { beginType(); return RBRACK; }
173+
}
174+
165175
<xTYPE_REF> {
166176
"@" { yybegin(xCOMMENT_STRING); return STRING_BEGIN; }
167177
"," { _typeReq = true; return COMMA; }

0 commit comments

Comments
 (0)