forked from jasder/antlr
add comments to Chunk
This commit is contained in:
parent
3439df0fb0
commit
127d9bce3c
|
@ -1,6 +1,9 @@
|
||||||
package org.antlr.v4.runtime.tree.pattern;
|
package org.antlr.v4.runtime.tree.pattern;
|
||||||
|
|
||||||
class Chunk {
|
/** A chunk is either a token reference, a rule reference, or some plaintext
|
||||||
public Chunk() {
|
* 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 {
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,6 +39,7 @@ import org.antlr.v4.runtime.Parser;
|
||||||
import org.antlr.v4.runtime.ParserRuleContext;
|
import org.antlr.v4.runtime.ParserRuleContext;
|
||||||
import org.antlr.v4.runtime.Token;
|
import org.antlr.v4.runtime.Token;
|
||||||
import org.antlr.v4.runtime.TokenStream;
|
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.ParseTree;
|
||||||
import org.antlr.v4.runtime.tree.ParseTreeWalker;
|
import org.antlr.v4.runtime.tree.ParseTreeWalker;
|
||||||
import org.antlr.v4.runtime.tree.RuleNode;
|
import org.antlr.v4.runtime.tree.RuleNode;
|
||||||
|
@ -205,6 +206,11 @@ public class ParseTreePatternMatcher {
|
||||||
List<? extends Token> tokenList = tokenize(pattern);
|
List<? extends Token> tokenList = tokenize(pattern);
|
||||||
ListTokenSource tokenSrc = new ListTokenSource(tokenList);
|
ListTokenSource tokenSrc = new ListTokenSource(tokenList);
|
||||||
CommonTokenStream tokens = new CommonTokenStream(tokenSrc);
|
CommonTokenStream tokens = new CommonTokenStream(tokenSrc);
|
||||||
|
|
||||||
|
// ATNDeserializationOptions deserializationOptions = new ATNDeserializationOptions();
|
||||||
|
// deserializationOptions.setGenerateRuleBypassTransitions(true);
|
||||||
|
// ATN atn = new ATNDeserializer(deserializationOptions).deserialize(serializedATN);
|
||||||
|
|
||||||
parser.setTokenStream(tokens);
|
parser.setTokenStream(tokens);
|
||||||
parser.setErrorHandler(new ParseTreePatternErrorStrategy());
|
parser.setErrorHandler(new ParseTreePatternErrorStrategy());
|
||||||
ParseTree tree = null;
|
ParseTree tree = null;
|
||||||
|
|
Loading…
Reference in New Issue