mirror of
https://github.com/Drezil/dear-imgui.hs.git
synced 2024-11-22 16:57:00 +00:00
Update to 1.87 (#125)
This commit is contained in:
parent
265d143261
commit
dc11fad07f
@ -146,6 +146,8 @@ headers = do
|
|||||||
|
|
||||||
_ <- skipManyTill anySingle ( namedSection "Viewports" )
|
_ <- skipManyTill anySingle ( namedSection "Viewports" )
|
||||||
|
|
||||||
|
_ <- skipManyTill anySingle ( namedSection "Platform Dependent Interfaces" ) -- XXX: since 1.87
|
||||||
|
|
||||||
_ <- skipManyTill anySingle ( namedSection "Obsolete functions and types" )
|
_ <- skipManyTill anySingle ( namedSection "Obsolete functions and types" )
|
||||||
|
|
||||||
let
|
let
|
||||||
@ -254,13 +256,21 @@ patternNameAndValue enumName =
|
|||||||
where
|
where
|
||||||
count :: StateT EnumState m Integer
|
count :: StateT EnumState m Integer
|
||||||
count = do
|
count = do
|
||||||
_ <- single ( Identifier $ enumName <> "COUNT" )
|
let idName = enumName <> "COUNT"
|
||||||
|
_ <- single ( Identifier idName )
|
||||||
|
|
||||||
mbVal <- optional do
|
mbVal <- optional do
|
||||||
_ <- reservedSymbol '='
|
_ <- reservedSymbol '='
|
||||||
integerExpression
|
EnumState{enumValues} <- get
|
||||||
case mbVal of
|
integerExpression enumValues
|
||||||
|
|
||||||
|
countVal <- case mbVal of
|
||||||
Nothing -> currEnumTag <$> get
|
Nothing -> currEnumTag <$> get
|
||||||
Just ct -> pure ct
|
Just ct -> pure ct
|
||||||
|
|
||||||
|
modify' ( \ st -> st { enumValues = HashMap.insert idName countVal ( enumValues st ) } )
|
||||||
|
pure countVal
|
||||||
|
|
||||||
value :: StateT EnumState m ( Text, Integer )
|
value :: StateT EnumState m ( Text, Integer )
|
||||||
value = do
|
value = do
|
||||||
name <- identifier
|
name <- identifier
|
||||||
@ -271,13 +281,16 @@ patternNameAndValue enumName =
|
|||||||
patternRHS =
|
patternRHS =
|
||||||
( do
|
( do
|
||||||
reservedSymbol '='
|
reservedSymbol '='
|
||||||
try integerExpression <|> try disjunction
|
EnumState{enumValues} <- get
|
||||||
|
try disjunction <|> try (integerExpression enumValues)
|
||||||
)
|
)
|
||||||
<|> ( currEnumTag <$> get )
|
<|> ( currEnumTag <$> get )
|
||||||
|
|
||||||
disjunction :: StateT EnumState m Integer
|
disjunction :: StateT EnumState m Integer
|
||||||
disjunction = do
|
disjunction = do
|
||||||
( summands :: [Text] ) <- identifier `sepBy1` symbol "|"
|
initial <- identifier <* symbol "|"
|
||||||
|
( rest :: [Text] ) <- identifier `sepBy1` symbol "|"
|
||||||
|
let summands = initial : rest
|
||||||
valsMap <- enumValues <$> get
|
valsMap <- enumValues <$> get
|
||||||
let
|
let
|
||||||
res :: Either [ Text ] Integer
|
res :: Either [ Text ] Integer
|
||||||
@ -327,9 +340,9 @@ symbol :: MonadParsec e [ Tok ] m => Text -> m ()
|
|||||||
symbol s = token ( \ case { Symbolic s' | s == s' -> Just (); _ -> Nothing } ) mempty
|
symbol s = token ( \ case { Symbolic s' | s == s' -> Just (); _ -> Nothing } ) mempty
|
||||||
<?> ( Text.unpack s <> " (symbol)" )
|
<?> ( Text.unpack s <> " (symbol)" )
|
||||||
|
|
||||||
integerExpression :: MonadParsec e [ Tok ] m => m Integer
|
integerExpression :: MonadParsec e [ Tok ] m => HashMap Text Integer -> m Integer
|
||||||
integerExpression = try integerPower <|> integer
|
integerExpression enums = try integerPower <|> try integerAdd <|> try integerSub <|> integer
|
||||||
|
where
|
||||||
integerPower :: MonadParsec e [ Tok ] m => m Integer
|
integerPower :: MonadParsec e [ Tok ] m => m Integer
|
||||||
integerPower = do
|
integerPower = do
|
||||||
a <- integer
|
a <- integer
|
||||||
@ -337,18 +350,37 @@ integerPower = do
|
|||||||
i <- integer
|
i <- integer
|
||||||
pure ( a `shiftL` fromIntegral i )
|
pure ( a `shiftL` fromIntegral i )
|
||||||
|
|
||||||
|
integerAdd :: MonadParsec e [ Tok ] m => m Integer
|
||||||
|
integerAdd = do
|
||||||
|
a <- integer
|
||||||
|
_ <- symbol "+"
|
||||||
|
i <- integer
|
||||||
|
pure ( a + i )
|
||||||
|
|
||||||
|
integerSub :: MonadParsec e [ Tok ] m => m Integer
|
||||||
|
integerSub = do
|
||||||
|
a <- integer
|
||||||
|
_ <- symbol "-"
|
||||||
|
i <- integer
|
||||||
|
pure ( a - i )
|
||||||
|
|
||||||
integer :: forall e m. MonadParsec e [ Tok ] m => m Integer
|
integer :: forall e m. MonadParsec e [ Tok ] m => m Integer
|
||||||
integer =
|
integer =
|
||||||
option id mkSign <*>
|
option id mkSign <*>
|
||||||
token
|
token
|
||||||
( \ case {
|
( \case
|
||||||
Number i suff
|
Number i suff
|
||||||
| Just _ <- toBoundedInteger @Int64 i
|
| Just _ <- toBoundedInteger @Int64 i
|
||||||
, Right i' <- floatingOrInteger @Float @Integer i
|
, Right i' <- floatingOrInteger @Float @Integer i
|
||||||
, not ( Text.any ( (== 'f' ) . toLower ) suff )
|
, not ( Text.any ( (== 'f' ) . toLower ) suff )
|
||||||
-> Just i';
|
->
|
||||||
_ -> Nothing
|
Just i'
|
||||||
}
|
|
||||||
|
Identifier name ->
|
||||||
|
HashMap.lookup name enums
|
||||||
|
|
||||||
|
_ ->
|
||||||
|
Nothing
|
||||||
)
|
)
|
||||||
mempty
|
mempty
|
||||||
<?> "integer"
|
<?> "integer"
|
||||||
|
2
imgui
2
imgui
@ -1 +1 @@
|
|||||||
Subproject commit 512c54bbc062c41c74f8a8bd8ff1fd6bebd1e6d0
|
Subproject commit c71a50deb5ddf1ea386b91e60fa2e4a26d080074
|
Loading…
Reference in New Issue
Block a user