File tree Expand file tree Collapse file tree 3 files changed +7
-17
lines changed
Expand file tree Collapse file tree 3 files changed +7
-17
lines changed Original file line number Diff line number Diff line change @@ -2351,8 +2351,9 @@ def make_bin_override():
23512351
23522352print_verbose (output )
23532353
2354+ # Dump as JSON to allow js2c.cc read it as a simple json file.
23542355write ('config.gypi' , do_not_edit +
2355- pprint . pformat (output , indent = 2 , width = 128 ) + '\n ' )
2356+ json . dumps (output , indent = 2 ) + '\n ' )
23562357
23572358write ('config.status' , '#!/bin/sh\n set -x\n exec ./configure ' +
23582359 ' ' .join ([shlex .quote (arg ) for arg in original_argv ]) + '\n ' )
Original file line number Diff line number Diff line change @@ -49,8 +49,7 @@ let config = fs.readFileSync(configPath, 'utf8');
4949
5050// Clean up comment at the first line.
5151config = config . split ( '\n' ) . slice ( 1 ) . join ( '\n' ) ;
52- config = config . replace ( / " / g, '\\"' ) ;
53- config = config . replace ( / ' / g, '"' ) ;
52+ // Turn pseudo-booleans strings into booleans.
5453config = JSON . parse ( config , ( key , value ) => {
5554 if ( value === 'true' ) return true ;
5655 if ( value === 'false' ) return false ;
Original file line number Diff line number Diff line change @@ -784,21 +784,11 @@ std::vector<char> JSONify(const std::vector<char>& code) {
784784 // 1. Remove string comments
785785 std::vector<char > stripped = StripComments (code);
786786
787- // 2. join multiline strings
788- std::vector<char > joined = JoinMultilineString (stripped);
787+ // 2. turn pseudo-booleans strings into Booleans
788+ std::vector<char > result1 = ReplaceAll (stripped, R"( "true")" , " true" );
789+ std::vector<char > result2 = ReplaceAll (result1, R"( "false")" , " false" );
789790
790- // 3. normalize string literals from ' into "
791- for (size_t i = 0 ; i < joined.size (); ++i) {
792- if (joined[i] == ' \' ' ) {
793- joined[i] = ' "' ;
794- }
795- }
796-
797- // 4. turn pseudo-booleans strings into Booleans
798- std::vector<char > result3 = ReplaceAll (joined, R"( "true")" , " true" );
799- std::vector<char > result4 = ReplaceAll (result3, R"( "false")" , " false" );
800-
801- return result4;
791+ return result2;
802792}
803793
804794int AddGypi (const std::string& var,
You canβt perform that action at this time.
0 commit comments