From 069554cfb2f330f416f53affbec9a8c043fd308c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Chocholat=C3=BD?= Date: Tue, 26 Sep 2023 07:27:42 +0200 Subject: [PATCH] Revert "Rewrite opening files to fix compilation errors" This reverts commit 7f18ccaf96a1885f1a84e67efe0ca05f128c3586. --- bindings/python/libmata/parser.pxd | 1 - bindings/python/libmata/parser.pyx | 6 +++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/bindings/python/libmata/parser.pxd b/bindings/python/libmata/parser.pxd index 73ed3d5fe..826d9ea0b 100644 --- a/bindings/python/libmata/parser.pxd +++ b/bindings/python/libmata/parser.pxd @@ -13,7 +13,6 @@ cdef extern from "" 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 + diff --git a/bindings/python/libmata/parser.pyx b/bindings/python/libmata/parser.pyx index 5948bce07..625b7e8f4 100644 --- a/bindings/python/libmata/parser.pyx +++ b/bindings/python/libmata/parser.pyx @@ -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(): @@ -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: