add comments to Chunk

This commit is contained in:
Terence Parr 2013-11-20 16:08:51 -08:00
parent 3439df0fb0
commit 127d9bce3c
2 changed files with 12 additions and 3 deletions

View File

@ -1,6 +1,9 @@
package org.antlr.v4.runtime.tree.pattern;
class Chunk {
public Chunk() {
}
/** A chunk is either a token reference, a rule reference, or some plaintext
* within a tree pattern. Function split() in the pattern matcher returns
* a list of chunks in preparation for creating a token stream by tokenize().
* From there, we get a parse tree from with compile().
*/
abstract class Chunk {
}

View File

@ -39,6 +39,7 @@ import org.antlr.v4.runtime.Parser;
import org.antlr.v4.runtime.ParserRuleContext;
import org.antlr.v4.runtime.Token;
import org.antlr.v4.runtime.TokenStream;
import org.antlr.v4.runtime.atn.ATN;
import org.antlr.v4.runtime.tree.ParseTree;
import org.antlr.v4.runtime.tree.ParseTreeWalker;
import org.antlr.v4.runtime.tree.RuleNode;
@ -205,6 +206,11 @@ public class ParseTreePatternMatcher {
List<? extends Token> tokenList = tokenize(pattern);
ListTokenSource tokenSrc = new ListTokenSource(tokenList);
CommonTokenStream tokens = new CommonTokenStream(tokenSrc);
// ATNDeserializationOptions deserializationOptions = new ATNDeserializationOptions();
// deserializationOptions.setGenerateRuleBypassTransitions(true);
// ATN atn = new ATNDeserializer(deserializationOptions).deserialize(serializedATN);
parser.setTokenStream(tokens);
parser.setErrorHandler(new ParseTreePatternErrorStrategy());
ParseTree tree = null;