Commit 5f134463 authored by Vladimír Štill's avatar Vladimír Štill
Browse files

lib: Drop the bogus (and sometimes cycling) comment collection

parent 8c8da2fb
......@@ -255,16 +255,7 @@ class DFABuilder(DFAListener):
# for future support of comments
def exitComment(self, ctx):
comment = ""
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
return None
class NFABuilder(NFAListener):
......@@ -326,7 +317,7 @@ class NFABuilder(NFAListener):
if self.first_state is None:
self.first_state = state
def exitFinal(self, ctx):
def exitFinal(self, ctx) -> None:
i = 0
while ctx.stateset().statename(i) is not None:
state = State(self.visitStatename(ctx.stateset().statename(i)))
......@@ -335,16 +326,8 @@ class NFABuilder(NFAListener):
i += 1
# for future support of comments
def exitComment(self, ctx):
comment = ""
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
def exitComment(self, ctx) -> None:
return None
class RegExBuilder(RegExVisitor):
......@@ -426,17 +409,8 @@ class RegExBuilder(RegExVisitor):
# for future support of comments
def exitComment(self, ctx):
comment = ""
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
def exitComment(self, ctx) -> None:
return None
class CFGBuilder(CFGListener):
anyvalue_attributes = anyvalue_attributes(CFGParser)
......@@ -518,14 +492,5 @@ class CFGBuilder(CFGListener):
i += 1
# for future support of comments
def exitComment(self, ctx):
comment = ""
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
def exitComment(self, ctx) -> None:
return None
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment