Examples of RuleContext


Examples of modTransf.engine.RuleContext

    * @param args
    */
   public void callRule(Object args, String ruleName )
     //throws TransformationException
   {
   RuleContext request = getRuleContext();
   System.out.println("generate.callRule(" + args + ", " + ruleName + ")"  );


//   try
//     {
View Full Code Here

Examples of net.sourceforge.pmd.RuleContext

        locator.addSearchPath( "url", "" );
        locator.setOutputDirectory( targetDirectory );

        reportListener = new PmdReportListener();
        PMDConfiguration pmdConfiguration = getPMDConfiguration();
        RuleContext ruleContext = new RuleContext();
        ruleContext.getReport().addListener( reportListener );

        RuleSetFactory ruleSetFactory = new RuleSetFactory();
        ruleSetFactory.setMinimumPriority( RulePriority.valueOf( this.minimumPriority ) );

        // Workaround for https://sourceforge.net/p/pmd/bugs/1155/: add a dummy ruleset.
View Full Code Here

Examples of net.sourceforge.pmd.RuleContext

        throws MavenReportException
    {
        Sink sink = getSink();

        PMD pmd = getPMD();
        RuleContext ruleContext = new RuleContext();
        Report report = new Report();
        PmdReportListener reportSink = new PmdReportListener( sink, getBundle( locale ), aggregate );

        report.addListener( reportSink );
        ruleContext.setReport( report );
        reportSink.beginDocument();

        RuleSetFactory ruleSetFactory = new RuleSetFactory();
        ruleSetFactory.setMinimumPriority( this.minimumPriority );
        RuleSet[] sets = new RuleSet[rulesets.length];
        try
        {
            for ( int idx = 0; idx < rulesets.length; idx++ )
            {
                String set = rulesets[idx];
                getLog().debug( "Preparing ruleset: " + set );
                File ruleset = locator.getResourceAsFile( set, getLocationTemp( set ) );

                if ( null == ruleset )
                {
                    throw new MavenReportException( "Could not resolve " + set );
                }

                InputStream rulesInput = new FileInputStream( ruleset );
                try
                {
                    RuleSet ruleSet = ruleSetFactory.createRuleSet( rulesInput );
                    sets[idx] = ruleSet;

                    ruleSet.start( ruleContext );
                }
                finally
                {
                    rulesInput.close();
                }
            }
        }
        catch ( IOException e )
        {
            throw new MavenReportException( e.getMessage(), e );
        }
        catch ( ResourceNotFoundException e )
        {
            throw new MavenReportException( e.getMessage(), e );
        }
        catch ( FileResourceCreationException e )
        {
            throw new MavenReportException( e.getMessage(), e );
        }

        Map<File, PmdFileInfo> files;
        try
        {
            files = getFilesToProcess();
        }
        catch ( IOException e )
        {
            throw new MavenReportException( "Can't get file list", e );
        }

        if ( StringUtils.isEmpty( getSourceEncoding() ) && !files.isEmpty() )
        {
            getLog().warn( "File encoding has not been set, using platform encoding " + ReaderFactory.FILE_ENCODING
                               + ", i.e. build is platform dependent!" );
        }

        for ( Map.Entry<File, PmdFileInfo> entry : files.entrySet() )
        {
            File file = entry.getKey();
            PmdFileInfo fileInfo = entry.getValue();

            // TODO: lazily call beginFile in case there are no rules

            reportSink.beginFile( file, fileInfo );
            ruleContext.setSourceCodeFilename( file.getAbsolutePath() );
            for ( int idx = 0; idx < rulesets.length; idx++ )
            {
                try
                {
                    // PMD closes this Reader even though it did not open it so we have
View Full Code Here

Examples of net.sourceforge.pmd.RuleContext

    {
        Sink sink = getSink();

        PMDConfiguration pmdConfiguration = getPMDConfiguration();
        final PmdReportListener reportSink = new PmdReportListener( getLog(), sink, getBundle( locale ), aggregate );
        RuleContext ruleContext = new RuleContext()
        {
            @Override
            public void setReport( Report report )
            {
                super.setReport( report );
View Full Code Here

Examples of net.sourceforge.pmd.RuleContext

   }

   private Report computeReport( final FlexPmdViolations pmd )
   {
      final Report report = new Report();
      final RuleContext ruleContext = new RuleContext();
      final PmdReportListener reportSink = new PmdReportListener( sink, bundle, aggregate );

      report.addListener( reportSink );
      ruleContext.setReport( report );
      reportSink.beginDocument();
      report.start();

      for ( final IFlexFile file : pmd.getViolations().keySet() )
      {
         final File javaFile = new File( file.getFilePath() ); // NOPMD
         final List< IFlexViolation > violations = pmd.getViolations().get( file );

         reportSink.beginFile( javaFile,
                               new PmdFileInfo( project, javaFile.getParentFile(), "" ) ); // NOPMD
         ruleContext.setSourceCodeFilename( file.getPackageName()
               + "." + file.getClassName() );

         for ( final IFlexViolation violation : violations )
         {
            report.addRuleViolation( violation );
View Full Code Here

Examples of net.sourceforge.pmd.RuleContext

        locator.addSearchPath( "url", "" );
        locator.setOutputDirectory( targetDirectory );

        reportListener = new PmdReportListener();
        PMDConfiguration pmdConfiguration = getPMDConfiguration();
        RuleContext ruleContext = new RuleContext();
        ruleContext.getReport().addListener( reportListener );

        RuleSetFactory ruleSetFactory = new RuleSetFactory();
        ruleSetFactory.setMinimumPriority( RulePriority.valueOf( this.minimumPriority ) );

        // Workaround for https://sourceforge.net/p/pmd/bugs/1155/: add a dummy ruleset.
View Full Code Here

Examples of org.antlr.v4.runtime.RuleContext

    ParseTree tree = execStartRule(startRuleName, parser);

    List<String> nodes = new ArrayList<String>();
    for (ParseTree t : XPath.findAll(tree, xpath, parser) ) {
      if ( t instanceof RuleContext) {
        RuleContext r = (RuleContext)t;
        nodes.add(parser.getRuleNames()[r.getRuleIndex()]);
      }
      else {
        TerminalNode token = (TerminalNode)t;
        nodes.add(token.getText());
      }
View Full Code Here

Examples of org.antlr.v4.runtime.RuleContext

  public IntervalSet getExpectedTokens(int stateNumber, @Nullable RuleContext context) {
    if (stateNumber < 0 || stateNumber >= states.size()) {
      throw new IllegalArgumentException("Invalid state number.");
    }

    RuleContext ctx = context;
    ATNState s = states.get(stateNumber);
    IntervalSet following = nextTokens(s);
    if (!following.contains(Token.EPSILON)) {
      return following;
    }
View Full Code Here

Examples of org.antlr.v4.runtime.RuleContext

            this.isCtxDependent = isCtxDependent;
        }

        @Override
        public boolean eval(Recognizer<?,?> parser, RuleContext parserCallStack) {
            RuleContext localctx = isCtxDependent ? parserCallStack : null;
            return parser.sempred(localctx, ruleIndex, predIndex);
        }
View Full Code Here

Examples of org.antlr.v4.runtime.RuleContext

            else if (JAVADOC_WRONG_SINGLETON_TAG.equals(aMsg)) {
                log(lineNumber, JAVADOC_WRONG_SINGLETON_TAG, token.getText());
                throw new ParseCancellationException();
            }
            else {
                final RuleContext ruleContext = aEx.getCtx();
                if (ruleContext != null) {
                    final int ruleIndex = aEx.getCtx().getRuleIndex();
                    final String ruleName = aRecognizer.getRuleNames()[ruleIndex];
                    final String upperCaseRuleName = CaseFormat.UPPER_CAMEL.to(
                            CaseFormat.UPPER_UNDERSCORE, ruleName);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.