public RootNode parseInternal(StringBuilderVar block) { char[] chars = block.getChars(); int[] ixMap = new int[chars.length + 1]; // map of cleaned indices to original indices // strip out CROSSED_OUT characters and build index map StringBuilder clean = new StringBuilder(); for (int i = 0; i < chars.length; i++) { char c = chars[i]; if (c != CROSSED_OUT) { ixMap[clean.length()] = i; clean.append(c); } } ixMap[clean.length()] = chars.length; // run inner parse char[] cleaned = new char[clean.length()]; clean.getChars(0, cleaned.length, cleaned, 0); RootNode rootNode = parseInternal(cleaned); // correct AST indices with index map fixIndices(rootNode, ixMap); return rootNode; }