Package org.python.pydev.parser.jython.ast

Examples of org.python.pydev.parser.jython.ast.commentType


    private void addSpecial(SimpleNode node, Object special, boolean after) {
        if (special instanceof Token) {
            Token t = (Token) special;
            if (t.toString().trim().startsWith("#")) {
                commentType comment = new commentType(t.image.trim());
                comment.beginColumn = t.beginColumn;
                comment.beginLine = t.beginLine;
                special = comment;

                if (node.beginLine != comment.beginLine) {
View Full Code Here


     * Adds the special tokens as tokens in the document.
     */
    private void writeSpecials(SimpleNode node, List<Object> specials) {
        for (Object c : specials) {
            if (c instanceof commentType) {
                commentType comment = (commentType) c;
                doc.add(comment.beginLine, comment.beginColumn, comment.id, comment);

            } else if (c instanceof Name) {
                Name name = (Name) c;
                doc.add(name.beginLine, name.beginColumn, name.id, name);
View Full Code Here

            writtenComment = true; //make it as if we've written it
            return indent;
        }

        ILinePart2 iLinePart2 = (ILinePart2) linePart;
        commentType commentType = (commentType) linePart.getToken();
        int col = commentType.beginColumn;
        if (col == 1) { //yes, our indexing starts at 1.
            lastWasComment = true;
            writtenComment = true;
            writeStateV2.writeRaw(iLinePart2.getString());
View Full Code Here

                return ((NameTok) n.name).id;
            }
        }

        if (node instanceof commentType) {
            commentType type = (commentType) node;
            return type.id;
        }

        if (node instanceof excepthandlerType) {
            excepthandlerType type = (excepthandlerType) node;
View Full Code Here

    @Override
    protected void doAddNode(ASTEntry entry) {
        SimpleNode node = entry.node;

        if (node instanceof commentType) {
            commentType type = (commentType) node;
            if (type.beginColumn == 1) {
                entry.parent = null; //top-level
            } else {

                //try to match it to some other indentation already set.
View Full Code Here

        if (specials == null || isInAssign) {
            return;
        }
        for (Object object : specials) {
            if (object instanceof commentType) {
                commentType type = (commentType) object;
                String trimmed = type.id.trim();

                if (trimmed.startsWith("#---") || trimmed.endsWith("---")) {
                    atomic(type);
                }
View Full Code Here

            while (it.hasNext()) {
                String string = it.next();
                if (string.trim().startsWith("#")) {
                    int l = it.getCurrentLine() - 1;
                    addFoldingEntry(ret, new FoldingEntry(FoldingEntry.TYPE_COMMENT, l, l + 1, new ASTEntry(null,
                            new commentType(string))));
                }
            }
        }

        Collections.sort(ret, new Comparator<FoldingEntry>() {
View Full Code Here

            //also make comments found after the node a part of its context.
            List<Object> s = entry.node.specialsAfter;
            if (s != null) {
                for (Object o : s) {
                    if (o instanceof commentType) {
                        commentType comment = (commentType) o;
                        if (comment.beginLine > entry.endLine) {
                            entry.endLine = comment.beginLine;
                        }
                    }
                }
View Full Code Here

        if (size > 0) {
            int i = -1;
            if (node.specialsAfter != null) {
                for (Object o : node.specialsAfter) {
                    if (o instanceof commentType) {
                        commentType type = (commentType) o;
                        if (type.beginLine > i) {
                            i = type.beginLine;
                        }
                    }
                }
View Full Code Here

            }
            modules.deleteCharAt(modules.length() - 1);
            return modules.toString() + " (" + ((NameTok) importToken.module).id + ")";

        } else if (astThis.node instanceof commentType) {
            commentType type = (commentType) astThis.node;
            String rep = type.id.trim();
            rep = StringUtils.split(rep, '\n').get(0);
            rep = StringUtils.split(rep, '\r').get(0);
            rep = rep.substring(1);
            rep = StringUtils.rightTrim(rep, '-');
View Full Code Here

TOP

Related Classes of org.python.pydev.parser.jython.ast.commentType

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.