mirror of
https://github.com/autc04/Retro68.git
synced 2024-06-01 15:41:39 +00:00
handle macro-less inline procedures
This commit is contained in:
parent
8eeb63b4f3
commit
dbc71a294d
|
@ -45,15 +45,28 @@ balancedText stopAtComma = fmap (foldr ($) "") $
|
||||||
trim = dropWhile isSpace . reverse . dropWhile isSpace . reverse
|
trim = dropWhile isSpace . reverse . dropWhile isSpace . reverse
|
||||||
cleanup = unwords . words . trim
|
cleanup = unwords . words . trim
|
||||||
|
|
||||||
|
returnType = do
|
||||||
|
t <- identifier tp
|
||||||
|
ptrs <- many (reservedOp tp "*" >> return '*')
|
||||||
|
return $ t ++ ptrs
|
||||||
|
|
||||||
externApiDeclaration = do
|
externApiDeclaration = do
|
||||||
reserved tp "EXTERN_API"
|
rettype <- (reserved tp "EXTERN_API" >> (fmap trim $ parens tp (balancedText False)))
|
||||||
rettype <- fmap trim $ parens tp (balancedText False)
|
<|> (reserved tp "pascal" >> returnType)
|
||||||
name <- identifier tp
|
name <- identifier tp
|
||||||
arguments <- fmap (map cleanup) $ parens tp (commaSep tp $ balancedText True)
|
arguments <- fmap (map cleanup) $ parens tp (commaSep tp $ balancedText True)
|
||||||
inlines <- option [] $ do
|
|
||||||
inlinekey <- identifier tp
|
let hexwords = commaSep tp hexword
|
||||||
guard ("WORDINLINE" `isSuffixOf` inlinekey)
|
macroinline = do
|
||||||
parens tp (commaSep tp hexword)
|
inlinekey <- identifier tp
|
||||||
|
guard ("WORDINLINE" `isSuffixOf` inlinekey)
|
||||||
|
parens tp hexwords
|
||||||
|
plaininline = do
|
||||||
|
reservedOp tp "="
|
||||||
|
braces tp hexwords
|
||||||
|
|
||||||
|
inlines <- macroinline <|> plaininline <|> return []
|
||||||
|
|
||||||
semi tp
|
semi tp
|
||||||
let arguments' | arguments == ["void"] = []
|
let arguments' | arguments == ["void"] = []
|
||||||
| otherwise = arguments
|
| otherwise = arguments
|
||||||
|
|
Loading…
Reference in New Issue
Block a user