summaryrefslogtreecommitdiff
path: root/python/src/grammar.pxi
diff options
context:
space:
mode:
authorVictor Chahuneau <vchahune@cs.cmu.edu>2012-08-11 23:30:00 -0400
committerVictor Chahuneau <vchahune@cs.cmu.edu>2012-08-11 23:30:00 -0400
commitccdb3061d1e582a5abd412b37ee0da2278f45706 (patch)
tree9952c909e8bccf4f4ed105c1a135e431f7edd05e /python/src/grammar.pxi
parent7f688a6a4ef605dea284b096889f1735406123b6 (diff)
[python] fix for new dict API
- TDConvert returns a string - various c_str fixes (make copies) - cleanup .gitignore
Diffstat (limited to 'python/src/grammar.pxi')
-rw-r--r--python/src/grammar.pxi12
1 files changed, 6 insertions, 6 deletions
diff --git a/python/src/grammar.pxi b/python/src/grammar.pxi
index a9a5ea14..05351290 100644
--- a/python/src/grammar.pxi
+++ b/python/src/grammar.pxi
@@ -8,7 +8,7 @@ def _phrase(phrase):
cdef class NT:
cdef public bytes cat
cdef public unsigned ref
- def __init__(self, char* cat, unsigned ref=0):
+ def __init__(self, bytes cat, unsigned ref=0):
self.cat = cat
self.ref = ref
@@ -78,9 +78,9 @@ cdef class TRule:
w = f_[0][i]
if w < 0:
idx += 1
- f.append(NT(TDConvert(-w), idx))
+ f.append(NT(TDConvert(-w).c_str(), idx))
else:
- f.append(unicode(TDConvert(w), encoding='utf8'))
+ f.append(unicode(TDConvert(w).c_str(), encoding='utf8'))
return f
def __set__(self, f):
@@ -107,7 +107,7 @@ cdef class TRule:
idx += 1
e.append(NTRef(1-w))
else:
- e.append(unicode(TDConvert(w), encoding='utf8'))
+ e.append(unicode(TDConvert(w).c_str(), encoding='utf8'))
return e
def __set__(self, e):
@@ -154,7 +154,7 @@ cdef class TRule:
property lhs:
def __get__(self):
- return NT(TDConvert(-self.rule.get().lhs_))
+ return NT(TDConvert(-self.rule.get().lhs_).c_str())
def __set__(self, lhs):
if not isinstance(lhs, NT):
@@ -196,7 +196,7 @@ cdef class Grammar:
property name:
def __get__(self):
- self.grammar.get().GetGrammarName().c_str()
+ str(self.grammar.get().GetGrammarName().c_str())
def __set__(self, name):
self.grammar.get().SetGrammarName(string(<char *>name))