Skip to content

Commit f03c6ff

Browse files
committed
format code
1 parent 0dc90e4 commit f03c6ff

File tree

5 files changed

+18
-18
lines changed

5 files changed

+18
-18
lines changed

src/compiler.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ export class SyntaxScriptCompiler {
160160
out.push(statementExport);
161161
} else if (statementIsA(statement, NodeType.Keyword)) {
162162
out.push({ type: ExportType.Keyword, word: statement.word });
163-
} else if (statementIsA(statement,NodeType.Global)) {
163+
} else if (statementIsA(statement, NodeType.Global)) {
164164
//TODO
165165
} else throw new CompilerError(statement.range, `Unexpected \'${statement.type}\' statement after export statement.`, file);
166166

src/diagnostic.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export function createSyntaxScriptDiagnosticReport(filePath: string, fileContent
4545
data: error.actions
4646
});
4747
} else {
48-
items.push({message:`Parser Error: ${error.message}`,range:{end:{line:0,character:1},start:{line:0,character:0}},severity:DiagnosticSeverity.Warning});
48+
items.push({ message: `Parser Error: ${error.message}`, range: { end: { line: 0, character: 1 }, start: { line: 0, character: 0 } }, severity: DiagnosticSeverity.Warning });
4949
}
5050
} finally {
5151
return { items, kind: DocumentDiagnosticReportKind.Full };
@@ -247,7 +247,7 @@ function exportableCheck(statements: Statement[], filePath: string): Diagnostic[
247247
] as CodeAction[]
248248
});
249249

250-
if (dictionary.StatementTypesWithBody.includes(stmt.type)) items.push(...exportableCheck((stmt as GlobalStatement).body,filePath));
250+
if (dictionary.StatementTypesWithBody.includes(stmt.type)) items.push(...exportableCheck((stmt as GlobalStatement).body, filePath));
251251
});
252252

253253
return items;

src/dictionary/dictionary.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,31 +6,31 @@ const rules: Rule[] = [
66
name: 'imports-keyword',
77
type: 'keyword',
88
default: 'import',
9-
conflicts:[]
9+
conflicts: []
1010
},
1111
{
1212
name: 'function-value-return-enabled',
1313
type: 'boolean',
1414
default: false,
15-
conflicts:[]
15+
conflicts: []
1616
},
1717
{
1818
name: 'function-value-return-keyword',
1919
type: 'keyword',
2020
default: 'return',
21-
conflicts:[]
21+
conflicts: []
2222
},
2323
{
2424
name: 'enforce-single-string-quotes',
2525
type: 'boolean',
2626
default: false,
27-
conflicts:['enforge-double-string-quotes']
27+
conflicts: ['enforge-double-string-quotes']
2828
},
2929
{
3030
name: 'enforce-double-string-quotes',
3131
type: 'boolean',
3232
default: false,
33-
conflicts:['enforce-single-string-quotes']
33+
conflicts: ['enforce-single-string-quotes']
3434
}
3535
];
3636

@@ -54,7 +54,7 @@ export namespace dictionary {
5454
export const PrimitiveTypes: string[] = ['int', 'decimal', 'boolean', 'string'];
5555
export const Keywords: string[] = ['export', 'rule', 'keyword', 'import', 'operator', 'function', 'global'];
5656
export const Functionaries: Functionary[] = func;
57-
export const ExportableNodeTypes: NodeType[] = [NodeType.Function,NodeType.Operator,NodeType.Keyword,NodeType.Rule,NodeType.Global];
58-
export const StatementTypesWithBody: NodeType[] = [NodeType.Operator,NodeType.Function,NodeType.Global];
57+
export const ExportableNodeTypes: NodeType[] = [NodeType.Function, NodeType.Operator, NodeType.Keyword, NodeType.Rule, NodeType.Global];
58+
export const StatementTypesWithBody: NodeType[] = [NodeType.Operator, NodeType.Function, NodeType.Global];
5959

6060
}

src/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import { AnyExportable, ExportType, Exported, ExportedFunction, ExportedKeyword, ExportedOperator, OneParameterMethod, ReturnerMethod, SyntaxScriptCompiler, escapeRegex } from './compiler.js';
1+
import { AnyExportable, ExportType, Exported, ExportedFunction, ExportedKeyword, ExportedOperator, OneParameterMethod, ReturnerMethod, SyntaxScriptCompiler, escapeRegex } from './compiler.js';
22
import { BaseRule, BooleanRule, Functionary, FunctionaryValueType, Rule, RuleType, StringRule, dictionary } from './dictionary/index.js';
3-
import { BraceExpression, CompileStatement, CompilerError, Expression, FunctionStatement, GlobalStatement, ImportStatement, ImportsStatement, KeywordStatement, Node, NodeType, OperatorStatement, ParenExpression, PrimitiveTypeExpression, ProgramStatement, RuleStatement, SquareExpression,Statement,StringExpression,SyxConfig,SyxConfigCompile,Token,TokenType,VariableExpression,WhitespaceIdentifierExpression,isCompilerError,statementIsA } from './types.js';
4-
import { createSyntaxScriptDiagnosticReport,subRange } from './diagnostic.js';
3+
import { BraceExpression, CompileStatement, CompilerError, Expression, FunctionStatement, GlobalStatement, ImportStatement, ImportsStatement, KeywordStatement, Node, NodeType, OperatorStatement, ParenExpression, PrimitiveTypeExpression, ProgramStatement, RuleStatement, SquareExpression, Statement, StringExpression, SyxConfig, SyxConfigCompile, Token, TokenType, VariableExpression, WhitespaceIdentifierExpression, isCompilerError, statementIsA } from './types.js';
4+
import { createSyntaxScriptDiagnosticReport, subRange } from './diagnostic.js';
55
import { sysparser, syxparser } from './ast.js';
66
import { tokenizeSys, tokenizeSyx } from './lexer.js';
77

src/test/compiler.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { CompileStatement, FunctionStatement, GlobalStatement, ImportStatement, ImportsStatement, KeywordStatement, NodeType, ProgramStatement, RuleStatement, TokenType, isCompilerError } from '../types.js';
22
import { Diagnostic, DiagnosticSeverity, DocumentDiagnosticReportKind, Range } from 'lsp-types';
3-
import { describe, inst, it, onError } from '@efekos/es-test/bin/testRunner.js';
3+
import { describe, inst, it } from '@efekos/es-test/bin/testRunner.js';
44
import { tokenizeSys, tokenizeSyx } from '../lexer.js';
55
import { createSyntaxScriptDiagnosticReport } from '../diagnostic.js';
66
import { expect } from 'chai';
@@ -23,7 +23,7 @@ describe('Compiler module', () => {
2323

2424
const tokens = tokenizeSyx('keyword hello;');
2525

26-
tokens.map(r=>r.range).forEach(r=>rangeExpectations(r));
26+
tokens.map(r => r.range).forEach(r => rangeExpectations(r));
2727
expect(tokens[0].range).to.deep.equal({ end: { line: 1, character: 8 }, start: { line: 1, character: 1 } });
2828
expect(tokens[1].range).to.deep.equal({ end: { line: 1, character: 14 }, start: { line: 1, character: 9 } });
2929
expect(tokens[2].range).to.deep.equal({ end: { line: 1, character: 15 }, start: { line: 1, character: 14 } });
@@ -35,7 +35,7 @@ describe('Compiler module', () => {
3535
const tokens = tokenizeSyx('rule "imports-keyword": cray;');
3636

3737
expect(tokens).to.be.a('array').to.have.lengthOf(10);
38-
tokens.map(r=>r.range).forEach(r=>rangeExpectations(r));
38+
tokens.map(r => r.range).forEach(r => rangeExpectations(r));
3939
expect(tokens[0].range).to.be.deep.equal({ end: { line: 1, character: 5 }, start: { line: 1, character: 1 } });
4040
expect(tokens[1].range).to.be.deep.equal({ end: { line: 1, character: 7 }, start: { line: 1, character: 6 } });
4141
expect(tokens[2].range).to.be.deep.equal({ end: { line: 1, character: 14 }, start: { line: 1, character: 7 } });
@@ -48,11 +48,11 @@ describe('Compiler module', () => {
4848

4949
});
5050

51-
inst(()=>{
51+
inst(() => {
5252
const tokens = tokenizeSyx('rule "return-function-value-enabled":true;');
5353

5454
expect(tokens).to.be.a('array').to.have.lengthOf(14);
55-
tokens.map(r=>r.range).forEach(r=>rangeExpectations(r));
55+
tokens.map(r => r.range).forEach(r => rangeExpectations(r));
5656
expect(tokens[0].range).to.be.deep.equal({ end: { line: 1, character: 5 }, start: { line: 1, character: 1 } });
5757
expect(tokens[1].range).to.be.deep.equal({ end: { line: 1, character: 7 }, start: { line: 1, character: 6 } });
5858
expect(tokens[2].range).to.be.deep.equal({ end: { line: 1, character: 13 }, start: { line: 1, character: 7 } });

0 commit comments

Comments
 (0)