Package wyfs.util

Examples of wyfs.util.Trie


    return wf;
  }

  private Trie parsePackage() {
    Trie pkg = Trie.ROOT;

    if (tryAndMatch(true, Package) != null) {
      // found a package keyword
      pkg = pkg.append(match(Identifier).text);

      while (tryAndMatch(true, Dot) != null) {
        pkg = pkg.append(match(Identifier).text);
      }

      matchEndLine();
      return pkg;
    } else {
View Full Code Here


      }
      token = match(Identifier);
    }

    // Second, parse package string
    Trie filter = Trie.ROOT.append(token.text);
    token = null;
    while ((token = tryAndMatch(true, Dot, DotDot)) != null) {
      if (token.kind == DotDot) {
        filter = filter.append("**");
      }
      if (tryAndMatch(true, Star) != null) {
        filter = filter.append("*");
      } else {
        filter = filter.append(match(Identifier).text);
      }
    }

    int end = index;
    matchEndLine();
View Full Code Here

    HashSet<Pair<NameID, Nominal.FunctionOrMethod>> candidates = new HashSet<Pair<NameID, Nominal.FunctionOrMethod>>();
    // first, try to find the matching message
    for (WhileyFile.Import imp : context.imports()) {
      String impName = imp.name;
      if (impName == null || impName.equals(name) || impName.equals("*")) {
        Trie filter = imp.filter;
        if (impName == null) {
          // import name is null, but it's possible that a module of
          // the given name exists, in which case any matching names
          // are automatically imported.
          filter = filter.parent().append(name);
        }
        for (Path.ID mid : builder.imports(filter)) {
          NameID nid = new NameID(mid, name);
          addCandidateFunctionsAndMethods(nid, parameters,
              candidates, context);
View Full Code Here

  public NameID resolveAsName(String name, Context context)
      throws IOException, ResolveError {
    for (WhileyFile.Import imp : context.imports()) {
      String impName = imp.name;
      if (impName == null || impName.equals(name) || impName.equals("*")) {
        Trie filter = imp.filter;
        if (impName == null) {
          // import name is null, but it's possible that a module of
          // the given name exists, in which case any matching names
          // are automatically imported.
          filter = filter.parent().append(name);
        }
        for (Path.ID mid : builder.imports(filter)) {
          NameID nid = new NameID(mid, name);
          if (builder.isName(nid)) {
            // ok, we have found the name in question. But, is it
View Full Code Here

   */
  public Path.ID resolveAsModule(String name, Context context)
      throws IOException, ResolveError {

    for (WhileyFile.Import imp : context.imports()) {
      Trie filter = imp.filter;
      String last = filter.last();
      if (last.equals("*")) {
        // this is generic import, so narrow the filter.
        filter = filter.parent().append(name);
      } else if (!last.equals(name)) {
        continue; // skip as not relevant
      }

      for (Path.ID mid : builder.imports(filter)) {
View Full Code Here

    return wf;
  }

  private Trie parsePackage() {
    Trie pkg = Trie.ROOT;

    if (tryAndMatch(true, Package) != null) {
      // found a package keyword
      pkg = pkg.append(match(Identifier).text);

      while (tryAndMatch(true, Dot) != null) {
        pkg = pkg.append(match(Identifier).text);
      }

      matchEndLine();
      return pkg;
    } else {
View Full Code Here

      }
      token = match(Identifier);
    }

    // Second, parse package string
    Trie filter = Trie.ROOT.append(token.text);
    token = null;
    while ((token = tryAndMatch(true, Dot, DotDot)) != null) {
      if (token.kind == DotDot) {
        filter = filter.append("**");
      }
      if (tryAndMatch(true, Star) != null) {
        filter = filter.append("*");
      } else {
        filter = filter.append(match(Identifier).text);
      }
    }

    int end = index;
    matchEndLine();
View Full Code Here

TOP

Related Classes of wyfs.util.Trie

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.