Examples of PatternSet


Examples of net.sourceforge.chaperon.model.extended.PatternSet

    return pattern;
  }

  public PatternSet getPreviousPattern()
  {
    PatternSet pattern = new PatternSet();

    for (Item item = first; item!=null; item = item.next)
      if ((item.position==Item.GOTO) && (item.pattern!=null))
        pattern.addPattern(item.pattern);

    return pattern;
  }
View Full Code Here

Examples of net.sourceforge.chaperon.model.extended.PatternSet

    {
      //State state = getState(i);
      //System.out.println("\nState "+i+"\n"+state);
      SortedCharSet limits = new SortedCharSet();
      StringSet nonterminals = new StringSet();
      PatternSet gotoPattern = new PatternSet();

      for (Item item = state.first; item!=null; item = item.next)
      {
        if (item.position==Item.SHIFT)
        {
          if (item.pattern.getSymbol()!=null)
            nonterminals.addString(item.pattern.getSymbol());

          limits.addChar(item.pattern.getLimits());
        }
        else if (item.position==Item.GOTO)
          gotoPattern.addPattern(item.pattern);

        limits.addChar(item.lookahead.getLimits());
      }

//      System.out.println("limits="+limits);
//      System.out.println("nonterminals="+nonterminals);
//      System.out.println("gotoPattern="+gotoPattern);
      // for all other characters from the begin
      if ((limits.getCharCount()>=1) && (limits.getChar(0)>'\u0000'))
      {
        addShiftAction(state, '\u0000', (char)(limits.getChar(0)-1));
        addReduceAction(state, '\u0000', (char)(limits.getChar(0)-1));
      }

      // for each character
      for (int j = 0; j<limits.getCharCount(); j++)
      {
        if ((j>0) && ((limits.getChar(j)-limits.getChar(j-1))>1))
        {
          addShiftAction(state, (char)(limits.getChar(j-1)+1), (char)(limits.getChar(j)-1));
          addReduceAction(state, (char)(limits.getChar(j-1)+1), (char)(limits.getChar(j)-1));
        }

        addShiftAction(state, limits.getChar(j), limits.getChar(j));
        addReduceAction(state, limits.getChar(j), limits.getChar(j));
      }

      // for all other characters to the end
      if (limits.getCharCount()>=1)
      {
        addShiftAction(state, (char)(limits.getChar(limits.getCharCount()-1)+1), '\u4000');
        addReduceAction(state, (char)(limits.getChar(limits.getCharCount()-1)+1), '\u4000');
      }

      // for universal characters
      if (limits.getCharCount()==0)
      {
        addShiftAction(state, '\u0000', '\u4000');
        addReduceAction(state, '\u0000', '\u4000');
      }

      // for each nonterminal
      for (int j = 0; j<nonterminals.getStringCount(); j++)
        addGotoAction(state, nonterminals.getString(j));

      for (PatternIterator pattern = gotoPattern.getPattern(); pattern.hasNext();)
        addGotoAction(state, pattern.next());

      addReduceAction(state);
    }
  }
View Full Code Here

Examples of net.sourceforge.chaperon.model.extended.PatternSet

  private State getStartState()
  {
    if (grammar.getStartSymbol()==null)
      throw new IllegalArgumentException("Start symbol is not defined");

    PatternSet firstSet = grammar.getFirstSet();

    System.out.println("firstset = "+firstSet);

    State state = new State(grammar);

    for (PatternIterator pattern = firstSet.getPattern(); pattern.hasNext();)
    {
      Pattern firstPattern = pattern.next();
      Item item =
        new Item(((Definition)definitions.get(firstPattern)).getSymbol(), firstPattern, Item.SHIFT,
                 null);
View Full Code Here

Examples of net.sourceforge.chaperon.model.extended.PatternSet

        String symbol = ((Element)item.pattern).getSymbol();
        System.out.println("pattern="+item.pattern);

        Definition definition = ((Definition)definitions.get(item.pattern));
        PatternSet firstSet = grammar.getFirstSet(symbol);
        for (PatternIterator pattern = firstSet.getPattern(); pattern.hasNext();)
        {
          Pattern firstPattern = pattern.next();

          //Definition definition = ((Definition)definitions.get(firstSet.getPattern(l)));
          if (definition.getLastSet().contains(item.pattern))
View Full Code Here

Examples of org.apache.maven.model.PatternSet

     * @return PatternSet
     */
    private PatternSet parsePatternSet( String tagName, XmlPullParser parser, boolean strict )
        throws IOException, XmlPullParserException
    {
        PatternSet patternSet = new PatternSet();
        java.util.Set parsed = new java.util.HashSet();
        while ( parser.nextTag() == XmlPullParser.START_TAG )
        {
            if ( checkFieldWithDuplicate( parser, "includes", null, parsed ) )
            {
                java.util.List includes = new java.util.ArrayList/*<String>*/();
                patternSet.setIncludes( includes );
                while ( parser.nextTag() == XmlPullParser.START_TAG )
                {
                    if ( parser.getName().equals( "include" ) )
                    {
                        includes.add( getTrimmedValue( parser.nextText() ) );
                    }
                    else if ( strict )
                    {
                        throw new XmlPullParserException( "Unrecognised association: '" + parser.getName() + "'", parser, null );
                    }
                    else
                    {
                        // swallow up to end tag since this is not valid
                        while ( parser.next() != XmlPullParser.END_TAG ) {}
                    }
                }
            }
            else if ( checkFieldWithDuplicate( parser, "excludes", null, parsed ) )
            {
                java.util.List excludes = new java.util.ArrayList/*<String>*/();
                patternSet.setExcludes( excludes );
                while ( parser.nextTag() == XmlPullParser.START_TAG )
                {
                    if ( parser.getName().equals( "exclude" ) )
                    {
                        excludes.add( getTrimmedValue( parser.nextText() ) );
View Full Code Here

Examples of org.apache.maven.project.PatternSet

     * @param parser
     */
    private PatternSet parsePatternSet(String tagName, XmlPullParser parser, boolean strict, String encoding)
        throws IOException, XmlPullParserException
    {
        PatternSet patternSet = new PatternSet();
        patternSet.setModelEncoding( encoding );
        java.util.Set parsed = new java.util.HashSet();
        while ( parser.nextTag() == XmlPullParser.START_TAG )
        {
            if ( parser.getName().equals( "includes" )  )
            {
                if ( parsed.contains( "includes" ) )
                {
                    throw new XmlPullParserException( "Duplicated tag: '" + parser.getName() + "'", parser, null);
                }
                parsed.add( "includes" );
                java.util.List includes = new java.util.ArrayList();
                patternSet.setIncludes( includes );
                while ( parser.nextTag() == XmlPullParser.START_TAG )
                {
                    if ( parser.getName().equals( "include" ) )
                    {
                        includes.add( getTrimmedValue( parser.nextText()) );
                    }
                    else
                    {
                        parser.nextText();
                    }
                }
            }
            else if ( parser.getName().equals( "excludes" )  )
            {
                if ( parsed.contains( "excludes" ) )
                {
                    throw new XmlPullParserException( "Duplicated tag: '" + parser.getName() + "'", parser, null);
                }
                parsed.add( "excludes" );
                java.util.List excludes = new java.util.ArrayList();
                patternSet.setExcludes( excludes );
                while ( parser.nextTag() == XmlPullParser.START_TAG )
                {
                    if ( parser.getName().equals( "exclude" ) )
                    {
                        excludes.add( getTrimmedValue( parser.nextText()) );
View Full Code Here

Examples of org.apache.tools.ant.types.PatternSet

  } // end of transform path structure.


  private void createPatternSet()
  {
    final PatternSet patternSet = new PatternSet();

    log("Creating a patternset for the bundles with id='" +patternSetId +"'.",
        Project.MSG_DEBUG);

    for (Iterator it=bas.allBundleArchives.iterator(); it.hasNext();) {
      BundleArchives.BundleArchive ba
        = (BundleArchives.BundleArchive) it.next();

      patternSet.setIncludes(ba.relPath);
      log("Adding includes '" +ba.relPath +"'.", Project.MSG_DEBUG);
    }
    getProject().addReference(patternSetId, patternSet);
  } // end of create pattern set for bundles
View Full Code Here

Examples of org.apache.tools.ant.types.PatternSet

        log("copyInjars does not support inpath.\n", Project.MSG_WARN);
      }
      String taskName = getTaskName() + " - unzip";
      String[] paths = injars.list();
      if (!LangUtil.isEmpty(paths)) {
        PatternSet patternSet = new PatternSet();
        patternSet.setProject(project);
        patternSet.setIncludes("**/*");
        patternSet.setExcludes("**/*.class");
        for (int i = 0; i < paths.length; i++) {
          Expand unzip = new Expand();
          unzip.setProject(project);
          unzip.setTaskName(taskName);
          unzip.setDest(destDir);
View Full Code Here

Examples of org.apache.tools.ant.types.PatternSet

            return getPattern().createExclude();
        }

        private PatternSet getPattern() {
            if (patternSet == null) {
                patternSet = new PatternSet();
            }
            return patternSet;
        }
View Full Code Here

Examples of org.apache.tools.ant.types.PatternSet

        // for each sourcePath entry, add a directoryset with includes
        // taken from packagenames attribute and nested package
        // elements and excludes taken from excludepackages attribute
        // and nested excludepackage elements
        if (this.sourcePath != null) {
            PatternSet ps = new PatternSet();
            if (packageNames.size() > 0) {
                for (String pn : packageNames) {
                    String pkg = pn.replace('.', '/');
                    if (pkg.endsWith("*")) {
                        pkg += "*";
                    }
                    ps.createInclude().setName(pkg);
                }
            } else {
                ps.createInclude().setName("**");
            }

            for (String epn : excludePackageNames) {
                String pkg = epn.replace('.', '/');
                if (pkg.endsWith("*")) {
                    pkg += "*";
                }
                ps.createExclude().setName(pkg);
            }

            String[] pathElements = this.sourcePath.list();
            for (String pathElement : pathElements) {
                File dir = new File(pathElement);
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.