You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/compiler.ts
+14-14Lines changed: 14 additions & 14 deletions
Original file line number
Diff line number
Diff line change
@@ -68,7 +68,7 @@ export class SyntaxScriptCompiler {
68
68
* Compiles one .syx file from the path given.
69
69
* @param {string} file Path to a file to compile.
70
70
* @author efekos
71
-
* @version 1.0.2
71
+
* @version 1.0.3
72
72
* @since 0.0.1-alpha
73
73
*/
74
74
publiccompileSyx(file: string){
@@ -106,7 +106,7 @@ export class SyntaxScriptCompiler {
106
106
constcompileStmt=stmtasCompileStatement;
107
107
108
108
compileStmt.formats.forEach(frmt=>{
109
-
if(operatorStmtExport.outputGenerators[frmt]!==undefined)thrownewCompilerError({character: compileStmt.pos,line: compileStmt.line},`Duplicate file format at compile statement \'${frmt}\'`);
109
+
if(operatorStmtExport.outputGenerators[frmt]!==undefined)thrownewCompilerError(compileStmt.range,`Duplicate file format at compile statement \'${frmt}\'`);
@@ -131,11 +131,11 @@ export class SyntaxScriptCompiler {
131
131
constimportStmt=stmtasImportsStatement;
132
132
133
133
importStmt.formats.forEach(frmt=>{
134
-
if(operatorStmtExport.imports[frmt]!==undefined)thrownewCompilerError({character: importStmt.pos,line: importStmt.line},`Duplicate file format at imports statement \'${frmt}\'`);
134
+
if(operatorStmtExport.imports[frmt]!==undefined)thrownewCompilerError(importStmt.range,`Duplicate file format at imports statement \'${frmt}\'`);
if(compileStatement.body[0].type!==NodeType.String)thrownewCompilerError({character: compileStatement.pos,line: compileStatement.line},'Expected a string after compile statement parens');
150
+
if(compileStatement.body[0].type!==NodeType.String)thrownewCompilerError(compileStatement.range,'Expected a string after compile statement parens');
151
151
compileStatement.formats.forEach(each=>{
152
-
if(statementExport.formatNames[each]!==undefined)thrownewCompilerError({character: compileStatement.pos,line: compileStatement.line},`Encountered multiple compile statements for target language '${each}'`);
152
+
if(statementExport.formatNames[each]!==undefined)thrownewCompilerError(compileStatement.range,`Encountered multiple compile statements for target language '${each}'`);
if(statementExport.imports[each]!==undefined)thrownewCompilerError({character: importsStatement.pos,line: importsStatement.line},`Encountered multiple import statements for target language '${each}'`);
158
+
if(statementExport.imports[each]!==undefined)thrownewCompilerError(importsStatement.range,`Encountered multiple import statements for target language '${each}'`);
if(!existsSync(pathToImport))thrownewCompilerError({character: importStmt.pos,line: importStmt.line},`File \'${pathToImport}\' imported from \'${file}\' does not exist.`);
212
+
if(!existsSync(pathToImport))thrownewCompilerError(importStmt.range,`File \'${pathToImport}\' imported from \'${file}\' does not exist.`);
213
213
this.exportData[pathToImport].forEach(exported=>{
214
214
if(exported.type===ExportType.Operator)
215
-
if(imported.filter(r=>r.type===ExportType.Operator).some(i=>exported.regexMatcher===(iasOperator).regexMatcher))thrownewCompilerError({character: importStmt.pos,line: importStmt.line},`There are more than one operators with the same syntax imported to \'${file}\'.`);
215
+
if(imported.filter(r=>r.type===ExportType.Operator).some(i=>exported.regexMatcher===(iasOperator).regexMatcher))thrownewCompilerError(importStmt.range,`There are more than one operators with the same syntax imported to \'${file}\'.`);
216
216
imported.push(exported);
217
217
});
218
218
}
@@ -235,11 +235,11 @@ export class SyntaxScriptCompiler {
235
235
imported.forEach(i=>{
236
236
237
237
if(i.type===ExportType.Operator){
238
-
if(i.outputGenerators[this.mainFileFormat]===undefined)thrownewCompilerError({character:1,line:1},`Can't compile operator to target language (${this.mainFileFormat}).`);
238
+
if(i.outputGenerators[this.mainFileFormat]===undefined)thrownewCompilerError({end:{character:0,line:0},start:{character:0,line:0}},`Can't compile operator to target language (${this.mainFileFormat}).`);
if(i.formatNames[this.mainFileFormat]===undefined)thrownewCompilerError({character:1,line:1},`Can't compile function to target language (${this.mainFileFormat}).`);
242
+
if(i.formatNames[this.mainFileFormat]===undefined)thrownewCompilerError({end:{character:0,line:0},start:{character:0,line:0}},`Can't compile function to target language (${this.mainFileFormat}).`);
0 commit comments