Skip to content
Snippets Groups Projects
Commit 12d599ce authored by koizel's avatar koizel
Browse files

Merge branch 'hotfix-1.0.1'

parents 559126a5 25a7ae35
No related branches found
Tags 1.0.1
No related merge requests found
Pipeline #3398 passed with stage
in 27 minutes and 4 seconds
image: ocaml/opam2
stages:
- test
test:
stage: test
cache:
key: "$CI_COMMIT_REF_SLUG"
paths:
- _opam
script:
- sudo apt install -y m4
- opam repository set-url default https://opam.ocaml.org
- opam update
- opam switch $OCAML_VERSION
- opam install --deps-only -t -y .
- eval $(opam env)
- dune runtest
parallel:
matrix:
- OCAML_VERSION: ["4.02", "4.04", "4.06", "4.07", "4.08", "4.09", "4.10"]
......@@ -3,6 +3,13 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
## [Unreleased]
## [1.0.1] -- 2021-01-16
### Fixed
- Correct OCaml dependency
- Tests comply with OCaml 4.02
### Added
- Gitlab continuous integration
## [1.0] -- 2021-01-14
### Changed
- API: parser uses a data structure passed as argument
......
opam-version: "2.0"
version: "1.0"
version: "1.0.1"
synopsis:
"An implementation of the Pratt parsing algorithm for first order terms"
description: """
......@@ -13,7 +13,7 @@ license: "BSD-3-Clause"
homepage: "https://github.com/gabrielhdt/pratter"
bug-reports: "https://github.com/gabrielhdt/pratter/issues"
depends: [
"ocaml" {>= "4.0.5"}
"ocaml" {>= "4.02"}
"dune" {>= "2.7"}
"alcotest" {with-test}
"odoc" {with-doc}
......
......@@ -21,10 +21,18 @@ struct
type nonrec table = table
let get_unary { unary; _ } t =
match t with Symb id -> StrMap.find_opt id unary | _ -> None
match t with
| Symb id -> (
try Some (StrMap.find id unary)
with Not_found -> None )
| _ -> None
let get_binary { binary; _ } t =
match t with Symb id -> StrMap.find_opt id binary | _ -> None
match t with
| Symb id -> (
try Some (StrMap.find id binary)
with Not_found -> None )
| _ -> None
let make_appl _ t u = Appl (t, u)
end
......@@ -46,7 +54,7 @@ module TTerm : Alcotest.TESTABLE with type t = term = struct
(** Syntactic equality *)
let rec equal t u =
match (t, u) with
| Symb t, Symb u -> String.equal t u
| Symb t, Symb u -> t = u
| Appl (t, t'), Appl (u, u') -> equal t u && equal t' u'
| _ -> false
......@@ -69,8 +77,7 @@ let simple_binary () =
let two_operators () =
let tbl =
[ ("+", (1.0, Pratter.Left)); ("*", (1.1, Pratter.Left)) ]
|> List.to_seq |> StrMap.of_seq
StrMap.(empty |> add "+" (1.0, Pratter.Left) |> add "*" (1.1, Pratter.Left))
in
let tbl = { empty with binary = tbl } in
let x = symb "x" in
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment