mirror of
https://github.com/KarolS/millfork.git
synced 2025-01-19 19:30:08 +00:00
Fix #use and #pragma
This commit is contained in:
parent
ff78c738f2
commit
80e4b6d173
@ -64,7 +64,7 @@ abstract class AbstractSourceLoadingQueue[T](val initialFilenames: List[String],
|
||||
val PreprocessingResult(src, featureConstants, pragmas) = Preprocessor(options, shortFileName, Files.readAllLines(path, StandardCharsets.UTF_8).toIndexedSeq)
|
||||
for (pragma <- pragmas) {
|
||||
if (!supportedPragmas(pragma._1)) {
|
||||
options.log.warn(s"Unsupported pragma: #pragma $pragma", Some(Position(moduleName, pragma._2, 1, 0)))
|
||||
options.log.warn(s"Unsupported pragma: #pragma ${pragma._1}", Some(Position(moduleName, pragma._2, 1, 0)))
|
||||
}
|
||||
}
|
||||
val parser = createParser(shortFileName, src, parentDir, featureConstants, pragmas.keySet)
|
||||
|
@ -59,7 +59,7 @@ object Preprocessor {
|
||||
keyword match {
|
||||
case "use" => if (enabled) {
|
||||
if (param == "") log.error("#use should have a parameter", pos)
|
||||
featureConstants += param -> platform.features.getOrElse(param, {
|
||||
featureConstants += param -> options.features.getOrElse(param, {
|
||||
log.warn(s"Undefined parameter $param, assuming 0", pos)
|
||||
0L
|
||||
})
|
||||
@ -115,8 +115,10 @@ object Preprocessor {
|
||||
ifStack.push(ifStack.pop().copy(hadEnabled = true, hadElse = true))
|
||||
}
|
||||
case "pragma" =>
|
||||
if (param == "") log.error("#pragma should", pos)
|
||||
pragmas += param -> lineNo
|
||||
if (enabled) {
|
||||
if (param == "") log.error("#pragma should have a parameter", pos)
|
||||
pragmas += param -> lineNo
|
||||
}
|
||||
case _ =>
|
||||
log.error("Invalid preprocessor directive: #" + keyword, pos)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user