Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

- Translator implementing is in progress.

  • Loading branch information...
commit c3bea6cf12cc1413b49ec1696b48ae2a67b764ac 1 parent e53ab06
@graninas authored
View
10 Amoeba.cabal
@@ -64,9 +64,10 @@ library
Middleware.Parsing.Facade,
Middleware.Parsing.Common,
Middleware.Parsing.ParsecFacade,
- GameLogic.Language.RawToken,
GameLogic.Language.Parsers.RawParser,
- GameLogic.Language.Parsers.Common
+ GameLogic.Language.Parsers.Common,
+ GameLogic.Language.Parsers.RawToken,
+ GameLogic.Language.Translator
executable Amoeba
build-depends: base >= 4
@@ -101,7 +102,8 @@ executable Amoeba
Middleware.Parsing.Facade,
Middleware.Parsing.Common,
Middleware.Parsing.ParsecFacade,
- GameLogic.Language.RawToken,
GameLogic.Language.Parsers.RawParser,
- GameLogic.Language.Parsers.Common
+ GameLogic.Language.Parsers.Common,
+ GameLogic.Language.Parsers.RawToken,
+ GameLogic.Language.Translator
sers.ItemParser
View
2  Amoeba/Application/Boot.hs
@@ -16,7 +16,7 @@ boot cfg = do
logPath <- Cfg.extract cfg logPathLoader
dataPath <- Cfg.extract cfg dataPathLoader
- game <- loadGame dataPath
+ game <- loadWorld dataPath
viewSettings <- loadViewSettings cfg
withEnvironment $ do
view <- setupView viewSettings
View
9 Amoeba/Application/Storage/WorldLoader.hs
@@ -1,9 +1,12 @@
module Application.Storage.WorldLoader where
-worldFile dataPath = dataPath ++ "world.dat"
+import GameLogic.Language.Translator
+worldFile dataPath = dataPath ++ "Raws/world.arf"
-loadGame dataPath = do
- putStrLn $ worldFile dataPath
+
+loadWorld dataPath = do
+ worldContents <- readFile dataPath
+ return ()
View
2  Amoeba/GameLogic/Language/Parsers/Common.hs
@@ -1,7 +1,7 @@
module GameLogic.Language.Parsers.Common where
import Middleware.Parsing.Facade as P
-import GameLogic.Language.RawToken
+import GameLogic.Language.Parsers.RawToken
import Control.Monad (liftM)
View
2  Amoeba/GameLogic/Language/Parsers/ItemParser.hs
@@ -1,6 +1,6 @@
module GameLogic.Language.Parsers.ItemParser where
-import GameLogic.Language.RawToken
+import GameLogic.Language.Parsers.RawToken
import GameLogic.Language.Parsers.Common
import Middleware.Parsing.Facade as P
View
2  Amoeba/GameLogic/Language/Parsers/RawParser.hs
@@ -1,6 +1,6 @@
module GameLogic.Language.Parsers.RawParser where
-import GameLogic.Language.RawToken
+import GameLogic.Language.Parsers.RawToken
import GameLogic.Language.Parsers.WorldParser
import GameLogic.Language.Parsers.ItemParser
import GameLogic.Language.Parsers.Common
View
2  Amoeba/GameLogic/Language/RawToken.hs → ...ba/GameLogic/Language/Parsers/RawToken.hs
@@ -1,4 +1,4 @@
-module GameLogic.Language.RawToken where
+module GameLogic.Language.Parsers.RawToken where
type Caption = String
type Name = String
View
2  Amoeba/GameLogic/Language/Parsers/WorldParser.hs
@@ -1,6 +1,6 @@
module GameLogic.Language.Parsers.WorldParser where
-import GameLogic.Language.RawToken
+import GameLogic.Language.Parsers.RawToken
import GameLogic.Language.Parsers.Common
import Middleware.Parsing.Facade as P
View
34 Amoeba/GameLogic/Language/Translator.hs
@@ -0,0 +1,34 @@
+module GameLogic.Language.Translator where
+
+import qualified GameLogic.Language.Parsers.RawParser as RP
+import GameLogic.Runtime.World
+
+{-
+type Caption = String
+type Name = String
+type PlayerName = String
+
+data PropertyToken = IntProperty Name Int
+ | ObjectProperty Name RawToken
+ | CellsProperty Name [PropertyToken]
+ | CellProperty (Int, Int) RawToken
+ | IntResource Name (Int, Int)
+ deriving (Show, Read, Eq)
+
+data RawToken = Comment String
+ | World Name [PropertyToken]
+ | Item Name [PropertyToken]
+ | Object Name PlayerName
+ | EmptyToken
+ deriving (Show, Read, Eq)
+-}
+
+
+translateToWorld w [] = Left "No data passed."
+translateToWorld w (EmptyToken : ts) = translateToWorld w ts
+translateToWorld w ts = undefined
+
+
+toWorld rawString = do
+ ts <- RP.parseRawTokens rawString
+ translateToWorld ts
View
6 Amoeba/GameLogic/Runtime/World.hs
@@ -1,12 +1,12 @@
{-# LANGUAGE TemplateHaskell #-}
-module GameLogic.World where
+module GameLogic.Runtime.World where
import qualified Control.Lens as L
import qualified Data.Map as M
import Prelude hiding (null, lookup)
-import GameLogic.Geometry
-import GameLogic.Object as O
+import GameLogic.Base.Geometry
+import GameLogic.Data.Facade as O
data Effect = Effect
deriving (Show, Read, Eq)
View
2  Amoeba/Test/ParsingTest.hs
@@ -7,7 +7,7 @@ import Test.QuickCheck.Monadic (assert, monadicIO, run)
import Test.QuickCheck.All
import Control.Monad (liftM)
-import GameLogic.Language.RawToken
+import GameLogic.Language.Parsers.RawToken
import GameLogic.Language.Parsers.ItemParser
import GameLogic.Language.Parsers.WorldParser
import GameLogic.Language.Parsers.RawParser
View
BIN  Game/Amoeba
Binary file not shown
Please sign in to comment.
Something went wrong with that request. Please try again.