Skip to content

Commit

Permalink
use sedlex for utf-8 aware lexing (closes #5163) (#6172)
Browse files Browse the repository at this point in the history
* use sedlex for utf-8 aware lexing (closes #5163)

* use opam on travis/linux
  • Loading branch information
nadako authored and Simn committed May 1, 2017
1 parent 61bccc6 commit 2f53fe4
Show file tree
Hide file tree
Showing 9 changed files with 467 additions and 449 deletions.
3 changes: 2 additions & 1 deletion .merlin
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ S src/**
B _build/src/**
S libs/**
B libs/**
B +threads
B +threads
PKG sedlex
7 changes: 5 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ install_linux: &install_linux
ocaml-native-compilers
ocaml-findlib
camlp4
- wget https://raw.github.com/ocaml/opam/master/shell/opam_installer.sh -O - | sh -s /usr/local/bin system
- export OPAMYES=1
- opam install sedlex
# Setup database
- travis_retry sudo apt-get install mysql-server-5.6 -y
- mysql -u root -e "create user travis@localhost identified by '';"
Expand All @@ -43,7 +46,7 @@ install_linux: &install_linux
- java -version
# Build haxe
- make package_src -s
- make -s
- opam config exec -- make -s
- make package_bin -s
- ls -l out
- export PATH="$PATH:$TRAVIS_BUILD_DIR"
Expand All @@ -56,7 +59,7 @@ install_osx: &install_osx
- travis_retry brew install opam;
- export OPAMYES=1
- opam init
- opam install camlp4 ocamlfind
- opam install camlp4 sedlex ocamlfind
- eval `opam config env`
# Install neko
- travis_retry brew install neko --HEAD;
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# - use 'make -f Makefile.win' to build for Windows
# - use 'make MSVC=1 -f Makefile.win' to build for Windows with OCaml/MSVC
#
.SUFFIXES : .ml .mli .cmo .cmi .cmx .mll .mly
.SUFFIXES : .ml .mli .cmo .cmi .cmx .mly

INSTALL_DIR=$(DESTDIR)/usr
INSTALL_BIN_DIR=$(INSTALL_DIR)/bin
Expand All @@ -29,7 +29,7 @@ STATICLINK?=0

HAXE_DIRECTORIES=compiler context generators generators/gencommon macro filters optimization syntax typing display
EXTLIB_LIBS=extlib extc neko javalib ziplib swflib xml-light ttflib ilib objsize pcre
FINDLIB_LIBS=unix str threads
FINDLIB_LIBS=unix str threads sedlex

# Includes, packages and compiler

Expand Down
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ install:
- 7z x "opam32.tar.xz" -so | 7z x -aoa -si -ttar
- '%CYG_ROOT%/bin/bash -lc "cd \"$OLDPWD\" && bash opam32/install.sh"'
- '%CYG_ROOT%/bin/bash -lc "opam init mingw \"https://github.com/fdopen/opam-repository-mingw.git\" --comp 4.02.3+mingw32c --switch 4.02.3+mingw32c --auto-setup --yes"'
- '%CYG_ROOT%/bin/bash -lc "opam install camlp4 ocamlfind --yes"'
- '%CYG_ROOT%/bin/bash -lc "opam install camlp4 sedlex ocamlfind --yes"'
# Install neko
- choco install neko --prerelease --ignore-dependencies -s 'https://ci.appveyor.com/nuget/neko' -y
- choco install chocolatey-core.extension php --ignore-dependencies -y
Expand Down
4 changes: 0 additions & 4 deletions compile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@ if [ ! -f "_build/src/syntax/parser.ml" -o "src/syntax/parser.mly" -nt "_build/s
camlp4o -impl src/syntax/parser.mly -o _build/src/syntax/parser.ml
fi

if [ ! -f "_build/src/syntax/lexer.ml" -o "src/syntax/lexer.mll" -nt "_build/src/syntax/lexer.ml" ]; then
ocamllex -o _build/src/syntax/lexer.ml src/syntax/lexer.mll
fi

if [ "$1" -eq "0" -a ! -f "_build/src/compiler/version.ml" ]; then
echo let version_extra = None > _build/src/compiler/version.ml
fi
Loading

6 comments on commit 2f53fe4

@mockey
Copy link
Contributor

@mockey mockey commented on 2f53fe4 May 2, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nadako How do I get this to compile under Linux? I get the error:
ocamlfind: Package 'sedlex' not found

@Simn
Copy link
Member

@Simn Simn commented on 2f53fe4 May 2, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

opam install sedlex

@mockey
Copy link
Contributor

@mockey mockey commented on 2f53fe4 May 2, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, so opam is needed now for handling the ocaml deps?

@Simn
Copy link
Member

@Simn Simn commented on 2f53fe4 May 2, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe not strictly needed, but I don't know how else to manage OCaml libraries.

@mockey
Copy link
Contributor

@mockey mockey commented on 2f53fe4 May 2, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, I had some problems before to find a working ocamlfind for Ubuntu 14.04. Might be better to completely switch to opam. Do you use it for installing OCaml as well?

@Simn
Copy link
Member

@Simn Simn commented on 2f53fe4 May 2, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, opam manages OCaml versions too and allows to switch between them easily.

Please sign in to comment.