From d7154a52f9e1a680729da8b9a29e120e8db89e92 Mon Sep 17 00:00:00 2001 From: odanoburu Date: Mon, 9 Apr 2018 12:14:02 -0300 Subject: [PATCH 1/4] - rm trailing spaces --- src/runtime/haskell-bind/pgf2.cabal | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/runtime/haskell-bind/pgf2.cabal b/src/runtime/haskell-bind/pgf2.cabal index 312d851be..bb48448f6 100644 --- a/src/runtime/haskell-bind/pgf2.cabal +++ b/src/runtime/haskell-bind/pgf2.cabal @@ -1,13 +1,13 @@ name: pgf2 version: 0.1.0.0 --- synopsis: --- description: +-- synopsis: +-- description: homepage: http://www.grammaticalframework.org license: LGPL-3 --license-file: LICENSE author: Krasimir Angelov, Inari -maintainer: --- copyright: +maintainer: +-- copyright: category: Language build-type: Simple extra-source-files: README @@ -20,7 +20,7 @@ library other-modules: PGF2.FFI, PGF2.Expr, PGF2.Type, SG.FFI build-depends: base >=4.3, containers, pretty - -- hs-source-dirs: + -- hs-source-dirs: default-language: Haskell2010 build-tools: hsc2hs From 2c163bb24324526b3044334b2056717e75360ee7 Mon Sep 17 00:00:00 2001 From: odanoburu Date: Mon, 9 Apr 2018 12:14:32 -0300 Subject: [PATCH 2/4] - rm duplicate lines --- src/runtime/haskell-bind/pgf2.cabal | 1 - 1 file changed, 1 deletion(-) diff --git a/src/runtime/haskell-bind/pgf2.cabal b/src/runtime/haskell-bind/pgf2.cabal index bb48448f6..178f15023 100644 --- a/src/runtime/haskell-bind/pgf2.cabal +++ b/src/runtime/haskell-bind/pgf2.cabal @@ -26,7 +26,6 @@ library extra-libraries: sg pgf gu cc-options: -std=c99 - default-language: Haskell2010 c-sources: utils.c executable pgf-shell From 2d898e78c0f8bc097db675392f829f53ed62347b Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Thu, 12 Apr 2018 14:45:02 +0200 Subject: [PATCH 3/4] bugfix in the C parser --- src/runtime/c/pgf/parser.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/runtime/c/pgf/parser.c b/src/runtime/c/pgf/parser.c index 2650e2618..d12852a71 100644 --- a/src/runtime/c/pgf/parser.c +++ b/src/runtime/c/pgf/parser.c @@ -1236,6 +1236,7 @@ pgf_new_parse_state(PgfParsing* ps, size_t start_offset, PgfLexiconIdxEntry* entry = gu_buf_extend(state->lexicon_idx); entry->idx = seq->idx; entry->offset = state->start_offset; + entry->sym_idx= 0; } // Add non-epsilon lexical rules to the bottom up index From 2036ffe06db7df5fb39543a25396a04384d8aba3 Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Thu, 12 Apr 2018 15:12:36 +0200 Subject: [PATCH 4/4] bugfix in the Haskell binding --- src/runtime/haskell-bind/PGF2.hsc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/runtime/haskell-bind/PGF2.hsc b/src/runtime/haskell-bind/PGF2.hsc index 409283981..fb3672c0f 100644 --- a/src/runtime/haskell-bind/PGF2.hsc +++ b/src/runtime/haskell-bind/PGF2.hsc @@ -542,7 +542,7 @@ parseWithHeuristics :: Concr -- ^ the language with which we parse -- If a literal has been recognized then the output should -- be Just (expr,probability,end_offset) -> ParseOutput -parseWithHeuristics lang (Type ctype _) sent heuristic callbacks = +parseWithHeuristics lang (Type ctype touchType) sent heuristic callbacks = unsafePerformIO $ do exprPl <- gu_new_pool parsePl <- gu_new_pool @@ -550,6 +550,7 @@ parseWithHeuristics lang (Type ctype _) sent heuristic callbacks = sent <- newUtf8CString sent parsePl callbacks_map <- mkCallbacksMap (concr lang) callbacks parsePl enum <- pgf_parse_with_heuristics (concr lang) ctype sent heuristic callbacks_map exn parsePl exprPl + touchType failed <- gu_exn_is_raised exn if failed then do is_parse_error <- gu_exn_caught exn gu_exn_type_PgfParseError