MCPcopy Index your code
hub / github.com/python/cpython / meta

Method meta

Tools/peg_generator/pegen/grammar_parser.py:94–128  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

92
93 @memoize
94 def meta(self) -> Optional[MetaTuple]:
95 # meta: "@" NAME NEWLINE | "@" NAME NAME NEWLINE | "@" NAME STRING NEWLINE
96 mark = self._mark()
97 if (
98 (literal := self.expect("@"))
99 and
100 (name := self.name())
101 and
102 (_newline := self.expect('NEWLINE'))
103 ):
104 return ( name . string , None )
105 self._reset(mark)
106 if (
107 (literal := self.expect("@"))
108 and
109 (a := self.name())
110 and
111 (b := self.name())
112 and
113 (_newline := self.expect('NEWLINE'))
114 ):
115 return ( a . string , b . string )
116 self._reset(mark)
117 if (
118 (literal := self.expect("@"))
119 and
120 (name := self.name())
121 and
122 (string := self.string())
123 and
124 (_newline := self.expect('NEWLINE'))
125 ):
126 return ( name . string , literal_eval ( string . string ) )
127 self._reset(mark)
128 return None
129
130 @memoize
131 def rules(self) -> Optional[RuleList]:

Callers 2

metasMethod · 0.95
test_input_optionsMethod · 0.80

Calls 5

literal_evalFunction · 0.90
stringMethod · 0.80
expectMethod · 0.45
nameMethod · 0.45
_resetMethod · 0.45

Tested by 1

test_input_optionsMethod · 0.64