summaryrefslogtreecommitdiff
path: root/src/runtime/python
diff options
context:
space:
mode:
authorkr.angelov <kr.angelov@gmail.com>2013-08-19 15:34:19 +0000
committerkr.angelov <kr.angelov@gmail.com>2013-08-19 15:34:19 +0000
commitd1368c35198630ee9ae16f31f735512a4a30703b (patch)
treedcdfdd105cb7502093a85b75276708734ab0a18b /src/runtime/python
parent2aa14bfef8a69145deaef28be7458cf8a3d73dbd (diff)
word completion in the C runtime now returns multi-word expressions and the category for every expression
Diffstat (limited to 'src/runtime/python')
-rw-r--r--src/runtime/python/pypgf.c7
-rw-r--r--src/runtime/python/test.py4
2 files changed, 6 insertions, 5 deletions
diff --git a/src/runtime/python/pypgf.c b/src/runtime/python/pypgf.c
index eb6725050..5adf91c10 100644
--- a/src/runtime/python/pypgf.c
+++ b/src/runtime/python/pypgf.c
@@ -920,9 +920,10 @@ Iter_fetch_token(IterObject* self)
if (tp == NULL)
return NULL;
- PyObject* ty_tok = gu2py_string(tp->tok);
- PyObject* res = Py_BuildValue("(f,O)", tp->prob, ty_tok);
- Py_DECREF(ty_tok);
+ PyObject* py_tok = gu2py_string(tp->tok);
+ PyObject* py_cat = gu2py_string(tp->cat);
+ PyObject* res = Py_BuildValue("(f,O,O)", tp->prob, py_tok, py_cat);
+ Py_DECREF(py_tok);
return res;
}
diff --git a/src/runtime/python/test.py b/src/runtime/python/test.py
index 93a3c4a2d..3425a4b42 100644
--- a/src/runtime/python/test.py
+++ b/src/runtime/python/test.py
@@ -24,7 +24,7 @@ class Completer():
if state == 0:
line = readline.get_line_buffer()
line = line[0:readline.get_begidx()]
- self.i = source_lang.getCompletions(line, prefix=prefix)
+ self.i = source_lang.complete(line, prefix=prefix)
self.tokens = sets.Set()
if len(self.tokens) > 50:
@@ -32,7 +32,7 @@ class Completer():
while True:
try:
- (p,t) = self.i.next()
+ (p,t,c) = self.i.next()
if t not in self.tokens:
self.tokens.add(t)
return t