From a46d9f4dddcfaef7b6f28f5d803dc785d3a44992 Mon Sep 17 00:00:00 2001 From: Quint Daenen Date: Tue, 19 Mar 2024 16:05:55 +0100 Subject: [PATCH] Fix empty service bug. --- candid/internal/candid/grammar.go | 2 +- candid/internal/candid/grammar.pegn | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/candid/internal/candid/grammar.go b/candid/internal/candid/grammar.go index 4ffd860..bb7f087 100755 --- a/candid/internal/candid/grammar.go +++ b/candid/internal/candid/grammar.go @@ -123,9 +123,9 @@ func ActorType(p *ast.Parser) (*ast.Node, error) { TypeStrings: NodeTypes, Value: op.And{ '{', + Ws, op.Optional( op.And{ - Ws, MethType, op.MinZero( op.And{ diff --git a/candid/internal/candid/grammar.pegn b/candid/internal/candid/grammar.pegn index d9d280d..4a4607e 100644 --- a/candid/internal/candid/grammar.pegn +++ b/candid/internal/candid/grammar.pegn @@ -7,7 +7,7 @@ Type <-- 'type' Sp Id Sp '=' Sp DataType Import <-- 'import' Sp Text Actor <-- 'service' Sp? (Id Sp)? ':' Sp (TupType Sp '->' Ws)? (ActorType / Id) -ActorType <-- '{' (Ws MethType (';' Ws MethType)* ';'? Ws)? '}' +ActorType <-- '{' Ws (MethType (';' Ws MethType)* ';'? Ws)? '}' MethType <-- Name Sp? ':' Ws (FuncType / Id) FuncType <-- TupType (Sp '->' Ws TupType (Sp FuncAnn)?)? FuncAnn <-- 'oneway' / 'query'