1
0
mirror of https://github.com/KarolS/millfork.git synced 2025-01-01 06:29:53 +00:00

Allow using $$ instead of # in preprocessor directives

This commit is contained in:
Karol Stasiak 2019-06-14 15:33:17 +02:00
parent ffff51dee9
commit ba16021426
3 changed files with 5 additions and 2 deletions

View File

@ -16,6 +16,9 @@ Despite its similarity to the C preprocessor, it's much more restricted in its p
* separate namespaces for the preprocessor and the language (you need to use `#use` to use a preprocessor constant in the code)
Preprocessor directives by default start with `#`.
To avoid conflicts with C preprocessor (for users wishing to use it), it is also possible to replace `#` with `$$`.
### Defining feature values
Feature values are defined in the `[define]` section of the platform definition file.

View File

@ -15,7 +15,7 @@ case class PreprocessingResult(source: String, featureConstants: Map[String, Lon
object Preprocessor {
private val Regex = raw"\A\s*#\s*([a-z]+)\s*(.*?)\s*\z".r
private val Regex = """\A\s*(?:#|\$\$)\s*([a-z]+)\s*(.*?)\s*\z""".r
def preprocessForTest(options: CompilationOptions, code: String): PreprocessingResult = {
apply(options, "", code.lines.toSeq)

View File

@ -196,7 +196,7 @@ class BasicSymonTest extends FunSuite with Matchers {
| #use ARCH_I80
|
| #use HORSE = ARCH_6502
| #use COW = ARCH_I80
| $$use COW = ARCH_I80
|
| #if 1
| asm void main () {