Package cambridge.parser.tokens

Examples of cambridge.parser.tokens.CloseTagToken


            if (c == '>') {
               builder.append(c);
            }

            state = State.INITIAL_STATE;
            CloseTagToken tok = new CloseTagToken(line, col, builder.toString(), getLineNo(), getColumn());

            tok.setTagName(tagName);

            return tok;
            // OPEN TAG <X
         } else if (CharUtil.isLetter((int) peek(1))) {
            c = nextChar();
View Full Code Here


            if (node != null) {
               matchedNodes.add(node);
            }
            break;
         case CLOSE_TAG:
            CloseTagToken token = (CloseTagToken) currentToken;
            TagNode tag = null;
            int openIndex = -1;
            for (int i = matchedNodes.size() - 1; i != -1; i--) {
               TemplateNode n = matchedNodes.get(i);
               if (n instanceof TagNode) {
                  TagNode tn = (TagNode) n;
                  if (tn.getEndLine() == 0 && tn.getEndColumn() == 0 && tn.tagNameString.equals(token.getTagName())) {
                     tag = tn;
                     openIndex = i;
                     break;
                  }
               }
            }

            if (openIndex != -1 && tag != null) {
               ArrayList<TemplateNode> sub = new ArrayList<TemplateNode>();
               for (int i = openIndex + 1; i < matchedNodes.size(); i++) {
                  TemplateNode n = matchedNodes.get(i);
                  n.setParent(tag);
                  sub.add(n);
               }

               tag.addChildren(sub);

               matchedNodes.removeAll(sub);
               tag.setCloseText(token.getActualValue());
               tag.setEndLine(peek(1).getLineNo());
               tag.setEndColumn(peek(1).getColumn());
            } else {
               node = new TextNode();
               TextNode text = (TextNode) node;
View Full Code Here

                if (node != null) {
                    matchedNodes.add(node);
                }
                break;
            case CLOSE_TAG:
                CloseTagToken token = (CloseTagToken) currentToken;
                TagNode tag = null;
                int openIndex = -1;
                for (int i = matchedNodes.size() - 1; i != -1; i--) {
                    TemplateNode n = matchedNodes.get(i);
                    if (n instanceof TagNode) {
                        TagNode tn = (TagNode) n;
                        if (tn.getEndLine() == 0 && tn.getEndColumn() == 0 && tn.tagNameString.equals(token.getTagName())) {
                            tag = tn;
                            openIndex = i;
                            break;
                        }
                    }
                }

                if (openIndex != -1 && tag != null) {
                    ArrayList<TemplateNode> sub = new ArrayList<TemplateNode>();
                    for (int i = openIndex + 1; i < matchedNodes.size(); i++) {
                        TemplateNode n = matchedNodes.get(i);
                        n.setParent(tag);
                        sub.add(n);
                    }

                    tag.addChildren(sub);

                    matchedNodes.removeAll(sub);
                    tag.setCloseText(token.getActualValue());
                    tag.setEndLine(peek(1).getLineNo());
                    tag.setEndColumn(peek(1).getColumn());
                } else {
                    node = new TextNode();
                    TextNode text = (TextNode) node;
View Full Code Here

            if (c == '>') {
               builder.append(c);
            }

            state = State.INITIAL_STATE;
            CloseTagToken tok = new CloseTagToken(line, col, builder.toString(), getLineNo(), getColumn());

            tok.setTagName(tagName);

            return tok;
            // OPEN TAG <X
         } else if (CharUtil.isLetter((int) peek(1))) {
            c = nextChar();
View Full Code Here

TOP

Related Classes of cambridge.parser.tokens.CloseTagToken

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.