Package org.docopt.Pattern

Examples of org.docopt.Pattern.MatchResult


      }
    }

    extras(help, version, $argv, doc);

    final MatchResult m = pattern.fix().match($argv);

    if (m.matched() && m.getLeft().isEmpty()) {
      // @formatter:off
      // >>> return Dict((a.name, a.value) for a in (pattern.flat() + collected))
      // @formatter:on
      final Map<String, Object> u = new HashMap<String, Object>();

      for (final Pattern p : pattern.flat()) {
        // TODO: Does flat always return LeafPattern objects?
        if (!(p instanceof LeafPattern)) {
          throw new IllegalStateException();
        }

        final LeafPattern lp = (LeafPattern) p;

        u.put(lp.getName(), lp.getValue());
      }

      for (final LeafPattern p : m.getCollected()) {
        u.put(p.getName(), p.getValue());
      }

      return u;
    }
View Full Code Here

TOP

Related Classes of org.docopt.Pattern.MatchResult

Copyright © 2018 www.massapicom. 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.