Loading lib/parsing/parser.py +8 −43 Original line number Original line Diff line number Diff line Loading @@ -255,16 +255,7 @@ class DFABuilder(DFAListener): # for future support of comments # for future support of comments def exitComment(self, ctx): def exitComment(self, ctx): comment = "" return None i = 0 while ctx.anyvalue(i) is not None: if ctx.anyvalue(i).ANYCHAR(): comment += str(ctx.anyvalue(i).ANYCHAR()) if ctx.anyvalue(i).STATE(): comment += str(ctx.anyvalue(i).STATE()) # add more of tokens (EQUALS, COMMA, ...) if needed # or change allowed tokens in grammar definition i += 1 class NFABuilder(NFAListener): class NFABuilder(NFAListener): Loading Loading @@ -326,7 +317,7 @@ class NFABuilder(NFAListener): if self.first_state is None: if self.first_state is None: self.first_state = state self.first_state = state def exitFinal(self, ctx): def exitFinal(self, ctx) -> None: i = 0 i = 0 while ctx.stateset().statename(i) is not None: while ctx.stateset().statename(i) is not None: state = State(self.visitStatename(ctx.stateset().statename(i))) state = State(self.visitStatename(ctx.stateset().statename(i))) Loading @@ -335,16 +326,8 @@ class NFABuilder(NFAListener): i += 1 i += 1 # for future support of comments # for future support of comments def exitComment(self, ctx): def exitComment(self, ctx) -> None: comment = "" return None i = 0 while ctx.anyvalue(i) is not None: while ctx.anyvalue(i) is not None: for attribute in self.anyvalue_attributes: value = getattr(ctx.anyvalue(i), attribute)() if value is not None: comment += str(value) i += 1 class RegExBuilder(RegExVisitor): class RegExBuilder(RegExVisitor): Loading Loading @@ -426,17 +409,8 @@ class RegExBuilder(RegExVisitor): # for future support of comments # for future support of comments def exitComment(self, ctx): def exitComment(self, ctx) -> None: comment = "" return None i = 0 while ctx.anyvalue(i) is not None: if ctx.anyvalue(i).ANYCHAR(): comment += str(ctx.anyvalue(i).ANYCHAR()) if ctx.anyvalue(i).STATE(): comment += str(ctx.anyvalue(i).STATE()) # add more of tokens (EQUALS, COMMA, ...) if needed # or change allowed tokens in grammar definition i += 1 class CFGBuilder(CFGListener): class CFGBuilder(CFGListener): anyvalue_attributes = anyvalue_attributes(CFGParser) anyvalue_attributes = anyvalue_attributes(CFGParser) Loading Loading @@ -518,14 +492,5 @@ class CFGBuilder(CFGListener): i += 1 i += 1 # for future support of comments # for future support of comments def exitComment(self, ctx): def exitComment(self, ctx) -> None: comment = "" return None i = 0 while ctx.anyvalue(i) is not None: if ctx.anyvalue(i).ANYCHAR(): comment += str(ctx.anyvalue(i).ANYCHAR()) if ctx.anyvalue(i).STATE(): comment += str(ctx.anyvalue(i).STATE()) # add more of tokens (EQUALS, COMMA, ...) if needed # or change allowed tokens in grammar definition i += 1 No newline at end of file Loading
lib/parsing/parser.py +8 −43 Original line number Original line Diff line number Diff line Loading @@ -255,16 +255,7 @@ class DFABuilder(DFAListener): # for future support of comments # for future support of comments def exitComment(self, ctx): def exitComment(self, ctx): comment = "" return None i = 0 while ctx.anyvalue(i) is not None: if ctx.anyvalue(i).ANYCHAR(): comment += str(ctx.anyvalue(i).ANYCHAR()) if ctx.anyvalue(i).STATE(): comment += str(ctx.anyvalue(i).STATE()) # add more of tokens (EQUALS, COMMA, ...) if needed # or change allowed tokens in grammar definition i += 1 class NFABuilder(NFAListener): class NFABuilder(NFAListener): Loading Loading @@ -326,7 +317,7 @@ class NFABuilder(NFAListener): if self.first_state is None: if self.first_state is None: self.first_state = state self.first_state = state def exitFinal(self, ctx): def exitFinal(self, ctx) -> None: i = 0 i = 0 while ctx.stateset().statename(i) is not None: while ctx.stateset().statename(i) is not None: state = State(self.visitStatename(ctx.stateset().statename(i))) state = State(self.visitStatename(ctx.stateset().statename(i))) Loading @@ -335,16 +326,8 @@ class NFABuilder(NFAListener): i += 1 i += 1 # for future support of comments # for future support of comments def exitComment(self, ctx): def exitComment(self, ctx) -> None: comment = "" return None i = 0 while ctx.anyvalue(i) is not None: while ctx.anyvalue(i) is not None: for attribute in self.anyvalue_attributes: value = getattr(ctx.anyvalue(i), attribute)() if value is not None: comment += str(value) i += 1 class RegExBuilder(RegExVisitor): class RegExBuilder(RegExVisitor): Loading Loading @@ -426,17 +409,8 @@ class RegExBuilder(RegExVisitor): # for future support of comments # for future support of comments def exitComment(self, ctx): def exitComment(self, ctx) -> None: comment = "" return None i = 0 while ctx.anyvalue(i) is not None: if ctx.anyvalue(i).ANYCHAR(): comment += str(ctx.anyvalue(i).ANYCHAR()) if ctx.anyvalue(i).STATE(): comment += str(ctx.anyvalue(i).STATE()) # add more of tokens (EQUALS, COMMA, ...) if needed # or change allowed tokens in grammar definition i += 1 class CFGBuilder(CFGListener): class CFGBuilder(CFGListener): anyvalue_attributes = anyvalue_attributes(CFGParser) anyvalue_attributes = anyvalue_attributes(CFGParser) Loading Loading @@ -518,14 +492,5 @@ class CFGBuilder(CFGListener): i += 1 i += 1 # for future support of comments # for future support of comments def exitComment(self, ctx): def exitComment(self, ctx) -> None: comment = "" return None i = 0 while ctx.anyvalue(i) is not None: if ctx.anyvalue(i).ANYCHAR(): comment += str(ctx.anyvalue(i).ANYCHAR()) if ctx.anyvalue(i).STATE(): comment += str(ctx.anyvalue(i).STATE()) # add more of tokens (EQUALS, COMMA, ...) if needed # or change allowed tokens in grammar definition i += 1 No newline at end of file