MCPcopy Index your code
hub / github.com/antlr/codebuff / getMatchingSymbolEndsLine

Method getMatchingSymbolEndsLine

src/org/antlr/codebuff/Trainer.java:665–684  ·  view source on GitHub ↗
(Corpus corpus,
	                                            InputDocument doc,
	                                            TerminalNode node)

Source from the content-addressed store, hash-verified

663 }
664
665 public static int getMatchingSymbolEndsLine(Corpus corpus,
666 InputDocument doc,
667 TerminalNode node)
668 {
669 TerminalNode matchingLeftNode = getMatchingLeftSymbol(corpus, doc, node);
670 if ( matchingLeftNode != null ) {
671 Token matchingLeftToken = matchingLeftNode.getSymbol();
672 int i = matchingLeftToken.getTokenIndex();
673 Token tokenAfterMatchingToken = doc.tokens.getNextRealToken(i);
674// System.out.printf("doc=%s node=%s, pair=%s, after=%s\n",
675// new File(doc.fileName).getName(), node.getSymbol(), matchingLeftToken, tokenAfterMatchingToken);
676 if ( tokenAfterMatchingToken!=null ) {
677 if ( tokenAfterMatchingToken.getType()==Token.EOF ) {
678 return 1;
679 }
680 return tokenAfterMatchingToken.getLine()>matchingLeftToken.getLine() ? 1 : 0;
681 }
682 }
683 return NOT_PAIR;
684 }
685
686 public static TerminalNode getMatchingLeftSymbol(Corpus corpus,
687 InputDocument doc,

Callers 1

getContextFeaturesMethod · 0.95

Calls 5

getMatchingLeftSymbolMethod · 0.95
getTokenIndexMethod · 0.80
getNextRealTokenMethod · 0.80
getTypeMethod · 0.45
getLineMethod · 0.45

Tested by

no test coverage detected