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

AutoFormat.java, Mk III #3002

Merged
merged 9 commits into from Jan 19, 2015

Conversation

Projects
None yet
2 participants
@GKFX
Contributor

GKFX commented Dec 6, 2014

This is a finished copy of what was #2560.
Fix #2540, fix #1041.

GKFX added some commits Jun 4, 2014

Autoformat bug fixes
Miscellaneous fixes. I broke the indent-on-continued-lines feature, but it
was bad to start with.
Add indents on statements continued over new lines
This wraps up my changes to the autoformatter.
Mostly finished AutoFormat.java - a few bugs left.
Am commiting before attempting to fix by mass deletion of code.
Fixed #2540, #1041, and EOF checks in autoformat
This adds proper support for indents caused by continuing to a new line, allows arrays to be expressed in more compact form, prevents the final line being eaten if it isn't properly ended, and neatens code.
Finish AutoFormat.java
Sort out arrays and do-while loops. Fix some more bugs.
Merge branch 'autoform2' of https://github.com/GKFX/processing into a…
…utoform2

Conflicts:
	app/src/processing/mode/java/AutoFormat.java

@GKFX GKFX closed this Dec 7, 2014

@GKFX GKFX referenced this pull request Jan 9, 2015

Closed

Auto Format adds extra indent #1041

@GKFX GKFX reopened this Jan 9, 2015

@GKFX

This comment has been minimized.

Show comment
Hide comment
@GKFX

GKFX Jan 9, 2015

Contributor

Done!

Contributor

GKFX commented Jan 9, 2015

Done!

AutoFormat.java
Fix if-else regression
@GKFX

This comment has been minimized.

Show comment
Hide comment
@GKFX

GKFX Jan 15, 2015

Contributor

Just to review what's happened:

  • Line overflow indent mechanism replaced, including special array handling. Arrays need not be split over many lines now, although if an array is split it will be formatted like that.
  • s_ind and ind converted to boolean – they were int arrays holding only 0 and 1.
  • Do-while loops properly handled so they appear as
do {
  f;
} while (a);
  • castFlags removed – didn't seem very useful as it only looked at a few types. Replaced by a check for if-for-while structures
  • Delete get_string entirely, as it's useless.
  • Neaten/clarify stuff.
  • Split lookup into two methods: bufStarts and bufEnds.
  • Ensure that no code is deleted.
  • Prevent exceptions on many consecutive single-line ifs. (`if(a)\n if(a)\n if(a)\n if(a)\n ..."). It's unusual code, but there shouldn't be an exception.
  • Avoid removing the whole margin for labels: that's a C convention I haven't seen in Java.
Contributor

GKFX commented Jan 15, 2015

Just to review what's happened:

  • Line overflow indent mechanism replaced, including special array handling. Arrays need not be split over many lines now, although if an array is split it will be formatted like that.
  • s_ind and ind converted to boolean – they were int arrays holding only 0 and 1.
  • Do-while loops properly handled so they appear as
do {
  f;
} while (a);
  • castFlags removed – didn't seem very useful as it only looked at a few types. Replaced by a check for if-for-while structures
  • Delete get_string entirely, as it's useless.
  • Neaten/clarify stuff.
  • Split lookup into two methods: bufStarts and bufEnds.
  • Ensure that no code is deleted.
  • Prevent exceptions on many consecutive single-line ifs. (`if(a)\n if(a)\n if(a)\n if(a)\n ..."). It's unusual code, but there shouldn't be an exception.
  • Avoid removing the whole margin for labels: that's a C convention I haven't seen in Java.
@GKFX

This comment has been minimized.

Show comment
Hide comment
@GKFX

GKFX Jan 15, 2015

Contributor

Brief close after noticing what may be significant typo. Didn't do any harm in testing but worth correcting.

Contributor

GKFX commented Jan 15, 2015

Brief close after noticing what may be significant typo. Didn't do any harm in testing but worth correcting.

@GKFX GKFX closed this Jan 15, 2015

@GKFX

This comment has been minimized.

Show comment
Hide comment
@GKFX

GKFX Jan 17, 2015

Contributor

Actually, it's not a problem. In fact, it's an improvement. (gotElse now isn't called in case '\n' for the code else x(); (no newline inside), but seeing as it's already been called in case ' ', it doesn't matter at all.)

Contributor

GKFX commented Jan 17, 2015

Actually, it's not a problem. In fact, it's an improvement. (gotElse now isn't called in case '\n' for the code else x(); (no newline inside), but seeing as it's already been called in case ' ', it doesn't matter at all.)

@GKFX GKFX reopened this Jan 17, 2015

benfry added a commit that referenced this pull request Jan 19, 2015

@benfry benfry merged commit e92e6d7 into processing:master Jan 19, 2015

@benfry

This comment has been minimized.

Show comment
Hide comment
@benfry

benfry Jan 19, 2015

Member

Thanks! Merging; fingers crossed.

Member

benfry commented Jan 19, 2015

Thanks! Merging; fingers crossed.

@GKFX GKFX deleted the GKFX:autoform2 branch Jul 3, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment