MessageFilter.g:164:1: path_function : XPATH_FUN_NAME '(' STRING ')' -> ^( XPATH_FUN_NAME STRING ) ;
555079
public final path_function_return path_function() throws RecognitionException {
        path_function_return retval = new path_function_return();
        retval.start = input.LT(1);


        CommonTree root_0 = null;

        Token XPATH_FUN_NAME81=null;
        Token char_literal82=null;
        Token STRING83=null;
        Token char_literal84=null;

        CommonTree XPATH_FUN_NAME81_tree=null;
        CommonTree char_literal82_tree=null;
        CommonTree STRING83_tree=null;
        CommonTree char_literal84_tree=null;
        RewriteRuleTokenStream stream_XPATH_FUN_NAME=new RewriteRuleTokenStream(adaptor,"token XPATH_FUN_NAME");
        RewriteRuleTokenStream stream_33=new RewriteRuleTokenStream(adaptor,"token 33");
        RewriteRuleTokenStream stream_34=new RewriteRuleTokenStream(adaptor,"token 34");
        RewriteRuleTokenStream stream_STRING=new RewriteRuleTokenStream(adaptor,"token STRING");

        try {
            // MessageFilter.g:165:2: ( XPATH_FUN_NAME '(' STRING ')' -> ^( XPATH_FUN_NAME STRING ) )
            // MessageFilter.g:165:4: XPATH_FUN_NAME '(' STRING ')'
            {
            XPATH_FUN_NAME81=(Token)match(input,XPATH_FUN_NAME,FOLLOW_XPATH_FUN_NAME_in_path_function990);
            stream_XPATH_FUN_NAME.add(XPATH_FUN_NAME81);


            char_literal82=(Token)match(input,33,FOLLOW_33_in_path_function992);
            stream_33.add(char_literal82);


            STRING83=(Token)match(input,STRING,FOLLOW_STRING_in_path_function994);
            stream_STRING.add(STRING83);


            char_literal84=(Token)match(input,34,FOLLOW_34_in_path_function996);
            stream_34.add(char_literal84);


            // AST REWRITE
            // elements: XPATH_FUN_NAME, STRING
            // token labels:
            // rule labels: retval
            // token list labels:
            // rule list labels:
            // wildcard labels:
            retval.tree = root_0;
            RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.tree:null);

            root_0 = (CommonTree)adaptor.nil();
            // 165:34: -> ^( XPATH_FUN_NAME STRING )
            {
                // MessageFilter.g:165:37: ^( XPATH_FUN_NAME STRING )
                {
                CommonTree root_1 = (CommonTree)adaptor.nil();
                root_1 = (CommonTree)adaptor.becomeRoot(
                new XPathTreeNode(stream_XPATH_FUN_NAME.nextToken())
                , root_1);

                adaptor.addChild(root_1,
                new StringTreeNode(stream_STRING.nextToken())
                );

                adaptor.addChild(root_0, root_1);
                }

            }


            retval.tree = root_0;

            }

            retval.stop = input.LT(-1);


            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }

        finally {
        	// do for sure before leaving
        }
        return retval;
    }
1096866
function JavascriptXPathEngine() {
// private
    var engineDoc = document;

// public
    // Override
    this.isAvailable = function() { return true; };

    // Override
    this.selectNodes = function(xpath, contextNode, namespaceResolver) {
        if (contextNode != this.doc) {
            // Regarding use of the second argument to document.evaluate():
            // http://groups.google.com/group/comp.lang.javascript/browse_thread/thread/a59ce20639c74ba1/a9d9f53e88e5ebb5
            xpath = '.' + xpath;
        }

        var nodes = [];

        try {
            // When using the new and faster javascript-xpath library, we'll
            // use the TestRunner's document object, not the App-Under-Test's
            // document. The new library only modifies the TestRunner document
            // with the new functionality.
            var xpathResult = engineDoc.evaluate(xpath, contextNode,
                namespaceResolver, 0, null);
        }
        catch (e) {
            var msg = extractExceptionMessage(e);
            throw new SeleniumError("Invalid xpath [1]: " + msg);
        }
        finally {
            if (xpathResult == null) {
                // If the result is null, we should still throw an Error.
                throw new SeleniumError("Invalid xpath [2]: " + xpath);
            }
        }

        var node = xpathResult.iterateNext();

        while (node) {
            nodes.push(node);
            node = xpathResult.iterateNext();
        }

        return nodes;
    };
}
184567
function (str) {
        // Try fast path regexp
        // See: https://github.com/joyent/node/pull/7878
        var simplePath = typeof str === 'string' && simplePathRegExp.exec(str);

        // Construct simple URL
        if (simplePath) {
            var pathname = simplePath[1];
            var search = simplePath[2] || null;
            var url = urlModule.Url !== undefined ? new urlModule.Url() : {};
            url.path = str;
            url.href = str;
            url.pathname = pathname;
            url.search = search;
            url.query = search && search.substr(1);

            return url;
        }

        return urlModule.parse(str);
    }
783797
function PathNotFoundError(path, sympath){
  superError.call(
    this,
    'PathNotFoundError',
    util.format('Path was not found in the tree: %s', sympath)
  );

  this.arrayPath = path;
  this.sympath = sympath;
}
653972
def path(string):
        
        if not os.path.exists(string):
            msg = "Path %s not found!" % string
            raise ArgumentTypeError(msg)
        return string
134405
private String validatePath(String path) throws CmsSecurityException {

        // Problems with spaces in new folders (default: "Neuer Ordner")
        // Solution: translate this to a correct name.
        String ret = m_cms.getRequestContext().getFileTranslator().translateResource(path);

        // add site root only works correct if system folder ends with a slash
        if (CmsResource.VFS_FOLDER_SYSTEM.equals(ret)) {
            ret = ret.concat("/");
        }

        // filter path
        if (isFiltered(ret)) {
            throw new CmsSecurityException(Messages.get().container(Messages.ERR_ITEM_FILTERED_1, path));
        }

        return ret;
    }
1096532
private static String formatXPathForJavaXPath(String xpath) throws Exception {
		String newXPath = "";

		if (xpath.startsWith("xpath=")) {
			xpath = xpath.replace("xpath=", "");
		}

		boolean convertIndicator = true;
		boolean onSlash = false;
		boolean onSingleQuote = false;
		boolean onDoubleQuote = false;
		for (int i = 0; i < xpath.length(); i++) {
			char c = xpath.charAt(i);
			if (c == '/') {
				if (!onSingleQuote && !onDoubleQuote) {
					if (convertIndicator) {
						if (!onSlash) {
							onSlash = true;
						} else {
							onSlash = false;
						}
					} else {
						convertIndicator = true;
						onSlash = true;
					}
				}
			} else if (c == '[') {
				if (!onSingleQuote && !onDoubleQuote)
					convertIndicator = false;
			} else if (c == ']') {
				if (!onSingleQuote && !onDoubleQuote)
					convertIndicator = true;
			} else if (c == '\'') {
				if (!onSingleQuote)
					onSingleQuote = true;
				else
					onSingleQuote = false;
			} else if (c == '\"') {
				if (!onDoubleQuote)
					onDoubleQuote = true;
				else
					onDoubleQuote = false;
			}

			if (convertIndicator)
				newXPath = newXPath + String.valueOf(c).toLowerCase();
			else
				newXPath = newXPath + String.valueOf(c);
		}

		return newXPath;
	}
993139
public Object extFunction(String ns, String funcName, Vector argVec,
        Object methodKey) throws javax.xml.transform.TransformerException {
        try {

            if ( funcName == null ) {
                String fmsg = XSLMessages.createXPATHMessage(
                    XPATHErrorResources.ER_ARG_CANNOT_BE_NULL,
                    new Object[] {"Function Name"} );
                throw new NullPointerException ( fmsg ); 
            }
            //Find the XPathFunction corresponding to namespace and funcName
            javax.xml.namespace.QName myQName = new QName( ns, funcName );

            // JAXP 1.3 spec says When XMLConstants.FEATURE_SECURE_PROCESSING 
            // feature is set then invocation of extension functions need to
            // throw XPathFunctionException
            if ( extensionInvocationDisabled ) {
                String fmsg = XSLMessages.createXPATHMessage(
                    XPATHErrorResources.ER_EXTENSION_FUNCTION_CANNOT_BE_INVOKED,
                    new Object[] { myQName.toString() } );
                throw new XPathFunctionException ( fmsg );
            }

            // Assuming user is passing all the needed parameters ( including
            // default values )
            int arity = argVec.size();

            javax.xml.xpath.XPathFunction xpathFunction = 
                resolver.resolveFunction ( myQName, arity );

            // not using methodKey
            ArrayList argList = new ArrayList( arity);
            for ( int i=0; i<arity; i++ ) {
                Object argument = argVec.elementAt( i );
                // XNodeSet object() returns NodeVector and not NodeList
                // Explicitly getting NodeList by using nodelist()
                if ( argument instanceof XNodeSet ) {
                    argList.add ( i, ((XNodeSet)argument).nodelist() );
                } else if ( argument instanceof XObject ) {
                    Object passedArgument = ((XObject)argument).object();
                    argList.add ( i, passedArgument );
                } else {
                    argList.add ( i, argument );
                }
            }

            return ( xpathFunction.evaluate ( argList ));
        } catch ( XPathFunctionException xfe ) {
            // If we get XPathFunctionException then we want to terminate
            // further execution by throwing WrappedRuntimeException 
            throw new org.apache.xml.utils.WrappedRuntimeException ( xfe );
        } catch ( Exception e ) {
            throw new javax.xml.transform.TransformerException ( e );
        }
    
    }
35788
func exec_xpath_function(ctxt C.xmlXPathParserContextPtr, nargs C.int) {
	function := C.GoString((*C.char)(unsafe.Pointer(ctxt.context.function)))
	namespace := C.GoString((*C.char)(unsafe.Pointer(ctxt.context.functionURI)))
	context := (*VariableScope)(ctxt.context.funcLookupData)

	argcount := int(nargs)
	var args []interface{}

	for i := 0; i < argcount; i = i + 1 {
		args = append(args, XPathObjectToValue(C.valuePop(ctxt)))
	}

	// arguments are popped off the stack in reverse order, so
	// we reverse the slice before invoking our callback
	if argcount > 1 {
		for i, j := 0, len(args)-1; i < j; i, j = i+1, j-1 {
			args[i], args[j] = args[j], args[i]
		}
	}

	// push the result onto the stack
	// if for some reason we are unable to resolve the
	// function we push an empty nodeset
	f := (*context).ResolveFunction(function, namespace)
	if f != nil {
		retval := f(*context, args)
		C.valuePush(ctxt, ValueToXPathObject(retval))
	} else {
		ret := C.xmlXPathNewNodeSet(nil)
		C.valuePush(ctxt, ret)
	}

}
1027188
function constructPaths(xmlElement) {
  if (xmlElement['path'] == null) {
    return ['*'];
  }

  var paths = [];
  xmlElement.path.some(function(pathElement) {
    var url = pathElement['$']['url'];

    // Ignore explicit paths if '*' is defined
    if (url === '*') {
      paths = ['*'];
      return true;
    }

    paths.push(url);
  });

  return paths;
}
1007898
function relPath(s) {
  s = str(s);
  var lvls = str(s).replace(/[^/]/g, '').slice(1);
  if (lvls.length < 1 || s.slice(0,1) !== '/') return '.';
  return '..' + _.toArray(lvls).join('..').slice(0,-1);
}
1313925
def xpathEval(self, str):
        
        ret = libxml2mod.xmlXPathEval(str, self._o)
        if ret is None:raise xpathError('xmlXPathEval() failed')
        return xpathObjectRet(ret)
902600
def xpathNextFollowingSibling(self, ctxt):
        
        if ctxt is None: ctxt__o = None
        else: ctxt__o = ctxt._o
        ret = libxml2mod.xmlXPathNextFollowingSibling(ctxt__o, self._o)
        if ret is None:raise xpathError('xmlXPathNextFollowingSibling() failed')
        __tmp = xmlNode(_obj=ret)
        return __tmp
768201
def get_function(pkgpath):
    
    # Extract the module and function name from pkgpath
    elems = pkgpath.split('.')
    if len(elems) <= 1:
        raise PyMacaronCoreException("Path %s is too short. Should be at least module.func." % elems)
    func_name = elems[-1]
    func_module = '.'.join(elems[0:-1])

    # Load the function's module and get the function
    try:
        m = import_module(func_module)
        f = getattr(m, func_name)
        return f
    except Exception as e:
        t = traceback.format_exc()
        raise PyMacaronCoreException("Failed to import %s: %s\nTrace:\n%s" % (pkgpath, str(e), t))
982144
function(subPath, tokenMap, ignoreRegex) {
                if (typeof subPath !== 'string' || subPath.length === 0) {
                    return _folderPath;
                }
                tokenMap = tokenMap || {};
                ignoreRegex = !! ignoreRegex;

                var transform = _utils.getTransformer(tokenMap, ignoreRegex);
                subPath = transform(subPath);
                return _path.join(_folderPath, subPath);
            }
1104338
function matchPaths(pageLinks, path) {
  let result;
  path = _.compact(path.split('/'));
  result = _.filter(_.keys(pageLinks), key => {
    const path2 = _.compact(key.split('/'));
    const noMatch = _.filter(path2, fragment => {
      return fragment.substring(0, 1) !== ':' && _.indexOf(path, fragment) !== _.indexOf(path2, fragment);
    });
    return noMatch.length === 0;
  });
  return result[0];
}
314430
def rule_function_not_found(self, fun=None):
        
        sfun = str(fun)
        self.cry('rule_function_not_found:' + sfun)

        def not_found(*a, **k):
            return(sfun + ':rule_function_not_found', k.keys())
        return not_found