Ignore unrecognised preprocessor directives
This commit is contained in:
parent
73dc1c7057
commit
77949846ca
|
@ -3,6 +3,7 @@ Language features supported by Tock
|
|||
|
||||
Everything in occam2.1, minus:
|
||||
- inline VALOF
|
||||
- PORTs, PLACE
|
||||
- ...
|
||||
|
||||
KRoC's TLP interface.
|
||||
|
@ -15,3 +16,5 @@ Intrinsics:
|
|||
- SQRT
|
||||
- DSQRT
|
||||
|
||||
Simple versions of #USE and #INCLUDE that only work in a process context (i.e.
|
||||
you can't #INCLUDE the body of a nested block).
|
||||
|
|
|
@ -1825,6 +1825,7 @@ preprocessorDirective :: OccParser A.Process
|
|||
preprocessorDirective
|
||||
= ppInclude
|
||||
<|> ppUse
|
||||
<|> unknownPP
|
||||
<?> "preprocessor directive"
|
||||
|
||||
ppInclude :: OccParser A.Process
|
||||
|
@ -1834,6 +1835,7 @@ ppInclude
|
|||
file <- manyTill character sQuote
|
||||
eol
|
||||
includeFile $ concat file
|
||||
<?> "#INCLUDE directive"
|
||||
|
||||
ppUse :: OccParser A.Process
|
||||
ppUse
|
||||
|
@ -1848,6 +1850,7 @@ ppUse
|
|||
if file `elem` psLoadedFiles ps
|
||||
then process
|
||||
else includeFile file
|
||||
<?> "#USE directive"
|
||||
|
||||
-- | Invoke the parser recursively to handle an included file.
|
||||
includeFile :: String -> OccParser A.Process
|
||||
|
@ -1857,6 +1860,14 @@ includeFile file
|
|||
setState ps' { psLocalNames = psMainLocals ps' }
|
||||
p <- process
|
||||
return $ f p
|
||||
|
||||
unknownPP :: OccParser A.Process
|
||||
= do m <- md
|
||||
char '#'
|
||||
rest <- manyTill anyChar (try eol)
|
||||
addWarning m $ "unknown preprocessor directive ignored: " ++ rest
|
||||
process
|
||||
<?> "unknown preprocessor directive"
|
||||
--}}}
|
||||
--{{{ main process
|
||||
mainProcess :: OccParser A.Process
|
||||
|
|
6
fco2/testcases/preproc.occ
Normal file
6
fco2/testcases/preproc.occ
Normal file
|
@ -0,0 +1,6 @@
|
|||
#PRAGMA IMADETHISONEUP
|
||||
PROC P ()
|
||||
#PRAGMA I made this one up too.
|
||||
INT a:
|
||||
SKIP
|
||||
:
|
Loading…
Reference in New Issue
Block a user