Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0004262OCaml-for Camlp4 use 19:232010-04-29 14:18
Assigned Toertai 
PlatformOSOS Version
Product Version3.10+dev 
Target VersionFixed in Version3.10+dev 
Summary0004262: Camlp4MacroParser executes "DEFINE" directives in the "false" branch of an IFDEF; other Camlp4MacroParser improvements
DescriptionAs I wrote to the Caml list yesterday, I have noticed that the Camlp4MacroParser in 3.10.0+beta has an unfortunate problem - when processing an "IFDEF" (or "IFNDEF") directive, it will execute the "DEFINE"s in _both_ branches, regardless of whether the test is true or not (this was caused by the fact that the DEFINE directives would be executed eagerly at parse-time).

Attached is a corrected and improved version of the Camlp4MacroParser:

- Fixes the above problem; now the execution of the "DEFINE" directives inside IFDEF/IFNDEF is correct.

- Adds support for "local" definitions
  DEFINE <lident> = <expression> IN <expression>
  This is particularly useful for things like

  DEFINE body =
    let result = body in
    print_debug result;

- Adds an ability to omit the "ELSE" part of the IFDEF/IFNDEF expressions (the "ELSE" branch is then taken to default to unit expression "()").

- Adds an ability to use the macro argument as a pattern (provided the argument is a sufficiently simple expression)

- Adds a special macro "NOTHING" that can be used to "wipe out" unneeded function arguments. This is useful to be able to generate functions of different arity using the same macro.

The improved is attached.

TagsNo tags attached.
Attached Files? file icon [^] (12,376 bytes) 2007-04-17 19:23 [Show Content]
txt file icon report4262_Camlp4MacroParser_patch.txt [^] (7,600 bytes) 2007-04-17 19:26 [Show Content]

- Relationships

-  Notes
ertai (developer)
2007-04-17 21:23

Fixed in CVS.

- Issue History
Date Modified Username Field Change
2007-04-17 19:23 nogin New Issue
2007-04-17 19:23 nogin File Added:
2007-04-17 19:25 nogin Note Added: 0004020
2007-04-17 19:26 nogin File Added: report4262_Camlp4MacroParser_patch.txt
2007-04-17 19:26 nogin Note Deleted: 0004020
2007-04-17 21:23 ertai Note Added: 0004021
2007-04-17 21:23 ertai Assigned To => ertai
2007-04-17 21:23 ertai Status new => resolved
2007-04-17 21:23 ertai Resolution open => fixed
2007-04-17 21:23 ertai Fixed in Version => 3.10+dev
2010-04-29 14:18 xleroy Status resolved => closed
2016-02-08 12:49 doligez Category Camlp4 => for Camlp4 use [^]
2016-02-08 12:50 doligez Category for Camlp4 use [^] => for Camlp4 use [^]
2017-02-23 16:43 doligez Category for Camlp4 use [^] => -for Camlp4 use [^]

Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker