Exemplo n.º 1
0
        private bool IsTypeCorrect(VarRef varRef)
        {
            Type varRefType = varRef.EntryTypeReference.GetType();

            if (varRefType == typeof(Ident))
            {
                if (Declarations.GetDeclarationByName(varRef.entry).GetType() != typeof(Variable))
                {
                    return(false);
                }
                return(true);
            }
            else if (varRefType == typeof(BracesIdent))
            {
                return(true);
            }
            else if (varRefType == typeof(Placeholder))
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 2
0
        public override bool IsGrammarCorrect()
        {
            var declarationType = declarations.GetDeclarationByName(declarationName);


            if (entry.Equals("procName", StringComparison.OrdinalIgnoreCase) && declarationType is Procedure)
            {
                refType = RefType.String;
                return(true);
            }

            if (entry.Equals("varName", StringComparison.OrdinalIgnoreCase) && declarationType is Variable)
            {
                refType = RefType.String;
                return(true);
            }

            if (entry.Equals("value", StringComparison.OrdinalIgnoreCase) && declarationType is Constant)
            {
                refType = RefType.Integer;
                return(true);
            }

            if (entry.Equals("stmt#", StringComparison.OrdinalIgnoreCase) && declarationType is Statement)
            {
                refType = RefType.Integer;
                return(true);
            }

            return(false);
        }
Exemplo n.º 3
0
        public override bool IsGrammarCorrect()
        {
            var declaration = declarations.GetDeclarationByName(entry);

            if (declaration == null)
            {
                return(false);
            }

            if (!(declaration is ProgramLine))
            {
                return(false);
            }

            return(new Ident().validate(entry));
        }