mirror of
https://github.com/chrisnov-it/quantumbotx.git
synced 2026-07-29 11:47:48 +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.
64 lines
1.5 KiB
JavaScript
64 lines
1.5 KiB
JavaScript
import {
|
|
Function as FunctionToken,
|
|
RightParenthesis
|
|
} from '../../tokenizer/index.js';
|
|
|
|
export const name = 'FeatureFunction';
|
|
export const structure = {
|
|
kind: String,
|
|
feature: String,
|
|
value: ['Declaration', 'Selector']
|
|
};
|
|
|
|
function getFeatureParser(kind, name) {
|
|
const featuresOfKind = this.features[kind] || {};
|
|
const parser = featuresOfKind[name];
|
|
|
|
if (typeof parser !== 'function') {
|
|
this.error(`Unknown feature ${name}()`);
|
|
}
|
|
|
|
return parser;
|
|
}
|
|
|
|
export function parse(kind = 'unknown') {
|
|
const start = this.tokenStart;
|
|
const functionName = this.consumeFunctionName();
|
|
const valueParser = getFeatureParser.call(this, kind, functionName.toLowerCase());
|
|
|
|
this.skipSC();
|
|
|
|
const value = this.parseWithFallback(
|
|
() => {
|
|
const startValueToken = this.tokenIndex;
|
|
const value = valueParser.call(this);
|
|
|
|
if (this.eof === false &&
|
|
this.isBalanceEdge(startValueToken) === false) {
|
|
this.error();
|
|
}
|
|
|
|
return value;
|
|
},
|
|
() => this.Raw(null, false)
|
|
);
|
|
|
|
if (!this.eof) {
|
|
this.eat(RightParenthesis);
|
|
}
|
|
|
|
return {
|
|
type: 'FeatureFunction',
|
|
loc: this.getLocation(start, this.tokenStart),
|
|
kind,
|
|
feature: functionName,
|
|
value
|
|
};
|
|
}
|
|
|
|
export function generate(node) {
|
|
this.token(FunctionToken, node.feature + '(');
|
|
this.node(node.value);
|
|
this.token(RightParenthesis, ')');
|
|
}
|