-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace resolver/ast.ts with parser/ast.d.ts
- Loading branch information
Showing
8 changed files
with
73 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
export declare class SyntaxNode { | ||
readonly type: string; | ||
} | ||
|
||
export declare class Identifier extends SyntaxNode { | ||
readonly type: "Identifer"; | ||
readonly name: string; | ||
} | ||
|
||
export declare class StringLiteral extends SyntaxNode { | ||
readonly type: "StringLiteral"; | ||
readonly value: string; | ||
parse(): {value: string}; | ||
} | ||
|
||
export declare class MessageReference extends SyntaxNode { | ||
readonly type: "MessageReference"; | ||
readonly id: Identifier; | ||
readonly attribute: Identifier | null; | ||
} | ||
|
||
export type InlineExpression = StringLiteral | MessageReference; | ||
|
||
export type Expression = InlineExpression; | ||
|
||
export declare class TextElement extends SyntaxNode { | ||
readonly type: "TextElement"; | ||
readonly value: string; | ||
} | ||
|
||
export declare class Placeable extends SyntaxNode { | ||
readonly type: "Placeable"; | ||
readonly expression: Expression; | ||
} | ||
|
||
export type PatternElement = TextElement | Placeable; | ||
|
||
export declare class Pattern extends SyntaxNode { | ||
readonly type: "Pattern"; | ||
readonly elements: Array<PatternElement>; | ||
} | ||
|
||
export declare class Message extends SyntaxNode { | ||
readonly type: "Message"; | ||
readonly id: Identifier; | ||
readonly value: Pattern | null; | ||
readonly attributes: Array<Attribute>; | ||
} | ||
|
||
export declare class Attribute extends SyntaxNode { | ||
readonly type: "Attribute"; | ||
readonly id: Identifier; | ||
readonly value: Pattern; | ||
} | ||
|
||
export type Entry = Message; | ||
|
||
export declare class Resource extends SyntaxNode { | ||
readonly type: "Resource"; | ||
readonly body: Array<Entry>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
import {Resource} from "../../format/resolver/ast"; | ||
import * as ast from "./ast"; | ||
interface Result<T, E> { | ||
fold(s: (value: T) => T, f: (err: E) => never): T; | ||
} | ||
|
||
interface Parser { | ||
run(input: string): Result<Resource, string>; | ||
run(input: string): Result<ast.Resource, string>; | ||
} | ||
|
||
export declare let Resource: Parser; |