go2hx

manual

github

Module: stdgo.path

(view library index)

Overview

Index

Variables

import stdgo.path.Path
var errBadPattern:stdgo.Error

Classes

import stdgo.path.*

class Path

{
    	_ = 0
    	gotoNext = 2598007
    	_ = gotoNext == 2598007
    	if len(pattern) > 0 && pattern[0] == 42 {
    		gotoNext = 2598049
    		_ = gotoNext == 2598049
    		pattern = pattern[1:]
    		star = true
    		gotoNext = 2598007
    	} else {
    		gotoNext = 2598093
}
    	_ = gotoNext == 2598093
    	inrange_2598093 = false
    	gotoNext = 2598121
    	_ = gotoNext == 2598121
    	i_2598115 = 0
    	ScanBreak = false
    	gotoNext = 2598128
    	_ = gotoNext == 2598128
    	if !ScanBreak && (i_2598115 < len(pattern)) {
    		gotoNext = 2598161
    		_ = gotoNext == 2598161
    		_ = 0
    		gotoNext = 2598165
    		_ = gotoNext == 2598165
    		switch pattern[i_2598115] {
    		case 92:
    			gotoNext = 2598187
    			_ = gotoNext == 2598187
    			if i_2598115+1 < len(pattern) {
    				gotoNext = 2598277
    				_ = gotoNext == 2598277
    				i_2598115++
    				gotoNext = 2598157
    			} else {
    				gotoNext = 2598157
}
    			gotoNext = 2598157
    		case 91:
    			gotoNext = 2598294
    			_ = gotoNext == 2598294
    			inrange_2598093 = true
    			gotoNext = 2598157
    		case 93:
    			gotoNext = 2598324
    			_ = gotoNext == 2598324
    			inrange_2598093 = false
    			gotoNext = 2598157
    		case 42:
    			gotoNext = 2598355
    			_ = gotoNext == 2598355
    			if !inrange_2598093 {
    				gotoNext = 2598380
    				_ = gotoNext == 2598380
    				ScanBreak = true
    				gotoNext = 2598128
    				gotoNext = 2598157
    			} else {
    				gotoNext = 2598157
}
    			gotoNext = 2598157
    		default:
    			gotoNext = 2598157
}
    		_ = gotoNext == 2598157
    		i_2598115++
    		gotoNext = 2598128
    	} else {
    		gotoNext = 2598410
}
    	_ = gotoNext == 2598410
    	return star, pattern[0:i_2598115], pattern[i_2598115:]
    	gotoNext = -1
    }

Path function base

function base(_path:String):String
Base returns the last element of path.
        Trailing slashes are removed before extracting the last element.
        If the path is empty, Base returns ".".
        If the path consists entirely of slashes, Base returns "/".

(view code)

Path function clean

function clean(_path:String):String
Clean returns the shortest path name equivalent to path
        by purely lexical processing. It applies the following rules
        iteratively until no further processing can be done:
         1. Replace multiple slashes with a single slash.
         2. Eliminate each . path name element (the current directory).
         3. Eliminate each inner .. path name element (the parent directory)
            along with the non-.. element that precedes it.
         4. Eliminate .. elements that begin a rooted path:
            that is, replace "/.." by "/" at the beginning of a path.

The returned path ends in a slash only if it is the root "/".

If the result of this process is an empty string, Clean returns the string ".".

See also Rob Pike, “Lexical File Names in Plan 9 or Getting Dot-Dot Right,” https://9p.io/sys/doc/lexnames.html

(view code)

Path function dir

function dir(_path:String):String
Dir returns all but the last element of path, typically the path's directory.
        After dropping the final element using Split, the path is Cleaned and trailing
        slashes are removed.
        If the path is empty, Dir returns ".".
        If the path consists entirely of slashes followed by non-slash bytes, Dir
        returns a single slash. In any other case, the returned path does not end in a
        slash.

(view code)

Path function ext

function ext(_path:String):String
Ext returns the file name extension used by path.
        The extension is the suffix beginning at the final dot
        in the final slash-separated element of path;
        it is empty if there is no dot.

(view code)

Path function isAbs

function isAbs(_path:String):Bool

IsAbs reports whether the path is absolute.

(view code)

Path function join

function join(_elem:haxe.Rest<String>):String
Join joins any number of path elements into a single path,
        separating them with slashes. Empty elements are ignored.
        The result is Cleaned. However, if the argument list is
        empty or all its elements are empty, Join returns
        an empty string.

(view code)

Path function match

function match(_pattern:String, _name:String):stdgo.Tuple<Bool, stdgo.Error>
Match reports whether name matches the shell pattern.
        The pattern syntax is:
        	pattern:
        		{ term }
        	term:
        		'*'         matches any sequence of non-/ characters
        		'?'         matches any single non-/ character
        		'[' [ '^' ] { character-range } ']'
        		            character class (must be non-empty)
        		c           matches character c (c != '*', '?', '\\', '[')
        		'\\' c      matches character c
        	character-range:
        		c           matches character c (c != '\\', '-', ']')
        		'\\' c      matches character c
        		lo '-' hi   matches character c for lo <= c <= hi

Match requires pattern to match all of name, not just a substring. The only possible returned error is ErrBadPattern, when pattern is malformed.

(view code)

Path function split

function split(_path:String):stdgo.Tuple<String, String>
Split splits path immediately following the final slash,
        separating it into a directory and file name component.
        If there is no slash in path, Split returns an empty dir and
        file set to path.
        The returned values have the property that path = dir+file.

(view code)

Abstracts

abstract T_lazybuf

(view file containing code)