mirror of
https://github.com/KarolS/millfork.git
synced 2025-01-06 09:33:22 +00:00
Allow using $$ instead of # in preprocessor directives
This commit is contained in:
parent
ffff51dee9
commit
ba16021426
@ -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)
|
* 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
|
### Defining feature values
|
||||||
|
|
||||||
Feature values are defined in the `[define]` section of the platform definition file.
|
Feature values are defined in the `[define]` section of the platform definition file.
|
||||||
|
@ -15,7 +15,7 @@ case class PreprocessingResult(source: String, featureConstants: Map[String, Lon
|
|||||||
|
|
||||||
object Preprocessor {
|
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 = {
|
def preprocessForTest(options: CompilationOptions, code: String): PreprocessingResult = {
|
||||||
apply(options, "", code.lines.toSeq)
|
apply(options, "", code.lines.toSeq)
|
||||||
|
@ -196,7 +196,7 @@ class BasicSymonTest extends FunSuite with Matchers {
|
|||||||
| #use ARCH_I80
|
| #use ARCH_I80
|
||||||
|
|
|
|
||||||
| #use HORSE = ARCH_6502
|
| #use HORSE = ARCH_6502
|
||||||
| #use COW = ARCH_I80
|
| $$use COW = ARCH_I80
|
||||||
|
|
|
|
||||||
| #if 1
|
| #if 1
|
||||||
| asm void main () {
|
| asm void main () {
|
||||||
|
Loading…
Reference in New Issue
Block a user