Esempio n. 1
0
def _ResolveNames(names, funcs, aliases, search_path):
  results = []
  for name in names:
    if name in funcs:
      kind = ('function', name)
    elif name in aliases:
      kind = ('alias', name)
    elif Resolve(name) != builtin_e.NONE:
      kind = ('builtin', name)
    elif ResolveSpecial(name) != builtin_e.NONE:
      kind = ('builtin', name)
    elif ResolveAssign(name) != builtin_e.NONE:
      kind = ('builtin', name)
    elif lex.IsOtherBuiltin(name):  # continue, etc.
      kind = ('builtin', name)
    elif lex.IsKeyword(name):
      kind = ('keyword', name)
    else:
      resolved = search_path.Lookup(name)
      if resolved is None:
        kind = (None, None)
      else:
        kind = ('file', resolved) 
    results.append(kind)

  return results
Esempio n. 2
0
def _ResolveNames(names, funcs, path_val):
    if path_val.tag == value_e.Str:
        path_list = path_val.s.split(':')
    else:
        path_list = []  # treat as empty path

    results = []
    for name in names:
        if name in funcs:
            kind = ('function', name)
        elif Resolve(name) != builtin_e.NONE:
            kind = ('builtin', name)
        elif ResolveSpecial(name) != builtin_e.NONE:
            kind = ('builtin', name)
        elif lex.IsOtherBuiltin(name):  # declare, continue, etc.
            kind = ('builtin', name)
        elif lex.IsKeyword(name):
            kind = ('keyword', name)
        else:
            # Now look for files.
            found = False
            for path_dir in path_list:
                full_path = os_path.join(path_dir, name)
                if path_stat.exists(full_path):
                    kind = ('file', full_path)
                    found = True
                    break
            if not found:  # Nothing printed, but status is 1.
                kind = (None, None)
        results.append(kind)

    return results
Esempio n. 3
0
def _ResolveNames(names, funcs, path_val):
  results = []
  path_list = _ParsePath(path_val)
  for name in names:
    if name in funcs:
      kind = ('function', name)
    elif Resolve(name) != builtin_e.NONE:
      kind = ('builtin', name)
    elif ResolveSpecial(name) != builtin_e.NONE:
      kind = ('builtin', name)
    elif lex.IsOtherBuiltin(name):  # declare, continue, etc.
      kind = ('builtin', name)
    elif lex.IsKeyword(name):
      kind = ('keyword', name)
    else:
      kind = _ResolveFile(name, path_list)
    results.append(kind)

  return results