-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
27 changed files
with
125 additions
and
264 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 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,11 +1,8 @@ | ||
import { Text } from '../redux/editor/types' | ||
import { Sign } from './sign' | ||
|
||
function CodeToString(text: Text): string { | ||
export function CodeToString(text: Text): string { | ||
return text.map( | ||
(row) => row.letters.map((letter) => `${Sign[letter.sign]};`).join('') | ||
).join('\n') | ||
} | ||
|
||
export { CodeToString } | ||
|
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 |
---|---|---|
@@ -1,57 +1,53 @@ | ||
import { Sign } from '../../lib/sign' | ||
|
||
interface LetterSize { | ||
export interface LetterSize { | ||
edgePx: number | ||
marginPx: number | ||
} | ||
|
||
interface Letter { | ||
export interface Letter { | ||
id: string | ||
sign: Sign | ||
} | ||
|
||
interface LetterRow { | ||
export interface LetterRow { | ||
id: string | ||
letters: Letter[] | ||
} | ||
|
||
type AlphabetCategory = { name: string, signs: Sign[] } | ||
type CategorizedAlphabet = AlphabetCategory[] | ||
type Text = LetterRow[] | ||
type FileName = string | ||
type SignToGifMap = Map<Sign, FileName> | ||
export type AlphabetCategory = { name: string, signs: Sign[] } | ||
export type CategorizedAlphabet = AlphabetCategory[] | ||
export type Text = LetterRow[] | ||
export type FileName = string | ||
export type SignToGifMap = Map<Sign, FileName> | ||
|
||
interface PositionPixels { | ||
export interface PositionPixels { | ||
x: number | ||
y: number | ||
} | ||
|
||
interface PositionRowCol { | ||
export interface PositionRowCol { | ||
row: number | ||
col: number | ||
} | ||
|
||
enum RunState { | ||
export enum RunState { | ||
STARTING, RUNNING, DEBUG_WAITING, DEBUG_RUNNING, NOT_RUNNING | ||
} | ||
|
||
interface ExecutionState { | ||
export interface ExecutionState { | ||
state: RunState | ||
output: string | ||
worker: Worker | null | ||
resolveNextStep: () => void | ||
lineno: number | ||
} | ||
|
||
interface EditorState { | ||
export interface EditorState { | ||
text: Text, | ||
cursorPosition: PositionRowCol | ||
letterSize: LetterSize, | ||
signToGifMap: SignToGifMap, | ||
alphabet: CategorizedAlphabet, | ||
execution: ExecutionState, | ||
} | ||
|
||
|
||
export { EditorState, RunState, Text, ExecutionState, LetterSize, SignToGifMap, PositionRowCol, PositionPixels, Letter, LetterRow, CategorizedAlphabet, AlphabetCategory } | ||
|
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 |
---|---|---|
@@ -1,16 +1,13 @@ | ||
import { EditorState } from './editor/types' | ||
|
||
interface State { | ||
export interface State { | ||
readonly editor: EditorState | ||
} | ||
|
||
// "My" prefix is used to distinguish this interface from "Action" interface | ||
// found in redux. | ||
interface MyAction<Payload = undefined> { | ||
export interface MyAction<Payload = undefined> { | ||
type: string | ||
payload?: Payload | ||
reducer: (state: State) => State | ||
} | ||
|
||
export { State, MyAction } | ||
|
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,13 +1,10 @@ | ||
type JisonLocator = { | ||
export type JisonLocator = { | ||
first_line: number, | ||
first_column: number, | ||
last_line: number, | ||
last_column: number | ||
} | ||
|
||
abstract class AstNode { | ||
export abstract class AstNode { | ||
constructor(readonly locator: JisonLocator) { } | ||
} | ||
|
||
export { AstNode, JisonLocator } | ||
|
Oops, something went wrong.