Creates a COMMA node with type information matching its second argument.
506999
private Node createCommaNode(Node expr1, Node expr2) {
    Node commaNode = IR.comma(expr1, expr2);
    if (shouldAddTypesOnNewAstNodes) {
      commaNode.setJSType(expr2.getJSType());
    }
    return commaNode;
  }
1369330
def _AssTuple(self, t):
        

        # _write each elements, separated by a comma.
        for element in t.nodes[:-1]:
            self._dispatch(element)
            self._write(", ")

        # Handle the last one without writing comma
        last_element = t.nodes[-1]
        self._dispatch(last_element)
184718
def make_node(cls, new_type, node, lineno):
        
        assert isinstance(new_type, SymbolTYPE)

        # None (null) means the given AST node is empty (usually an error)
        if node is None:
            return None  # Do nothing. Return None

        assert isinstance(node, Symbol), '<%s> is not a Symbol' % node
        # The source and dest types are the same
        if new_type == node.type_:
            return node  # Do nothing. Return as is

        STRTYPE = TYPE.string
        # Typecasting, at the moment, only for number
        if node.type_ == STRTYPE:
            syntax_error(lineno, 'Cannot convert string to a value. '
                                 'Use VAL() function')
            return None

        # Converting from string to number is done by STR
        if new_type == STRTYPE:
            syntax_error(lineno, 'Cannot convert value to string. '
                                 'Use STR() function')
            return None

        # If the given operand is a constant, perform a static typecast
        if is_CONST(node):
            node.expr = cls(new_type, node.expr, lineno)
            return node

        if not is_number(node) and not is_const(node):
            return cls(new_type, node, lineno)

        # It's a number. So let's convert it directly
        if is_const(node):
            node = SymbolNUMBER(node.value, node.lineno, node.type_)

        if new_type.is_basic and not TYPE.is_integral(new_type):  # not an integer
            node.value = float(node.value)
        else:  # It's an integer
            new_val = (int(node.value) & ((1 << (8 * new_type.size)) - 1))  # Mask it

            if node.value >= 0 and node.value != new_val:
                errmsg.warning_conversion_lose_digits(node.lineno)
                node.value = new_val
            elif node.value < 0 and (1 << (new_type.size * 8)) + \
                    node.value != new_val:  # Test for positive to negative coercion
                errmsg.warning_conversion_lose_digits(node.lineno)
                node.value = new_val - (1 << (new_type.size * 8))

        node.type_ = new_type
        return node
1198001
def make_typecast(type_, node, lineno):
    
    assert isinstance(type_, symbols.TYPE)
    return symbols.TYPECAST.make_node(type_, node, lineno)
784224
def compile_node(self, node):
        
        # XXX Optimize certain Wildcard-containing-Wildcard patterns
        # that can be merged
        if node.type == self.syms.Matcher:
            node = node.children[0] # Avoid unneeded recursion

        if node.type == self.syms.Alternatives:
            # Skip the odd children since they are just '|' tokens
            alts = [self.compile_node(ch) for ch in node.children[::2]]
            if len(alts) == 1:
                return alts[0]
            p = pytree.WildcardPattern([[a] for a in alts], min=1, max=1)
            return p.optimize()

        if node.type == self.syms.Alternative:
            units = [self.compile_node(ch) for ch in node.children]
            if len(units) == 1:
                return units[0]
            p = pytree.WildcardPattern([units], min=1, max=1)
            return p.optimize()

        if node.type == self.syms.NegatedUnit:
            pattern = self.compile_basic(node.children[1:])
            p = pytree.NegatedPattern(pattern)
            return p.optimize()

        assert node.type == self.syms.Unit

        name = None
        nodes = node.children
        if len(nodes) >= 3 and nodes[1].type == token.EQUAL:
            name = nodes[0].value
            nodes = nodes[2:]
        repeat = None
        if len(nodes) >= 2 and nodes[-1].type == self.syms.Repeater:
            repeat = nodes[-1]
            nodes = nodes[:-1]

        # Now we've reduced it to: STRING | NAME [Details] | (...) | [...]
        pattern = self.compile_basic(nodes, repeat)

        if repeat is not None:
            assert repeat.type == self.syms.Repeater
            children = repeat.children
            child = children[0]
            if child.type == token.STAR:
                min = 0
                max = pytree.HUGE
            elif child.type == token.PLUS:
                min = 1
                max = pytree.HUGE
            elif child.type == token.LBRACE:
                assert children[-1].type == token.RBRACE
                assert  len(children) in (3, 5)
                min = max = self.get_int(children[1])
                if len(children) == 5:
                    max = self.get_int(children[3])
            else:
                assert False
            if min != 1 or max != 1:
                pattern = pattern.optimize()
                pattern = pytree.WildcardPattern([[pattern]], min=min, max=max)

        if name is not None:
            pattern.name = name
        return pattern.optimize()
50625
def n_list(self, node):
        
        p = self.prec
        self.prec = 100
        n = node.pop()
        lastnode = n.kind
        start = len(self.f.getvalue())
        if lastnode.startswith('BUILD_LIST'):
            self.write('['); endchar = ']'
        elif lastnode.startswith('BUILD_TUPLE'):
            self.write('('); endchar = ')'
        elif lastnode.startswith('BUILD_SET'):
            self.write('{'); endchar = '}'
        elif lastnode.startswith('ROT_TWO'):
            self.write('('); endchar = ')'
        else:
            raise RuntimeError('Internal Error: n_list expects list or tuple')

        flat_elems = []
        for elem in node:
            if elem == 'expr1024':
                for subelem in elem:
                        for subsubelem in subelem:
                            flat_elems.append(subsubelem)
            elif elem == 'expr32':
                for subelem in elem:
                    flat_elems.append(subelem)
            else:
                flat_elems.append(elem)

        self.indent_more(INDENT_PER_LEVEL)
        if len(node) > 3:
            line_separator = ',\n' + self.indent
        else:
            line_separator = ', '
        sep = INDENT_PER_LEVEL[:-1]

        # FIXME:
        # if flat_elems > some_number, then group
        # do automatic wrapping
        for elem in flat_elems:
            if (elem == 'ROT_THREE'):
                continue

            assert elem == 'expr'
            value = self.traverse(elem)
            self.node_append(sep, value, elem)
            sep = line_separator
        if len(node) == 1 and lastnode.startswith('BUILD_TUPLE'):
            self.write(',')
        self.write(endchar)
        finish = len(self.f.getvalue())
        n.parent = node.parent
        self.set_pos_info(n, start, finish)
        self.set_pos_info(node, start, finish)
        self.indent_less(INDENT_PER_LEVEL)
        self.prec = p
        self.prune()
        return
658582
def _exprcomp(node):
    """"""
    try:
        comp = _LITS[node.data()]
    except KeyError:
        comp = _LITS[node.data()] = Complement(node)
    return comp
1036547
def _make_node(self, singular, plural, variables, plural_expr,
                   vars_referenced, num_called_num):
        """"""
        # no variables referenced?  no need to escape for old style
        # gettext invocations only if there are vars.
        if not vars_referenced and not self.environment.newstyle_gettext:
            singular = singular.replace('%%', '%')
            if plural:
                plural = plural.replace('%%', '%')

        # singular only:
        if plural_expr is None:
            gettext = nodes.Name('gettext', 'load')
            node = nodes.Call(gettext, [nodes.Const(singular)],
                              [], None, None)

        # singular and plural
        else:
            ngettext = nodes.Name('ngettext', 'load')
            node = nodes.Call(ngettext, [
                nodes.Const(singular),
                nodes.Const(plural),
                plural_expr
            ], [], None, None)

        # in case newstyle gettext is used, the method is powerful
        # enough to handle the variable expansion and autoescape
        # handling itself
        if self.environment.newstyle_gettext:
            for key, value in iteritems(variables):
                # the function adds that later anyways in case num was
                # called num, so just skip it.
                if num_called_num and key == 'num':
                    continue
                node.kwargs.append(nodes.Keyword(key, value))

        # otherwise do that here
        else:
            # mark the return value as safe if we are in an
            # environment with autoescaping turned on
            node = nodes.MarkSafeIfAutoescape(node)
            if variables:
                node = nodes.Mod(node, nodes.Dict([
                    nodes.Pair(nodes.Const(key), value)
                    for key, value in variables.items()
                ]))
        return nodes.Output([node])
190709
function Node(details) {

		// If we got a string
		if(is.string(details)) {
			details = {"__type__": details};
		}

		// If the details are not an Object
		if(!is.object(details)) {
			throw 'details must be an Object';
		}

		// If the type is not found
		if(!('__type__' in details)) {
			throw 'missing "__type__" in details';
		}

		// If the type is not valid
		if(_validNode.indexOf(details['__type__']) == -1) {
			throw 'invalid "__type__" in details';
		}

		// Store the type and remove it from the details
		this._type	= details['__type__'];
		delete details['__type__'];

		// Init the value types
		this._regex = null;
		this._options = null;
		this._minimum = null;
		this._maximum = null;

		/**
		 * Compare IPs
		 *
		 * Compares two IPs and returns a status based on which is greater
		 * If first is less than second: -1
		 * If first is equal to second: 0
		 * If first is greater than second: 1
		 *
		 * @name compareIPs
		 * @access private
		 * @param String first			A string representing an IP address
		 * @param String second			A string representing an IP address
		 * @return int					-1, 0, 1
		 */
		var compareIPs = function compareIPs(first, second) {

			// If the two IPs are the same, return 0
			if(first == second) {
				return 0;
			}

			// Create lists from the split of each IP, store them as ints
			var aFirst = first.split('.');
			for(var i in aFirst) { aFirst[i] = parseInt(aFirst[i]); }
			var aSecond = second.split('.');
			for(var i in aSecond) { aSecond[i] = parseInt(aSecond[i]); }

			// Go through each part from left to right until we find the
			// 	difference
			for(var i = 0; i < 4; ++i) {

				// If the part of x is greater than the part of y
				if(aFirst[i] > aSecond[i]) {
					return 1;
				}

				// Else if the part of x is less than the part of y
				else if(aFirst[i] < aSecond[i]) {
					return -1;
				}
			}
		}

		/**
		 * Clean
		 *
		 * Cleans and returns the new value
		 *
		 * @name clean
		 * @access protected
		 * @param mixed value			The value to validate
		 * @return mixed
		 */
		this.clean = function clean(value) {

			// If the value is null and it's optional, return as is
			if(value == null && this._optional) {
				return null;
			}

			// If it's an ANY, there is no reasonable expectation that we know
			//	what the value should be, so we return it as is
			if(this._type == 'any') {
				//pass
			}

			// Else if it's a basic string type
			else if(['base64', 'ip', 'string', 'uuid'].indexOf(this._type) != -1) {

				// And not already a string
				if(!is.string(value)) {
					value = String(value);
				}
			}

			// Else if it's a BOOL just check if the value flags as positive
			else if(this._type == 'bool') {

				// If it's specifically a string, it needs to match a specific
				//	pattern to be true
				if(is.string(value)) {
					value = (['true', 'True', 'TRUE', 't', 'T', 'yes', 'Yes', 'YES', 'y', 'Y', 'x', '1'].indexOf(value) == -1) ? false : true;
				}
				else {
					value = value ? true : false;
				}
			}

			// Else if it's a date type
			else if(this._type == 'date') {

				// If it's a JavaScript type, convert it to a string
				if(value instanceof Date) {
					value = DateToStr(value);
				}

				// Else if it's already a string
				else if(is.string(value)) {
					//pass
				}

				// Else convert it to a string
				else {
					value = String(value);
				}
			}

			// Else if it's a datetime type
			else if(this._type == 'datetime') {

				// If it's a JavaScript type, convert it to a string
				if(value instanceof Date) {
					value = DateTimeToStr(value);
				}

				// Else if it's already a string
				else if(is.string(value)) {
					//pass
				}

				// Else convert it to a string
				else {
					value = String(value);
				}
			}

			// Else if it's a decimal
			else if(this._type == 'decimal') {

				// And not already a string
				if(!is.string(value)) {
					value = String(value);
				}
			}

			// Else if it's a float
			else if(this._type == 'float') {
				value = parseFloat(value);
			}

			// Else if it's an int type
			else if(['int', 'timestamp', 'uint'].indexOf(this._type) != -1) {

				// If it's a string
				if(is.string(value)) {

					// If it starts with 0
					if(value.charAt(0) == '0' && value.length > 1) {

						// If it's followed by X or x, it's hex
						if(['x', 'X'].indexOf(value.charAt(1)) != -1 && value.length > 2) {
							value = parseInt(value, 16)
						}

						// Else it's octal
						else {
							value = parseInt(value, 8)
						}
					}

					// Else it's base 10
					else {
						value = parseInt(value, 10);
					}
				}

				// Else if it's not an int already
				else if(!is.integer(value)) {
					value = parseInt(value);
				}
			}

			// Else if it's a JSON type
			else if(this._type == 'json') {

				// If it's already a string
				if(is.string(value)) {
					//pass
				}

				// Else, encode it
				else {
					value = JSON.stringify(value);
				}
			}

			// Else if it's an md5 type
			else if(this._type == 'md5') {

				// If it's a string
				if(is.string(value)) {
					//pass
				}

				// Else, try to convert it to a string
				else {
					value = String(value);
				}
			}

			// Else if it's a price type
			else if(this._type == 'price') {
				value = new Number(value).toFixed(2);
			}

			// Else if it's a time type
			else if(this._type == 'time') {

				// If it's a JavaScript type, get the time part
				if(value instanceof Date) {
					value = value.toTimeString().substr(0,8);
				}

				// Else if it's already a string
				else if(is.string(value)) {
					//pass
				}

				// Else convert it to a string
				else {
					value = String(value);
				}
			}

			// Else we probably forgot to add a new type
			else {
				throw '"' + this._type + '" has not been added to .clean()';
			}

			// Return the cleaned value
			return value;
		};

		/**
		 * Min/Max
		 *
		 * Sets or gets the minimum and/or maximum values for the Node. For
		 * getting, returns {"minimum":mixed,"maximum":mixed}
		 *
		 * @name minmax
		 * @access public
		 * @param mixed minimum			The minimum value
		 * @param mixed maximum			The maximum value
		 * @return void|Object
		 */
		this.minmax = function minmax(minimum, maximum) {

			// If neither min or max is set, this is a getter
			if(typeof minimum === 'undefined' && typeof maximum === 'undefined') {
				return {"minimum":this._minimum,"maximum":this._maximum};
			}

			// If the minimum is set
			if(minimum !== null) {

				// If the current type is a date, datetime, ip, or time
				if(['base64', 'date', 'datetime', 'ip', 'time'].indexOf(this._type) != -1) {

					// Make sure the value is valid for the type
					if(!is.string(minimum) || !_typeToRegex[this._type].test(minimum)) {
						throw '"__minimum__" is not valid for the current type: "' + this._type + '"';
					}
				}

				// Else if the type is an int (unsigned, timestamp), or a string
				//	in which the minimum/maximum are lengths
				else if(['int', 'string', 'timestamp', 'uint'].indexOf(this._type) != -1) {

					// If the value is not a valid int or long
					if(!is.integer(minimum)) {

						// If it's a valid representation of an integer
						if(is.string(minimum) && _typeToRegex['int'].test(minimum)) {

							// Convert it
							minimum = parseInt(minimum, 0);
						}

						// Else, raise an error
						else {
							throw '"__minimum__" must be an integer';
						}

						// If the type is meant to be unsigned
						if(['base64', 'string', 'timestamp', 'uint'].indexOf(this._type) != -1) {

							// And it's below zero
							if(minimum < 0) {
								throw '"__minimum__" must be an unsigned integer';
							}
						}
					}
				}

				// Else if the type is a decimal
				else if(this._type == 'decimal') {

					// If it's a not valid representation of a decimal
					if(!is.string(minimum) || !_typeToRegex['decimal'].test(minimum)) {

						// Throw an error
						throw '"__minimum__" not a valid decimal';
					}
				}

				// Else if the type is float
				else if(this._type == 'float') {

					// If it's not a float
					if(!is.float(minimum)) {

						// If we can't convert it to a float
						f	= parseFloat(minimum);
						if(isNaN(f)) {
							throw '"__minimum__" not a valid float';
						}

						// Store the parsed value
						minimum	= f;
					}
				}

				// Else if the type is price
				else if(this._type == 'price') {

					// If it's a not valid representation of a price
					if(!is.string(minimum) || !_typeToRegex['price'].test(minimum)) {

						// Throw an error
						throw '"__minimum__" not a valid price';
					}

				}

				// Else we can't have a minimum
				else {
					throw 'can not set __minimum__ for "' + this._type + '"';
				}

				// Store the minimum
				this._minimum = minimum;
			}

			// If the maximum is set
			if(maximum !== null) {

				// If the current type is a date, datetime, ip, or time
				if(['base64', 'date', 'datetime', 'ip', 'time'].indexOf(this._type) != -1) {

					// Make sure the value is valid for the type
					if(!is.string(maximum) || !_typeToRegex[this._type].test(maximum)) {
						throw '"__maximum__" is not valid for the current type: "' + this._type + '"';
					}
				}

				// Else if the type is an int (unsigned, timestamp), or a string
				//	in which the minimum/maximum are lengths
				else if(['int', 'string', 'timestamp', 'uint'].indexOf(this._type) != -1) {

					// If the value is not a valid int or long
					if(!is.integer(maximum)) {

						// If it's a valid representation of an integer
						if(is.string(maximum) && _typeToRegex['int'].test(maximum)) {

							// Convert it
							maximum	= parseInt(maximum, 0);
						}

						// Else, raise an error
						else {
							throw '"__maximum__" must be an integer';
						}

						// If the type is meant to be unsigned
						if(['base64', 'string', 'timestamp', 'uint'].indexOf(this._type) != -1) {

							// And it's below zero
							if(maximum < 0) {
								throw '"__maximum__" must be an unsigned integer';
							}
						}
					}
				}

				// Else if the type is decimal
				else if(this._type == 'decimal') {

					// If it's a not valid representation of a decimal
					if(!is.string(maximum) || !_typeToRegex['decimal'].test(maximum)) {

						// Throw an error
						throw '"__maximum__" not a valid decimal';
					}
				}

				// Else if the type is float
				else if(this._type == 'float') {

					// If it's not a float
					if(!is.float(maximum)) {

						// If we can't convert it to a float
						f	= parseFloat(maximum);
						if(isNaN(f)) {
							throw '"__maximum__" not a valid float';
						}

						// Store the parsed value
						maximum = f;
					}
				}

				// Else if the type is price
				else if(this._type == 'price') {

					// If it's a not valid representation of a price
					if(!is.string(maximum) || !_typeToRegex['price'].test(maximum)) {

						// Throw an error
						throw '"__maximum__" not a valid price';
					}
				}

				// Else we can't have a minimum
				else {
					throw 'can not set __maximum__ for "' + this._type + '"';
				}

				// If we also have a minimum
				if(this._minimum != null) {

					// If the type is an IP
					if(this._type == 'ip') {

						// If the min is above the maximum, we have a problem
						if(compareIPs(this._minimum, maximum) == 1) {
							throw '"__maximum__" can not be below "__minimum__"';
						}
					}

					// Else any other data type
					else {

						// If the min is above the maximum, we have a problem
						if(this._minimum > maximum) {
							throw '"__maximum__" can not be below "__minimum__"';
						}
					}
				}

				// Store the maximum
				this._maximum = maximum;
			}
		};

		/**
		 * Options
		 *
		 * Sets or gets the list of acceptable values for the Node
		 *
		 * @name options
		 * @access protected
		 * @param array opts			An array of valid values for the node when setting
		 * @return void|Array
		 */
		this.options = function options(opts) {

			// If opts aren't set, this is a getter
			if(typeof opts == 'undefined') {
				return this._options;
			}

			// Else this is a setter
			else {

				// If the options are not an Array
				if(!is.array(opts)) {
					throw '"__options__" must be an array';
				}

				// If the type is not one that can have options
				if(['any', 'base64', 'date', 'datetime', 'decimal',
						'float', 'int', 'ip', 'md5', 'price', 'string',
						'time', 'timestamp', 'uint', 'uuid'].indexOf(this._type) == -1) {
					throw 'can not set __options__ for "' + this._type + '"';
				}

				// Init the array of options to be saved
				var aOpts = [];

				// Go through each item and make sure it's unique and valid
				for(var i = 0; i < opts.length; ++i) {

					// Convert the value based on the type
					// If the type is a string one that we can validate
					if(['base64', 'date', 'datetime', 'ip', 'md5', 'time'].indexOf(this._type) != -1) {

						// If the value is not a string or doesn't match its regex,
						//	throw an error
						if(!is.string(opts[i]) || !_typeToRegex[this._type].test(opts[i])) {
							throw '"__options__[' + i + ']" is not valid for "' + this._type + '"';
						}
					}

					//	Else if it's decimal
					else if(this._type == 'decimal') {

						// And it's not a valid decimal representation
						if(is.string(opts[i]) || !_typeToRegex['decimal'].test(opts[i])) {

							// Throw an error
							throw '"__options__[' + i + ']" not a valid decimal';
						}
					}

					// Else if it's a float
					else if(this._type == 'float') {

						// If it's not a float
						if(!is.float(opts[i])) {

							// If we can't convert it to a float
							f = parseFloat(opts[i]);
							if(isNaN(f)) {
								throw '"__options__[' + i + ']" not a valid float';
							}

							// Store the parsed value
							opts[i]	= f;
						}
					}

					// Else if it's an integer
					else if(['int', 'timestamp', 'uint'].indexOf(this._type) != -1) {

						// If we don't already have an int
						if(!is.integer(opts[i])) {

							// If it's a valid representation of an integer
							if(is.string(opts[i]) && _typeToRegex['int'].test(opts[i])) {

								// Convert it
								opts[i]	= parseInt(opts[i], 0);
							}

							// Else, raise an error
							else {
								throw '"__options__[' + i + ']" must be an integer';
							}
						}

						// If the type is unsigned and negative, raise an error
						if(['timestamp', 'uint'].indexOf(this._type) != -1 && opts[i] < 0) {
							throw '"__options__[' + i + ']" must be an unsigned integer';
						}
					}

					//	Else if it's a price
					else if(this._type == 'price') {

						// And it's not a valid price representation
						if(!is.string(opts[i]) || !_typeToRegex['price'].test(opts[i])) {

							// Throw an error
							throw '"__options__[' + i + ']" not a valid price';
						}
					}

					// Else if the type is a string
					else if(this._type == 'string') {

						// If the value is not a string
						if(!is.string(opts[i])) {

							// Convert it
							opts[i]	= String(opts[i]);
						}
					}

					// If it's already in the list, raise an error
					if(aOpts.indexOf(opts[i]) != -1) {
						throw '"__options__[' + i + '] is a duplicate'
					}

					// Store the option
					else {
						aOpts.push(opts[i]);
					}
				}

				// Store the list of options
				this._options = aOpts;
			}
		};

		/**
		 * Regex
		 *
		 * Sets or gets the regular expression used to validate the Node
		 *
		 * @name regex
		 * @access protected
		 * @param str|RegExp regex		A regular expression string or object
		 * @return void|RegExp
		 */
		this.regex = function regex(regex) {

			// If regex was not set, this is a getter
			if(typeof regex === 'undefined') {
				return this._regex;
			}

			// Else this is a setter
			else {

				// If the type is not a string
				if(['decimal', 'int', 'price', 'string', 'timestamp', 'uint'].indexOf(this._type) == -1) {
					throw 'can not set __regex__ for "' + this._type + '"';
				}

				// If it's not a valid regex
				if(!(regex instanceof RegExp)) {

					// And it's not a string
					if(!is.string(regex)) {
						throw '"__regex__" must be a valid string or RegExp';
					}

					// Turn the string into a RegExp
					regex = new RegExp(regex);
				}

				// Store the regex
				this._regex = regex;
			}
		};

		/**
		 * To Object
		 *
		 * Returns the Node as an Object in the same format as is used in
		 * constructing it
		 *
		 * @name toObject
		 * @return Object
		 */
		this.toObject = function toObject() {

			// Init the Object we will return
			var oRet = {
				"__type__": this._type
			}

			// If there is a regex associated, add it
			if(this._regex) {
				oRet['__regex__'] = String(this._regex);
			}

			// Else if there were options associated, add them
			else if(this._options) {
				oRet['__options__'] = this._options;
			}

			// Else check for min and max and add if either are found
			else {
				if(this._minimum) {
					oRet['__minimum__'] = this._minimum;
				}
				if(this._maximum) {
					oRet['__maximum__'] = this._maximum;
				}
			}

			// Get the parents Object and add it to the return
			var oBasic = BasicNode.prototype.toObject.call(this);
			for(var k in oBasic) {
				oRet[k] = oBasic[k];
			}

			// Return
			return oRet;
		}

		/**
		 * Type
		 *
		 * Returns the type of Node this is
		 *
		 * @name type
		 * @return String
		 */
		this.type = function type() {
			return 'Node.' + this._type;
		};

		/**
		 * Valid
		 *
		 * Checks if a value is valid based on the instance's values
		 *
		 * @name valid
		 * @param mixed value			The value to validate
		 * @param array level			Names of parents to this node
		 * @return bool
		 */
		this.valid = function valid(value, level) {

			// Reset validation failures
			this.validation_failures = [];

			// If the value is None and it's optional, we're good
			if(value == null && this._optional) {
				return true;
			}

			// If level is not passed
			if(typeof level == 'undefined') {
				level = [];
			}

			// If we are validating an ANY field, immediately return true
			if(this._type == 'any') {

				// If there's a list of options
				if(this._options) {

					// Returns based on the option's existance
					if(this._options.indexOf(value) == -1) {
						this.validation_failures.push([level.join('.'), 'not in options']);
						return false;
					} else {
						return true;
					}
				}

				// Else, just return true
				return true;
			}

			// If we are validating a DATE, DATETIME, IP or TIME data point
			else if(['base64', 'date', 'datetime', 'ip', 'md5', 'time', 'uuid'].indexOf(this._type) != -1) {

				// If it's a date, datetime, or time type and the value is a
				//	JavaScript Date
				if(['date', 'datetime', 'time'].indexOf(this._type) != -1 &&
					value instanceof Date) {
					return true;
				}

				// If the value is not a string
				if(!is.string(value)) {
					this.validation_failures.push([level.join('.'), 'not a string'])
					return false;
				}

				// If there's no match
				if(!_typeToRegex[this._type].test(value)) {
					this.validation_failures.push([level.join('.'), 'failed regex (internal)'])
					return false;
				}

				// Else if there's a list of options
				else if(this._options) {

					// Returns based on the option's existance
					if(this._options.indexOf(value) == -1) {
						this.validation_failures.push([level.join('.'), 'not in options'])
						return false;
					} else {
						return true;
					}
				}
			}

			// Else if we are validating some sort of integer
			else if(['int', 'timestamp', 'uint'].indexOf(this._type) != -1) {

				// If the type is a bool, fail immediately
				if(typeof value == 'boolean') {
					this.validation_failures.push([level.join('.'), 'is a bool'])
					return false;
				}

				// If it's not an int
				if(!is.integer(value)) {

					// And it's a valid representation of an int
					if(is.string(value) && _typeToRegex['int'].test(value)) {

						// If it starts with 0
						if(value.charAt(0) == '0' && value.length > 1) {

							// If it's followed by X or x, it's hex
							if(['X', 'x'].indexOf(value.charAt(1)) != -1 && value.length > 2) {
								value = parseInt(value, 16);
							}

							// Else it's octal
							else {
								value = parseInt(value, 8);
							}
						}

						// Else it's base 10
						else {
							value = parseInt(value, 10);
						}
					}

					// Else, return false
					else {
						this.validation_failures.push([level.join('.'), 'not an integer'])
						return false;
					}
				}

				// If it's not signed
				if(['timestamp', 'uint'].indexOf(this._type) != -1) {

					// If the value is below 0
					if(value < 0) {
						this.validation_failures.push([level.join('.'), 'signed'])
						return false;
					}
				}

				// If there is a regex
				if(this._regex) {

					// And it doesn't match the regex
					if(!this._regex.test(String(value))) {
						this.validation_failures.push([level.join('.'), 'failed regex (custom)'])
						return false;
					}
				}

				// If there's a list of options
				if(this._options) {

					// Returns based on the option's existance
					if(this._options.indexOf(value) == -1) {
						this.validation_failures.push([level.join('.'), 'not in options'])
						return false;
					} else {
						return true;
					}
				}
			}

			// Else if we are validating a bool
			else if(this._type == 'bool') {

				// If it's already a bool
				if(typeof value == 'boolean') {
					return true;
				}

				// If it's an int or long at 0 or 1
				if(is.integer(value) && [0, 1].indexOf(value) != -1) {
					return true;
				}

				// Else if it's a string
				else if(is.string(value)) {

					// If it's t, T, 1, f, F, or 0
					if(['true', 'true', 'TRUE', 't', 'T', '1', 'false', 'false', 'FALSE', 'f', 'F', '0'].indexOf(value) != -1) {
						return true;
					} else {
						this.validation_failures.push([level.join('.'), 'not a valid string representation of a bool'])
						return false;
					}
				}

				// Else it's no valid type
				else {
					this.validation_failures.push([level.join('.'), 'not valid bool replacement'])
					return false;
				}
			}

			// Else if we are validating a decimal value
			else if(this._type == 'decimal') {

				// If the type is a bool, fail immediately
				if(typeof value == 'boolean') {
					this.validation_failures.push([level.join('.'), 'is a bool'])
					return false;
				}

				// If it's not a string or doesn't match the regex
				if(!is.string(value) || !_typeToRegex['decimal'].test(value)) {
					this.validation_failures.push([level.join('.'), 'failed regex (internal)'])
					return false;
				}

				// Else if there's a list of options
				else if(this._options) {

					// Returns based on the option's existance
					if(this._options.indexOf(value) == -1) {
						this.validation_failures.push([level.join('.'), 'not in options'])
						return false;
					} else {
						return true;
					}
				}
			}

			// Else if we are validating a floating point value
			else if(this._type == 'float') {

				// If the type is a bool, fail immediately
				if(typeof value == 'boolean') {
					this.validation_failures.push([level.join('.'), 'is a bool'])
					return false;
				}

				// If it's not a string or doesn't match the regex
				if(is.string(value) && !_typeToRegex['decimal'].test(value)) {
					this.validation_failures.push([level.join('.'), 'failed regex (internal)'])
					return false;
				}

				// If we fail to convert the value
				value = parseFloat(value);
				if(isNaN(value)) {
					this.validation_failures.push([level.join('.'), 'can not be converted to float'])
					return false;
				}

				// If there's a list of options
				if(this._options) {

					// Returns based on the option's existance
					if(this._options.indexOf(value) == -1) {
						this.validation_failures.push([level.join('.'), 'not in options'])
						return false;
					} else {
						return true;
					}
				}
			}

			// Else if we are validating a JSON string
			else if(this._type == 'json') {

				// If it's already a string
				if(is.string(value)) {

					// Try to decode it
					try {
						JSON.parse(value);
						return true;
					}
					catch(err) {
						this.validation_failures.push([level.join('.'), 'Can not be decoded from JSON'])
						return false;
					}
				}

				// Else
				else {

					// Try to encode it
					try {
						value = JSON.stringify(value);
						return true;
					}
					catch(err) {
						this.validation_failures.push([level.join('.'), 'Can not be encoded to JSON'])
						return false;
					}
				}
			}

			// Else if we are validating a price value
			else if(this._type == 'price') {

				// If the type is a bool, fail immediately
				if(typeof value == 'boolean') {
					this.validation_failures.push([level.join('.'), 'is a bool'])
					return false;
				}

				// If it's not a string
				if(!is.string(value)) {

					// If it's a number
					if(typeof value == 'number') {
						value = String(value);
					} else {
						return false;
					}
				}

				// If it doesn't match the regex
				if(!_typeToRegex['price'].test(value)) {
					this.validation_failures.push([level.join('.'), 'failed regex (internal)'])
					return false;
				}

				// If there's a regex
				if(this._regex) {

					// And it doesn't match
					if(!this._regex.test(value)) {
						this.validation_failures.push([level.join('.'), 'failed regex (custom)'])
						return false;
					}
				}

				// Else if there's a list of options
				else if(this._options) {

					// Returns based on the option's existance
					if(this._options.indexOf(value) == -1) {
						this.validation_failures.push([level.join('.'), 'not in options'])
						return false;
					} else {
						return true;
					}
				}
			}

			// Else if we are validating a string value
			else if(this._type == 'string') {

				// If the value is not some form of string
				if(!is.string(value)) {
					this.validation_failures.push([level.join('.'), 'is not a string'])
					return false;
				}

				// If we have a regex
				if(this._regex) {

					// If it doesn't match the regex
					if(!this._regex.test(value)) {
						this.validation_failures.push([level.join('.'), 'failed regex (custom)'])
						return false;
					}
				}

				// If there's a list of options
				else if(this._options) {

					// Returns based on the option's existance
					if(this._options.indexOf(value) == -1) {
						this.validation_failures.push([level.join('.'), 'not in options'])
						return false;
					} else {
						return true;
					}
				}

				// Else
				else {

					// If there's a minimum length and we don't reach it
					if(this._minimum && value.length < this._minimum) {
						this.validation_failures.push([level.join('.'), 'not long enough'])
						return false;
					}

					// If there's a maximum length and we surpass it
					if(this._maximum && value.length > this._maximum) {
						this.validation_failures.push([level.join('.'), 'too long'])
						return false;
					}
				}

				// Return ok
				return true;
			}

			// If there is a minimum value (for non bools and strings)
			if(this._minimum) {

				// If we are checking an IP
				if(this._type == 'ip') {

					// If the IP is less than the minimum
					if(compareIPs(value, this._minimum) == -1) {
						this.validation_failures.push([level.join('.'), 'did not meet minimum'])
						return false;
					}
				}

				// Else
				else {

					// If the value is less than the minimum
					if(value < this._minimum) {
						this.validation_failures.push([level.join('.'), 'did not meet minimum'])
						return false;
					}
				}
			}

			// If there is a maximum value (for non bools and strings)
			if(this._maximum) {

				// If we are checking an IP
				if(this._type == 'ip') {

					// If the IP is greater than the maximum
					if(compareIPs(value, this._maximum) == 1) {
						this.validation_failures.push([level.join('.'), 'exceeds maximum'])
						return false;
					}
				}

				// Else
				else {

					// If the value is greater than the maximum
					if(value > this._maximum) {
						this.validation_failures.push([level.join('.'), 'exceeds maximum'])
						return false;
					}
				}
			}

			// Value has no issues
			return true;
		};
		// END public methods
		// CONTINUE constructor

		// If there's a regex string available
		if('__regex__' in details) {
			this.regex(details['__regex__']);
			delete details['__regex__'];
		}

		// Else if there's a list of options
		else if('__options__' in details) {
			this.options(details['__options__']);
			delete details['__options__'];
		}

		// Else
		else {

			// If there's a min or max
			var bMin = '__minimum__' in details;
			var bMax = '__maximum__' in details;

			if(bMin || bMax) {
				this.minmax(
					(bMin ? details['__minimum__'] : null),
					(bMax ? details['__maximum__'] : null)
				);
			}

			if(bMin) {
				delete details['__minimum__'];
			}
			if(bMax) {
				delete details['__maximum__'];
			}
		}

		// Call the parent constructor
		BasicNode.call(this, details);
	}
512066
function getTypeSelector() {
  const type = NodeType.TypeSelectorType;
  const token = tokens[pos];
  const line = token.ln;
  const column = token.col;
  let content = [];

  if (checkNamePrefix(pos)) content.push(getNamePrefix());

  content = content.concat(getIdentOrInterpolation());

  return newNode(type, content, line, column);
}
322122
private Node parseParametersType(JsDocToken token) {
    Node paramsType = newNode(Token.PARAM_LIST);
    boolean isVarArgs = false;
    Node paramType = null;
    if (token != JsDocToken.RIGHT_PAREN) {
      do {
        if (paramType != null) {
          // skip past the comma
          next();
          skipEOLs();
          token = next();
        }

        if (token == JsDocToken.ELLIPSIS) {
          // In the latest ES4 proposal, there are no type constraints allowed
          // on variable arguments. We support the old syntax for backwards
          // compatibility, but we should gradually tear it out.
          skipEOLs();
          if (match(JsDocToken.RIGHT_PAREN)) {
            paramType = newNode(Token.ELLIPSIS);
          } else {
            skipEOLs();
            paramType = wrapNode(Token.ELLIPSIS, parseTypeExpression(next()));
            skipEOLs();
          }

          isVarArgs = true;
        } else {
          paramType = parseTypeExpression(token);
          if (match(JsDocToken.EQUALS)) {
            skipEOLs();
            next();
            paramType = wrapNode(Token.EQUALS, paramType);
          }
        }

        if (paramType == null) {
          return null;
        }
        paramsType.addChildToBack(paramType);
        if (isVarArgs) {
          break;
        }
      } while (match(JsDocToken.COMMA));
    }

    if (isVarArgs && match(JsDocToken.COMMA)) {
      return reportTypeSyntaxWarning("msg.jsdoc.function.varargs");
    }

    // The right paren will be checked by parseFunctionType

    return paramsType;
  }
855502
def compilearg(self):
        """"""
        if isinstance(self.value,list):
            value = self.delimiter.join(self.value)
        else:
            value = self.value
        if value.find(" ") >= 0:
            value = '"' + value + '"' #wrap all in quotes

        #for some odd, reason this produced an error, as if we're not an instance of choiceparameter
        #return super(ChoiceParameter,self).compilearg(value)

        #workaround:
        if self.paramflag and self.paramflag[-1] == '=' or self.nospace:
            sep = ''
        elif self.paramflag:
            sep = ' '
        else:
            return str(value)
        return self.paramflag + sep + str(value)
85892
function createElement (
  context,
  tag,
  data,
  children,
  normalizationType,
  alwaysNormalize
) {
  if (Array.isArray(data) || isPrimitive(data)) {
    normalizationType = children;
    children = data;
    data = undefined;
  }
  if (alwaysNormalize) { normalizationType = ALWAYS_NORMALIZE; }
  return _createElement(context, tag, data, children, normalizationType)
}
1348371
private Node newParameter(JSType type) {
    Node paramNode = Node.newString(Token.NAME, "");
    paramNode.setJSType(type);
    root.addChildToBack(paramNode);
    return paramNode;
  }
1249854
private void addNthOfType() {
        for (Node node : nodes) {
            int count = 1;
            Node n = DOMHelper.getPreviousSiblingElement(node);
            while (n != null) {
                if (DOMHelper.getNodeName(n).equals(DOMHelper.getNodeName(node))) {
                    count++;
                }
                
                n = DOMHelper.getPreviousSiblingElement(n);
            }
            
            if (specifier.isMatch(count)) {
                result.add(node);
            }
        }
    }
1350938
function isLastNode(node) {
            const token = sourceCode.getTokenAfter(node);

            return !token || (token.type === "Punctuator" && token.value === "}");
        }
1001
def _oxford_comma_separator(i, length):
    
    if length == 1:
        return None
    elif length < 3 and i == 0:
        return ' and '
    elif i < length - 2:
        return ', '
    elif i == length - 2:
        return ', and '
    else:
        return None