-
-
Notifications
You must be signed in to change notification settings - Fork 9
Meta Directives
Meta directives allow for conditional compilation and basic compile-time computation
Meta directives start with a # followed by the directive and its parameters
#directive // ... parameters ...
Defines a transcendent variable with an initial value
#define enable_secret_feature true
Sets the value of a transcendent variable if it's undefined
#default transcendent_variable value
Sets the value of a transcendent variable
#set transcendent_variable value
Prints the value of a transcendent expression
#print "Hello World!"
#print "Welcome + name
Prints the value of a transcendent expression as an error
#print_error "Something went wrong"
#print_error "Compilation failed due to " + fail_reason
Prints the value of a transcendent expression as a warning
#print_warning "Wet floor!"
#print_warning "Assuming version to be " + version
Prints the value of a transcendent epression without a trailing newline
#place "Hello World"
#place "Welcome " + name
Prints the value of a transcendent expression without a trailing newline as an error
#place_error "Something went wrong"
#place_error "Compilation failed due to " + fail_reason
Prints the value of a transcendent expression without a trailing newline as a warning
#place_warning "Wet floor!"
#place_warning "Assuming version to be " + version
Reads from standard input into a transcendent variable
#input name
Stops compilation, exits with status of 0.
#done
Stops compilation, exits with status of 1.
#halt
Conditionally compiles a section of code
#if condition
#print "condition is true"
#end
Conditionally compiles a section of code if none of the previous #if/#elif conditions were met and the given condition is true
#if condition1
#print "condition1 is true"
#elif condition2
#print "condition1 is false, but condition2 is true"
#end
Conditionally compiles a section of code if none of the previous if/elif conditions were met
#if condition1
#print "condition1 is true"
#else
#print "condition1 is false"
#end
Ends a meta conditional
#if condition
#print "condition is true"
#end
Compiles a section of code if the condition given isn't true
#unless condition
#print "condition is false"
#end
Imports the value of a transcendent expression
#import necessary_folder + "necessary.adept"
Raises an error (with a code snippet) and halts compilation
#error "Requirements not met!"
main.adept:2:1: error: Requirements not met!
2| #error "Requirements not met!"
^^^^^^
Raises a warning (with a code snippet)
#warning "Missing information"
main.adept:2:1: warning: Missing information
2| #warning "Missing information"
^^^^^^^^
Gets the value of a transcendent variable and injects it into the surrounding code
print(#get version_string)
Creates a project-local copy of a file (if one with the same name doesn't already exist)
#runtime_resource "libcurl-x64.dll"
Used to automatically supply runtime resources such as .dll files to new projects that need them.
Alternative syntax for pragma directives
#pragma compiler_supports '2.5'
Alternative syntax for file imports
#import <basics>
#import "greet.adept"