Skip to content

Commit

Permalink
Generate parser files
Browse files Browse the repository at this point in the history
  • Loading branch information
pnbabu committed Oct 7, 2024
1 parent eecc955 commit a377d19
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 36 deletions.
62 changes: 31 additions & 31 deletions pynestml/generated/PyNestMLParser.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -2199,7 +2199,7 @@ def smallStmt(self):

elif la_ == 5:
self.state = 325
self.includeStatement()
self.includeStmt()
pass


Expand Down Expand Up @@ -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):
Expand All @@ -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
Expand All @@ -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:
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions pynestml/generated/PyNestMLParserVisitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)


Expand Down
2 changes: 1 addition & 1 deletion pynestml/grammars/PyNestMLParser.g4
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit a377d19

Please sign in to comment.