| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 2d1efc7 commit a7bb974
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -2351,8 +2351,9 @@ def make_bin_override(): | |||
| 2351 | 2351 | ||
| 2352 | 2352 | print_verbose(output) | |
| 2353 | 2353 | ||
| 2354 | + # Dump as JSON to allow js2c.cc read it as a simple json file. | ||
| 2354 | 2355 | write('config.gypi', do_not_edit + | |
| 2355 | - pprint.pformat(output, indent=2, width=128) + '\n') | ||
| 2356 | + json.dumps(output, indent=2) + '\n') | ||
| 2356 | 2357 | ||
| 2357 | 2358 | write('config.status', '#!/bin/sh\nset -x\nexec ./configure ' + | |
| 2358 | 2359 | ' '.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'); | |||
| 49 | 49 | ||
| 50 | 50 | // Clean up comment at the first line. | |
| 51 | 51 | config = config.split('\n').slice(1).join('\n'); | |
| 52 | - config = config.replace(/"/g, '\\"'); | ||
| 53 | - config = config.replace(/'/g, '"'); | ||
| 52 | + // Turn pseudo-booleans strings into booleans. | ||
| 54 | 53 | config = JSON.parse(config, (key, value) => { | |
| 55 | 54 | if (value === 'true') return true; | |
| 56 | 55 | 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) { | |||
| 784 | 784 | // 1. Remove string comments | |
| 785 | 785 | std::vector<char> stripped = StripComments(code); | |
| 786 | 786 | ||
| 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"); | ||
| 789 | 790 | ||
| 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; | ||
| 802 | 792 | } | |
| 803 | 793 | ||
| 804 | 794 | int AddGypi(const std::string& var, | |
| Back | FazBrowse Home | New Git URL |
0 commit comments