public class CaptureTree extends Object
E.g.
Matcher matcher = Pattern.compile("(?x)" + "(?(DEFINE)" + "(?<sum> (?'summand')(?:\\+(?'summand'))+ )"
+ "(?<summand> (?'product') | (?'number') )" + "(?<product> (?'factor')(?:\\*(?'factor'))+ )"
+ "(?<factor>(?'number') )" + "(?<number>\\d++)" + ")" + "(?'sum')").matcher("5+6*8");
matcher.matches();
System.out.println(matcher.captureTree());
prints out
0
sum
summand
number
summand
product
factor
number
factor
number
Matcher.captureTree()| Modifier and Type | Method and Description |
|---|---|
CaptureTreeNode |
getRoot()
Returns the root of this capture tree
|
String |
toString()
Returns a string representation of this capture tree
Don't rely on the implementation of this method to remain unchanged
|
public CaptureTreeNode getRoot()
Copyright © 2019. All rights reserved.