diff options
Diffstat (limited to 'prolog/parser.py')
-rw-r--r-- | prolog/parser.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/prolog/parser.py b/prolog/parser.py index 5b5c325..c9f4d86 100644 --- a/prolog/parser.py +++ b/prolog/parser.py @@ -14,7 +14,7 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. -from nltk import ParentedTree as Tree +from nltk import Tree import ply.yacc as yacc from .lexer import operators, tokens from .util import Token @@ -165,10 +165,10 @@ def p_list_empty(p): p[0] = Tree('list', [make_token(p, 1), make_token(p, 2)]) def p_list(p): 'list : LBRACKET args RBRACKET' - p[0] = Tree('list', [make_token(p, 1)] + p[2] + [make_token(p, 3)]) + p[0] = Tree('list', [make_token(p, 1)] + list(p[2]) + [make_token(p, 3)]) def p_list_tail(p): 'list : LBRACKET args PIPE term RBRACKET' - p[0] = Tree('list', [make_token(p, 1)] + p[2] + [make_token(p, 3), p[4], make_token(p, 5)]) + p[0] = Tree('list', [make_token(p, 1)] + list(p[2]) + [make_token(p, 3), p[4], make_token(p, 5)]) def p_functor(p): 'functor : NAME' |