-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Factor out language specifications (#32)
- Loading branch information
Showing
16 changed files
with
615 additions
and
421 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
{-# LANGUAGE LambdaCase #-} | ||
{-# LANGUAGE OverloadedLists #-} | ||
{-# LANGUAGE OverloadedStrings #-} | ||
|
||
module Main where | ||
|
||
import Sdam.Parser (pValue, parse) | ||
import Source | ||
import Source.Language.Morte | ||
import Source.NewGen | ||
import System.Environment (getArgs) | ||
import System.Exit (die) | ||
import Text.Megaparsec as Megaparsec | ||
|
||
main :: IO () | ||
main = do | ||
mParsedValue <- getArgs >>= \case | ||
[filepath] -> do | ||
content <- readFile filepath | ||
case parse pValue filepath content of | ||
Left e -> die (Megaparsec.errorBundlePretty e) | ||
Right a -> return (Just a) | ||
[] -> return Nothing | ||
_ -> die "Usage: foundry FILE.sd" | ||
runSource foundryPlugin mParsedValue | ||
|
||
foundryPlugin :: Plugin | ||
foundryPlugin = | ||
Plugin | ||
{ _pluginSchema = morteSchema, | ||
_pluginRecLayouts = morteRecLayouts | ||
} |
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,32 @@ | ||
{-# LANGUAGE LambdaCase #-} | ||
{-# LANGUAGE OverloadedLists #-} | ||
{-# LANGUAGE OverloadedStrings #-} | ||
|
||
module Main where | ||
|
||
import Sdam.Parser (pValue, parse) | ||
import Source | ||
import Source.Language.Haskell | ||
import Source.NewGen | ||
import System.Environment (getArgs) | ||
import System.Exit (die) | ||
import Text.Megaparsec as Megaparsec | ||
|
||
main :: IO () | ||
main = do | ||
mParsedValue <- getArgs >>= \case | ||
[filepath] -> do | ||
content <- readFile filepath | ||
case parse pValue filepath content of | ||
Left e -> die (Megaparsec.errorBundlePretty e) | ||
Right a -> return (Just a) | ||
[] -> return Nothing | ||
_ -> die "Usage: hask FILE.sd" | ||
runSource haskPlugin mParsedValue | ||
|
||
haskPlugin :: Plugin | ||
haskPlugin = | ||
Plugin | ||
{ _pluginSchema = haskellSchema, | ||
_pluginRecLayouts = haskellRecLayouts | ||
} |
Oops, something went wrong.