Skip to content

Commit

Permalink
Merge pull request #345 from VeriFIT/revert_opening_files
Browse files Browse the repository at this point in the history
Revert "Rewrite opening files to fix compilation errors" #patch
  • Loading branch information
Adda0 authored Sep 26, 2023
2 parents 40ca1cd + 069554c commit f58941a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
1 change: 0 additions & 1 deletion bindings/python/libmata/parser.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ cdef extern from "<fstream>" namespace "std":
cdef cppclass ifstream(istream):
ifstream() except+
ifstream(const char*) except +
void open(const char*)

cdef extern from "mata/parser/re2parser.hh" namespace "mata::parser":
cdef void create_nfa(CNfa*, string) except +
Expand Down
6 changes: 3 additions & 3 deletions bindings/python/libmata/parser.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def from_mata(src, alph.Alphabet alphabet):

# either load single automata
if isinstance(src, str):
fs.open(src.encode('utf-8'))
fs = parser.ifstream(src.encode('utf-8'))
res_inter_aut = parser.parse_from_mf(parser.parse_mf(fs, True))
result = mata_nfa.Nfa()
if res_inter_aut[0].is_bitvector():
Expand All @@ -64,9 +64,9 @@ def from_mata(src, alph.Alphabet alphabet):
else:
automata = []
for file in src:
fs.open(file.encode('utf-8'))
fs = parser.ifstream(file.encode('utf-8'))
res_inter_aut = parser.parse_from_mf(parser.parse_mf(fs, True))
inter_aut.push_back(res_inter_aut[0])
inter_aut.emplace_back(res_inter_aut[0])
if inter_aut[0].is_bitvector():
mintermized_inter_aut = mintermization.c_mintermize_vec(inter_aut)
else:
Expand Down

0 comments on commit f58941a

Please sign in to comment.