-
-
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
1 parent
0c97f83
commit 715fd93
Showing
3 changed files
with
94 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import type { MOT } from "./types"; | ||
|
||
export class MOTC { | ||
private _mot: MOT = { | ||
metadata: {}, | ||
chunks: [] | ||
}; | ||
|
||
private constructor(private _src: string) { } | ||
|
||
private _tokenize(): MOT { | ||
/** @todo */ | ||
|
||
return this._mot; | ||
} | ||
|
||
public static parse(src: string): MOT { | ||
return new MOTC(src)._tokenize(); | ||
} | ||
} |
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,24 @@ | ||
#name Sample Map | ||
#description This is a sample description! | ||
#author NriotHrreion | ||
|
||
@objects { | ||
ball { | ||
id: ball1; | ||
name: m; | ||
mass: 5; | ||
} | ||
|
||
block { | ||
id: block1; | ||
name: M; | ||
mass: 10; | ||
} | ||
} | ||
|
||
@when { | ||
3s { | ||
delete ball1; | ||
delete block1; | ||
} | ||
} |
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,50 @@ | ||
export interface MOT { | ||
metadata: { | ||
name?: string | ||
description?: string | ||
author?: string | ||
} | ||
|
||
chunks: Chunk[] | ||
} | ||
|
||
type ChunkName = "objects" | "when"; | ||
|
||
export interface Chunk { | ||
name: ChunkName | ||
members: Scope[] | ||
} | ||
|
||
export interface ObjectsChunk extends Chunk { | ||
name: "objects" | ||
members: ObjectScope[] | ||
} | ||
|
||
export interface WhenChunk extends Chunk { | ||
name: "when" | ||
members: TimeScope[] | ||
} | ||
|
||
export interface Scope { | ||
name: string | ||
} | ||
|
||
export interface ObjectScope extends Scope { | ||
properties: Property[] | ||
} | ||
|
||
export interface TimeScope extends Scope { | ||
statements: Statement[] | ||
} | ||
|
||
export interface Property { | ||
key: string | ||
value: string | ||
} | ||
|
||
type StatementVerb = "move" | "delete"; | ||
|
||
export interface Statement { | ||
verb: StatementVerb | ||
args: string[] | ||
} |