Exemplo n.º 1
0
        protected void performSemanticAnalysis(
            string sourceName,
            List <object> rootNode,
            Environment environment,
            StreamWriter err,
            HashSet <Exception> pErrors)
        {
            OCLSemanticAnalyzer oclSemanticAnalyzer = getSemanticAnalyzer();

            performSemanticAnalysisPass(sourceName, rootNode, environment, err, pErrors, oclSemanticAnalyzer, new Pass1OclCompilerAction());
            performSemanticAnalysisPass(sourceName, rootNode, environment, err, pErrors, oclSemanticAnalyzer, new Pass2OclCompilerAction());
        }
Exemplo n.º 2
0
        protected void performSemanticAnalysisPass(
            string sourceName,
            List <object> rootNode,
            Environment environment,
            StreamWriter err,
            HashSet <Exception> pErrors,
            OCLSemanticAnalyzer analyzer,
            OclCompilerAction action)
        {
            foreach (CSTNode node in rootNode)
            {
                try {
                    if (node != null)
                    {
                        action.doAction(analyzer, environment, node);
                    }
                } catch (OCLMultipleSemanticExceptions exceptions) {
                    foreach (OCLSemanticException e in exceptions.getAllExceptions())
                    {
                        pErrors.Add(e);
                        if (err != null)
                        {
                            err.WriteLine(e);
                        }
                        semanticErrorsCount++;
                    }
                }  catch (OCLSemanticException e) {
                    pErrors.Add(e);

                    if (err != null)
                    {
                        err.WriteLine(e);
                    }

                    semanticErrorsCount++;
                } catch (Exception e) {
                    Console.WriteLine(e.StackTrace);

                    if (err != null)
                    {
                        err.WriteLine(e.Message);
                    }

                    semanticErrorsCount++;
                }
            }

            if ((err != null) && (semanticErrorsCount != 0))
            {
                err.Flush();
            }
        }
Exemplo n.º 3
0
 public void doAction(OCLSemanticAnalyzer analyzer, Environment environment, CSTNode node)
 {
     analyzer.analyze(environment, node);
 }
Exemplo n.º 4
0
 public void doAction(OCLSemanticAnalyzer analyzer, Environment environment, CSTNode node)
 {
     analyzer.analyzeFeatureDefinitions(environment, node);
 }