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

Handle end of file better for PureText #4

Open
Diusrex opened this issue Apr 7, 2016 · 0 comments
Open

Handle end of file better for PureText #4

Diusrex opened this issue Apr 7, 2016 · 0 comments

Comments

@Diusrex
Copy link
Collaborator

Diusrex commented Apr 7, 2016

For the JET templates that we used in Umple originally, some ended with a newline, while others didn't. (http://stackoverflow.com/questions/5813311/no-newline-at-end-of-file).

For example, the Java test template files association_AddImmutableUnidirectionalMany.jet does not have a newline at the end, while association_SetOptionalOneToMandatoryMany.jet does. The best way to see the difference is to view them in eclipse, where association_SetOptionalOneToMandatoryMany has a blank line at the end, but association_AddImmutableUnidirectionalMany doesn't. Then, contrast this with looking at them in Github (association_SetOptionalOneToMandatoryMany vs association_AddImmutableUnidirectionalMany

The issue that occurs is that, in JET, the newline at the end of the last line is counted as an additional newline. However, the Java parsing does not differentiate between a final line ending with a newline vs a final line ending with the EOF character. This means that when translating from JET to Umple, there are some inconsistencies between certain files.

This just needs to be handled for PureText parsing, in the special case started by if (line == null && containsOnlySpaces(previousLine)) {. Because of how many files are affected by this, it is possible that the relevant special case should not be kept, or will need to be vastly changed.

Please note that one difficulty with dealing with this issue is how vim (as well as possibly other editors) will automatically insert a newline at the end of the file, while Eclipse will not and instead displays it (so some files will appear to have an additional line at the end of the file).

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

No branches or pull requests

1 participant