Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
fja
eval
Commits
5f134463
Commit
5f134463
authored
Feb 24, 2021
by
Vladimír Štill
Browse files
lib: Drop the bogus (and sometimes cycling) comment collection
parent
8c8da2fb
Changes
1
Hide whitespace changes
Inline
Side-by-side
lib/parsing/parser.py
View file @
5f134463
...
...
@@ -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
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment