[Pkg-ocaml-maint-commits] [cppo] 01/09: Imported Upstream version 1.0.0

Stéphane Glondu glondu at moszumanska.debian.org
Thu Sep 3 12:38:58 UTC 2015


This is an automated email from the git hooks/post-receive script.

glondu pushed a commit to branch master
in repository cppo.

commit 887514d836b223f6d7086c7c17ffb7fcb2210223
Author: Stephane Glondu <steph at glondu.net>
Date:   Thu Sep 3 14:21:29 2015 +0200

    Imported Upstream version 1.0.0
---
 .gitignore                    |  17 ++++++
 Makefile                      |   4 +-
 README.md                     |  20 +++----
 cppo_command.ml               |   2 -
 cppo_eval.ml                  |  54 +++++++++---------
 cppo_lexer.mll                | 130 ++++++++++++++++++++----------------------
 cppo_main.ml                  |  20 +++----
 cppo_parser.mly               |   2 +-
 cppo_types.ml                 |   6 +-
 examples/french.ml            |   2 +-
 examples/lexer.mll            |   2 +-
 test/Makefile                 |  13 +++++
 test/comments.cppo            |   7 +++
 test/comments.ref             |   8 +++
 {testdata => test}/ext.cppo   |   0
 {testdata => test}/ext.ref    |   0
 {testdata => test}/incl.cppo  |   0
 {testdata => test}/incl2.cppo |   0
 {testdata => test}/source.sh  |   0
 testdata/Makefile             |   7 ---
 20 files changed, 160 insertions(+), 134 deletions(-)

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..160ccab
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,17 @@
+*~
+*.out
+*.cmi
+*.cmo
+*.cmx
+*.cmxs
+*.cma
+*.cmxa
+*.o
+*.a
+*.annot
+cppo_lexer.ml
+cppo_parser.mli
+cppo_parser.ml
+cppo_version.ml
+cppo
+_build
diff --git a/Makefile b/Makefile
index 7f9177e..5c920a0 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-VERSION = 0.9.4
+VERSION = 1.0.0
 
 ifeq "$(shell ocamlc -config |grep os_type)" "os_type: Win32"
 EXE=.exe
@@ -92,7 +92,7 @@ cppo_parser.mli cppo_parser.ml: cppo_parser.mly cppo_types.ml
 endif
 
 test:
-	cd testdata; $(MAKE)
+	$(MAKE) -C test
 
 clean:
 	rm -f *.cm[iox] *.o *.annot *.conflicts *.automaton \
diff --git a/README.md b/README.md
index c1a762e..dbfd034 100644
--- a/README.md
+++ b/README.md
@@ -61,7 +61,7 @@ match state with
   | _ -> false
 ```
 
-After preprocessing by cppo, the code above becomes: 
+After preprocessing by cppo, the code above becomes:
 
 ```ocaml
 match state with
@@ -188,7 +188,7 @@ Arithmetic operators over signed 64-bit ints:
 * ... `land` ...
 * ... `lor` ...
 * ... `lxor` ...
-* `lnot` ... 
+* `lnot` ...
 
 Macro identifiers can be used in place of ints as long as they expand
 to an int literal, e.g.:
@@ -266,7 +266,7 @@ input from stdin and writes its output to stdout.
 Escaping
 --------
 
-The following characters can be escaped by a backslash when needed: 
+The following characters can be escaped by a backslash when needed:
 
 ```ocaml
 (
@@ -407,16 +407,16 @@ Options:
           Add directory DIR to the search path for included files
   -o FILE
           Output file
-  -q 
+  -q
           Identify and preserve camlp4 quotations
-  -s 
-          Output line directives pointing to the exact source location of 
-          each token, including those coming from the body of macro 
+  -s
+          Output line directives pointing to the exact source location of
+          each token, including those coming from the body of macro
           definitions.  This behavior is off by default.
-  -n 
-          Do not output any line directive other than those found in the 
+  -n
+          Do not output any line directive other than those found in the
           input (overrides -s).
-  -version 
+  -version
           Print the version of the program and exit.
   -x NAME:CMD_TEMPLATE
           Define a custom preprocessor target section starting with:
diff --git a/cppo_command.ml b/cppo_command.ml
index b92f235..5c61028 100644
--- a/cppo_command.ml
+++ b/cppo_command.ml
@@ -1,5 +1,3 @@
-(* $Id$ *)
-
 open Printf
 
 type command_token =
diff --git a/cppo_eval.ml b/cppo_eval.ml
index 94299b1..eebb8e7 100644
--- a/cppo_eval.ml
+++ b/cppo_eval.ml
@@ -1,5 +1,3 @@
-(* $Id$ *)
-
 open Printf
 
 open Cppo_types
@@ -48,17 +46,17 @@ let line_directive buf prev_file pos =
 	   pos.Lexing.pos_fname
   );
   bprintf buf "%s" (String.make (pos.Lexing.pos_cnum - pos.Lexing.pos_bol) ' ')
-    
+
 let rec add_sep sep last = function
     [] -> [ last ]
   | [x] -> [ x; last ]
-  | x :: l -> x :: sep :: add_sep sep last l 
+  | x :: l -> x :: sep :: add_sep sep last l
 
 
 let trim s =
   let len = String.length s in
   let is_space = function ' ' | '\t' | '\n' | '\r' -> true | _ -> false in
-  let first = 
+  let first =
     let x = ref len in
     (try
        for i = 0 to len - 1 do
@@ -107,7 +105,7 @@ let trim_and_compact buf s =
       | c ->
           if !need_space then
             Buffer.add_char buf ' ';
-          (match c with 
+          (match c with
                '\"' -> Buffer.add_string buf "\\\""
              | '\\' -> Buffer.add_string buf "\\\\"
              | c -> Buffer.add_char buf c);
@@ -128,7 +126,7 @@ let trim_and_compact_string s =
 let is_ident s =
   let len = String.length s in
   len > 0
-  && 
+  &&
     (match s.[0] with
          'A'..'Z' | 'a'..'z' -> true
        | '_' when len > 1 -> true
@@ -162,14 +160,14 @@ let rec eval_int env (x : arith_expr) : int64 =
 	  try
 	    match M.find name env with
 		`Def (_, _, l, _) -> l
-	      | `Defun _ -> 
+	      | `Defun _ ->
 		  error loc (sprintf "%S expects arguments" name)
 	      | `Special -> assert false
 	  with Not_found -> error loc (sprintf "Undefined identifier %S" name)
 	in
 	(try
 	   match remove_space l with
-	       [ `Ident (loc, name, None) ] -> 
+	       [ `Ident (loc, name, None) ] ->
 		 eval_int env (`Ident (loc, name))
 	     | _ ->
 		 let text =
@@ -185,8 +183,8 @@ let rec eval_int env (x : arith_expr) : int64 =
 		 in
 		 let s = String.concat "" text in
 		 (match int_of_string_with_space s with
-		      None -> 
-			error loc 
+		      None ->
+			error loc
 			  (sprintf
 			     "Identifier %S is not bound to an int literal"
 			     name)
@@ -206,7 +204,7 @@ let rec eval_int env (x : arith_expr) : int64 =
 	 with Division_by_zero ->
 	   error loc "Division by zero")
 
-    | `Mod (loc, a, b) -> 
+    | `Mod (loc, a, b) ->
 	(try Int64.rem (eval_int env a) (eval_int env b)
 	 with Division_by_zero ->
 	   error loc "Division by zero")
@@ -260,7 +258,7 @@ let rec eval_bool env (x : bool_expr) =
     | `Lt (a, b) -> eval_int env a < eval_int env b
     | `Gt (a, b) -> eval_int env a > eval_int env b
 
-    
+
 type globals = {
   call_loc : Cppo_types.loc;
     (* location used to set the value of
@@ -299,7 +297,7 @@ type globals = {
     (* mapping from extension ID to pipeline command *)
 }
 
-        
+
 
 let parse ~preserve_quotations file lexbuf =
   let lexer_env = Cppo_lexer.init ~preserve_quotations file lexbuf in
@@ -366,7 +364,7 @@ let rec include_file g loc rel_file env =
 	error loc (sprintf "Included file %S does not exist" rel_file)
     else
       try
-	let dir = 
+	let dir =
 	  List.find (
 	    fun dir ->
 	      let file = Filename.concat dir rel_file in
@@ -377,7 +375,7 @@ let rec include_file g loc rel_file env =
 	  rel_file
 	else
 	  Filename.concat dir rel_file
-      with Not_found -> 
+      with Not_found ->
 	error loc (sprintf "Cannot find included file %S" rel_file)
   in
   if S.mem file g.included then
@@ -428,7 +426,7 @@ and expand_node ?(top = false) g env0 x =
 	      None, None ->
 		expand_node g env0 (`Text (loc, false, name))
 	    | None, Some args ->
-		let with_sep = 
+		let with_sep =
 		  add_sep
 		    [`Text (loc, false, ",")]
 		    [`Text (loc, false, ")")]
@@ -436,20 +434,20 @@ and expand_node ?(top = false) g env0 x =
 		let l =
 		  `Text (loc, false, name ^ "(") :: List.flatten with_sep in
 		expand_list g env0 l
-		  
+		
 	    | Some (`Defun (_, _, arg_names, _, _)), None ->
-		error loc 
-		  (sprintf "%S expects %i arguments but is applied to none." 
+		error loc
+		  (sprintf "%S expects %i arguments but is applied to none."
 		     name (List.length arg_names))
-		  
+		
 	    | Some (`Def _), Some l ->
-		error loc 
+		error loc
 		  (sprintf "%S expects no arguments" name)
-		  
+		
 	    | Some (`Def (_, _, l, env)), None ->
 		ignore (expand_list g env l);
 		env0
-		  
+		
 	    | Some (`Defun (_, _, arg_names, l, env)), Some args ->
 		let argc = List.length arg_names in
 		let n = List.length args in
@@ -473,7 +471,7 @@ and expand_node ?(top = false) g env0 x =
 		  in
 		  ignore (expand_list g app_env l);
 		  env0
-		    
+		
 	    | Some `Special, _ -> assert false
 	in
 
@@ -488,7 +486,7 @@ and expand_node ?(top = false) g env0 x =
 	env
 
 
-    | `Def (loc, name, body)-> 
+    | `Def (loc, name, body)->
 	g.require_location := true;
 	if M.mem name env0 then
 	  error loc (sprintf "%S is already defined" name)
@@ -505,7 +503,7 @@ and expand_node ?(top = false) g env0 x =
     | `Undef (loc, name) ->
 	g.require_location := true;
 	if is_reserved name then
-	  error loc 
+	  error loc
 	    (sprintf "%S is a built-in variable that cannot be undefined" name)
 	else
 	  M.remove name env0
@@ -607,7 +605,7 @@ and expand_node ?(top = false) g env0 x =
 	bprintf g.buf " %S " pos.Lexing.pos_fname;
 	env0
 
-	  
+	
 
 
 let include_inputs
diff --git a/cppo_lexer.mll b/cppo_lexer.mll
index 226def3..36a2c7c 100644
--- a/cppo_lexer.mll
+++ b/cppo_lexer.mll
@@ -1,6 +1,4 @@
-(* $Id$ *)
 {
-  
 open Printf
 open Lexing
 
@@ -25,7 +23,7 @@ let lex_new_lines lb =
       incr n
   done;
   let p = lb.lex_curr_p in
-  lb.lex_curr_p <- 
+  lb.lex_curr_p <-
     { p with
 	pos_lnum = p.pos_lnum + !n;
 	pos_bol = p.pos_cnum
@@ -33,7 +31,7 @@ let lex_new_lines lb =
 
 let count_new_lines lb n =
   let p = lb.lex_curr_p in
-  lb.lex_curr_p <- 
+  lb.lex_curr_p <-
     { p with
 	pos_lnum = p.pos_lnum + n;
 	pos_bol = p.pos_cnum
@@ -131,7 +129,7 @@ let hex = ['0'-'9' 'a'-'f' 'A'-'F']
 let oct = ['0'-'7']
 let bin = ['0'-'1']
 
-let operator_char = 
+let operator_char =
   [ '!' '$' '%' '&' '*' '+' '-' '.' '/' ':' '<' '=' '>' '?' '@' '^' '|' '~']
 let infix_symbol =
   ['=' '<' '>' '@' '^' '|' '&' '+' '-' '*' '/' '$' '%'] operator_char*
@@ -159,7 +157,7 @@ rule token e = parse
 
 and line e = parse
     blank* "#" as s
-        { 
+        {
 	  match e.lexer with
 	      `Test -> lexer_error lexbuf "Syntax error in boolean expression"
 	    | `Ocaml ->
@@ -182,7 +180,7 @@ and line e = parse
 	  token e lexbuf }
 
 and directive e = parse
-    blank* "define" dblank1 (ident as id) "(" 
+    blank* "define" dblank1 (ident as id) "("
       { DEFUN (long_loc e, id) }
 
   | blank* "define" dblank1 (ident as id)
@@ -234,7 +232,7 @@ and directive e = parse
 	eval_string e lexbuf;
 	blank_until_eol e lexbuf;
 	INCLUDE (long_loc e, get e) }
-  
+
   | blank* "error" dblank0 '"'
       { clear e;
 	eval_string e lexbuf;
@@ -328,8 +326,8 @@ and ocaml_token e = parse
       { e.line_start <- false;
 	FUNIDENT (loc lexbuf, s) }
 
-  | "'\n'" 
-  | "'\r\n'" 
+  | "'\n'"
+  | "'\r\n'"
       { new_line e;
 	TEXT (loc lexbuf, false, lexeme lexbuf) }
 
@@ -347,12 +345,12 @@ and ocaml_token e = parse
   | "<-" | "=" | ">" | ">]" | ">}" | "?" | "??" | "[" | "[<" | "[>" | "[|"
   | "]" | "_" | "`" | "{" | "{<" | "|" | "|]" | "}" | "~"
   | ">>"
-  | prefix_symbol 
+  | prefix_symbol
   | infix_symbol
-  | "'" ([^ '\'' '\\'] 
+  | "'" ([^ '\'' '\\']
          | '\\' (_ | digit digit digit | 'x' hex hex)) "'"
 
-      { e.line_start <- false; 
+      { e.line_start <- false;
 	TEXT (loc lexbuf, false, lexeme lexbuf) }
 
   | blank+
@@ -383,7 +381,7 @@ and ocaml_token e = parse
       { clear e;
 	add e "(*";
 	e.token_start <- pos1 lexbuf;
-	comment e 1 lexbuf }
+	comment (loc lexbuf) e 1 lexbuf }
 
   | '"'
       { clear e;
@@ -415,8 +413,8 @@ and ocaml_token e = parse
 	 | ("0o"| "0O") oct (oct | '_')*	
 	 | ("0b"| "0B") bin (bin | '_')* )
 
-  | '-'? digit (digit | '_')* ('.' (digit | '_')* )? 
-      (['e' 'E'] ['+' '-']? digit (digit | '_')* )? 
+  | '-'? digit (digit | '_')* ('.' (digit | '_')* )?
+      (['e' 'E'] ['+' '-']? digit (digit | '_')* )?
       { e.line_start <- false;
 	TEXT (loc lexbuf, false, lexeme lexbuf) }
 
@@ -427,20 +425,20 @@ and ocaml_token e = parse
       { e.line_start <- false;
 	TEXT (loc lexbuf, false, lexeme lexbuf) }
 
-  | eof 
+  | eof
       { EOF }
 
 
-and comment e depth = parse
+and comment startloc e depth = parse
     "(*"
       { add e "(*";
-	comment e (depth + 1) lexbuf }
-      
+	comment startloc e (depth + 1) lexbuf }
+
   | "*)"
-      { let depth = depth - 1 in 
+      { let depth = depth - 1 in
 	add e "*)";
 	if depth > 0 then
-	  comment e depth lexbuf
+	  comment startloc e depth lexbuf
 	else (
 	  e.line_start <- false;
 	  TEXT (long_loc e, false, get e)
@@ -449,58 +447,56 @@ and comment e depth = parse
   | '"'
       { add_char e '"';
 	string e lexbuf;
-	comment e depth lexbuf }
-      
-  | "'\n'" 
-  | "'\r\n'" 
+	comment startloc e depth lexbuf }
+
+  | "'\n'"
+  | "'\r\n'"
       { new_line e;
 	add e (lexeme lexbuf);
-	comment e depth lexbuf }
+	comment startloc e depth lexbuf }
 
-  | "'" ([^ '\'' '\\'] 
+  | "'" ([^ '\'' '\\']
          | '\\' (_ | digit digit digit | 'x' hex hex)) "'"
       { add e (lexeme lexbuf);
-	comment e depth lexbuf }
+	comment startloc e depth lexbuf }
 
   | '\r'? '\n'
-      { 
+      {
 	new_line e;
 	add e (lexeme lexbuf);
-	comment e depth lexbuf
+	comment startloc e depth lexbuf
       }
-      
-  | [^'(' '*' '"' '\r' '\n']+
-      { 
-	(* tolerates unmatched single quotes in comments, unlike the
-	   standard ocaml lexer *)
+
+  | [^'(' '*' '"' '\'' '\r' '\n']+
+      {
 	add e (lexeme lexbuf);
-	comment e depth lexbuf
+	comment startloc e depth lexbuf
       }
 
   | _
       { add e (lexeme lexbuf);
-	comment e depth lexbuf }
-      
+	comment startloc e depth lexbuf }
+
   | eof
-      { lexer_error lexbuf "Unterminated comment reaching the end of file" }
-      
-      
+      { error startloc "Unterminated comment reaching the end of file" }
+
+
 and string e = parse
     '"'
       { add_char e '"' }
-      
+
   | "\\\\"
   | '\\' '"'
       { add e (lexeme lexbuf);
 	string e lexbuf }
-      
+
   | '\\' '\r'? '\n'
       {
 	add e (lexeme lexbuf);
 	new_line e;
 	string e lexbuf
       }
-      
+
   | '\r'? '\n'
       {
 	if e.in_directive then
@@ -511,19 +507,19 @@ and string e = parse
 	  string e lexbuf
 	)
       }
-      
+
   | _ as c
       { add_char e c;
 	string e lexbuf }
-      
+
   | eof
       { }
-      
+
 
 and eval_string e = parse
     '"'
       {  }
-      
+
   | '\\' (['\'' '\"' '\\'] as c)
       { add_char e c;
 	eval_string e lexbuf }
@@ -531,47 +527,47 @@ and eval_string e = parse
   | '\\' '\r'? '\n'
       { assert e.in_directive;
         eval_string e lexbuf }
-      
+
   | '\r'? '\n'
       { assert e.in_directive;
         lexer_error lexbuf "Unterminated string literal" }
-      
+
   | '\\' (digit digit digit as s)
       { add_char e (Char.chr (int_of_string s));
 	eval_string e lexbuf }
-      
+
   | '\\' 'x' (hex as c1) (hex as c2)
       { add_char e (read_hex2 c1 c2);
 	eval_string e lexbuf }
-      
+
   | '\\' 'b'
       { add_char e '\b';
 	eval_string e lexbuf }
-      
+
   | '\\' 'n'
       { add_char e '\n';
 	eval_string e lexbuf }
-      
+
   | '\\' 'r'
       { add_char e '\r';
 	eval_string e lexbuf }
-      
+
   | '\\' 't'
       { add_char e '\t';
 	eval_string e lexbuf }
-      
+
   | [^ '\"' '\\']+
       { add e (lexeme lexbuf);
 	eval_string e lexbuf }
-      
+
   | eof
       { lexer_error lexbuf "Unterminated string literal" }
-      
-      
+
+
 and quotation e = parse
     ">>"
       { add e ">>" }
-      
+
   | "\\>>"
       { add e "\\>>";
 	quotation e lexbuf }
@@ -588,7 +584,7 @@ and quotation e = parse
 	  quotation e lexbuf
 	)
       }
-      
+
   | '\r'? '\n'
       {
 	if e.in_directive then
@@ -599,12 +595,12 @@ and quotation e = parse
 	  quotation e lexbuf
 	)
       }
-      
+
   | [^'>' '\\' '\r' '\n']+
       { add e (lexeme lexbuf);
 	quotation e lexbuf }
-      
-  | eof 
+
+  | eof
       { lexer_error lexbuf "Unterminated quotation" }
 
 and test_token e = parse
@@ -629,7 +625,7 @@ and test_token e = parse
 	 | ("0b"| "0B") bin (bin | '_')* )
       { let s = Lexing.lexeme lexbuf in
 	try INT (Int64.of_string s)
-	with _ -> 
+	with _ ->
 	  error (loc lexbuf)
 	    (sprintf "Integer constant %s is out the valid range for int64" s)
       }
@@ -653,7 +649,7 @@ and test_token e = parse
   | blank+                   { test_token e lexbuf }
   | '\\' '\r'? '\n'          { new_line e;
 			       test_token e lexbuf }
-  | '\r'? '\n' 
+  | '\r'? '\n'
   | eof        { assert e.in_directive;
 		 e.in_directive <- false;
 		 new_line e;
diff --git a/cppo_main.ml b/cppo_main.ml
index f60e7ac..68ee5b5 100644
--- a/cppo_main.ml
+++ b/cppo_main.ml
@@ -1,10 +1,8 @@
-(* $Id$ *)
-
 open Printf
 
 let add_extension tbl s =
   let i =
-    try String.index s ':' 
+    try String.index s ':'
     with Not_found ->
       failwith "Invalid -x argument"
   in
@@ -50,13 +48,13 @@ let () =
 
     "-s", Arg.Set show_exact_locations,
     "
-          Output line directives pointing to the exact source location of 
-          each token, including those coming from the body of macro 
+          Output line directives pointing to the exact source location of
+          each token, including those coming from the body of macro
           definitions.  This behavior is off by default.";
 
     "-n", Arg.Set show_no_locations,
     "
-          Do not output any line directive other than those found in the 
+          Do not output any line directive other than those found in the
           input (overrides -s).";
 
     "-version", Arg.Unit (fun () ->
@@ -94,7 +92,7 @@ Usage: %s [OPTIONS] [FILE1 [FILE2 ...]]
 Options:" Sys.argv.(0) in
   let add_file s = files := s :: !files in
   Arg.parse options add_file msg;
-  
+
   let inputs =
     let preliminaries =
       match List.rev !header with
@@ -102,19 +100,19 @@ Options:" Sys.argv.(0) in
 	| l ->
 	    let s = String.concat "" l in
 	    [ Sys.getcwd (),
-	      "<command line>", 
+	      "<command line>",
 	      (fun () -> Lexing.from_string s),
 	      (fun () -> ()) ]
     in
     let main =
       match List.rev !files with
 	  [] -> [ Sys.getcwd (),
-		  "<stdin>", 
+		  "<stdin>",
 		  (fun () -> Lexing.from_channel stdin),
 		  (fun () -> ()) ]
-	| l -> 
+	| l ->
 	    List.map (
-	      fun file -> 
+	      fun file ->
 		let ic = lazy (open_in file) in
 		Filename.dirname file,
 		file,
diff --git a/cppo_parser.mly b/cppo_parser.mly
index a6b81cd..6cbe59e 100644
--- a/cppo_parser.mly
+++ b/cppo_parser.mly
@@ -18,7 +18,7 @@
 /* Boolean expressions in #if/#elif directives */
 %token OP_PAREN TRUE FALSE DEFINED NOT AND OR EQ LT GT NE LE GE
        PLUS MINUS STAR LNOT LSL LSR ASR LAND LOR LXOR
-%token < Cppo_types.loc > SLASH MOD 
+%token < Cppo_types.loc > SLASH MOD
 %token < int64 > INT
 
 
diff --git a/cppo_types.ml b/cppo_types.ml
index 338dccd..07e3240 100644
--- a/cppo_types.ml
+++ b/cppo_types.ml
@@ -1,5 +1,3 @@
-(* $Id$ *)
-
 open Printf
 open Lexing
 
@@ -76,12 +74,12 @@ let string_of_loc (pos1, pos2) =
 exception Cppo_error of string
 
 let error loc s =
-  let msg = 
+  let msg =
     sprintf "%s\nError: %s" (string_of_loc loc) s in
   raise (Cppo_error msg)
 
 let warning loc s =
-  let msg = 
+  let msg =
     sprintf "%s\nWarning: %s" (string_of_loc loc) s in
   eprintf "%s\n%!" msg
 
diff --git a/examples/french.ml b/examples/french.ml
index 6b8ed88..4bede49 100644
--- a/examples/french.ml
+++ b/examples/french.ml
@@ -14,7 +14,7 @@
 #define tri sort
 
 soit rec separation x = fonction
-    y :: l -> 
+    y :: l ->
       soit l1, l2 = separation x l dans
       si y < x alors (y :: l1), l2
       sinon l1, (y :: l2)
diff --git a/examples/lexer.mll b/examples/lexer.mll
index 719005a..446e8ee 100644
--- a/examples/lexer.mll
+++ b/examples/lexer.mll
@@ -1,4 +1,4 @@
-(* Warning: ocamllex doesn't accept cppo directives 
+(* Warning: ocamllex doesn't accept cppo directives
             within the rules section. *)
 rule token = parse
     ['a'-'z']+  { `String (Lexing.lexeme lexbuf) }
diff --git a/test/Makefile b/test/Makefile
new file mode 100644
index 0000000..5c37a29
--- /dev/null
+++ b/test/Makefile
@@ -0,0 +1,13 @@
+.PHONY: all ext comments
+
+all: ext comments
+
+ext:
+	../cppo -x rot13:"tr '[a-z]' '[n-za-m]'" \
+		-x source:"./source.sh '%F' %B %E" \
+		ext.cppo > ext.out
+	diff -u ext.ref ext.out
+
+comments:
+	../cppo comments.cppo > comments.out
+	diff -u comments.ref comments.out
diff --git a/test/comments.cppo b/test/comments.cppo
new file mode 100644
index 0000000..5e335f1
--- /dev/null
+++ b/test/comments.cppo
@@ -0,0 +1,7 @@
+(* '"' *)
+
+#define BE_GONE
+
+(* "*)"
+#define DONT_TOUCH_THIS
+*)
diff --git a/test/comments.ref b/test/comments.ref
new file mode 100644
index 0000000..150391d
--- /dev/null
+++ b/test/comments.ref
@@ -0,0 +1,8 @@
+# 1 "comments.cppo"
+(* '"' *)
+
+
+# 5
+(* "*)"
+#define DONT_TOUCH_THIS
+*)
diff --git a/testdata/ext.cppo b/test/ext.cppo
similarity index 100%
rename from testdata/ext.cppo
rename to test/ext.cppo
diff --git a/testdata/ext.ref b/test/ext.ref
similarity index 100%
rename from testdata/ext.ref
rename to test/ext.ref
diff --git a/testdata/incl.cppo b/test/incl.cppo
similarity index 100%
rename from testdata/incl.cppo
rename to test/incl.cppo
diff --git a/testdata/incl2.cppo b/test/incl2.cppo
similarity index 100%
rename from testdata/incl2.cppo
rename to test/incl2.cppo
diff --git a/testdata/source.sh b/test/source.sh
similarity index 100%
rename from testdata/source.sh
rename to test/source.sh
diff --git a/testdata/Makefile b/testdata/Makefile
deleted file mode 100644
index 371dcf0..0000000
--- a/testdata/Makefile
+++ /dev/null
@@ -1,7 +0,0 @@
-.PHONY: all ext
-
-all: ext
-	../cppo -x rot13:"tr '[a-z]' '[n-za-m]'" \
-		-x source:"./source.sh '%F' %B %E" \
-		ext.cppo > ext.out
-	diff -u ext.ref ext.out

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ocaml-maint/packages/cppo.git



More information about the Pkg-ocaml-maint-commits mailing list