Пример #1
0
        public override bool CheckType(QLTypeErrors typeErrors)
        {
            if (Memory.IsDeclared(Name))
            {
                typeErrors.ReportError(new QLTypeError(
                                           string.Format("(Question) Identifier '{0}' is already defined!", Name),
                                           TokenInfo
                                           ));

                return(false);
            }

            Memory.Declare(Name, Type);

            if (Memory.LabelIsDeclared(Label))
            {
                typeErrors.ReportError(new QLTypeError(
                                           string.Format("(Question) Declared label already exists: '{0}'", Label),
                                           TokenInfo,
                                           true
                                           ));
            }

            Memory.DeclareLabel(Label);

            DeclareValue();

            return(true);
        }
Пример #2
0
        public override bool CheckType(QLTypeErrors typeErrors)
        {
            if (!_memory.IsDeclared(_name))
            {
                typeErrors.ReportError(new QLTypeError(
                                           string.Format("Referenced identifier '{0}' is not defined!", _name),
                                           TokenInfo
                                           ));

                return(false);
            }

            return(true);
        }