From 6b24f905b19ad7be14c36e9bcfa0863e0c2bcc54 Mon Sep 17 00:00:00 2001 From: Kyrylo Riabov Date: Thu, 21 Nov 2024 12:27:51 +0200 Subject: [PATCH] Fix parsing of templates and buses without arguments (#7) * Fixed parsing of templates and buses without arguments --- data/Example3.circom | 2 +- grammar/CircomParser.g4 | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/data/Example3.circom b/data/Example3.circom index 509389b..a1bc4d0 100644 --- a/data/Example3.circom +++ b/data/Example3.circom @@ -1,4 +1,4 @@ -bus B1(){ +bus B1 { signal x; } diff --git a/grammar/CircomParser.g4 b/grammar/CircomParser.g4 index 77aa0e5..05644fe 100644 --- a/grammar/CircomParser.g4 +++ b/grammar/CircomParser.g4 @@ -44,10 +44,10 @@ blockDefiniton functionDefinition: 'function' ID '(' argNames=simpleIdentifierList? ')' body ; templateDefinition - : 'template' 'custom'? 'parallel'? ID '(' argNames=simpleIdentifierList? ')' body + : 'template' 'custom'? 'parallel'? ID ('(' argNames=simpleIdentifierList? ')')? body ; -busDefinition: 'bus' ID '(' argNames=simpleIdentifierList? ')' body ; +busDefinition: 'bus' ID ('(' argNames=simpleIdentifierList? ')')? body ; publicInputsDefinition: '{' 'public' '[' publicInputs=simpleIdentifierList ']' '}' ;