Exemplo n.º 1
0
  private static void analyzeOddTicksCombos(LinkedList<Line> lines) {
    for (Line line : lines) {
      if ((line.numBold % 2 == 1) && (line.numItalics % 2 == 1)) {
        int firstSpace = -1;
        int firstSlWord = -1;
        int firstMlWord = -1;

        for (int i = 0; i < line.ticks.size(); ++i) {
          LineEntry entry = line.ticks.get(i);

          AstNode p = entry.previous;
          if (p == null || entry.tickCount != 3) continue;

          if (p instanceof ContentNode) {
            ContentNode c = (ContentNode) p;

            p = null;
            if (!c.isEmpty()) p = c.get(c.size() - 1);
          }

          char tMinus1 = '\0';
          char tMinus2 = '\0';
          if (p instanceof StringContentNode) {
            String t = ((StringContentNode) p).getContent();

            if (t.length() >= 1) tMinus1 = t.charAt(t.length() - 1);

            if (t.length() >= 2) tMinus2 = t.charAt(t.length() - 2);
          }

          if (tMinus1 == ' ') {
            if (firstSpace == -1) firstSpace = i;
          } else if (tMinus2 == ' ') {
            if (firstSlWord == -1) firstSlWord = i;
          } else {
            if (firstMlWord == -1) firstMlWord = i;
          }
        }

        if (firstSlWord != -1) {
          apostrophize(line.ticks.get(firstSlWord));
        } else if (firstMlWord != -1) {
          apostrophize(line.ticks.get(firstMlWord));
        } else if (firstSpace != -1) {
          apostrophize(line.ticks.get(firstSpace));
        }
      }
    }
  }
Exemplo n.º 2
0
 private AstNode implicitLineScope(ContentNode n) {
   NodeList content = n.getContent();
   mapInPlace(content);
   finishLine(content);
   return n;
 }