On avance mais sans compiler !!!

pull/1/head
Optimal Sup-Spé 3 years ago
parent 7e5a9d6785
commit 3a81f479c1
  1. 150
      src/GenerateurH5P.elm

@ -1482,11 +1482,21 @@ h5pParser =
] ]
stars profondeur =
succeed ()
|. symbol (S.repeat profondeur "*")
|. espaces
titleParser =
tillEndOfLine
questionParser = questionParser =
tillEndOfLine tillEndOfLine
titleParser = alternativeParser =
tillEndOfLine tillEndOfLine
@ -1496,10 +1506,25 @@ tillEndOfLine =
|. chompWhile ((/=) '\n') |. chompWhile ((/=) '\n')
{-| Avale tout l'espace blanc et impose de s'arrêter
soit en début de ligne soit en fin de fichier.
-}
blankLines = blankLines =
succeed () succeed ()
|. chompWhile (\x -> x == ' ' || x == '\t' || x == '\n' || x == '\u{000D}') |. chompWhile
|. (getPosition (\x ->
x
== ' '
|| x
== '\t'
|| x
== '\n'
|| x
== '\u{000D}'
)
|. oneOf
[ end
, getPosition
|> andThen |> andThen
(\( row, col ) -> (\( row, col ) ->
if col == 1 then if col == 1 then
@ -1507,11 +1532,11 @@ blankLines =
else else
problem problem
("N'y aurait-il pas des espaces en trop au débul de la ligne " ("N'y aurait-il pas des espaces en trop au débul de la ligne ?"
++ String.fromInt row ++ String.fromInt row
) )
) )
) ]
espaces = espaces =
@ -1550,29 +1575,28 @@ branchingScenarioParser profondeur =
|. keyword "BranchingScenario" |. keyword "BranchingScenario"
|. espaces |. espaces
|= titleParser |= titleParser
|. token "\n" |. blankLines
|= sequence |= loop ( [], 0 ) (branchingScenarioParserHelp (profondeur + 1))
{ start = "" |. blankLines
, separator = ""
, end = ""
, spaces = blankLines
, item = contentParser (profondeur + 1)
, trailing = Optional
}
|. spaces
stars profondeur = branchingScenarioParserHelp profondeur ( contentList, contentId ) =
succeed () oneOf
|. symbol (S.repeat profondeur "*") [ succeed Loop
|. espaces |= contentParser profondeur contentId
, succeed ()
|> P.map (\_ -> Done (List.concat contentList))
]
contentParser profondeur = contentParser profondeur contentId =
oneOf oneOf
[ --branchingQuestionParser profondeur [ branchingQuestionParser profondeur contentId
coursePresentationParser profondeur , succeed (\x -> ( [ x ], contentId + 1 ))
, trueFalseParser profondeur |= oneOf
[ coursePresentationParser profondeur
, trueFalseParser profondeur
]
] ]
@ -1599,29 +1623,63 @@ uuid n =
-} -}
--branchingQuestionParser profondeur =
-- let
-- f question branchList = {-| Ici branchList est un enregistrement forçant la liste à avoir au moins deux éléments
-- case branchList of -}
-- [] -> branchingQuestionParser profondeur contentId =
-- 0 let
-- in f question ( branchList, id ) =
-- succeed f ( branchList.first :: branchList.second :: branchList.others
-- |. stars profondeur , contentId + L.length branchList.others + 2
-- |. keyword "BranchingQuestion" )
-- |. espaces in
-- |= questionParser succeed f
-- |. token "\n" |. stars profondeur
-- |= sequence |. keyword "BranchingQuestion"
-- { start = "" |. espaces
-- , separator = "" |= questionParser
-- , end = "" |. blankLines
-- , spaces = blankLines |= loop ( [], contentId ) (branchingQuestionAlternativeParser (profondeur + 1))
-- , item = branchingQuestionAlternativeParser (profondeur + 1)
-- , trailing = Optional
-- } {-| Ici branchList est une liste
--branchingQuestionAlternativeParser profondeur = -}
-- 0 branchingQuestionAlternativeParser profondeur ( branchList, contentId ) =
oneOf
[ let
f alternative ( alternativeList, id ) =
case branchList of
[] ->
-- TODO
Loop ( alternativeList, id )
_ ->
-- TODO
Loop ( alternativeList, id )
in
succeed f
|. stars profondeur
|= alternativeParser
|= lazy (loop ( [], contentId ) (branchingQuestionAlternativeParserHelp (profondeur + 1) (contentId + 1)))
, succeed ()
|> P.map (\_ -> Done (List.concat branchList))
]
branchingQuestionAlternativeParserHelp profondeur contentId =
-- À réécrire
sequence
{ start = ""
, separator = ""
, end = ""
, spaces = blankLines
, item = h5pParser
, trailing = Optional
}
{- {-

Loading…
Cancel
Save