Exemplo n.º 1
0
        public override void EnterMacro_clause([NotNull] TxMarkParser.Macro_clauseContext context)
        {
            var macroName       = context.macro().macroName().GetText();
            var macroDefinition = _compileContext.ResolveMacro(macroName);

            if (!macroDefinition.Defined)
            {
                _compileContext.Log(LogLevel.Error, $"Macro ({macroName}:) was not found.", context.Start.Line, context.Start.Column);
            }
            string hookName = null;

            if (macroDefinition.RequiresHook)
            {
                if (context.hook() == null)
                {
                    _compileContext.Log(LogLevel.Error, $"Macro ({macroName}:) requires a hook, which was not supplied.", context.Start.Line, context.Start.Column);
                }
                else
                {
                    hookName = _compileContext.ResolveHookName(context);
                }
            }
            _compileContext.SetLocation(context.Start.Line, context.Start.Column);
            _compileContext.PushMacro(macroDefinition, hookName);
        }