MCPcopy Index your code
hub / github.com/nodejs/node / parse_primary

Method parse_primary

deps/v8/third_party/jinja2/parser.py:644–676  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

642 return node
643
644 def parse_primary(self) -> nodes.Expr:
645 token = self.stream.current
646 node: nodes.Expr
647 if token.type == "name":
648 if token.value in ("true", "false", "True", "False"):
649 node = nodes.Const(token.value in ("true", "True"), lineno=token.lineno)
650 elif token.value in ("none", "None"):
651 node = nodes.Const(None, lineno=token.lineno)
652 else:
653 node = nodes.Name(token.value, "load", lineno=token.lineno)
654 next(self.stream)
655 elif token.type == "string":
656 next(self.stream)
657 buf = [token.value]
658 lineno = token.lineno
659 while self.stream.current.type == "string":
660 buf.append(self.stream.current.value)
661 next(self.stream)
662 node = nodes.Const("".join(buf), lineno=lineno)
663 elif token.type in ("integer", "float"):
664 next(self.stream)
665 node = nodes.Const(token.value, lineno=token.lineno)
666 elif token.type == "lparen":
667 next(self.stream)
668 node = self.parse_tuple(explicit_parentheses=True)
669 self.stream.expect("rparen")
670 elif token.type == "lbracket":
671 node = self.parse_list()
672 elif token.type == "lbrace":
673 node = self.parse_dict()
674 else:
675 self.fail(f"unexpected {describe_token(token)!r}", token.lineno)
676 return node
677
678 def parse_tuple(
679 self,

Callers 3

parse_assign_targetMethod · 0.95
parse_unaryMethod · 0.95
parse_testMethod · 0.95

Calls 10

parse_tupleMethod · 0.95
parse_listMethod · 0.95
parse_dictMethod · 0.95
failMethod · 0.95
describe_tokenFunction · 0.70
nextFunction · 0.50
NameMethod · 0.45
appendMethod · 0.45
joinMethod · 0.45
expectMethod · 0.45

Tested by

no test coverage detected