@@ -97,26 +97,21 @@ class State:
9797class CbmcCexTransformer (BaseTransformer ):
9898 def state (self , n ):
9999 header , lhs , rhs , * _ = n
100- state_id , file , function , line , _ = header .children
100+ state_id , file , function , line , * _ = header .children
101101 return State (state_id , file , function , line , lhs , rhs )
102102
103103
104104def translateCPROVER54 (cex , info ):
105105 with resources .path ("sliver.grammars" , "cbmc_cex.lark" ) as grammar_path :
106106 with open (grammar_path ) as grammar :
107- lark_parser = Lark (grammar ,
108- parser = 'lalr' ,
109- start = 'start54' ,
110- transformer = CbmcCexTransformer ())
107+ lark_parser = Lark (grammar , parser = 'lalr' , start = 'start54' )
111108 yield from translateCPROVER (cex , info , parser = lark_parser )
112109
113110
114111def translateCPROVERNEW (cex , info ):
115112 with resources .path ("sliver.grammars" , "cbmc_cex.lark" ) as grammar_path :
116113 with open (grammar_path ) as grammar :
117- lark_parser = Lark (grammar ,
118- parser = 'lalr' ,
119- transformer = CbmcCexTransformer ())
114+ lark_parser = Lark (grammar , parser = 'lalr' )
120115 yield from translateCPROVER (cex , info , parser = lark_parser )
121116
122117
@@ -147,7 +142,10 @@ def fmt(match, store_name, tid):
147142
148143 cex_start_pos = cex .find ("Counterexample:" ) + 15
149144 cex_end_pos = cex .rfind ("Violated property:" )
150- states = parser .parse (cex [cex_start_pos :cex_end_pos ]).children
145+ tree = parser .parse (cex [cex_start_pos :cex_end_pos ])
146+ transformer = CbmcCexTransformer ()
147+ tree = transformer .transform (tree )
148+ states = tree .children
151149
152150 inits = [
153151 (s .lhs , s .rhs ) for s in states
0 commit comments