Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Capture and preserve source line numbers. #16

Merged
merged 8 commits into from
Dec 6, 2015

Conversation

amcgregor
Copy link
Member

Contributing work towards #4 and #12.

As a module-level list named `__mapping__`, and as a compressed delta
encoding for production use as ``__gzmapping__``.

The compressed version is the base-84 representation of a gzipped
stream of packed integer bytes defining the difference in line number
from line to line.
@amcgregor
Copy link
Member Author

As examples, the cinje.std.htmlmodule during testing gave back pretty line number results of:

__mapping__ = [0, 2, 3, 4, 5, 6, 6, 6, 6, 6, 6, 6, 7, 8, 9, 10, 11, 12, 13, 14, 14, 14, 14, 14, 15, 15, 16, 17, 17,
        19, 20, 21, 22, 23, 23, 23, 23, 23, 24, 25, 25, 25, 25, 25, 28, 29, 29, 29, 29, 29, 31, 32, 32, 32, 32, 32,
        34, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 38, 39, 40, 41, 42, 43, 43, 43, 43, 43, 44, 46, 47, 47, 47, 47,
        47, 49, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 53, 54, 55, 56, 57, 58, 59, 61, 61, 61, 61, 61, 62, 62, 63,
        63, 63, 64, 64, 65, 66, 66, 67, 68, 68, 68, 68, 69, 69, 69, 69, 69, 69, 70, 71, 72, 72, 73, 73, 73, 73, 73,
        73, 73, 75, 76, 77, 78, 79, 79, 79, 79, 79, 80, 80, 80, 80, 80, 80, 80, 81, 81, 81, 81, 81, 81, 82, 82, 82,
        82, 82, 82, 84, 85, 86, 87, 87, 87, 87, 87, 88, 88, 88, 88, 88, 89, 89, 89, 89, 89, 89, 90, 90, 90, 90, 90,
        90, 92, 93, 94, 95, 95, 95, 95, 95, 96, 96, 96, 96, 96, 97, 98, 99, 100, 102, 102, 102, 102, 102, 102, 104,
        105, 106, 107, 107, 107, 107, 107, 108, 108, 108, 108, 108, 108, 109, 110, 111, 112, 114, 114, 114, 114, 114,
        114, 114, 114, 114, 114, 116, 117, 118, 119, 119, 119, 119, 119, 120, 120, 120, 120, 120, 120, 120, 120, 120,
        120, 120, 120, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 136, 136, 136, 136, 136, 137, 137,
        137, 137, 137, 137, 138, 139, 140, 140, 140, 140, 141, 141, 141, 141, 143, 144, 145, 145, 145, 145, 145, 148,
        148, 148, 148, 148, 148, 148, 148, 148, 148, 150, 150, 150]

While the compressed representation takes up less than 9% of the space:

__gzmapping__ = rb"""c${@mK@I>Q2txY*pKFFjYjI!-DlIS;kO(2`)uFx3Bbmn7a*utypib&;PDf>`vNS!%m~Q=zin?XfU(d3IaV@H*zTj*C6JsX;mj"""

amcgregor added a commit that referenced this pull request Dec 6, 2015
Capture and preserve source line numbers.

Now ready for application in #4 and #12.
@amcgregor amcgregor merged commit a1a1266 into develop Dec 6, 2015
@amcgregor
Copy link
Member Author

Minor reduction (by one line) in coverage acceptable.

@amcgregor amcgregor deleted the feature/line-number-mapping branch December 19, 2015 03:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants