/** Track start/stop token for subtree root created for a rule. * Only works with Tree nodes. For rules that match nothing, * seems like this will yield start=i and stop=i-1 in a nil node. * Might be useful info so I'll not force to be i..i. */ public void setTokenBoundaries(Object t, Token startToken, Token stopToken) { if ( t==null ) return; int start = 0; int stop = 0; if ( startToken!=null ) start = startToken.getTokenIndex(); if ( stopToken!=null ) stop = stopToken.getTokenIndex(); ((Tree)t).setTokenStartIndex(start); ((Tree)t).setTokenStopIndex(stop); }
/** Track start/stop token for subtree root created for a rule. * Only works with Tree nodes. For rules that match nothing, * seems like this will yield start=i and stop=i-1 in a nil node. * Might be useful info so I'll not force to be i..i. */ @Override public void setTokenBoundaries(Object t, Token startToken, Token stopToken) { if ( t==null ) return; int start = 0; int stop = 0; if ( startToken!=null ) start = startToken.getTokenIndex(); if ( stopToken!=null ) stop = stopToken.getTokenIndex(); ((Tree)t).setTokenStartIndex(start); ((Tree)t).setTokenStopIndex(stop); }
/** Track start/stop token for subtree root created for a rule. * Only works with Tree nodes. For rules that match nothing, * seems like this will yield start=i and stop=i-1 in a nil node. * Might be useful info so I'll not force to be i..i. */ @Override public void setTokenBoundaries(Object t, Token startToken, Token stopToken) { if ( t==null ) return; int start = 0; int stop = 0; if ( startToken!=null ) start = startToken.getTokenIndex(); if ( stopToken!=null ) stop = stopToken.getTokenIndex(); ((Tree)t).setTokenStartIndex(start); ((Tree)t).setTokenStopIndex(stop); }
/** Track start/stop token for subtree root created for a rule. * Only works with Tree nodes. For rules that match nothing, * seems like this will yield start=i and stop=i-1 in a nil node. * Might be useful info so I'll not force to be i..i. */ @Override public void setTokenBoundaries(Object t, Token startToken, Token stopToken) { if ( t==null ) return; int start = 0; int stop = 0; if ( startToken!=null ) start = startToken.getTokenIndex(); if ( stopToken!=null ) stop = stopToken.getTokenIndex(); ((Tree)t).setTokenStartIndex(start); ((Tree)t).setTokenStopIndex(stop); }
/** Track start/stop token for subtree root created for a rule. * Only works with Tree nodes. For rules that match nothing, * seems like this will yield start=i and stop=i-1 in a nil node. * Might be useful info so I'll not force to be i..i. */ @Override public void setTokenBoundaries(Object t, Token startToken, Token stopToken) { if ( t==null ) return; int start = 0; int stop = 0; if ( startToken!=null ) start = startToken.getTokenIndex(); if ( stopToken!=null ) stop = stopToken.getTokenIndex(); ((Tree)t).setTokenStartIndex(start); ((Tree)t).setTokenStopIndex(stop); }
/** Track start/stop token for subtree root created for a rule. * Only works with Tree nodes. For rules that match nothing, * seems like this will yield start=i and stop=i-1 in a nil node. * Might be useful info so I'll not force to be i..i. */ @Override public void setTokenBoundaries(Object t, Token startToken, Token stopToken) { if ( t==null ) return; int start = 0; int stop = 0; if ( startToken!=null ) start = startToken.getTokenIndex(); if ( stopToken!=null ) stop = stopToken.getTokenIndex(); ((Tree)t).setTokenStartIndex(start); ((Tree)t).setTokenStopIndex(stop); }
@Override public void setTokenBoundaries(Object t, Token startToken, Token stopToken) { if ( t==null ) return; int start = 0; int stop = 0; if ( startToken!=null ) start = startToken.getTokenIndex(); if ( stopToken!=null ) stop = stopToken.getTokenIndex(); ((Tree)t).setTokenStartIndex(start); ((Tree)t).setTokenStopIndex(stop); if (t instanceof HiddenTokenAwareTree) { HiddenTokenAwareTree token = (HiddenTokenAwareTree) t; token.setStopToken(stopToken); } }