remove dependencies
This commit is contained in:
parent
a7873cc203
commit
8f914cc2d9
@ -6,8 +6,6 @@
|
|||||||
## Compile lemon-js
|
## Compile lemon-js
|
||||||
```bash
|
```bash
|
||||||
gcc -o ./lemon-src/lemon-js -O2 ./lemon-src/lemon-js.c
|
gcc -o ./lemon-src/lemon-js -O2 ./lemon-src/lemon-js.c
|
||||||
npm install
|
|
||||||
# or
|
|
||||||
./build.sh
|
./build.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -89,4 +87,8 @@ See lemon.html for additional documentation.
|
|||||||
Used re2js lexer from: [http://git.macaw.me:3000/chichenkov/re2-js-generator](http://git.macaw.me:3000/chichenkov/re2-js-generator)
|
Used re2js lexer from: [http://git.macaw.me:3000/chichenkov/re2-js-generator](http://git.macaw.me:3000/chichenkov/re2-js-generator)
|
||||||
|
|
||||||
## Original project
|
## Original project
|
||||||
See https://github.com/sormy/lemon-js
|
See https://github.com/sormy/lemon-js
|
||||||
|
|
||||||
|
## Links
|
||||||
|
- Used js-beautify-node from: [https://github.com/rwaldron/js-beautify-node](https://github.com/rwaldron/js-beautify-node)
|
||||||
|
- Used args-parser from: [https://www.npmjs.com/package/args-parser](https://www.npmjs.com/package/args-parser)
|
@ -2,8 +2,6 @@
|
|||||||
|
|
||||||
gcc -o ./lemon-src/lemon-js -O2 ./lemon-src/lemon-js.c
|
gcc -o ./lemon-src/lemon-js -O2 ./lemon-src/lemon-js.c
|
||||||
|
|
||||||
npm install
|
|
||||||
|
|
||||||
cat config.example > config.js
|
cat config.example > config.js
|
||||||
|
|
||||||
node main.js
|
node main.js
|
2
build.sh
2
build.sh
@ -2,6 +2,4 @@
|
|||||||
|
|
||||||
gcc -o ./lemon-src/lemon-js -O2 ./lemon-src/lemon-js.c
|
gcc -o ./lemon-src/lemon-js -O2 ./lemon-src/lemon-js.c
|
||||||
|
|
||||||
npm install
|
|
||||||
|
|
||||||
cat config.template > config.js
|
cat config.template > config.js
|
File diff suppressed because it is too large
Load Diff
41
libs/args-parser.js
Normal file
41
libs/args-parser.js
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
/**
|
||||||
|
* Created by Aleksey Chichenkov <a.chichenkov@initi.ru> on 1/30/19.
|
||||||
|
*/
|
||||||
|
|
||||||
|
function Parse (argv) {
|
||||||
|
// Removing node/bin and called script name
|
||||||
|
argv = argv.slice(2);
|
||||||
|
|
||||||
|
// Returned object
|
||||||
|
var args = {};
|
||||||
|
|
||||||
|
var argName, argValue;
|
||||||
|
|
||||||
|
// For each argument
|
||||||
|
argv.forEach(function (arg, index) {
|
||||||
|
// Seperate argument, for a key/value return
|
||||||
|
arg = arg.split('=');
|
||||||
|
|
||||||
|
// Retrieve the argument name
|
||||||
|
argName = arg[0];
|
||||||
|
|
||||||
|
// Remove "--" or "-"
|
||||||
|
if (argName.indexOf('-') === 0) {
|
||||||
|
argName = argName.slice(argName.slice(0, 2).lastIndexOf('-') + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Associate defined value or initialize it to "true" state
|
||||||
|
argValue = (arg.length === 2)
|
||||||
|
? parseFloat(arg[1]).toString() === arg[1] // check if argument is valid number
|
||||||
|
? +arg[1]
|
||||||
|
: arg[1]
|
||||||
|
: true;
|
||||||
|
|
||||||
|
// Finally add the argument to the args set
|
||||||
|
args[argName] = argValue;
|
||||||
|
});
|
||||||
|
|
||||||
|
return args;
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = Parse;
|
1179
libs/js-beautifier.js
Normal file
1179
libs/js-beautifier.js
Normal file
File diff suppressed because it is too large
Load Diff
13
main.js
13
main.js
@ -2,8 +2,8 @@
|
|||||||
* Created by Aleksey Chichenkov <a.chichenkov@initi.ru> on 1/28/19.
|
* Created by Aleksey Chichenkov <a.chichenkov@initi.ru> on 1/28/19.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var js_beautify = require("js-beautify");
|
var js_beautify = require("./libs/js-beautifier");
|
||||||
var args = require("args-parser")(process.argv);
|
var args = require("./libs/args-parser")(process.argv);
|
||||||
var fs = require("fs");
|
var fs = require("fs");
|
||||||
var exec = require('child_process').exec;
|
var exec = require('child_process').exec;
|
||||||
|
|
||||||
@ -55,7 +55,14 @@ var post_process_parser = function () {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
out_js = js_beautify(out_js, {indent_size: 4, space_in_empty_paren: true});
|
out_js = js_beautify(out_js, {
|
||||||
|
indent_size: 4,
|
||||||
|
indent_char: ' ',
|
||||||
|
preserve_newlines: true,
|
||||||
|
space_after_anon_function: true,
|
||||||
|
keep_array_indentation: false,
|
||||||
|
braces_on_own_line: false
|
||||||
|
});
|
||||||
|
|
||||||
if(!fs.existsSync(output_path)){
|
if(!fs.existsSync(output_path)){
|
||||||
fs.mkdirSync(output_path);
|
fs.mkdirSync(output_path);
|
||||||
|
@ -7,8 +7,5 @@
|
|||||||
"name": "chichenkov",
|
"name": "chichenkov",
|
||||||
"email": "rolahd@yandex.ru"
|
"email": "rolahd@yandex.ru"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {}
|
||||||
"args-parser": "^1.1.0",
|
|
||||||
"js-beautify": "^1.8.9"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
2
test.js
2
test.js
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
var fs = require("fs");
|
var fs = require("fs");
|
||||||
var exec = require('child_process').exec;
|
var exec = require('child_process').exec;
|
||||||
var args = require("args-parser")(process.argv);
|
var args = require("./libs/args-parser")(process.argv);
|
||||||
|
|
||||||
var cfg_path = "config.js";
|
var cfg_path = "config.js";
|
||||||
var config;
|
var config;
|
||||||
|
Loading…
Reference in New Issue
Block a user