Skip to content

syntax-script/compiler

Repository files navigation

@syntaxs/compiler v0.0.3-alpha

Stars Releases Version License

Main compiler module of Syntax Script.

This module is used to either compile a syntax script project, or create diagnostic reports for language servers.

Usage

Using the compiler.

import { SyntaxScriptCompiler } from '@syntaxs/compiler';

const compiler = new SyntaxScriptCompiler('/path/to/root/dir','/path/to/out/dir','ts');
compiler.compile();

Creating diagnostic reports for language servers.

import {createSyntaxScriptDiagnosticReport} from '@syntaxs/compiler';

const report = createSyntaxScriptDiagnosticReport('/path/to/file.syx');
console.log(`${report.items.length} Problems found in the file.`);

Handling compiler errors.

import { SyntaxScriptCompiler,isCompilerError } from '@syntaxs/compiler';

const compiler = new SyntaxScriptCompiler('/path/to/root/dir','/path/to/out/dir','ts');
try {
    compiler.compile();
} catch (e) {
    if(isCompilerError(e)) {
        console.log(`There is a syntax error in the file: ${e.message}`);
        console.log(`This problem is at line ${e.range.start.line}`);
        console.log(`There are ${e.actions.length} recommended solutions to this problem.`)
    }
}
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy