Boost logo

Boost-Build :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2005-01-26 07:08:15


Hi,
all most of you know, Jam is sensitive to spaces. A typical first user's error
is:

exe a : a.cpp;

The attached patch attempts to fix that. Now, whenever bjam sees ';' outside
of quited string, it terminates the current token.

It would be good to handle other symbols ( '[', ']', ':' ) in the similar way,
but unfortunately, they can appear inside variable accesses, for example:

gFILES($(targets[1])) = fff ;

During scanning, it's not easy to find if we're inside variable access or
not, so those symbols can't be safely handled.

Opinions? Should I commit this?

- Volodya

 --Boundary-00=_wg49BFY2bXmDVga Content-Type: text/x-diff;
charset="us-ascii";
name="spaces.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename="spaces.diff"

? jam_src/A.diff
? jam_src/ChangeLog
? jam_src/a
? jam_src/bin.cygwinx86
? jam_src/bin.linuxx86
? jam_src/bin.ntx86
? jam_src/bootstrap
? jam_src/bootstrap.borland
? jam_src/bootstrap.gcc
? jam_src/bootstrap.msvc
? jam_src/log
? jam_src/vc70.pdb
Index: v2/util/print.jam
===================================================================
RCS file: /cvsroot/boost/boost/tools/build/v2/util/print.jam,v
retrieving revision 1.28
diff -u -r1.28 print.jam
--- v2/util/print.jam 24 Jan 2005 15:16:00 -0000 1.28
+++ v2/util/print.jam 26 Jan 2005 12:00:43 -0000
@@ -286,11 +286,11 @@
indent = "" ;
for local c in $(indent-chars)
{
- if $(c) = " " { c =   ; }
- else if $(c) = " " { c =      ; }
+ if $(c) = " " { c = &nbsp\; ; }
+ else if $(c) = " " { c = &nbsp\;&nbsp\;&nbsp\;&nbsp\; ; }
indent = $(indent)$(c) ;
}
- local html-text = [ escape-html $(text) :   ] ;
+ local html-text = [ escape-html $(text) : &nbsp\; ] ;
text $(html-text[1])<br> $(indent)$(html-text[2-])<br> ;
}
}
Index: v2/tools/common.jam
===================================================================
RCS file: /cvsroot/boost/boost/tools/build/v2/tools/common.jam,v
retrieving revision 1.31
diff -u -r1.31 common.jam
--- v2/tools/common.jam 24 Jan 2005 15:16:00 -0000 1.31
+++ v2/tools/common.jam 26 Jan 2005 12:00:43 -0000
@@ -352,11 +352,11 @@
local sep = ":" ;
if $(exported)
{
- result = $(variable)=$(values:J=$(sep));export $(variable) ;
+ result = "$(variable)=$(values:J=$(sep));export $(variable)" ;
}
else
{
- result = $(variable)=$(values:J=$(sep)) ;
+ result = "$(variable)=$(values:J=$(sep))" ;
}
}
return $(result:J=" ") ;
Index: v2/tools/boostbook.jam
===================================================================
RCS file: /cvsroot/boost/boost/tools/build/v2/tools/boostbook.jam,v
retrieving revision 1.32
diff -u -r1.32 boostbook.jam
--- v2/tools/boostbook.jam 24 Jan 2005 02:14:15 -0000 1.32
+++ v2/tools/boostbook.jam 26 Jan 2005 12:00:43 -0000
@@ -108,7 +108,7 @@
if ! $(.boostbook-xsl-dir) || ! $(.boostbook-dtd-dir)
{
errors.warning
- couldn't find BoostBook xsl or dtd directories;
+ "couldn't find BoostBook xsl or dtd directories;"
: please set \"BOOST_ROOT\" variable to the root directory of
your boost installation. Searched in:
: $(search-dirs:J="
Index: jam_src/scan.c
===================================================================
RCS file: /cvsroot/boost/boost/tools/build/jam_src/scan.c,v
retrieving revision 1.6
diff -u -r1.6 scan.c
--- jam_src/scan.c 23 Jan 2004 14:16:29 -0000 1.6
+++ jam_src/scan.c 26 Jan 2005 12:00:43 -0000
@@ -299,13 +299,36 @@
c != EOF &&
b < buf + sizeof( buf ) &&
( inquote || !isspace( c ) ) )
- {
- if( c == '"' )
+ {
+ if( c == '"' )
{
/* begin or end " */
inquote = !inquote;
notkeyword = 1;
}
+ /* Check if we got separator. If yes, and current
+ token is non-empty, we terminate the current token
+ without adding the separator. If the current token
+ is empty, we add separator and terminate the token.
+
+ The ';' symbol is not the only separator we want to
+ handle. But, the '[' and ']' symbols can occur in variables:
+ gFILES($(targets[1])) =
+ and bjam scanner is too simple minded to handle this case
+ correctly. So, only ';' is handled.
+ */
+ else if (c == ';' && !inquote)
+ {
+ if (b == buf)
+ {
+ *b++ = c;
+ /* After loop, 'c' is next symbol in the stream,
+ not added to 'buf'. Maintain this invariant. */
+ c = yychar();
+ }
+ /*printf("Found separator in %s at %s:%d\n", buf, incp->fname, incp->line);*/
+ break;
+ }
else if( c != '\\' )
{
/* normal char */
 --Boundary-00=_wg49BFY2bXmDVga--


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