|
Boost-Build : |
Subject: [Boost-build] [lex] header file
From: Gaydov Victor (victor.gaydov_at_[hidden])
Date: 2009-10-31 03:39:32
Patch to generate header file (important in C++ scanners) like this:
cpp Lexer.cpp : Parser.ll ;
hpp Lexer.hpp : Parser.ll ;
---lex.jam.orig 2009-10-31 10:32:53.000000000 +0300
+++ flex.jam 2009-10-31 10:35:01.000000000 +0300
@@ -6,28 +6,38 @@ import type ;
import generators ;
import feature ;
import property ;
+import utility : ungrist ;
feature.feature flex.prefix : : free ;
type.register LEX : l ;
type.register LEX++ : ll ;
-generators.register-standard lex.lex : LEX : C ;
-generators.register-standard lex.lex : LEX++ : CPP ;
+generators.register-standard lex.lex : LEX : C H ;
+generators.register-standard lex.lex : LEX++ : CPP HPP ;
rule init ( )
{
}
-rule lex ( target : source : properties * )
+rule lex ( target + : source : properties * )
{
local r = [ property.select flex.prefix : $(properties) ] ;
if $(r)
{
PREFIX on $(<) = $(r:G=) ;
}
+
+ for local file in $(target)
+ {
+ if $(file:S) = .hpp || $(file:S) = .h
+ {
+ local dir = [ MATCH p(.*) : [ ungrist $(file:G) ] ] ;
+ HEADER on $(<) = $(dir)/$(file:G=) ;
+ }
+ }
}
actions lex
{
- flex -P$(PREFIX) -o$(<) $(>)
+ flex -P$(PREFIX) --header-file="$(HEADER)" -o"$(<[0])" "$(>)"
}
Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk