Fix the layout of some generated Go code

And some related fixes.

- Combined multiple blank lines between package decls into one
- Moved some doc comments to just above what they document
- Changed some doc comments to start with the documented thing's name
- Removed some redundant anchor and wrap ST options
- Changed an empty struct type containing just a newline to struct{}
- Added some missing doc comments to exported interface methods
- Removed unneeded parentheses around a single import
- Prevents generating empty const blocks
- Generates single-line package const decls if only one decl
- Indented switch case bodies
- Content checks for some template vars, e.g. if v defined then v else nothing
- Removed template redundancies, e.g. from <attrs:{a | <a>}> to <attrs>.
- Removed blank lines that group embedded types and fields separately
- Changed some trivial one-line func/method decls to mult-line
- Changed empty package slice decls to use nil, e.g. var foo []uint16
- Changed const int enums that used the ST <i> var to use iota instead
- Replaced separator in GoTarget.encodeIntAsCharEscape with a template separator
This commit is contained in:
Will Faught 2016-05-27 16:46:11 -07:00
parent ce5fb52989
commit c3d6c20ee4
2 changed files with 673 additions and 250 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,3 @@
package org.antlr.v4.codegen.target;
import org.antlr.v4.codegen.CodeGenerator;
@ -66,7 +65,7 @@ public class GoTarget extends Target {
@Override
public String encodeIntAsCharEscape(int v) {
return Integer.toString(v) + ",";
return Integer.toString(v);
}
@Override