backport: 20.1.1
This commit is contained in:
parent
323ba12fbc
commit
d3755fbc70
6 changed files with 37 additions and 15 deletions
|
@ -17,6 +17,14 @@ Changelog structure reference:
|
|||
|
||||
## [Unreleased]
|
||||
|
||||
## [20.1.1]
|
||||
|
||||
### Fixed
|
||||
|
||||
- Zig
|
||||
- Unterminated string at the end of the file soft-locks the editor
|
||||
- Trailing commas in for loop parameters don't get parsed correctly
|
||||
|
||||
## [20.1.0]
|
||||
|
||||
### Added
|
||||
|
|
|
@ -180,11 +180,11 @@
|
|||
Root ::= CONTAINER_DOC_COMMENT? ContainerMembers?
|
||||
|
||||
// *** Top level ***
|
||||
ContainerMembers ::= ContainerDeclarations? (ContainerField COMMA)* (ContainerField | ContainerDeclarations)?
|
||||
ContainerMembers ::= ContainerDeclaration* (ContainerField COMMA)* (ContainerField | ContainerDeclaration*)
|
||||
|
||||
ContainerDeclarations ::= (TestDecl | ComptimeDecl | DOC_COMMENT? KEYWORD_PUB? Decl)+
|
||||
ContainerDeclaration ::= TestDecl | ComptimeDecl | DOC_COMMENT? KEYWORD_PUB? Decl
|
||||
|
||||
TestDecl ::= DOC_COMMENT? KEYWORD_TEST (STRING_LITERAL_SINGLE | IDENTIFIER)? Block {pin=2}
|
||||
TestDecl ::= KEYWORD_TEST (STRING_LITERAL_SINGLE | IDENTIFIER)? Block {pin=1}
|
||||
|
||||
ComptimeDecl ::= KEYWORD_COMPTIME Block
|
||||
|
||||
|
@ -205,6 +205,7 @@ ContainerField ::= DOC_COMMENT? KEYWORD_COMPTIME? !KEYWORD_FN (IDENTIFIER COLON)
|
|||
Statement
|
||||
::= KEYWORD_COMPTIME ComptimeStatement
|
||||
| KEYWORD_NOSUSPEND BlockExprStatement
|
||||
| KEYWORD_SUSPEND BlockExprStatement
|
||||
| KEYWORD_DEFER BlockExprStatement
|
||||
| KEYWORD_ERRDEFER Payload? BlockExprStatement
|
||||
| IfStatement
|
||||
|
@ -415,14 +416,21 @@ WhilePrefix ::= KEYWORD_WHILE ZB_WhilePrefix_Operand PtrPayload? WhileContinueEx
|
|||
|
||||
private ZB_WhilePrefix_Operand ::= LPAREN Expr RPAREN {pin=1}
|
||||
|
||||
ForRange ::= Expr DOT2 Expr?
|
||||
ForOperand ::= ForRange | Expr {recoverWhile="ZB_ForOperand_Recover"}
|
||||
ForPrefix ::= KEYWORD_FOR LPAREN ZB_ForParams RPAREN ForPayload {pin=1}
|
||||
|
||||
private ZB_ForOperand_Recover ::= !(COMMA | RPAREN)
|
||||
private ZB_ForParams ::= ForInput (COMMA ForInput)* COMMA? {recoverWhile="ZB_ForParams_Recover"}
|
||||
|
||||
ForPrefix ::= KEYWORD_FOR ZB_ForPrefix_Operands PtrIndexPayload {pin=1}
|
||||
private ZB_ForParams_Recover ::= !(RPAREN)
|
||||
|
||||
private ZB_ForPrefix_Operands ::= LPAREN (ForOperand COMMA)* ForOperand RPAREN {pin=1}
|
||||
ForInput ::= Expr (DOT2 Expr?)? {recoverWhile="ZB_ForInput_Recover"}
|
||||
|
||||
private ZB_ForInput_Recover ::= !(COMMA | RPAREN)
|
||||
|
||||
ForPayload ::= PIPE ZB_ForPayload_Item (COMMA ZB_ForPayload_Item)* PIPE {pin=1}
|
||||
|
||||
private ZB_ForPayload_Item ::= ASTERISK? IDENTIFIER {recoverWhile="ZB_ForPayload_Recover"}
|
||||
|
||||
private ZB_ForPayload_Recover ::= !(COMMA | PIPE)
|
||||
|
||||
// Payloads
|
||||
Payload ::= PIPE IDENTIFIER PIPE
|
||||
|
|
|
@ -222,6 +222,7 @@ BUILTINIDENTIFIER="@"[A-Za-z_][A-Za-z0-9_]*
|
|||
|
||||
<YYINITIAL> "'" { yybegin(CHAR_LIT); }
|
||||
<CHAR_LIT> {char_char}*"'" { yybegin(YYINITIAL); return CHAR_LITERAL; }
|
||||
<CHAR_LIT> <<EOF>> { yybegin(YYINITIAL); return BAD_SQUOT; }
|
||||
<CHAR_LIT> [^] { yypushback(1); yybegin(UNT_SQUOT); }
|
||||
|
||||
<YYINITIAL> {FLOAT} { return FLOAT; }
|
||||
|
@ -229,6 +230,7 @@ BUILTINIDENTIFIER="@"[A-Za-z_][A-Za-z0-9_]*
|
|||
|
||||
<YYINITIAL> "\"" { yybegin(STR_LIT); }
|
||||
<STR_LIT> {string_char}*"\"" { yybegin(YYINITIAL); return STRING_LITERAL_SINGLE; }
|
||||
<STR_LIT> <<EOF>> { yybegin(YYINITIAL); return BAD_DQUOT; }
|
||||
<STR_LIT> [^] { yypushback(1); yybegin(UNT_DQUOT); }
|
||||
<YYINITIAL> "\\\\" { yybegin(STR_MULT_LINE); }
|
||||
<STR_MULT_LINE> {all_nl_wrap} "\\\\" { }
|
||||
|
@ -237,12 +239,17 @@ BUILTINIDENTIFIER="@"[A-Za-z_][A-Za-z0-9_]*
|
|||
<YYINITIAL> {IDENTIFIER_PLAIN} { return IDENTIFIER; }
|
||||
<YYINITIAL> "@\"" { yybegin(ID_QUOT); }
|
||||
<ID_QUOT> {string_char}*"\"" { yybegin(YYINITIAL); return IDENTIFIER; }
|
||||
<ID_QUOT> <<EOF>> { yybegin(YYINITIAL); return BAD_DQUOT; }
|
||||
<ID_QUOT> [^] { yypushback(1); yybegin(UNT_DQUOT); }
|
||||
|
||||
<YYINITIAL> {BUILTINIDENTIFIER} { return BUILTINIDENTIFIER; }
|
||||
|
||||
<UNT_SQUOT> [^\n]*{CRLF} { yybegin(YYINITIAL); return BAD_SQUOT; }
|
||||
<UNT_DQUOT> [^\n]*{CRLF} { yybegin(YYINITIAL); return BAD_DQUOT; }
|
||||
<UNT_SQUOT> <<EOF>> { yybegin(YYINITIAL); return BAD_SQUOT; }
|
||||
<UNT_SQUOT> {CRLF} { yybegin(YYINITIAL); return BAD_SQUOT; }
|
||||
<UNT_SQUOT> [^\n]* { }
|
||||
<UNT_DQUOT> <<EOF>> { yybegin(YYINITIAL); return BAD_DQUOT; }
|
||||
<UNT_DQUOT> {CRLF} { yybegin(YYINITIAL); return BAD_DQUOT; }
|
||||
<UNT_DQUOT> [^\n]* { }
|
||||
|
||||
<YYINITIAL> {WHITE_SPACE} { return WHITE_SPACE; }
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ abstract class ZigTopLevelLineMarker: RunLineMarkerContributor() {
|
|||
|
||||
var nestingLevel = 0;
|
||||
while (parent != null && parent !is PsiFile) {
|
||||
if (parent.elementType == ZigTypes.CONTAINER_DECLARATIONS) {
|
||||
if (parent.elementType == ZigTypes.CONTAINER_DECLARATION) {
|
||||
if (nestingLevel != 0)
|
||||
return null
|
||||
nestingLevel++
|
||||
|
|
|
@ -59,10 +59,9 @@ class ZigStringElementManipulator: AbstractElementManipulator<ZigStringLiteral>(
|
|||
val stringLiteral = dummy
|
||||
.firstChild
|
||||
.let {it as ZigContainerMembers}
|
||||
.containerDeclarationsList
|
||||
.first()
|
||||
.declList
|
||||
.containerDeclarationList
|
||||
.first()
|
||||
.decl!!
|
||||
.globalVarDecl!!
|
||||
.expr
|
||||
.let { it as ZigPrimaryTypeExpr }
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
pluginName=ZigBrains
|
||||
pluginRepositoryUrl=https://github.com/FalsePattern/ZigBrains
|
||||
|
||||
pluginVersion=20.1.0
|
||||
pluginVersion=20.1.1
|
||||
|
||||
pluginSinceBuild=241
|
||||
pluginUntilBuild=241.*
|
||||
|
|
Loading…
Add table
Reference in a new issue