Skip to content

Commit

Permalink
Merge pull request #336 from VeriFIT/rewrite_opening_files
Browse files Browse the repository at this point in the history
Rewrite opening files to fix compilation errors #patch
  • Loading branch information
Adda0 authored Sep 20, 2023
2 parents 7a521f2 + 7f18cca commit 2b84311
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions bindings/python/libmata/parser.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ 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 = parser.ifstream(src.encode('utf-8'))
fs.open(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 = parser.ifstream(file.encode('utf-8'))
fs.open(file.encode('utf-8'))
res_inter_aut = parser.parse_from_mf(parser.parse_mf(fs, True))
inter_aut.emplace_back(res_inter_aut[0])
inter_aut.push_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 2b84311

Please sign in to comment.