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());
        }
        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();
            }
        }
 public void doAction(OCLSemanticAnalyzer analyzer, Environment environment, CSTNode node)
 {
     analyzer.analyze(environment, node);
 }
 public void doAction(OCLSemanticAnalyzer analyzer, Environment environment, CSTNode node)
 {
     analyzer.analyzeFeatureDefinitions(environment, node);
 }