Fix inclusion of libc++ in wasm build
This commit is contained in:
parent
73e1512555
commit
f3ecafe13b
3 changed files with 14 additions and 4 deletions
|
|
@ -1,8 +1,10 @@
|
|||
const release = '../../../target/release'
|
||||
const Parser = require(`${release}/tree-sitter.js`);
|
||||
const JavaScript = require.resolve(`${release}/tree-sitter-javascript.wasm`);
|
||||
const Python = require.resolve(`${release}/tree-sitter-python.wasm`);
|
||||
|
||||
module.exports = Parser.init().then(async () => ({
|
||||
Parser,
|
||||
JavaScript: await Parser.Language.load(JavaScript),
|
||||
Python: await Parser.Language.load(Python)
|
||||
}));
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
const {assert} = require('chai');
|
||||
let Parser, JavaScript;
|
||||
let Parser, JavaScript, Python;
|
||||
|
||||
describe("Parser", () => {
|
||||
let parser;
|
||||
|
||||
before(async () =>
|
||||
({Parser, JavaScript} = await require('./helper'))
|
||||
({Parser, JavaScript, Python} = await require('./helper'))
|
||||
);
|
||||
|
||||
beforeEach(() => {
|
||||
|
|
@ -125,6 +125,15 @@ describe("Parser", () => {
|
|||
assert.equal(tree.rootNode.firstChild.firstChild.namedChildCount, repeatCount);
|
||||
});
|
||||
|
||||
it.only("can use languages with external scanners written in C++", () => {
|
||||
parser.setLanguage(Python);
|
||||
tree = parser.parse("def foo():\n bar()");
|
||||
assert.equal(
|
||||
tree.rootNode.toString(),
|
||||
'(module (function_definition (identifier) (parameters) (expression_statement (call (identifier) (argument_list)))))'
|
||||
);
|
||||
});
|
||||
|
||||
it('parses only the text within the `includedRanges` if they are specified', () => {
|
||||
const sourceCode = "<% foo() %> <% bar %>";
|
||||
|
||||
|
|
|
|||
|
|
@ -2,8 +2,6 @@
|
|||
|
||||
set -e
|
||||
|
||||
export EMCC_FORCE_STDLIBS=libc++
|
||||
|
||||
args="-Os"
|
||||
if [[ "$1" == "--debug" ]]; then
|
||||
args="-s ASSERTIONS=1 SAFE_HEAP=1 -O0"
|
||||
|
|
@ -15,6 +13,7 @@ docker run \
|
|||
--rm \
|
||||
-v $(pwd):/src \
|
||||
-u $(id -u) \
|
||||
-e EMCC_FORCE_STDLIBS=libc++ \
|
||||
trzeci/emscripten-slim \
|
||||
\
|
||||
emcc \
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue