From a377d193288a6a3f4671b2e19c81bd0271ad797d Mon Sep 17 00:00:00 2001
From: Pooja Babu
Date: Mon, 7 Oct 2024 15:45:57 +0200
Subject: [PATCH] Generate parser files
---
pynestml/generated/PyNestMLParser.py | 62 ++++++++++-----------
pynestml/generated/PyNestMLParserVisitor.py | 8 +--
pynestml/grammars/PyNestMLParser.g4 | 2 +-
3 files changed, 36 insertions(+), 36 deletions(-)
diff --git a/pynestml/generated/PyNestMLParser.py b/pynestml/generated/PyNestMLParser.py
index 622399583..5ce763d6c 100644
--- a/pynestml/generated/PyNestMLParser.py
+++ b/pynestml/generated/PyNestMLParser.py
@@ -310,8 +310,8 @@ class PyNestMLParser ( Parser ):
RULE_compoundStmt = 16
RULE_smallStmt = 17
RULE_assignment = 18
- RULE_includeStatement = 19
- RULE_includeStatement_newline = 20
+ RULE_includeStmt = 19
+ RULE_includeStmt_newline = 20
RULE_declaration = 21
RULE_declaration_newline = 22
RULE_anyDecorator = 23
@@ -345,7 +345,7 @@ class PyNestMLParser ( Parser ):
"simpleExpression", "unaryOperator", "bitOperator", "comparisonOperator",
"logicalOperator", "variable", "functionCall", "inlineExpression",
"odeEquation", "kernel", "block", "stmt", "compoundStmt",
- "smallStmt", "assignment", "includeStatement", "includeStatement_newline",
+ "smallStmt", "assignment", "includeStmt", "includeStmt_newline",
"declaration", "declaration_newline", "anyDecorator",
"namespaceDecoratorNamespace", "namespaceDecoratorName",
"returnStmt", "ifStmt", "ifClause", "elifClause", "elseClause",
@@ -2152,8 +2152,8 @@ def returnStmt(self):
return self.getTypedRuleContext(PyNestMLParser.ReturnStmtContext,0)
- def includeStatement(self):
- return self.getTypedRuleContext(PyNestMLParser.IncludeStatementContext,0)
+ def includeStmt(self):
+ return self.getTypedRuleContext(PyNestMLParser.IncludeStmtContext,0)
def getRuleIndex(self):
@@ -2199,7 +2199,7 @@ def smallStmt(self):
elif la_ == 5:
self.state = 325
- self.includeStatement()
+ self.includeStmt()
pass
@@ -2307,7 +2307,7 @@ def assignment(self):
return localctx
- class IncludeStatementContext(ParserRuleContext):
+ class IncludeStmtContext(ParserRuleContext):
__slots__ = 'parser'
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
@@ -2321,21 +2321,21 @@ def STRING_LITERAL(self):
return self.getToken(PyNestMLParser.STRING_LITERAL, 0)
def getRuleIndex(self):
- return PyNestMLParser.RULE_includeStatement
+ return PyNestMLParser.RULE_includeStmt
def accept(self, visitor:ParseTreeVisitor):
- if hasattr( visitor, "visitIncludeStatement" ):
- return visitor.visitIncludeStatement(self)
+ if hasattr( visitor, "visitIncludeStmt" ):
+ return visitor.visitIncludeStmt(self)
else:
return visitor.visitChildren(self)
- def includeStatement(self):
+ def includeStmt(self):
- localctx = PyNestMLParser.IncludeStatementContext(self, self._ctx, self.state)
- self.enterRule(localctx, 38, self.RULE_includeStatement)
+ localctx = PyNestMLParser.IncludeStmtContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 38, self.RULE_includeStmt)
try:
self.enterOuterAlt(localctx, 1)
self.state = 340
@@ -2351,40 +2351,40 @@ def includeStatement(self):
return localctx
- class IncludeStatement_newlineContext(ParserRuleContext):
+ class IncludeStmt_newlineContext(ParserRuleContext):
__slots__ = 'parser'
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
- def includeStatement(self):
- return self.getTypedRuleContext(PyNestMLParser.IncludeStatementContext,0)
+ def includeStmt(self):
+ return self.getTypedRuleContext(PyNestMLParser.IncludeStmtContext,0)
def NEWLINE(self):
return self.getToken(PyNestMLParser.NEWLINE, 0)
def getRuleIndex(self):
- return PyNestMLParser.RULE_includeStatement_newline
+ return PyNestMLParser.RULE_includeStmt_newline
def accept(self, visitor:ParseTreeVisitor):
- if hasattr( visitor, "visitIncludeStatement_newline" ):
- return visitor.visitIncludeStatement_newline(self)
+ if hasattr( visitor, "visitIncludeStmt_newline" ):
+ return visitor.visitIncludeStmt_newline(self)
else:
return visitor.visitChildren(self)
- def includeStatement_newline(self):
+ def includeStmt_newline(self):
- localctx = PyNestMLParser.IncludeStatement_newlineContext(self, self._ctx, self.state)
- self.enterRule(localctx, 40, self.RULE_includeStatement_newline)
+ localctx = PyNestMLParser.IncludeStmt_newlineContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 40, self.RULE_includeStmt_newline)
try:
self.enterOuterAlt(localctx, 1)
self.state = 343
- self.includeStatement()
+ self.includeStmt()
self.state = 344
self.match(PyNestMLParser.NEWLINE)
except RecognitionException as re:
@@ -3348,11 +3348,11 @@ def INDENT(self):
def DEDENT(self):
return self.getToken(PyNestMLParser.DEDENT, 0)
- def includeStatement_newline(self, i:int=None):
+ def includeStmt_newline(self, i:int=None):
if i is None:
- return self.getTypedRuleContexts(PyNestMLParser.IncludeStatement_newlineContext)
+ return self.getTypedRuleContexts(PyNestMLParser.IncludeStmt_newlineContext)
else:
- return self.getTypedRuleContext(PyNestMLParser.IncludeStatement_newlineContext,i)
+ return self.getTypedRuleContext(PyNestMLParser.IncludeStmt_newlineContext,i)
def blockWithVariables(self, i:int=None):
@@ -3445,7 +3445,7 @@ def modelBody(self):
token = self._input.LA(1)
if token in [29]:
self.state = 455
- self.includeStatement_newline()
+ self.includeStmt_newline()
pass
elif token in [33, 34, 35]:
self.state = 456
@@ -3713,11 +3713,11 @@ def PARAMETERS_KEYWORD(self):
def INTERNALS_KEYWORD(self):
return self.getToken(PyNestMLParser.INTERNALS_KEYWORD, 0)
- def includeStatement_newline(self, i:int=None):
+ def includeStmt_newline(self, i:int=None):
if i is None:
- return self.getTypedRuleContexts(PyNestMLParser.IncludeStatement_newlineContext)
+ return self.getTypedRuleContexts(PyNestMLParser.IncludeStmt_newlineContext)
else:
- return self.getTypedRuleContext(PyNestMLParser.IncludeStatement_newlineContext,i)
+ return self.getTypedRuleContext(PyNestMLParser.IncludeStmt_newlineContext,i)
def declaration_newline(self, i:int=None):
@@ -3769,7 +3769,7 @@ def blockWithVariables(self):
token = self._input.LA(1)
if token in [29]:
self.state = 502
- self.includeStatement_newline()
+ self.includeStmt_newline()
pass
elif token in [16, 30, 89]:
self.state = 503
diff --git a/pynestml/generated/PyNestMLParserVisitor.py b/pynestml/generated/PyNestMLParserVisitor.py
index 76b555f17..a204344f1 100644
--- a/pynestml/generated/PyNestMLParserVisitor.py
+++ b/pynestml/generated/PyNestMLParserVisitor.py
@@ -104,13 +104,13 @@ def visitAssignment(self, ctx:PyNestMLParser.AssignmentContext):
return self.visitChildren(ctx)
- # Visit a parse tree produced by PyNestMLParser#includeStatement.
- def visitIncludeStatement(self, ctx:PyNestMLParser.IncludeStatementContext):
+ # Visit a parse tree produced by PyNestMLParser#includeStmt.
+ def visitIncludeStmt(self, ctx:PyNestMLParser.IncludeStmtContext):
return self.visitChildren(ctx)
- # Visit a parse tree produced by PyNestMLParser#includeStatement_newline.
- def visitIncludeStatement_newline(self, ctx:PyNestMLParser.IncludeStatement_newlineContext):
+ # Visit a parse tree produced by PyNestMLParser#includeStmt_newline.
+ def visitIncludeStmt_newline(self, ctx:PyNestMLParser.IncludeStmt_newlineContext):
return self.visitChildren(ctx)
diff --git a/pynestml/grammars/PyNestMLParser.g4 b/pynestml/grammars/PyNestMLParser.g4
index c3cb98045..30dd86cb0 100644
--- a/pynestml/grammars/PyNestMLParser.g4
+++ b/pynestml/grammars/PyNestMLParser.g4
@@ -153,7 +153,7 @@ parser grammar PyNestMLParser;
compoundQuotient=FORWARD_SLASH_EQUALS)
expression;
- include : INCLUDE_KEYWORD STRING_LITERAL;
+ includeStmt : INCLUDE_KEYWORD STRING_LITERAL;
includeStmt_newline : includeStmt NEWLINE;
/** ASTDeclaration A variable declaration. It can be a simple declaration defining one or multiple variables: