Package com.strobel.decompiler.languages

Examples of com.strobel.decompiler.languages.LineNumberPosition


        int lineOffset = 0;
        List<String> brokenLines = new ArrayList<>();

        try( BufferedReader r = new BufferedReader( new FileReader( _file))) {
            for ( int posIndex=0; posIndex<_positions.size(); posIndex++) {
                LineNumberPosition pos = _positions.get( posIndex);
                o_LineBrokenPositions.add( new LineNumberPosition(
                        pos.getOriginalLine(), pos.getEmittedLine()+lineOffset, pos.getEmittedColumn()));
               
                // Copy the input file up to but not including the emitted line # in "pos".
                while ( numLinesRead < pos.getEmittedLine()-1) {
                    brokenLines.add( r.readLine());
                    numLinesRead++;
                }
               
                // Read the line that contains the next line number annotations, but don't write it yet.
                String line = r.readLine();
                numLinesRead++;
               
                // See if there are two original line annotations on the same emitted line.
                LineNumberPosition nextPos;
                int prevPartLen = 0;
                char[] indent = {};
                do {
                    nextPos = (posIndex < _positions.size()-1) ? _positions.get( posIndex+1) : null;
                    if ( nextPos != null
                        && nextPos.getEmittedLine() == pos.getEmittedLine()
                        && nextPos.getOriginalLine() > pos.getOriginalLine()) {
                        // Two different source line numbers on the same emitted line!
                        posIndex++;
                        lineOffset++;
                        String firstPart = line.substring( 0, nextPos.getEmittedColumn() - prevPartLen - 1);
                        brokenLines.add( new String(indent) + firstPart);
                        prevPartLen += firstPart.length();
                        indent = new char[prevPartLen];
                        Arrays.fill( indent, ' ');
                        line = line.substring( firstPart.length(), line.length());
                       
                        // Alter the position while adding it.
                        o_LineBrokenPositions.add( new LineNumberPosition(
                                nextPos.getOriginalLine(), nextPos.getEmittedLine()+lineOffset, nextPos.getEmittedColumn()));
                    } else {
                        nextPos = null;
                    }
                } while ( nextPos != null);
               
View Full Code Here


            int lineNumber = offset2LineNumber.getLineForOffset( offset);
            if ( lineNumber > lastObservedLineNumber) {
                // Record a data structure mapping original to actual line numbers.
                int lineOfComment = output.getRow();
                int columnOfComment = output.getColumn();
                LineNumberPosition pos = new LineNumberPosition( lineNumber, lineOfComment, columnOfComment);
                lineNumberPositions.add( pos);               
                lastObservedLineNumber = lineNumber;
                if ( lineNumberMode == LineNumberMode.WITH_DEBUG_LINE_NUMBERS) {
                    // Emit a comment showing the original line number.
                    String commentStr = prefix + lineNumber + "*/";
 
View Full Code Here

TOP

Related Classes of com.strobel.decompiler.languages.LineNumberPosition

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.