Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
constructor(public connection: IConnection) {
this.connection = connection;
this.originalOpenDocuments = [];
this.gmlGrammar = grammar(fse.readFileSync(path.join(__dirname, path.normalize('../lib/gmlGrammar.ohm')), 'utf-8'));
this.__dirName = path.normalize(__dirname);
// Create our tools:
this.reference = new Reference(this);
this.fsManager = new FileSystem(this.gmlGrammar, this);
this.initialStartup = new InitialAndShutdown(this.reference, this.gmlGrammar, this);
//#region Language Services
this.gmlHoverProvider = new GMLHoverProvider(this.reference, this.fsManager);
this.gmlDefinitionProvider = new GMLDefinitionProvider(this.reference, this);
this.gmlSignatureProvider = new GMLSignatureProvider(this.reference, this.fsManager);
this.gmlCompletionProvider = new GMLCompletionProvider(this.reference, this.fsManager);
this.timer = new TimeUtil();
// Basic User Settings
this.userSettings = {
function makeGrammar(source, optNamespace) {
if (Array.isArray(source)) {
source = source.join('\n');
}
return ohm.grammar(source, optNamespace);
}
constructor() {
const grammarPath = path.join(
__dirname, '..', 'component', 'component.grammar.ohm');
this.grammar = ohm.grammar(readFileSync(grammarPath, 'utf-8'));
this.semantics = this.grammar.createSemantics();
}
= "(" Exp ")" -- paren
| "+" PriExp -- pos
| "-" PriExp -- neg
| cell
| number
cell (a cell)
= upper+ digit+
number (a number)
= digit* "." digit+ -- fract
| digit+ -- whole
}
`;
const formulaGrammar = ohm.grammar(GRAMMAR_SRC);
class UnOp {
constructor(child) {
this.child = child;
}
}
class BinOp {
constructor(left, right) {
this.left = left;
this.right = right;
}
}
class Plus extends BinOp {
eval(name, cells) {
constructor() {
const grammar_path = path.join(__dirname, "grammar.ohm");
this._grammar = ohm.grammar(fs.readFileSync(grammar_path, "utf-8"));
this._semantics = this._grammar.createSemantics()
.addOperation("tbonds", {
ClicheDecl: (cliche, name, uses, key1, para, key2) => {
this.cliche_map = this._get_cliche_map(name.sourceString, uses);
return _u
.chain(para.tbonds())
.flatten()
.reject(_u.isEmpty)
.value();
},
Paragraph_widget: decl => [],
Paragraph_data: decl => decl.tbonds(),
Paragraph_assignment: decl => [],
DataDecl: (data, name, key1, fields, key2, bond) => {
const subtype = name.sourceString;
const mapped_cliche = this.cliche_map["this"];
constructor() {
this.contents = fs.readFileSync(__dirname + "/src/moniel.ohm", "utf8")
this.grammar = ohm.grammar(this.contents)
this.semantics = this.grammar.createSemantics().addOperation("eval", this.evalOperation)
}
function makeParser(code) {
const grammar = Ohm.grammar(code);
const parse = (source, rule, { filename }) => {
const match = grammar.match(source, rule);
if (match.failed()) {
throw new SyntaxError(match.message);
}
return match;
};
return parse;
}
constructor() {
const grammarPath = path.join(__dirname, 'dv.ohm');
this.grammar = ohm.grammar(readFileSync(grammarPath, 'utf-8'));
this.semantics = this.grammar.createSemantics();
}