import modelize_property
import parser_util
-import simple_misc_analysis
import modelbuilder
+private import annotation
redef class ToolContext
var platform_phase: Phase = new PlatformPhase(self, [modelize_property_phase])
var annotation_name = "platform"
# Skip if we are not interested
- if nat.n_atid.n_id.text != annotation_name then return
+ if nat.name != annotation_name then return
# Do some validity checks and print errors if the annotation is used incorrectly
var modelbuilder = toolcontext.modelbuilder
else if args.is_empty then
platform_name = nmoduledecl.n_name.collect_text
else
- var arg = args.first
- var format_error = "Syntax error: \"{annotation_name}\" expects its argument to be the name of the target platform as a String literal."
-
- if not arg isa AExprAtArg then
+ platform_name = args.first.as_string
+ if platform_name == null then
+ var format_error = "Syntax error: \"{annotation_name}\" expects its argument to be the name of the target platform as a String literal."
modelbuilder.error(nat, format_error)
return
end
-
- var expr = arg.n_expr
- if not expr isa AStringFormExpr then
- modelbuilder.error(nat, format_error)
- return
- end
- var target = expr.collect_text
- platform_name = target.substring(1, target.length-2)
end
var nmodule = nmoduledecl.parent.as(AModule)
#
# Services will be added to this class in other modules.
abstract class Platform
+ fun supports_libunwind: Bool do return true
+
+ fun supports_libgc: Bool do return true
+
+ # Does this platform declare its own main function? If so, we won't generate one in Nit.
+ fun no_main: Bool do return false
end