{-# OPTIONS_GHC -threaded #-}
{-# OPTIONS_HADDOCK show-extensions #-}
{-# LANGUAGE BangPatterns #-}
module Phonetic.Languages.General.Simple.Parsing where
import Phonetic.Languages.Array.General.PropertiesSyllablesG2
import Data.Phonetic.Languages.PrepareText
import System.Environment (getArgs)
import Phonetic.Languages.General.Simple
import Data.List (sort)
import GHC.Arr
import Data.Phonetic.Languages.Base
import Data.Phonetic.Languages.Syllables
import Text.Read (readMaybe)
import Data.Maybe (fromMaybe)
import Data.Phonetic.Languages.SpecificationsRead
import Interpreter.StringConversion (readFileIfAny)
import CLI.Arguments
import CLI.Arguments.Parsing
import CLI.Arguments.Get
import qualified Phonetic.Languages.Permutations.Represent as R
argsToSimplePrepare
:: (Double -> String -> ([[[PRS]]] -> [[Double]]))
-> [([[[PRS]]] -> [[Double]])]
-> (String -> Bool)
-> IO ()
argsToSimplePrepare :: (Double -> String -> [[[PRS]]] -> [[Double]])
-> [[[[PRS]]] -> [[Double]]] -> (String -> Bool) -> IO ()
argsToSimplePrepare Double -> String -> [[[PRS]]] -> [[Double]]
h [[[[PRS]]] -> [[Double]]]
qs String -> Bool
p = do
[String]
args50 <- IO [String]
getArgs
let (Args
argsA,Args
argsB,Args
argsC1,[String]
argss) = FirstChars
-> CLSpecifications -> [String] -> (Args, Args, Args, [String])
args2Args31R FirstChars
fstCharsMA CLSpecifications
specs1 [String]
args50
args00000 :: [String]
args00000 = (Args, [String]) -> [String]
forall a b. (a, b) -> b
snd ((Args, [String]) -> [String])
-> ([String] -> (Args, [String])) -> [String] -> [String]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CLSpecifications -> [String] -> (Args, [String])
takeBsR [(String
"+p",GQtyArgs
1)] ([String] -> [String]) -> [String] -> [String]
forall a b. (a -> b) -> a -> b
$ [String]
args50
pairwisePermutations :: PermutationsType
pairwisePermutations = [String] -> PermutationsType
R.bTransform2Perms ([String] -> PermutationsType)
-> (Args -> [String]) -> Args -> PermutationsType
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> Args -> [String]
forall (t :: * -> *).
Foldable t =>
String -> t Arguments -> [String]
getB String
"+p" (Args -> PermutationsType) -> Args -> PermutationsType
forall a b. (a -> b) -> a -> b
$ Args
argsB
(Args
txtPFs,[String]
args0000F) = FirstChars -> CLSpecifications -> [String] -> (Args, [String])
takeCs1R FirstChars
fstCharsT CLSpecifications
cSpecs1T [String]
args00000
textProcessmentFssFs :: [String]
textProcessmentFssFs = String -> Args -> [String]
forall (t :: * -> *).
Foldable t =>
String -> t Arguments -> [String]
getC String
"+t" Args
txtPFs
textProcessment0 :: String
textProcessment0
| String -> Bool
forall (t :: * -> *) a. Foldable t => t a -> Bool
null (String -> Bool) -> ([String] -> String) -> [String] -> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [String] -> String
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat ([String] -> String)
-> ([String] -> [String]) -> [String] -> String
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> Args -> [String]
forall (t :: * -> *).
Foldable t =>
String -> t Arguments -> [String]
getB String
"+t" (Args -> [String]) -> ([String] -> Args) -> [String] -> [String]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Args, [String]) -> Args
forall a b. (a, b) -> a
fst ((Args, [String]) -> Args)
-> ([String] -> (Args, [String])) -> [String] -> Args
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CLSpecifications -> [String] -> (Args, [String])
takeBsR [(String
"+t",GQtyArgs
1)] ([String] -> Bool) -> [String] -> Bool
forall a b. (a -> b) -> a -> b
$ [String]
args00000 = []
| Bool
otherwise = String
"+t" String -> String -> String
forall a. Monoid a => a -> a -> a
`mappend` ([String] -> String
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat ([String] -> String)
-> ([String] -> [String]) -> [String] -> String
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> Args -> [String]
forall (t :: * -> *).
Foldable t =>
String -> t Arguments -> [String]
getB String
"+t" (Args -> [String]) -> ([String] -> Args) -> [String] -> [String]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Args, [String]) -> Args
forall a b. (a, b) -> a
fst ((Args, [String]) -> Args)
-> ([String] -> (Args, [String])) -> [String] -> Args
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CLSpecifications -> [String] -> (Args, [String])
takeBsR [(String
"+t",GQtyArgs
1)] ([String] -> String) -> [String] -> String
forall a b. (a -> b) -> a -> b
$ [String]
args00000)
textProcessment1 :: GQtyArgs
textProcessment1 = GQtyArgs -> Maybe GQtyArgs -> GQtyArgs
forall a. a -> Maybe a -> a
fromMaybe GQtyArgs
70 (String -> Maybe GQtyArgs
forall a. Read a => String -> Maybe a
readMaybe (GQtyArgs -> String -> String
forall a. GQtyArgs -> [a] -> [a]
drop GQtyArgs
2 String
textProcessment0)::Maybe Int)
(Args
rcrs,[String]
args000) = CLSpecifications -> [String] -> (Args, [String])
takeAsR [(String
"+r",GQtyArgs
0)] ([String] -> (Args, [String]))
-> ([String] -> [String]) -> [String] -> (Args, [String])
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (String -> Bool) -> [String] -> [String]
forall a. (a -> Bool) -> [a] -> [a]
filter (Bool -> Bool
not (Bool -> Bool) -> (String -> Bool) -> String -> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> Bool
forall (t :: * -> *) a. Foldable t => t a -> Bool
null) ([String] -> (Args, [String])) -> [String] -> (Args, [String])
forall a b. (a -> b) -> a -> b
$ [String]
args0000F
recursiveMode :: Bool
recursiveMode = String -> Args -> Bool
forall (t :: * -> *). Foldable t => String -> t Arguments -> Bool
oneA String
"+r" Args
rcrs
(![String]
args14,![String]
args00) = GQtyArgs -> [String] -> ([String], [String])
forall a. GQtyArgs -> [a] -> ([a], [a])
splitAt GQtyArgs
4 [String]
args000
[String
fileGWrSys, String
controlFile, String
segmentRulesFile, String
concatenationsFileP] = [String]
args14
(String
gwrsCnts, String
controlConts, String
segmentData, String
concatenationsFile, String
toFileMode1, Bool
interactiveP, Bool
jstL0, [String]
args0, Coeffs2
coeffs, Coeffs2
coeffsWX, [String]
args, Bool
lstW) <- String
-> String
-> String
-> String
-> [String]
-> IO
(String, String, String, String, String, Bool, Bool, [String],
Coeffs2, Coeffs2, [String], Bool)
argsProcessment String
fileGWrSys String
controlFile String
segmentRulesFile String
concatenationsFileP [String]
args00
let (GWritingSystemPRPLX
wrs, [FirstChars]
ks, CharPhoneticClassification
arr, SegmentRulesG
gs, String
js, String
vs, Concatenations
ysss, String
ws) = String
-> String
-> String
-> String
-> (GWritingSystemPRPLX, [FirstChars], CharPhoneticClassification,
SegmentRulesG, String, String, Concatenations, String)
innerProcessmentSimple String
gwrsCnts String
controlConts String
segmentData String
concatenationsFile
[String]
textProcessmentFss0 <- (String -> IO String) -> [String] -> IO [String]
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM (String -> IO String
readFileIfAny) [String]
textProcessmentFssFs
let textProcessmentFss :: [String]
textProcessmentFss = (String -> Bool) -> [String] -> [String]
forall a. (a -> Bool) -> [a] -> [a]
filter (Bool -> Bool
not (Bool -> Bool) -> (String -> Bool) -> String -> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> Bool
forall (t :: * -> *) a. Foldable t => t a -> Bool
null) [String]
textProcessmentFss0
if Coeffs2 -> Bool
forall a. CoeffTwo a -> Bool
isPair Coeffs2
coeffs then PermutationsType
-> (String -> Bool)
-> [String]
-> String
-> GQtyArgs
-> GWritingSystemPRPLX
-> [FirstChars]
-> CharPhoneticClassification
-> SegmentRulesG
-> String
-> String
-> (Double -> String -> [[[PRS]]] -> [[Double]])
-> [[[[PRS]]] -> [[Double]]]
-> Concatenations
-> String
-> String
-> Bool
-> Bool
-> Bool
-> [String]
-> Coeffs2
-> Coeffs2
-> [String]
-> Bool
-> IO ()
generalProc3G PermutationsType
pairwisePermutations String -> Bool
p [String]
textProcessmentFss String
textProcessment0 GQtyArgs
textProcessment1 GWritingSystemPRPLX
wrs [FirstChars]
ks CharPhoneticClassification
arr SegmentRulesG
gs String
js String
vs Double -> String -> [[[PRS]]] -> [[Double]]
h [[[[PRS]]] -> [[Double]]]
qs Concatenations
ysss String
ws String
toFileMode1 Bool
recursiveMode Bool
interactiveP Bool
jstL0 [String]
args0 Coeffs2
coeffs Coeffs2
coeffsWX (GQtyArgs -> [String] -> [String]
forall a. GQtyArgs -> [a] -> [a]
drop GQtyArgs
1 [String]
args) Bool
lstW
else PermutationsType
-> (String -> Bool)
-> [String]
-> String
-> GQtyArgs
-> GWritingSystemPRPLX
-> [FirstChars]
-> CharPhoneticClassification
-> SegmentRulesG
-> String
-> String
-> (Double -> String -> [[[PRS]]] -> [[Double]])
-> [[[[PRS]]] -> [[Double]]]
-> Concatenations
-> String
-> String
-> Bool
-> Bool
-> Bool
-> [String]
-> Coeffs2
-> Coeffs2
-> [String]
-> Bool
-> IO ()
generalProc3G PermutationsType
pairwisePermutations String -> Bool
p [String]
textProcessmentFss String
textProcessment0 GQtyArgs
textProcessment1 GWritingSystemPRPLX
wrs [FirstChars]
ks CharPhoneticClassification
arr SegmentRulesG
gs String
js String
vs Double -> String -> [[[PRS]]] -> [[Double]]
h [[[[PRS]]] -> [[Double]]]
qs Concatenations
ysss String
ws String
toFileMode1 Bool
recursiveMode Bool
interactiveP Bool
jstL0 [String]
args0 Coeffs2
coeffs Coeffs2
coeffsWX [String]
args Bool
lstW
argsToSimplePrepare4Files
:: R.PermutationsType
-> FilePath
-> FilePath
-> FilePath
-> FilePath
-> (Double -> String -> ([[[PRS]]] -> [[Double]]))
-> [([[[PRS]]] -> [[Double]])]
-> String
-> (String -> Bool)
-> [String]
-> String
-> Int
-> IO ()
argsToSimplePrepare4Files :: PermutationsType
-> String
-> String
-> String
-> String
-> (Double -> String -> [[[PRS]]] -> [[Double]])
-> [[[[PRS]]] -> [[Double]]]
-> String
-> (String -> Bool)
-> [String]
-> String
-> GQtyArgs
-> IO ()
argsToSimplePrepare4Files PermutationsType
pairwisePermutations String
fileGWrSys String
controlFile String
segmentRulesFile String
concatenationsFileP Double -> String -> [[[PRS]]] -> [[Double]]
h [[[[PRS]]] -> [[Double]]]
qs String
other_args String -> Bool
p [String]
textProcessmentFss String
textProcessment0 GQtyArgs
textProcessment1 = do
let args000 :: [String]
args000 = GQtyArgs -> [String] -> [String]
forall a. GQtyArgs -> [a] -> [a]
drop GQtyArgs
4 ([String] -> [String])
-> (String -> [String]) -> String -> [String]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> [String]
words (String -> [String]) -> String -> [String]
forall a b. (a -> b) -> a -> b
$ String
other_args
(Args
rcs,[String]
args00) = CLSpecifications -> [String] -> (Args, [String])
takeAsR [(String
"+r",GQtyArgs
0)] [String]
args000
recursiveMode :: Bool
recursiveMode = String -> Args -> Bool
forall (t :: * -> *). Foldable t => String -> t Arguments -> Bool
oneA String
"+r" Args
rcs
(String
gwrsCnts, String
controlConts, String
segmentData, String
concatenationsFile, String
toFileMode1, Bool
interactiveP, Bool
jstL0, [String]
args0, Coeffs2
coeffs, Coeffs2
coeffsWX, [String]
args, Bool
lstW) <- String
-> String
-> String
-> String
-> [String]
-> IO
(String, String, String, String, String, Bool, Bool, [String],
Coeffs2, Coeffs2, [String], Bool)
argsProcessment String
fileGWrSys String
controlFile String
segmentRulesFile String
concatenationsFileP [String]
args00
let (GWritingSystemPRPLX
wrs, [FirstChars]
ks, CharPhoneticClassification
arr, SegmentRulesG
gs, String
js, String
vs, Concatenations
ysss, String
ws) = String
-> String
-> String
-> String
-> (GWritingSystemPRPLX, [FirstChars], CharPhoneticClassification,
SegmentRulesG, String, String, Concatenations, String)
innerProcessmentSimple String
gwrsCnts String
controlConts String
segmentData String
concatenationsFile
if Coeffs2 -> Bool
forall a. CoeffTwo a -> Bool
isPair Coeffs2
coeffs then PermutationsType
-> (String -> Bool)
-> [String]
-> String
-> GQtyArgs
-> GWritingSystemPRPLX
-> [FirstChars]
-> CharPhoneticClassification
-> SegmentRulesG
-> String
-> String
-> (Double -> String -> [[[PRS]]] -> [[Double]])
-> [[[[PRS]]] -> [[Double]]]
-> Concatenations
-> String
-> String
-> Bool
-> Bool
-> Bool
-> [String]
-> Coeffs2
-> Coeffs2
-> [String]
-> Bool
-> IO ()
generalProc3G PermutationsType
pairwisePermutations String -> Bool
p [String]
textProcessmentFss String
textProcessment0 GQtyArgs
textProcessment1 GWritingSystemPRPLX
wrs [FirstChars]
ks CharPhoneticClassification
arr SegmentRulesG
gs String
js String
vs Double -> String -> [[[PRS]]] -> [[Double]]
h [[[[PRS]]] -> [[Double]]]
qs Concatenations
ysss String
ws String
toFileMode1 Bool
recursiveMode Bool
interactiveP Bool
jstL0 [String]
args0 Coeffs2
coeffs Coeffs2
coeffsWX (GQtyArgs -> [String] -> [String]
forall a. GQtyArgs -> [a] -> [a]
drop GQtyArgs
1 [String]
args) Bool
lstW
else PermutationsType
-> (String -> Bool)
-> [String]
-> String
-> GQtyArgs
-> GWritingSystemPRPLX
-> [FirstChars]
-> CharPhoneticClassification
-> SegmentRulesG
-> String
-> String
-> (Double -> String -> [[[PRS]]] -> [[Double]])
-> [[[[PRS]]] -> [[Double]]]
-> Concatenations
-> String
-> String
-> Bool
-> Bool
-> Bool
-> [String]
-> Coeffs2
-> Coeffs2
-> [String]
-> Bool
-> IO ()
generalProc3G PermutationsType
pairwisePermutations String -> Bool
p [String]
textProcessmentFss String
textProcessment0 GQtyArgs
textProcessment1 GWritingSystemPRPLX
wrs [FirstChars]
ks CharPhoneticClassification
arr SegmentRulesG
gs String
js String
vs Double -> String -> [[[PRS]]] -> [[Double]]
h [[[[PRS]]] -> [[Double]]]
qs Concatenations
ysss String
ws String
toFileMode1 Bool
recursiveMode Bool
interactiveP Bool
jstL0 [String]
args0 Coeffs2
coeffs Coeffs2
coeffsWX [String]
args Bool
lstW
innerProcessmentSimple
:: String
-> String
-> String
-> String
-> (GWritingSystemPRPLX, [(Char, Char)], CharPhoneticClassification, SegmentRulesG, String, String, Concatenations, String)
innerProcessmentSimple :: String
-> String
-> String
-> String
-> (GWritingSystemPRPLX, [FirstChars], CharPhoneticClassification,
SegmentRulesG, String, String, Concatenations, String)
innerProcessmentSimple String
gwrsCnts String
controlConts String
segmentData String
concatenationsFile =
let [[String]
allophonesGs, [String]
charClfs, [String]
jss, [String]
vss, [String]
wss] = Char -> [String] -> Concatenations
groupBetweenChars Char
'~' ([String] -> Concatenations)
-> (String -> [String]) -> String -> Concatenations
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> [String]
lines (String -> Concatenations) -> String -> Concatenations
forall a b. (a -> b) -> a -> b
$ String
controlConts
wrs :: GWritingSystemPRPLX
wrs = Char -> String -> GWritingSystemPRPLX
getGWritingSystem Char
'~' String
gwrsCnts
ks :: [FirstChars]
ks = [FirstChars] -> [FirstChars]
forall a. Ord a => [a] -> [a]
sort ([FirstChars] -> [FirstChars])
-> (Maybe [FirstChars] -> [FirstChars])
-> Maybe [FirstChars]
-> [FirstChars]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [FirstChars] -> Maybe [FirstChars] -> [FirstChars]
forall a. a -> Maybe a -> a
fromMaybe [] (Maybe [FirstChars] -> [FirstChars])
-> Maybe [FirstChars] -> [FirstChars]
forall a b. (a -> b) -> a -> b
$ (String -> Maybe [FirstChars]
forall a. Read a => String -> Maybe a
readMaybe ([String] -> String
unwords [String]
allophonesGs)::Maybe [(Char, Char)])
arr :: CharPhoneticClassification
arr = String -> CharPhoneticClassification
forall a. Read a => String -> a
read ([String] -> String
unwords [String]
charClfs)::Array Int PRS
gs :: SegmentRulesG
gs = String -> SegmentRulesG
forall a. Read a => String -> a
read String
segmentData::SegmentRulesG
ysss :: Concatenations
ysss = Concatenations -> Concatenations
sort2Concat (Concatenations -> Concatenations)
-> (Maybe Concatenations -> Concatenations)
-> Maybe Concatenations
-> Concatenations
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Concatenations -> Maybe Concatenations -> Concatenations
forall a. a -> Maybe a -> a
fromMaybe [] (Maybe Concatenations -> Concatenations)
-> Maybe Concatenations -> Concatenations
forall a b. (a -> b) -> a -> b
$ (String -> Maybe Concatenations
forall a. Read a => String -> Maybe a
readMaybe String
segmentData::Maybe [[String]])
js :: String
js = [String] -> String
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat [String]
jss
vs :: String
vs = [String] -> String
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat [String]
vss
ws :: String
ws = String -> String
forall a. Ord a => [a] -> [a]
sort (String -> String) -> ([String] -> String) -> [String] -> String
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [String] -> String
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat ([String] -> String) -> [String] -> String
forall a b. (a -> b) -> a -> b
$ [String]
wss
in (GWritingSystemPRPLX
wrs, [FirstChars]
ks, CharPhoneticClassification
arr, SegmentRulesG
gs, String
js, String
vs, Concatenations
ysss, String
ws)
argsProcessment
:: FilePath
-> FilePath
-> FilePath
-> FilePath
-> [String]
-> IO (String, String, String, String, String, Bool, Bool, [String], Coeffs2, Coeffs2, [String], Bool)
argsProcessment :: String
-> String
-> String
-> String
-> [String]
-> IO
(String, String, String, String, String, Bool, Bool, [String],
Coeffs2, Coeffs2, [String], Bool)
argsProcessment String
fileGWrSys String
controlFile String
segmentRulesFile String
concatenationsFileP [String]
args00 = do
let args0 :: [String]
args0 = (Args, [String]) -> [String]
forall a b. (a, b) -> b
snd ((Args, [String]) -> [String])
-> ([String] -> (Args, [String])) -> [String] -> [String]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CLSpecifications -> [String] -> (Args, [String])
takeBsR [(String
"+x",GQtyArgs
1)] ([String] -> (Args, [String]))
-> ([String] -> [String]) -> [String] -> (Args, [String])
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Args, [String]) -> [String]
forall a b. (a, b) -> b
snd ((Args, [String]) -> [String])
-> ([String] -> (Args, [String])) -> [String] -> [String]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CLSpecifications -> [String] -> (Args, [String])
takeAsR ([String] -> [GQtyArgs] -> CLSpecifications
forall a b. [a] -> [b] -> [(a, b)]
zip [String
"+b",String
"+l",String
"+bl",String
"+i"] ([GQtyArgs] -> CLSpecifications)
-> ([GQtyArgs] -> [GQtyArgs]) -> [GQtyArgs] -> CLSpecifications
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [GQtyArgs] -> [GQtyArgs]
forall a. [a] -> [a]
cycle ([GQtyArgs] -> CLSpecifications) -> [GQtyArgs] -> CLSpecifications
forall a b. (a -> b) -> a -> b
$ [GQtyArgs
0]) ([String] -> [String]) -> [String] -> [String]
forall a b. (a -> b) -> a -> b
$ [String]
args00
lstW :: Bool
lstW = (String -> Bool) -> [String] -> Bool
forall (t :: * -> *) a. Foldable t => (a -> Bool) -> t a -> Bool
any (\String
x -> String
x String -> String -> Bool
forall a. Eq a => a -> a -> Bool
== String
"+b" Bool -> Bool -> Bool
|| String
x String -> String -> Bool
forall a. Eq a => a -> a -> Bool
== String
"+bl") [String]
args00
jstL0 :: Bool
jstL0 = (String -> Bool) -> [String] -> Bool
forall (t :: * -> *) a. Foldable t => (a -> Bool) -> t a -> Bool
any (\String
x -> String
x String -> String -> Bool
forall a. Eq a => a -> a -> Bool
== String
"+l" Bool -> Bool -> Bool
|| String
x String -> String -> Bool
forall a. Eq a => a -> a -> Bool
== String
"+bl") [String]
args00
toFileMode1 :: String
toFileMode1 = [String] -> String
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat ([String] -> String)
-> ([String] -> [String]) -> [String] -> String
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> Args -> [String]
forall (t :: * -> *).
Foldable t =>
String -> t Arguments -> [String]
getB String
"+f" (Args -> [String]) -> ([String] -> Args) -> [String] -> [String]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [String] -> Args
bSpcs ([String] -> String) -> [String] -> String
forall a b. (a -> b) -> a -> b
$ [String]
args0
interactiveP :: Bool
interactiveP = (String -> Bool) -> [String] -> Bool
forall (t :: * -> *) a. Foldable t => (a -> Bool) -> t a -> Bool
any (String -> String -> Bool
forall a. Eq a => a -> a -> Bool
== String
"+i") [String]
args00 Bool -> Bool -> Bool
|| Bool -> Bool
not (String -> Bool
forall (t :: * -> *) a. Foldable t => t a -> Bool
null String
toFileMode1)
args01 :: [String]
args01 = (Args, [String]) -> [String]
forall a b. (a, b) -> b
snd ((Args, [String]) -> [String])
-> ([String] -> (Args, [String])) -> [String] -> [String]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. FirstChars -> CLSpecifications -> [String] -> (Args, [String])
takeCs1R FirstChars
fstCharsMA [(String
"+a",-GQtyArgs
1)] ([String] -> [String]) -> [String] -> [String]
forall a b. (a -> b) -> a -> b
$ [String]
args0
args02 :: [String]
args02
| String -> Bool
forall (t :: * -> *) a. Foldable t => t a -> Bool
null String
toFileMode1 = (String -> Bool) -> [String] -> [String]
forall a. (a -> Bool) -> [a] -> [a]
filter (String -> String -> Bool
forall a. Eq a => a -> a -> Bool
/= String
"+f") [String]
args01
| Bool
otherwise = (Args, [String]) -> [String]
forall a b. (a, b) -> b
snd ((Args, [String]) -> [String])
-> ([String] -> (Args, [String])) -> [String] -> [String]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CLSpecifications -> [String] -> (Args, [String])
takeBsR [(String
"+f",GQtyArgs
1)] ([String] -> [String]) -> [String] -> [String]
forall a b. (a -> b) -> a -> b
$ [String]
args01
args :: [String]
args = (Args, [String]) -> [String]
forall a b. (a, b) -> b
snd ((Args, [String]) -> [String])
-> ([String] -> (Args, [String])) -> [String] -> [String]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. FirstChars -> CLSpecifications -> [String] -> (Args, [String])
takeCs1R FirstChars
fstCharsMA [(String
"+m",-GQtyArgs
1)] ([String] -> [String]) -> [String] -> [String]
forall a b. (a -> b) -> a -> b
$ [String]
args02
coeffs :: Coeffs2
coeffs = String -> Coeffs2
readCF (String -> Coeffs2) -> ([String] -> String) -> [String] -> Coeffs2
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [String] -> String
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat ([String] -> String)
-> ([String] -> [String]) -> [String] -> String
forall b c a. (b -> c) -> (a -> b) -> a -> c
. GQtyArgs -> [String] -> [String]
forall a. GQtyArgs -> [a] -> [a]
take GQtyArgs
1 ([String] -> Coeffs2) -> [String] -> Coeffs2
forall a b. (a -> b) -> a -> b
$ [String]
args
coeffsWX :: Coeffs2
coeffsWX = String -> Coeffs2
readCF (String -> Coeffs2) -> ([String] -> String) -> [String] -> Coeffs2
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [String] -> String
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat ([String] -> String)
-> ([String] -> [String]) -> [String] -> String
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> Args -> [String]
forall (t :: * -> *).
Foldable t =>
String -> t Arguments -> [String]
getB String
"+x" (Args -> [String]) -> ([String] -> Args) -> [String] -> [String]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Args, [String]) -> Args
forall a b. (a, b) -> a
fst ((Args, [String]) -> Args)
-> ([String] -> (Args, [String])) -> [String] -> Args
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CLSpecifications -> [String] -> (Args, [String])
takeBsR [(String
"+x",GQtyArgs
1)] ([String] -> Coeffs2) -> [String] -> Coeffs2
forall a b. (a -> b) -> a -> b
$ [String]
args00
[String
controlConts, String
gwrsCnts, String
segmentData, String
concatenationsFile] <- (String -> IO String) -> [String] -> IO [String]
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM String -> IO String
readFile [String
controlFile, String
fileGWrSys, String
segmentRulesFile, String
concatenationsFileP]
(String, String, String, String, String, Bool, Bool, [String],
Coeffs2, Coeffs2, [String], Bool)
-> IO
(String, String, String, String, String, Bool, Bool, [String],
Coeffs2, Coeffs2, [String], Bool)
forall (m :: * -> *) a. Monad m => a -> m a
return (String
gwrsCnts, String
controlConts, String
segmentData, String
concatenationsFile, String
toFileMode1, Bool
interactiveP, Bool
jstL0, [String]
args0, Coeffs2
coeffs, Coeffs2
coeffsWX, [String]
args, Bool
lstW)
aSpecs :: CLSpecifications
aSpecs :: CLSpecifications
aSpecs = [String] -> [GQtyArgs] -> CLSpecifications
forall a b. [a] -> [b] -> [(a, b)]
zip [String
"+r",String
"+b",String
"+l",String
"+bl",String
"+i"] ([GQtyArgs] -> CLSpecifications)
-> ([GQtyArgs] -> [GQtyArgs]) -> [GQtyArgs] -> CLSpecifications
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [GQtyArgs] -> [GQtyArgs]
forall a. [a] -> [a]
cycle ([GQtyArgs] -> CLSpecifications) -> [GQtyArgs] -> CLSpecifications
forall a b. (a -> b) -> a -> b
$ [GQtyArgs
0]
aSpcs :: [String] -> Args
aSpcs :: [String] -> Args
aSpcs = (Args, [String]) -> Args
forall a b. (a, b) -> a
fst ((Args, [String]) -> Args)
-> ([String] -> (Args, [String])) -> [String] -> Args
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CLSpecifications -> [String] -> (Args, [String])
takeAsR CLSpecifications
aSpecs
cSpecs1MA :: CLSpecifications
cSpecs1MA :: CLSpecifications
cSpecs1MA = [String] -> [GQtyArgs] -> CLSpecifications
forall a b. [a] -> [b] -> [(a, b)]
zip [String
"+m",String
"+a"] ([GQtyArgs] -> CLSpecifications)
-> ([GQtyArgs] -> [GQtyArgs]) -> [GQtyArgs] -> CLSpecifications
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [GQtyArgs] -> [GQtyArgs]
forall a. [a] -> [a]
cycle ([GQtyArgs] -> CLSpecifications) -> [GQtyArgs] -> CLSpecifications
forall a b. (a -> b) -> a -> b
$ [-GQtyArgs
1]
fstCharsMA :: FirstChars
fstCharsMA :: FirstChars
fstCharsMA = (Char
'+',Char
'-')
cSpecs1T :: CLSpecifications
cSpecs1T :: CLSpecifications
cSpecs1T = [(String
"+t",-GQtyArgs
1)]
fstCharsT :: FirstChars
fstCharsT :: FirstChars
fstCharsT = (Char
'+',Char
'^')
bSpecs :: CLSpecifications
bSpecs :: CLSpecifications
bSpecs = [String] -> [GQtyArgs] -> CLSpecifications
forall a b. [a] -> [b] -> [(a, b)]
zip [String
"+d",String
"+f",String
"+p"] ([GQtyArgs] -> CLSpecifications)
-> ([GQtyArgs] -> [GQtyArgs]) -> [GQtyArgs] -> CLSpecifications
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [GQtyArgs] -> [GQtyArgs]
forall a. [a] -> [a]
cycle ([GQtyArgs] -> CLSpecifications) -> [GQtyArgs] -> CLSpecifications
forall a b. (a -> b) -> a -> b
$ [GQtyArgs
1]
bSpcs :: [String] -> Args
bSpcs :: [String] -> Args
bSpcs = (Args, [String]) -> Args
forall a b. (a, b) -> a
fst ((Args, [String]) -> Args)
-> ([String] -> (Args, [String])) -> [String] -> Args
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CLSpecifications -> [String] -> (Args, [String])
takeBsR CLSpecifications
bSpecs
specs1 :: CLSpecifications
specs1 :: CLSpecifications
specs1 = CLSpecifications
aSpecs CLSpecifications -> CLSpecifications -> CLSpecifications
forall a. Monoid a => a -> a -> a
`mappend` CLSpecifications
bSpecs CLSpecifications -> CLSpecifications -> CLSpecifications
forall a. Monoid a => a -> a -> a
`mappend` CLSpecifications
cSpecs1MA