Skip to content

Commit

Permalink
Merge pull request #92 from maryvilledev/revert-91-cs_90
Browse files Browse the repository at this point in the history
Revert "Add C, Clojure, Java (not java8), and Lua #90"
  • Loading branch information
dane-johnson authored May 19, 2017
2 parents b719554 + 5bf6e87 commit c8c6b7a
Show file tree
Hide file tree
Showing 44 changed files with 99 additions and 1,453 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[submodule "grammars-v4"]
path = grammars-v4
url = https://github.com/maryvilledev/grammars-v4.git
[submodule "antlr4"]
path = antlr4
url = https://github.com/maryvilledev/antlr4.git
7 changes: 1 addition & 6 deletions __tests__/transformers/simplify_node.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,18 @@ describe(`simplify_node.js`, () => {
• end
• tags
• children`, () => {

// Different forms for starts and stops are intentionally
// used here, as both can be found in real ANTLR nodes.
const input_node = (
makeAntlrNode(0, { start: 0 }, { stop: 5 }, [
makeAntlrNode(1, { start: 0, stop: 4 }, undefined, []),
makeAntlrNode(1, { start: 0, stop: 4 }, undefined, undefined),
]));

const { rule_name_map } = lang_runtime_config;
const expected = (
makeNode(rule_name_map[0], 0, 5 + 1, [], [
makeNode(rule_name_map[1], 0, 4 + 1, [], []),
]));

expect(simplify_node(lang_runtime_config, input_node)).toEqual(expected);
});

Expand All @@ -53,16 +51,13 @@ describe(`simplify_node.js`, () => {
• tags
• children
• text`, () => {

const input_terminal = (
makeAntlrTerminal(0, 0, 5, 'foobar')
);

const { symbol_name_map } = lang_runtime_config;
const expected = (
makeTerminal(symbol_name_map[0 + 2], 0, 6, 'foobar', [])
);

expect(simplify_node(lang_runtime_config, input_terminal)).toEqual(expected);
});
});
18 changes: 0 additions & 18 deletions __tests__/tree/code/snippet.1v88olr0.clj

This file was deleted.

69 changes: 0 additions & 69 deletions __tests__/tree/code/snippet.ecemhuve.c

This file was deleted.

1 change: 1 addition & 0 deletions __tests__/tree/code/snippet.kt29xnfw.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
print('sum =', total)
except ValueError:
print('Please supply integer arguments')

44 changes: 0 additions & 44 deletions __tests__/tree/code/snippet.lk0rlo4z.java

This file was deleted.

69 changes: 0 additions & 69 deletions __tests__/tree/code/snippet.seefwj9h.lua

This file was deleted.

32 changes: 10 additions & 22 deletions __tests__/tree/compare.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const path = require('path');
const fs = require('fs-promise');
const antlr = require('antlr4');
const expect_error = require('../../src/utils/expect_error.js');
const run_antlr = require('../../src/utils/run_antlr.js');
const run_java = require('../../src/utils/run_java.js');
Expand Down Expand Up @@ -78,11 +79,13 @@ const prepareJs = async function(lang_compile_config, lang_runtime_config) {
}

const genTreeViaJs = async function(lang_runtime_config, js_parser, code) {
return js_parser(code, function(err) {
const tree = js_parser(code, function(err) {
throw err;
}, {
'return_antlr_toStringTree': true,
'return_antlr_tree': true,
});

return tree.toStringTree(tree.parser.ruleNames);
};


Expand Down Expand Up @@ -120,9 +123,7 @@ const compare = async function(language_name, code_file) {
console.log('compare(' + code_file + ') genJava: ' + (t4 - t3) + 'ms');
console.log('compare(' + code_file + ') genJs: ' + (t5 - t4) + 'ms');

return [treeViaJava, treeViaJs].map(function(val) {
return val.trim().replace(/(\\n|\s)+/g, ' ');
});
return treeViaJava.trim() === treeViaJs.trim();
};


Expand All @@ -144,32 +145,19 @@ describe('grammars-v4/', () => {
it(description, () => {
expect.assertions(1);
return compare(lang_key, __dirname + '/code/' + code_filename).then(data => {
expect(data[0]).toEqual(data[1]);
expect(data).toBeTruthy();
}).catch(err => {
console.error(err);
});
});
};

describe('grammars-v4/c/', () => {
test_snippet('c', 'handles lots of stuff', 'snippet.ecemhuve.c');
describe('grammars-v4/python3/', () => {
test_snippet('python3', 'handles basic hello worlds', 'snippet.voc84cjo.py');
test_snippet('python3', 'handles a script adding the input arguments', 'snippet.kt29xnfw.py');
});

describe('grammars-v4/clojure/', () => {
test_snippet('clojure', 'handles lots of stuff', 'snippet.1v88olr0.clj');
})

describe('grammars-v4/java8/', () => {
test_snippet('java8', 'handles basic hello worlds', 'snippet.k17eu4f2.java');
test_snippet('java8', 'handles lots of stuff', 'snippet.lk0rlo4z.java');
});

describe('grammars-v4/lua/', () => {
test_snippet('lua', 'handles lots of stuff', 'snippet.seefwj9h.lua');
});

describe('grammars-v4/python3/', () => {
test_snippet('python3', 'handles basic hello worlds', 'snippet.voc84cjo.py');
test_snippet('python3', 'handles a script adding the input arguments', 'snippet.kt29xnfw.py');
});
});
1 change: 1 addition & 0 deletions antlr4
Submodule antlr4 added at 2ebae9
2 changes: 1 addition & 1 deletion grammars-v4
7 changes: 7 additions & 0 deletions install
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,10 @@ git submodule update --init --recursive
mkdir -p bin/
curl http://www.antlr.org/download/antlr-4.6-complete.jar -o bin/antlr-4.6-complete.jar

cd antlr4/runtime/JavaScript/src/antlr4/
npm install
cd -
npm link antlr4/runtime/JavaScript/src/antlr4/

mkdir -p _cache/
mkdir -p _cache/java_func_data/
9 changes: 0 additions & 9 deletions language_configs/c.compile.js

This file was deleted.

Loading

0 comments on commit c8c6b7a

Please sign in to comment.