mirror of
https://github.com/chrisnov-it/quantumbotx.git
synced 2026-07-28 19:27:44 +00:00
aa984c4909
- Update `.gitignore` to include `lab/` for backtesting and raw data. - Refactor `app.py` to improve error handling and logging. - Remove deprecated files: `core/bot_logic.py`, `core/bots/base_bot.py`, `core/bots/manager.py`, `core/db/database.py`, `core/routes/api_analysis.py`, `core/routes/api_bots_analysis.py`, `core/strategies/logic_ma.py`, `core/strategies/logic_rsi.py`. - Modify multiple files to enhance bot management, routing, and strategy handling. - Update JavaScript and HTML templates for better UI and functionality.
56 lines
1.6 KiB
JavaScript
56 lines
1.6 KiB
JavaScript
import { createParser } from '../parser/create.js';
|
|
import { createGenerator } from '../generator/create.js';
|
|
import { createConvertor } from '../convertor/create.js';
|
|
import { createWalker } from '../walker/create.js';
|
|
import { Lexer } from '../lexer/Lexer.js';
|
|
import mix from './config/mix.js';
|
|
import { getTokenizer } from '../utils/get-tokenizer.js';
|
|
|
|
function createSyntax(config) {
|
|
const parse = createParser(config);
|
|
const walk = createWalker(config);
|
|
const generate = createGenerator(config);
|
|
const { fromPlainObject, toPlainObject } = createConvertor(walk);
|
|
|
|
const syntax = {
|
|
lexer: null,
|
|
createLexer: config => new Lexer(config, syntax, syntax.lexer.structure),
|
|
|
|
tokenize: getTokenizer(config),
|
|
parse,
|
|
generate,
|
|
|
|
walk,
|
|
find: walk.find,
|
|
findLast: walk.findLast,
|
|
findAll: walk.findAll,
|
|
|
|
fromPlainObject,
|
|
toPlainObject,
|
|
|
|
fork(extension) {
|
|
const base = mix({}, config); // copy of config
|
|
|
|
return createSyntax(
|
|
typeof extension === 'function'
|
|
? extension(base) // TODO: remove Object.assign as second parameter
|
|
: mix(base, extension)
|
|
);
|
|
}
|
|
};
|
|
|
|
syntax.lexer = new Lexer({
|
|
generic: config.generic,
|
|
cssWideKeywords: config.cssWideKeywords,
|
|
units: config.units,
|
|
types: config.types,
|
|
atrules: config.atrules,
|
|
properties: config.properties,
|
|
node: config.node
|
|
}, syntax);
|
|
|
|
return syntax;
|
|
};
|
|
|
|
export default config => createSyntax(mix({}, config));
|