Skip to content

Commit

Permalink
Merge pull request #14 from distributed-lab/fix/grammar-typo
Browse files Browse the repository at this point in the history
Update Grammar
  • Loading branch information
Arvolear authored Dec 31, 2024
2 parents 2b0ab23 + 00c9102 commit a933595
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 37 deletions.
2 changes: 1 addition & 1 deletion circom-g4-grammar
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@distributedlab/circom-parser",
"description": "Circom circuit parser built with ANTLR4",
"version": "0.2.5",
"version": "0.2.6",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"files": [
Expand Down
40 changes: 20 additions & 20 deletions src/generated/CircomParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ export default class CircomParser extends Parser {
public static readonly RULE_identifier = 35;
public static readonly RULE_identifierList = 36;
public static readonly RULE_simpleIdentifierList = 37;
public static readonly RULE_idetifierAccess = 38;
public static readonly RULE_identifierAccess = 38;
public static readonly RULE_arrayDimension = 39;
public static readonly RULE_identifierReferance = 40;
public static readonly RULE_expressionOrString = 41;
Expand Down Expand Up @@ -338,7 +338,7 @@ export default class CircomParser extends Parser {
"identifier",
"identifierList",
"simpleIdentifierList",
"idetifierAccess",
"identifierAccess",
"arrayDimension",
"identifierReferance",
"expressionOrString",
Expand Down Expand Up @@ -2931,7 +2931,7 @@ export default class CircomParser extends Parser {
{
{
this.state = 568;
this.idetifierAccess();
this.identifierAccess();
}
}
}
Expand Down Expand Up @@ -3088,13 +3088,13 @@ export default class CircomParser extends Parser {
return localctx;
}
// @RuleVersion(0)
public idetifierAccess(): IdetifierAccessContext {
let localctx: IdetifierAccessContext = new IdetifierAccessContext(
public identifierAccess(): IdentifierAccessContext {
let localctx: IdentifierAccessContext = new IdentifierAccessContext(
this,
this._ctx,
this.state,
);
this.enterRule(localctx, 76, CircomParser.RULE_idetifierAccess);
this.enterRule(localctx, 76, CircomParser.RULE_identifierAccess);
try {
this.state = 602;
this._errHandler.sync(this);
Expand Down Expand Up @@ -6464,16 +6464,16 @@ export class IdentifierStatementContext extends ParserRuleContext {
public ID(): TerminalNode {
return this.getToken(CircomParser.ID, 0);
}
public idetifierAccess_list(): IdetifierAccessContext[] {
public identifierAccess_list(): IdentifierAccessContext[] {
return this.getTypedRuleContexts(
IdetifierAccessContext,
) as IdetifierAccessContext[];
IdentifierAccessContext,
) as IdentifierAccessContext[];
}
public idetifierAccess(i: number): IdetifierAccessContext {
public identifierAccess(i: number): IdentifierAccessContext {
return this.getTypedRuleContext(
IdetifierAccessContext,
IdentifierAccessContext,
i,
) as IdetifierAccessContext;
) as IdentifierAccessContext;
}
public get ruleIndex(): number {
return CircomParser.RULE_identifierStatement;
Expand Down Expand Up @@ -6632,7 +6632,7 @@ export class SimpleIdentifierListContext extends ParserRuleContext {
}
}

export class IdetifierAccessContext extends ParserRuleContext {
export class IdentifierAccessContext extends ParserRuleContext {
constructor(
parser?: CircomParser,
parent?: ParserRuleContext,
Expand All @@ -6654,22 +6654,22 @@ export class IdetifierAccessContext extends ParserRuleContext {
) as IdentifierReferanceContext;
}
public get ruleIndex(): number {
return CircomParser.RULE_idetifierAccess;
return CircomParser.RULE_identifierAccess;
}
public enterRule(listener: CircomParserListener): void {
if (listener.enterIdetifierAccess) {
listener.enterIdetifierAccess(this);
if (listener.enterIdentifierAccess) {
listener.enterIdentifierAccess(this);
}
}
public exitRule(listener: CircomParserListener): void {
if (listener.exitIdetifierAccess) {
listener.exitIdetifierAccess(this);
if (listener.exitIdentifierAccess) {
listener.exitIdentifierAccess(this);
}
}
// @Override
public accept<Result>(visitor: CircomParserVisitor<Result>): Result {
if (visitor.visitIdetifierAccess) {
return visitor.visitIdetifierAccess(this);
if (visitor.visitIdentifierAccess) {
return visitor.visitIdentifierAccess(this);
} else {
return visitor.visitChildren(this);
}
Expand Down
10 changes: 5 additions & 5 deletions src/generated/CircomParserListener.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ import { IdentifierStatementContext } from "./CircomParser";
import { IdentifierContext } from "./CircomParser";
import { IdentifierListContext } from "./CircomParser";
import { SimpleIdentifierListContext } from "./CircomParser";
import { IdetifierAccessContext } from "./CircomParser";
import { IdentifierAccessContext } from "./CircomParser";
import { ArrayDimensionContext } from "./CircomParser";
import { IdentifierReferanceContext } from "./CircomParser";
import { ExpressionOrStringContext } from "./CircomParser";
Expand Down Expand Up @@ -797,15 +797,15 @@ export default class CircomParserListener extends ParseTreeListener {
*/
exitSimpleIdentifierList?: (ctx: SimpleIdentifierListContext) => void;
/**
* Enter a parse tree produced by `CircomParser.idetifierAccess`.
* Enter a parse tree produced by `CircomParser.identifierAccess`.
* @param ctx the parse tree
*/
enterIdetifierAccess?: (ctx: IdetifierAccessContext) => void;
enterIdentifierAccess?: (ctx: IdentifierAccessContext) => void;
/**
* Exit a parse tree produced by `CircomParser.idetifierAccess`.
* Exit a parse tree produced by `CircomParser.identifierAccess`.
* @param ctx the parse tree
*/
exitIdetifierAccess?: (ctx: IdetifierAccessContext) => void;
exitIdentifierAccess?: (ctx: IdentifierAccessContext) => void;
/**
* Enter a parse tree produced by `CircomParser.arrayDimension`.
* @param ctx the parse tree
Expand Down
6 changes: 3 additions & 3 deletions src/generated/CircomParserVisitor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ import { IdentifierStatementContext } from "./CircomParser";
import { IdentifierContext } from "./CircomParser";
import { IdentifierListContext } from "./CircomParser";
import { SimpleIdentifierListContext } from "./CircomParser";
import { IdetifierAccessContext } from "./CircomParser";
import { IdentifierAccessContext } from "./CircomParser";
import { ArrayDimensionContext } from "./CircomParser";
import { IdentifierReferanceContext } from "./CircomParser";
import { ExpressionOrStringContext } from "./CircomParser";
Expand Down Expand Up @@ -512,11 +512,11 @@ export default class CircomParserVisitor<
*/
visitSimpleIdentifierList?: (ctx: SimpleIdentifierListContext) => Result;
/**
* Visit a parse tree produced by `CircomParser.idetifierAccess`.
* Visit a parse tree produced by `CircomParser.identifierAccess`.
* @param ctx the parse tree
* @return the visitor result
*/
visitIdetifierAccess?: (ctx: IdetifierAccessContext) => Result;
visitIdentifierAccess?: (ctx: IdentifierAccessContext) => Result;
/**
* Visit a parse tree produced by `CircomParser.arrayDimension`.
* @param ctx the parse tree
Expand Down
4 changes: 2 additions & 2 deletions src/utils/ExpressionHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ class ExpressionVisitor extends ExtendedCircomVisitor<CircomValueType | null> {
visitPIdentifierStatement = (
ctx: PIdentifierStatementContext,
): CircomValueType | null => {
if (ctx.identifierStatement().idetifierAccess_list().length == 0) {
if (ctx.identifierStatement().identifierAccess_list().length == 0) {
const variableValue =
this.variableContext[ctx.identifierStatement().ID().getText()];

Expand All @@ -138,7 +138,7 @@ class ExpressionVisitor extends ExtendedCircomVisitor<CircomValueType | null> {

const reference = ctx
.identifierStatement()
.idetifierAccess_list()
.identifierAccess_list()
.map((access) => access.getText())
.join("");

Expand Down
6 changes: 3 additions & 3 deletions test/mocks/CircomTemplateInputsVisitor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ export class CircomTemplateInputsVisitor extends CircomVisitor<void> {

const identifierStatement = primaryExpression.identifierStatement();

if (identifierStatement.idetifierAccess_list().length > 0) {
if (identifierStatement.identifierAccess_list().length > 0) {
this.errors.push({
type: ErrorType.ComplexAccessNotSupported,
context: ctx,
Expand Down Expand Up @@ -384,7 +384,7 @@ export class CircomTemplateInputsVisitor extends CircomVisitor<void> {
) => {
const identifierStatement = ctx.identifierStatement();

if (identifierStatement.idetifierAccess_list().length > 0) {
if (identifierStatement.identifierAccess_list().length > 0) {
this.errors.push({
type: ErrorType.ComplexAccessNotSupported,
context: ctx,
Expand Down Expand Up @@ -518,7 +518,7 @@ export class CircomTemplateInputsVisitor extends CircomVisitor<void> {
visitSubsIcnDecOperation = (ctx: SubsIcnDecOperationContext) => {
const identifierStatement = ctx.identifierStatement();

if (identifierStatement.idetifierAccess_list().length > 0) {
if (identifierStatement.identifierAccess_list().length > 0) {
this.errors.push({
type: ErrorType.ComplexAccessNotSupported,
context: ctx,
Expand Down

0 comments on commit a933595

Please sign in to comment.