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
0e80271b
Commit
0e80271b
authored
Jul 03, 2020
by
Kateřina Sloupová
Browse files
few states and nonterminals names fix
parent
736c5265
Pipeline
#62477
passed with stage
in 56 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
lib/grammars.py
View file @
0e80271b
...
...
@@ -97,7 +97,7 @@ class RegGrammar:
def
eliminate_useless
(
self
)
->
RegGrammar
:
grammar
=
deepcopy
(
self
)
helper
=
Nonterminal
(
"helper
_
nonterminal"
)
helper
=
Nonterminal
(
"
<
helpernonterminal
>
"
)
previous
:
Set
[
Nonterminal
]
=
set
()
actual
:
Set
[
Nonterminal
]
=
{
helper
}
while
previous
!=
actual
:
...
...
lib/reg.py
View file @
0e80271b
...
...
@@ -51,7 +51,7 @@ class NFA(NFA):
rules
[
nonterminal1
].
add
(
terminal
)
if
self
.
init
in
self
.
final
:
new_init
=
Nonterminal
(
"new
_
init"
)
new_init
=
Nonterminal
(
"
<
newinit
>
"
)
rules
[
new_init
]
=
{
Eps
()}
for
rule
in
rules
[
init
]:
rules
[
new_init
].
add
(
rule
)
...
...
lib/regex.py
View file @
0e80271b
...
...
@@ -86,8 +86,8 @@ class RegEx:
self
.
expression
=
expression
def
regex_to_efa
(
self
)
->
NFA
:
init
=
State
(
"init"
)
final
=
State
(
"final"
)
init
=
State
(
"init
_state
"
)
final
=
State
(
"final
_state
"
)
states
:
Set
[
State
]
=
{
init
,
final
}
transition
:
Dict
[
Tuple
[
State
,
AST
],
Set
[
State
]]
=
dict
()
transition
[
init
,
self
.
expression
]
=
{
final
}
...
...
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