This is an automated email from the git hooks/post-receive script. glondu pushed a commit to branch master in repository cppo.
commit d41800aa6ca1a3d35823b70c7b543c4cb7821e74 Author: Stephane Glondu <st...@glondu.net> Date: Thu Sep 3 14:21:45 2015 +0200 Imported Upstream version 1.0.1 --- .gitignore | 1 + Makefile | 5 ++-- cppo_parser.mly | 17 +++---------- ocamlbuild_plugin/ocamlbuild_cppo.ml | 2 +- test.cppo | 1 - test/Makefile | 11 +++++++-- test/cond.cppo | 47 ++++++++++++++++++++++++++++++++++++ 7 files changed, 65 insertions(+), 19 deletions(-) diff --git a/.gitignore b/.gitignore index 160ccab..0baddb0 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,7 @@ *.o *.a *.annot +*.automaton cppo_lexer.ml cppo_parser.mli cppo_parser.ml diff --git a/Makefile b/Makefile index 5c920a0..7e4e009 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -VERSION = 1.0.0 +VERSION = 1.0.1 ifeq "$(shell ocamlc -config |grep os_type)" "os_type: Win32" EXE=.exe @@ -98,5 +98,6 @@ clean: rm -f *.cm[iox] *.o *.annot *.conflicts *.automaton \ cppo \ cppo_parser.mli cppo_parser.ml cppo_lexer.ml cppo_version.ml - cd examples; $(MAKE) clean + $(MAKE) -C examples clean + $(MAKE) -C test clean cd ocamlbuild_plugin; ocamlbuild -clean diff --git a/cppo_parser.mly b/cppo_parser.mly index 6cbe59e..b28bd9a 100644 --- a/cppo_parser.mly +++ b/cppo_parser.mly @@ -1,4 +1,3 @@ -/* $Id$ */ %{ open Printf open Cppo_types @@ -168,18 +167,6 @@ node: | IFDEF full_node_list0 elif_list error { error (fst $1) "missing #endif" } -| IF test full_node_list0 ELSE full_node_list0 ENDIF - { `Cond ((fst $1, snd $6), $2, $3, $5) } - -| IF test full_node_list0 ELSE full_node_list0 error - { error $1 "missing #endif" } - -| IFDEF full_node_list0 ELSE full_node_list0 ENDIF - { `Cond ((fst (fst $1), snd $5), (snd $1), $2, $4) } - -| IFDEF full_node_list0 ELSE full_node_list0 error - { error (fst $1) "missing #endif" } - | LINE { `Line $1 } ; @@ -189,6 +176,10 @@ elif_list: { let pos1, _ = $1 in let pos2 = Parsing.rhs_end_pos 4 in ((pos1, pos2), $2, $3) :: $4 } +| ELSE full_node_list0 + { let pos1, _ = $1 in + let pos2 = Parsing.rhs_end_pos 2 in + [ ((pos1, pos2), `True, $2) ] } | { [] } ; diff --git a/ocamlbuild_plugin/ocamlbuild_cppo.ml b/ocamlbuild_plugin/ocamlbuild_cppo.ml index 42cf246..61ff6dc 100644 --- a/ocamlbuild_plugin/ocamlbuild_cppo.ml +++ b/ocamlbuild_plugin/ocamlbuild_cppo.ml @@ -24,7 +24,7 @@ let dispatcher = function if Pathname.is_directory s then [] else [s]) ; flag ["cppo"; "cppo_q"] (A "-q") ; flag ["cppo"; "cppo_s"] (A "-s") ; - flag ["cppo"; "cppo_s"] (A "-n") ; + flag ["cppo"; "cppo_n"] (A "-n") ; pflag ["cppo"] "cppo_x" (fun s -> S [A "-x"; A s]) end | _ -> () diff --git a/test.cppo b/test.cppo index 551c749..39a08ba 100644 --- a/test.cppo +++ b/test.cppo @@ -13,7 +13,6 @@ f(3) "g" is not defined #endif - #define a(x) b() #define b(x) a() a() diff --git a/test/Makefile b/test/Makefile index 5c37a29..8e2048f 100644 --- a/test/Makefile +++ b/test/Makefile @@ -1,6 +1,7 @@ -.PHONY: all ext comments +TESTS = ext comments cond +.PHONY: all clean $(TESTS) -all: ext comments +all: $(TESTS) ext: ../cppo -x rot13:"tr '[a-z]' '[n-za-m]'" \ @@ -11,3 +12,9 @@ ext: comments: ../cppo comments.cppo > comments.out diff -u comments.ref comments.out + +cond: + ../cppo cond.cppo > cond.out + +clean: + rm -f *~ *.out diff --git a/test/cond.cppo b/test/cond.cppo new file mode 100644 index 0000000..b5f0c49 --- /dev/null +++ b/test/cond.cppo @@ -0,0 +1,47 @@ +#if 1 = 1 +#else +#error "ignored #else (?)" +#endif + +#if true + banana +#elif false + apple + #error "ignored #elif (?)" +#endif + +#if false + earthworm + #error "" +#elif true + apricot +#endif + +#if false + cuckoo + #error "" +#else + #if false + egg + #error "" + #else + nest + #endif +#endif + +#define X 3 + +#if false + helicopter + #error "" +#elif false + ocean + #error "" +#else + #if X = 12 + sand + #error "" + #elif 4 * X = 12 + sea urchin + #endif +#endif -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ocaml-maint/packages/cppo.git _______________________________________________ Pkg-ocaml-maint-commits mailing list Pkg-ocaml-maint-commits@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-ocaml-maint-commits