List of usage examples for org.antlr.v4.runtime.atn Transition label
public IntervalSet label()
From source file:org.tvl.goworks.editor.go.highlighter.GoHighlighterLexer.java
License:Open Source License
private static Transition patchTransition(Transition transition, IntervalSet digitChars, IntervalSet letterChars) {/*from w w w .ja va 2 s . com*/ switch (transition.getSerializationType()) { case Transition.ATOM: case Transition.RANGE: case Transition.SET: break; default: return null; } IntervalSet label = transition.label(); if (label == null) { return null; } IntervalSet updated = null; if (label.contains(unicodeDigitPlaceholder)) { updated = new IntervalSet(label); updated.addAll(digitChars); if (updated.size() == digitChars.size()) { updated = digitChars; } } if (label.contains(unicodeLetterPlaceholder)) { if (updated != null) { updated.addAll(label); } else { updated = new IntervalSet(label); } updated.addAll(letterChars); if (updated.size() == letterChars.size()) { updated = letterChars; } } if (updated == null) { return null; } return new SetTransition(transition.target, updated); }