remove dependencies
This commit is contained in:
parent
a7873cc203
commit
8f914cc2d9
@ -6,8 +6,6 @@
|
||||
## Compile lemon-js
|
||||
```bash
|
||||
gcc -o ./lemon-src/lemon-js -O2 ./lemon-src/lemon-js.c
|
||||
npm install
|
||||
# or
|
||||
./build.sh
|
||||
```
|
||||
|
||||
@ -90,3 +88,7 @@ Used re2js lexer from: [http://git.macaw.me:3000/chichenkov/re2-js-generator](ht
|
||||
|
||||
## Original project
|
||||
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
|
||||
|
||||
npm install
|
||||
|
||||
cat config.example > config.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
|
||||
|
||||
npm install
|
||||
|
||||
cat config.template > config.js
|
@ -1,44 +1,17 @@
|
||||
/* Generated by re2c 1.0.3 on Wed Jan 30 13:09:24 2019 */
|
||||
var types = [
|
||||
"SLASH",
|
||||
"LSB",
|
||||
"RSB",
|
||||
"LCB",
|
||||
"RCB",
|
||||
"COLON",
|
||||
"COMMA",
|
||||
"DOT",
|
||||
"REM",
|
||||
"GT",
|
||||
"GTE",
|
||||
"LT",
|
||||
"LTE",
|
||||
"EQ",
|
||||
"NEQ",
|
||||
"LIKE",
|
||||
"NLIKE",
|
||||
"AND",
|
||||
"OR",
|
||||
"NOT",
|
||||
"ADDRESS",
|
||||
"OID",
|
||||
"OID_LITERAL",
|
||||
"TIME",
|
||||
"TIMEDIFF",
|
||||
"INTEGER_LITERAL",
|
||||
"FLOAT_LITERAL",
|
||||
"BOOL_LITERAL",
|
||||
"ID"
|
||||
];
|
||||
/* Generated by re2c 1.0.3 on Wed Jan 30 16:51:51 2019 */
|
||||
var types = ["SLASH", "LSB", "RSB", "LCB", "RCB", "COLON", "COMMA", "DOT", "REM", "GT", "GTE", "LT", "LTE", "EQ", "NEQ", "LIKE", "NLIKE", "AND", "OR", "NOT", "ADDRESS", "OID", "OID_LITERAL", "TIME", "TIMEDIFF", "INTEGER_LITERAL", "FLOAT_LITERAL", "BOOL_LITERAL", "ID"];
|
||||
|
||||
var errors = {
|
||||
"-2": "not found close quote or singleQuote",
|
||||
"-2": "end of search",
|
||||
"-1": "not found any lexemes or errors or anything else",
|
||||
"0": "success",
|
||||
"1": "found unknown symbol"
|
||||
"1": "found unknown symbol",
|
||||
"2": "not found close quote or singleQuote",
|
||||
"3": "Unexpected symbol in oid structure",
|
||||
"4": "Not found close bracket for Oid",
|
||||
};
|
||||
|
||||
var Test_lexer = function(_string) {
|
||||
var Lexer = function (_string) {
|
||||
this._last_found_lexeme = {
|
||||
error: -1
|
||||
};
|
||||
@ -53,7 +26,7 @@ var Test_lexer = function(_string) {
|
||||
this._yy_accept = 0;
|
||||
};
|
||||
|
||||
Test_lexer.prototype = {
|
||||
Lexer.prototype = {
|
||||
types: types,
|
||||
errors: errors,
|
||||
_notFoundCloseQuote: function () {
|
||||
@ -463,7 +436,8 @@ Test_lexer.prototype = {
|
||||
++this._yy_cursor;
|
||||
case 5:
|
||||
{
|
||||
this._unknownSymbol();this._set_next();
|
||||
this._unknownSymbol();
|
||||
this._set_next();
|
||||
return;
|
||||
}
|
||||
case 6:
|
||||
@ -563,7 +537,8 @@ Test_lexer.prototype = {
|
||||
break;
|
||||
case 21:
|
||||
{
|
||||
this._foundLexeme("DOT");this._set_next();
|
||||
this._foundLexeme("DOT");
|
||||
this._set_next();
|
||||
return;
|
||||
}
|
||||
case 22:
|
||||
@ -600,7 +575,8 @@ Test_lexer.prototype = {
|
||||
break;
|
||||
case 26:
|
||||
{
|
||||
this._foundLexeme("INTEGER_LITERAL");this._set_next();
|
||||
this._foundLexeme("INTEGER_LITERAL");
|
||||
this._set_next();
|
||||
return;
|
||||
}
|
||||
case 27:
|
||||
@ -624,7 +600,8 @@ Test_lexer.prototype = {
|
||||
break;
|
||||
case 30:
|
||||
{
|
||||
this._foundLexeme("LT");this._set_next();
|
||||
this._foundLexeme("LT");
|
||||
this._set_next();
|
||||
return;
|
||||
}
|
||||
case 31:
|
||||
@ -655,7 +632,8 @@ Test_lexer.prototype = {
|
||||
break;
|
||||
case 33:
|
||||
{
|
||||
this._foundLexeme("GT");this._set_next();
|
||||
this._foundLexeme("GT");
|
||||
this._set_next();
|
||||
return;
|
||||
}
|
||||
case 34:
|
||||
@ -677,7 +655,8 @@ Test_lexer.prototype = {
|
||||
break;
|
||||
case 35:
|
||||
{
|
||||
this._foundLexeme("ID");this._set_next();
|
||||
this._foundLexeme("ID");
|
||||
this._set_next();
|
||||
return;
|
||||
}
|
||||
case 36:
|
||||
@ -959,7 +938,8 @@ Test_lexer.prototype = {
|
||||
break;
|
||||
case 56:
|
||||
{
|
||||
this._foundLexeme("FLOAT_LITERAL");this._set_next();
|
||||
this._foundLexeme("FLOAT_LITERAL");
|
||||
this._set_next();
|
||||
return;
|
||||
}
|
||||
case 57:
|
||||
@ -1140,7 +1120,8 @@ Test_lexer.prototype = {
|
||||
break;
|
||||
case 70:
|
||||
{
|
||||
this._foundLexeme("OR");this._set_next();
|
||||
this._foundLexeme("OR");
|
||||
this._set_next();
|
||||
return;
|
||||
}
|
||||
case 71:
|
||||
@ -1285,7 +1266,8 @@ Test_lexer.prototype = {
|
||||
break;
|
||||
case 76:
|
||||
{
|
||||
this._foundLexeme("AND");this._set_next();
|
||||
this._foundLexeme("AND");
|
||||
this._set_next();
|
||||
return;
|
||||
}
|
||||
case 77:
|
||||
@ -1420,7 +1402,8 @@ Test_lexer.prototype = {
|
||||
break;
|
||||
case 82:
|
||||
{
|
||||
this._foundLexeme("NOT");this._set_next();
|
||||
this._foundLexeme("NOT");
|
||||
this._set_next();
|
||||
return;
|
||||
}
|
||||
case 83:
|
||||
@ -1664,7 +1647,8 @@ Test_lexer.prototype = {
|
||||
break;
|
||||
case 92:
|
||||
{
|
||||
this._foundLexeme("LIKE");this._set_next();
|
||||
this._foundLexeme("LIKE");
|
||||
this._set_next();
|
||||
return;
|
||||
}
|
||||
case 93:
|
||||
@ -1758,7 +1742,8 @@ Test_lexer.prototype = {
|
||||
break;
|
||||
case 95:
|
||||
{
|
||||
this._foundLexeme("BOOL_LITERAL");this._set_next();
|
||||
this._foundLexeme("BOOL_LITERAL");
|
||||
this._set_next();
|
||||
return;
|
||||
}
|
||||
case 96:
|
||||
@ -1840,7 +1825,8 @@ Test_lexer.prototype = {
|
||||
break;
|
||||
case 97:
|
||||
{
|
||||
this._foundLexeme("TIME");this._set_next();
|
||||
this._foundLexeme("TIME");
|
||||
this._set_next();
|
||||
return;
|
||||
}
|
||||
case 98:
|
||||
@ -1933,7 +1919,8 @@ Test_lexer.prototype = {
|
||||
break;
|
||||
case 100:
|
||||
{
|
||||
this._foundLexeme("NLIKE");this._set_next();
|
||||
this._foundLexeme("NLIKE");
|
||||
this._set_next();
|
||||
return;
|
||||
}
|
||||
case 101:
|
||||
@ -2052,7 +2039,8 @@ Test_lexer.prototype = {
|
||||
break;
|
||||
case 105:
|
||||
{
|
||||
this._foundLexeme("ADDRESS");this._set_next();
|
||||
this._foundLexeme("ADDRESS");
|
||||
this._set_next();
|
||||
return;
|
||||
}
|
||||
case 106:
|
||||
@ -2145,7 +2133,8 @@ Test_lexer.prototype = {
|
||||
break;
|
||||
case 108:
|
||||
{
|
||||
this._foundLexeme("TIMEDIFF");this._set_next();
|
||||
this._foundLexeme("TIMEDIFF");
|
||||
this._set_next();
|
||||
return;
|
||||
}
|
||||
|
||||
@ -2206,4 +2195,7 @@ var print_f = function() {
|
||||
|
||||
return r_str;
|
||||
};
|
||||
module.exports = Test_lexer
|
||||
|
||||
|
||||
(new Lexer("[")).search();
|
||||
module.exports = Lexer
|
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.
|
||||
*/
|
||||
|
||||
var js_beautify = require("js-beautify");
|
||||
var args = require("args-parser")(process.argv);
|
||||
var js_beautify = require("./libs/js-beautifier");
|
||||
var args = require("./libs/args-parser")(process.argv);
|
||||
var fs = require("fs");
|
||||
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)){
|
||||
fs.mkdirSync(output_path);
|
||||
|
@ -7,8 +7,5 @@
|
||||
"name": "chichenkov",
|
||||
"email": "rolahd@yandex.ru"
|
||||
},
|
||||
"dependencies": {
|
||||
"args-parser": "^1.1.0",
|
||||
"js-beautify": "^1.8.9"
|
||||
}
|
||||
"dependencies": {}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user