MCPcopy
hub / github.com/antlr/antlr4 / match

Method match

runtime/Python3/src/antlr4/Parser.py:120–131  ·  view source on GitHub ↗
(self, ttype:int)

Source from the content-addressed store, hash-verified

118 # mismatched symbol
119
120 def match(self, ttype:int):
121 t = self.getCurrentToken()
122 if t.type==ttype:
123 self._errHandler.reportMatch(self)
124 self.consume()
125 else:
126 t = self._errHandler.recoverInline(self)
127 if self.buildParseTrees and t.tokenIndex==-1:
128 # we must have conjured up a new token during single token insertion
129 # if it's not the current symbol
130 self._ctx.addErrorNode(t)
131 return t
132
133 # Match current input symbol as a wildcard. If the symbol type matches
134 # (i.e. has a value greater than 0), {@link ANTLRErrorStrategy#reportMatch}

Callers 15

mainFunction · 0.45
visitStateMethod · 0.45
nextTokenMethod · 0.45
funcMethod · 0.45
bodyMethod · 0.45
argMethod · 0.45
statMethod · 0.45
primaryMethod · 0.45
primaryExpressionMethod · 0.45
genericSelectionMethod · 0.45
genericAssocListMethod · 0.45
genericAssociationMethod · 0.45

Calls 5

getCurrentTokenMethod · 0.95
consumeMethod · 0.95
reportMatchMethod · 0.65
recoverInlineMethod · 0.65
addErrorNodeMethod · 0.45

Tested by 1

getTokenTypesViaATNMethod · 0.36