| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent c6d7a7b commit 1c38f80
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -2446,8 +2446,9 @@ def make_bin_override(): | |||
| 2446 | 2446 | ||
| 2447 | 2447 | print_verbose(output) | |
| 2448 | 2448 | ||
| 2449 | + # Dump as JSON to allow js2c.cc read it as a simple json file. | ||
| 2449 | 2450 | write('config.gypi', do_not_edit + | |
| 2450 | - pprint.pformat(output, indent=2, width=128) + '\n') | ||
| 2451 | + json.dumps(output, indent=2) + '\n') | ||
| 2451 | 2452 | ||
| 2452 | 2453 | write('config.status', '#!/bin/sh\nset -x\nexec ./configure ' + | |
| 2453 | 2454 | ' '.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 | |
|---|---|---|---|
@@ -796,21 +796,11 @@ std::vector<char> JSONify(const std::vector<char>& code) { | |||
| 796 | 796 | // 1. Remove string comments | |
| 797 | 797 | std::vector<char> stripped = StripComments(code); | |
| 798 | 798 | ||
| 799 | - // 2. join multiline strings | ||
| 800 | - std::vector<char> joined = JoinMultilineString(stripped); | ||
| 799 | + // 2. turn pseudo-booleans strings into Booleans | ||
| 800 | + std::vector<char> result1 = ReplaceAll(stripped, R"("true")", "true"); | ||
| 801 | + std::vector<char> result2 = ReplaceAll(result1, R"("false")", "false"); | ||
| 801 | 802 | ||
| 802 | - // 3. normalize string literals from ' into " | ||
| 803 | - for (size_t i = 0; i < joined.size(); ++i) { | ||
| 804 | - if (joined[i] == '\'') { | ||
| 805 | - joined[i] = '"'; | ||
| 806 | - } | ||
| 807 | - } | ||
| 808 | - | ||
| 809 | - // 4. turn pseudo-booleans strings into Booleans | ||
| 810 | - std::vector<char> result3 = ReplaceAll(joined, R"("true")", "true"); | ||
| 811 | - std::vector<char> result4 = ReplaceAll(result3, R"("false")", "false"); | ||
| 812 | - | ||
| 813 | - return result4; | ||
| 803 | + return result2; | ||
| 814 | 804 | } | |
| 815 | 805 | ||
| 816 | 806 | int AddGypi(const std::string& var, | |
| Back | FazBrowse Home | New Git URL |
0 commit comments