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