Skip to content

Commit 08696c9

Browse files
committed
Fix
1 parent d11d863 commit 08696c9

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

pyformlang/cfg/cfg.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1081,14 +1081,13 @@ def _read_line(cls, line, productions, terminals, variables):
10811081
body_component = body_component[5:-1]
10821082
else:
10831083
type_component = ""
1084-
if not body_component[0].isupper() or type_component == "TER":
1084+
if type_component != "VAR" and (not body_component[0].isupper() or type_component == "TER" or body_component in EPSILON_SYMBOLS):
10851085
if body_component in EPSILON_SYMBOLS:
1086-
body_ter = Epsilon()
1087-
else:
1088-
body_ter = Terminal(body_component)
1086+
continue
1087+
body_ter = Terminal(body_component)
10891088
terminals.add(body_ter)
10901089
body.append(body_ter)
1091-
elif body_component[0].isupper() or type_component == "VAR":
1090+
elif type_component != "TER" and (body_component[0].isupper() or type_component == "VAR"):
10921091
body_var = Variable(body_component)
10931092
variables.add(body_var)
10941093
body.append(body_var)

0 commit comments

Comments
 (0)