Examples of ISpecialStr


Examples of org.python.pydev.parser.jython.ISpecialStr

        node.addSpecial(special, after);
    }

    public void addSpecialToken(Object o, int strategy) throws ParseException {
        ISpecialStr t = convertStringToSpecialStr(o);
        if (t != null) {
            grammar.getTokenSourceSpecialTokensList().add(new Object[] { t, strategy });
        }
    }
View Full Code Here

Examples of org.python.pydev.parser.jython.ISpecialStr

        grammar.getTokenSourceSpecialTokensList()
                .add(new Object[] { o, AbstractPythonGrammar.STRATEGY_ADD_AFTER_PREV });
    }

    public void findTokenAndAdd(String token) throws ParseException {
        ISpecialStr s = createSpecialStr(token, AbstractPythonGrammar.DEFAULT_SEARCH_ON_LAST, true);
        grammar.getTokenSourceSpecialTokensList()
                .add(new Object[] { s, AbstractPythonGrammar.STRATEGY_ADD_AFTER_PREV });
    }
View Full Code Here

Examples of org.python.pydev.parser.jython.ISpecialStr

        if (arity > 0) {
            nT = makeName(NameTok.ImportModule);
        } else {
            nT = new NameTok("", NameTok.ImportModule);
            Object temporaryTok = this.stack.getGrammar().temporaryToken;
            ISpecialStr temporaryToken;
            if (temporaryTok instanceof ISpecialStr) {
                temporaryToken = (ISpecialStr) temporaryTok;
            } else {
                //must be a Token
                temporaryToken = ((Token) temporaryTok).asSpecialStr();
            }
            if (temporaryToken.toString().equals("from")) {
                nT.beginColumn = temporaryToken.getBeginCol();
                nT.beginLine = temporaryToken.getBeginLine();
            } else {
                Log.log("Expected to find 'from' token as the current temporary token (begin col/line can be wrong)!");
            }
        }
        return new ImportFrom((NameTokType) nT, aliastL.toArray(new aliasType[0]), 0);
View Full Code Here

Examples of org.python.pydev.parser.jython.ISpecialStr

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

            } else if (c instanceof ISpecialStr) {
                ISpecialStr specialStr = (ISpecialStr) c;
                doc.add(specialStr.getBeginLine(), specialStr.getBeginCol(), specialStr.toString(), specialStr);

            } else {
                throw new RuntimeException("Unexpected special: '" + c + "' Class: " + c.getClass() + ". Node: " + node);
            }
        }
View Full Code Here

Examples of org.python.pydev.parser.jython.ISpecialStr

                    if (object instanceof Object[]) {
                        Object[] objects = (Object[]) object;
                        object = objects[0];
                    }
                    if (object instanceof ISpecialStr) {
                        ISpecialStr specialStr = (ISpecialStr) object;
                        if (specialStr.toString().equals(",")) {
                            endsWithComma = true;
                            break;
                        }
                    }
                }
View Full Code Here

Examples of org.python.pydev.parser.jython.ISpecialStr

            ImportFrom f = (ImportFrom) v;
            FindLastLineVisitor findLastLineVisitor = new FindLastLineVisitor();
            try {
                f.accept(findLastLineVisitor);
                SimpleNode lastNode = findLastLineVisitor.getLastNode();
                ISpecialStr lastSpecialStr = findLastLineVisitor.getLastSpecialStr();
                if (lastSpecialStr != null && lastSpecialStr.toString().equals(")")) {
                    //it was an from xxx import (euheon, utehon)
                    return lastSpecialStr.getBeginLine();
                } else {
                    return lastNode.beginLine;
                }
            } catch (Exception e) {
                Log.log(e);
View Full Code Here

Examples of org.python.pydev.parser.jython.ISpecialStr

            boolean addPrevious) {
        if (orelse != null) {
            if (orelse.specialsBefore != null) {
                for (Object o : orelse.specialsBefore) {
                    if (o instanceof ISpecialStr) {
                        ISpecialStr specialStr = (ISpecialStr) o;
                        if (specialStr.toString().equals(specialToken)) {
                            foldingEntry.endLine = specialStr.getBeginLine() - 1;
                            if (addPrevious) {
                                addFoldingEntry(ret, foldingEntry);
                            }
                            foldingEntry = new FoldingEntry(type, specialStr.getBeginLine() - 1, blockEndLine, entry);
                        }
                    }
                }
            }
        }
View Full Code Here

Examples of org.python.pydev.parser.jython.ISpecialStr

            higherLine = l;
        }
        if (node.specialsAfter != null) {
            for (Object o : node.specialsAfter) {
                if (o instanceof ISpecialStr) {
                    ISpecialStr str = (ISpecialStr) o;
                    if (str.getBeginLine() > higherLine) {
                        higherLine = str.getBeginLine();
                    }
                }
            }
        }
View Full Code Here

Examples of org.python.pydev.parser.jython.ISpecialStr

    }

    private Str convertSpecialToStr(Object o) {
        Str stringNode = null;
        if (o instanceof ISpecialStr) {
            ISpecialStr special = (ISpecialStr) o;
            stringNode = new Str(special.toString(), Str.SingleDouble, false, false, false);
            stringNode.beginLine = special.getBeginLine();
            stringNode.beginColumn = special.getBeginCol();
        }
        return stringNode;
    }
View Full Code Here

Examples of org.python.pydev.parser.jython.ISpecialStr

    private SimpleNode checkSpecials(SimpleNode node, List<Object> specials) {
        if (specials.size() > 0) {
            for (Object o : specials) {
                if (o instanceof ISpecialStr) {
                    ISpecialStr str = (ISpecialStr) o;
                    if (str.getBeginLine() >= extendNodeInSelection.beginLine) {
                        return convertSpecialToStr(o);
                    }
                }
            }
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.