diff --git a/format/lib/tools.ts b/format/lib/tools.ts index 7e59612..5d3e746 100644 --- a/format/lib/tools.ts +++ b/format/lib/tools.ts @@ -1,4 +1,4 @@ -import {NodeType} from "../resolver/ast"; +import {NodeType} from "../../syntax/parser/ast"; import {Bundle} from "../resolver/bundle"; import {ErrorKind} from "../resolver/error"; import {Resource} from "../resolver/resource"; diff --git a/format/resolver/bundle.ts b/format/resolver/bundle.ts index 4079797..ca1048b 100644 --- a/format/resolver/bundle.ts +++ b/format/resolver/bundle.ts @@ -1,4 +1,4 @@ -import {NodeType, Pattern} from "./ast"; +import {NodeType, Pattern} from "../../syntax/parser/ast"; import {ScopeError} from "./error"; import {Message} from "./message"; import {Resource} from "./resource"; diff --git a/format/resolver/message.ts b/format/resolver/message.ts index 5f2de37..2a82e98 100644 --- a/format/resolver/message.ts +++ b/format/resolver/message.ts @@ -1,4 +1,4 @@ -import {Pattern} from "./ast"; +import {Pattern} from "../../syntax/parser/ast"; export interface Message { readonly id: string; diff --git a/format/resolver/resource.ts b/format/resolver/resource.ts index 767cde5..8ea8fd0 100644 --- a/format/resolver/resource.ts +++ b/format/resolver/resource.ts @@ -1,5 +1,5 @@ +import {Entry} from "../../syntax/parser/ast"; import {Resource as ResourceParser} from "../../syntax/parser/grammar"; -import {Entry} from "./ast"; export class Resource { public readonly body: Array; diff --git a/format/resolver/scope.ts b/format/resolver/scope.ts index 5b48b6b..0b7ac91 100644 --- a/format/resolver/scope.ts +++ b/format/resolver/scope.ts @@ -1,4 +1,4 @@ -import * as ast from "./ast"; +import * as ast from "../../syntax/parser/ast"; import {ErrorKind, ScopeError} from "./error"; import {Message} from "./message"; import {NoneValue, StringValue, Value} from "./value"; diff --git a/format/resolver/ast.ts b/syntax/parser/ast.d.ts similarity index 73% rename from format/resolver/ast.ts rename to syntax/parser/ast.d.ts index b7acb07..fb39ef0 100644 --- a/format/resolver/ast.ts +++ b/syntax/parser/ast.d.ts @@ -10,22 +10,22 @@ export enum NodeType { Resource = "Resource", } -export interface SyntaxNode { +export declare class SyntaxNode { readonly type: NodeType; } -export interface Identifier extends SyntaxNode { +export declare class Identifier extends SyntaxNode { readonly type: NodeType.Identifer; readonly name: string; } -export interface StringLiteral extends SyntaxNode { +export declare class StringLiteral extends SyntaxNode { readonly type: NodeType.StringLiteral; readonly value: string; parse(): {value: string}; } -export interface MessageReference extends SyntaxNode { +export declare class MessageReference extends SyntaxNode { readonly type: NodeType.MessageReference; readonly id: Identifier; readonly attribute: Identifier | null; @@ -35,31 +35,31 @@ export type InlineExpression = StringLiteral | MessageReference; export type Expression = InlineExpression; -export interface TextElement extends SyntaxNode { +export declare class TextElement extends SyntaxNode { readonly type: NodeType.TextElement; readonly value: string; } -export interface Placeable extends SyntaxNode { +export declare class Placeable extends SyntaxNode { readonly type: NodeType.Placeable; readonly expression: Expression; } export type PatternElement = TextElement | Placeable; -export interface Pattern extends SyntaxNode { +export declare class Pattern extends SyntaxNode { readonly type: NodeType.Pattern; readonly elements: Array; } -export interface Message extends SyntaxNode { +export declare class Message extends SyntaxNode { readonly type: NodeType.Message; readonly id: Identifier; readonly value: Pattern | null; readonly attributes: Array; } -export interface Attribute extends SyntaxNode { +export declare class Attribute extends SyntaxNode { readonly type: NodeType.Attribute; readonly id: Identifier; readonly value: Pattern; @@ -67,7 +67,7 @@ export interface Attribute extends SyntaxNode { export type Entry = Message; -export interface Resource extends SyntaxNode { +export declare class Resource extends SyntaxNode { readonly type: NodeType.Resource; readonly body: Array; } diff --git a/syntax/parser/grammar.d.ts b/syntax/parser/grammar.d.ts index 22ccad7..56a3c14 100644 --- a/syntax/parser/grammar.d.ts +++ b/syntax/parser/grammar.d.ts @@ -1,10 +1,10 @@ -import {Resource} from "../../format/resolver/ast"; +import * as ast from "./ast"; interface Result { fold(s: (value: T) => T, f: (err: E) => never): T; } interface Parser { - run(input: string): Result; + run(input: string): Result; } export declare let Resource: Parser;