Package httl.ast

Examples of httl.ast.Text


        buf.append(((Text) nodes.get(i)).getContent());
        while (i + 1 < nodes.size() && isNoLiteralText(nodes.get(i + 1))) {
          buf.append(((Text) nodes.get(i + 1)).getContent());
          i ++;
        }
        result.add(new Text(buf.toString(), false, offset));
      } else if (result != null) {
        result.add(nodes.get(i));
      }
    }
    if (result != null) {
View Full Code Here


          literal = true;
        } else {
          message = filterEscape(message);
          literal = false;
        }
        directives.add(new Text(message, literal, offset));
      }
    }
    return directives;
  }
View Full Code Here

              if (tail.length() > 0 && tail.trim().length() == 0) {
                text = text.substring(0, pos + 1);
                if (text.length() == 0) {
                  empty_text_index_list.add(prev_index); // 将会是空节点,加入到待删除队列
                } else {
                  nodes.set(prev_index, new Text(text, false,
                      prev.getOffset())); // 修改
                }
              }
            }
          }
        } // prev text node

        if (i + 1 < nodes.size()) {
          int next_index = i + 1;
          Statement next = nodes.get(next_index);

          if (isNoLiteralText(next)) {
            // 删除下一个文本节点地一个\n之前的所有空白符
            String text = ((Text) next).getContent();
            int pos = text.indexOf('\n');
            if (pos >= 0) {
              String head = text.substring(0, pos);
              if (head.trim().length() == 0) {
                text = text.substring(pos + 1);
                boolean isEmptyNode = false;
                if (text.length() == 0) {
                  empty_text_index_list.add(next_index); // 将会是空节点,加入到待删除队列
                  isEmptyNode = true;
                } else if (text.indexOf('\n') == -1
                    && text.trim().length() == 0) {
                  // 看看下面是不是还是个指令,是不是可以全部丢掉
                  if (next_index + 1 < nodes.size()) {
                    Statement next_next = nodes
                        .get(next_index + 1);
                    if (isTrimableDirective(next_next)) {
                      empty_text_index_list
                          .add(next_index); // 将会是空节点,加入到待删除队列
                      isEmptyNode = true;
                    }
                  }
                }
                if (!isEmptyNode) {
                  nodes.set(next_index, new Text(text, false,
                      next.getOffset())); // 修改
                }
              }
            }
            i++; // skip next
View Full Code Here

TOP

Related Classes of httl.ast.Text

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.