Convert a name lex token into a name parse node.
181839
def parse_name(lexer: Lexer) -> NameNode:
    """"""
    token = expect_token(lexer, TokenKind.NAME)
    return NameNode(value=token.value, loc=loc(lexer, token))
911856
def parse_definition(lexer: Lexer) -> DefinitionNode:
    """"""
    if peek(lexer, TokenKind.NAME):
        func = _parse_definition_functions.get(cast(str, lexer.token.value))
        if func:
            return func(lexer)
    elif peek(lexer, TokenKind.BRACE_L):
        return parse_executable_definition(lexer)
    elif peek_description(lexer):
        return parse_type_system_definition(lexer)
    raise unexpected(lexer)
28749
def _readtoken(self, name, pos, length):
        """"""
        if length is not None and int(length) > self.length - pos:
            raise ReadError("Reading off the end of the data. "
                            "Tried to read {0} bits when only {1} available.".format(int(length), self.length - pos))
        try:
            val = name_to_read[name](self, length, pos)
            return val, pos + length
        except KeyError:
            if name == 'pad':
                return None, pos + length
            raise ValueError("Can't parse token {0}:{1}".format(name, length))
        except TypeError:
            # This is for the 'ue', 'se' and 'bool' tokens. They will also return the new pos.
            return name_to_read[name](self, pos)
983841
function parseName(name) {
  if (name) {
    const arr = name.split('.')
    const len = arr.length

    if (len > 2) {
      return arr.slice(0, -1).join('.')
    }
    else if (len === 2 || len === 1) {
      return arr[0]
    }
  }
  return name
}
1154737
def from_name(cls, name):
        """"""
        result = cls.list()
        dc_names = {}
        for dc in result:
            dc_names[dc['name']] = dc['id']

        return dc_names.get(name)
197524
function parse_node_name(name)
{
	// is it a "modifier" style class
	let is_a_modifier = false

	// detect modifier style classes
	if (starts_with(name, '&'))
	{
		name = name.substring('&'.length)
		is_a_modifier = true
	}

	// support old-school CSS syntax
	if (starts_with(name, '.'))
	{
		name = name.substring('.'.length)
	}

	// if there is a trailing colon in the style class name - trim it
	// (Python people with yaml-alike syntax)
	if (ends_with(name, ':'))
	{
		name = name.substring(0, name.length - ':'.length)
		// throw new Error(`Remove the trailing colon at line: ${original_line}`)
	}

	return { name, is_a_modifier }
}
1315485
public Parser<Token> token(String tokenName) {
    return Parsers.token(InternalFunctors.tokenWithSameValue(word(tokenName)));
  }
1155900
def name_to_vector(name):
    
    if not isinstance(name, unicode):
        name = name.decode("utf-8")

    name = name.lower()
    name = unicodedata.normalize('NFKD', name).encode('ascii', 'ignore')
    name = "".join(filter(lambda x: x.isalpha() or x == " ", list(name)))

    return sorted(name.split(), key=lambda x: len(x), reverse=True)
1054741
def _get_node_name(self, node):
        """"""
        res = getattr(node, "name", None)
        if res is None:
            return res

        if isinstance(res, AST.TypeDecl):
            return res.declname
        
        return res
1324418
def get_token_nodes_from_sentence(self, sentence_root_node):
        """"""
        return spanstring2tokens(self, self.node[sentence_root_node][self.ns+':span'])
867795
def parse(self, text):
        """"""
        token_stream = self.lexer.tokenize(text)
        return self.expr(token_stream, next(token_stream))
178917
def _process_name(name):
    """"""

    # Unescape HTML entities
    name = unescape(name)

    # Remove bracketed stuff on the end
    name = NG_RE.sub('', name).strip()  # Nomenclature groups
    name = END_RE.sub('', name).strip(', ')  # Words
    name = RATIO_RE.sub('', name).strip(', ')  # Ratios

    # Remove stuff off start
    name = START_RE.sub('', name).strip()

    # Remove balanced start and end brackets if none in between
    name = BRACKET_RE.sub('\g<1>', name)

    # Un-invert CAS style names
    comps = name.split(', ')
    if len(comps) == 2:
        if comps[1].endswith('-'):
            name = comps[0]
            name = '%s%s' % (comps[1], name)
    elif len(comps) > 2:
        name = comps[0]
        for i in range(1, len(comps)):
            if comps[i].endswith('-'):
                name = '%s%s' % (comps[i], name)
            else:
                name = '%s %s' % (name, comps[i])
    return name
186112
def parse_list(lexer: Lexer, is_const: bool) -> ListValueNode:
    """"""
    start = lexer.token
    item = parse_const_value if is_const else parse_value_value
    return ListValueNode(
        values=any_nodes(lexer, TokenKind.BRACKET_L, item, TokenKind.BRACKET_R),
        loc=loc(lexer, start),
    )
738120
def decode_name(s):
    """"""
    # Some names contain XML-like entity codes
    return re.sub(r'&#(\d+);', lambda x: chr(int(x.group(1))), s)
130214
def names(expr: AST) -> Set[str]:
    """"""
    nodes = [node for node in ast.walk(expr) if isinstance(node, ast.Name)]
    loaded = {node.id for node in nodes if isinstance(node.ctx, ast.Load)}
    stored = {node.id for node in nodes if isinstance(node.ctx, ast.Store)}
    return loaded - stored
348366
protected function lexName(): NameNode
    {
        $token = $this->expect(TokenKindEnum::NAME);

        return new NameNode($token->getValue(), $this->createLocation($token));
    }
211234
protected Name parseName( TokenStream tokens ) {
        String value = tokens.consume();
        try {
            return nameFactory.create(removeQuotes(value));
        } catch (ValueFormatException e) {
            if (e.getCause() instanceof NamespaceException) {
                throw (NamespaceException)e.getCause();
            }
            throw new ParsingException(tokens.previousPosition(), CndI18n.expectedValidNameLiteral.text(value));
        }
    }