1 | # quote.jam
|
---|
2 | #
|
---|
3 | # Copyright (c) 2007-2008
|
---|
4 | # Steven Watanabe
|
---|
5 | #
|
---|
6 | # Distributed under the Boost Software License, Version 1.0. (See
|
---|
7 | # accompanying file LICENSE_1_0.txt or copy at
|
---|
8 | # http://www.boost.org/LICENSE_1_0.txt
|
---|
9 |
|
---|
10 | import regex ;
|
---|
11 |
|
---|
12 | rule quote_string ( string )
|
---|
13 | {
|
---|
14 | if ( [ regex.match (\".*\") : $(string) : 1 ] )
|
---|
15 | {
|
---|
16 | return $(string) ;
|
---|
17 | }
|
---|
18 | else
|
---|
19 | {
|
---|
20 | return \"$(string)\" ;
|
---|
21 | }
|
---|
22 | }
|
---|
23 |
|
---|
24 | rule double-quote ( string )
|
---|
25 | {
|
---|
26 | if ( [ regex.match (\".*\") : $(string) : 1 ] )
|
---|
27 | {
|
---|
28 | return $(string) ;
|
---|
29 | }
|
---|
30 | else
|
---|
31 | {
|
---|
32 | return \"$(string)\" ;
|
---|
33 | }
|
---|
34 | }
|
---|