chore: Grammar tidy

This commit is contained in:
FalsePattern 2024-12-24 12:49:18 +01:00
parent 6879cbf0e5
commit 694acfc1d3
Signed by: falsepattern
GPG key ID: E930CDEC50C50E23
3 changed files with 7 additions and 7 deletions

View file

@ -180,11 +180,11 @@
Root ::= CONTAINER_DOC_COMMENT? ContainerMembers? Root ::= CONTAINER_DOC_COMMENT? ContainerMembers?
// *** Top level *** // *** 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 ComptimeDecl ::= KEYWORD_COMPTIME Block
@ -205,6 +205,7 @@ ContainerField ::= DOC_COMMENT? KEYWORD_COMPTIME? !KEYWORD_FN (IDENTIFIER COLON)
Statement Statement
::= KEYWORD_COMPTIME ComptimeStatement ::= KEYWORD_COMPTIME ComptimeStatement
| KEYWORD_NOSUSPEND BlockExprStatement | KEYWORD_NOSUSPEND BlockExprStatement
| KEYWORD_SUSPEND BlockExprStatement
| KEYWORD_DEFER BlockExprStatement | KEYWORD_DEFER BlockExprStatement
| KEYWORD_ERRDEFER Payload? BlockExprStatement | KEYWORD_ERRDEFER Payload? BlockExprStatement
| IfStatement | IfStatement

View file

@ -36,7 +36,7 @@ abstract class ZigTopLevelLineMarker: RunLineMarkerContributor() {
var nestingLevel = 0; var nestingLevel = 0;
while (parent != null && parent !is PsiFile) { while (parent != null && parent !is PsiFile) {
if (parent.elementType == ZigTypes.CONTAINER_DECLARATIONS) { if (parent.elementType == ZigTypes.CONTAINER_DECLARATION) {
if (nestingLevel != 0) if (nestingLevel != 0)
return null return null
nestingLevel++ nestingLevel++

View file

@ -59,10 +59,9 @@ class ZigStringElementManipulator: AbstractElementManipulator<ZigStringLiteral>(
val stringLiteral = dummy val stringLiteral = dummy
.firstChild .firstChild
.let {it as ZigContainerMembers} .let {it as ZigContainerMembers}
.containerDeclarationsList .containerDeclarationList
.first()
.declList
.first() .first()
.decl!!
.globalVarDecl!! .globalVarDecl!!
.expr .expr
.let { it as ZigPrimaryTypeExpr } .let { it as ZigPrimaryTypeExpr }