-
Notifications
You must be signed in to change notification settings - Fork 35
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
Comments & Indentation bugfix #89
Comments & Indentation bugfix #89
Conversation
O erro do Travis, aparentemente, é um bug do lado deles. |
@guilhermejccavalcanti have you checked this? is there a better approach for handling comments at the end of class declarations? |
I couldn't think of a better solution. |
Open and close brackets are FSTTerminals to capture orphan comments
d6f58bc
to
2dc106d
Compare
if (lines.get(i).contains("extends AbstractFSTPrintVisitor")) { | ||
lines.set(i, "public class SimplePrintVisitor extends S3MPrettyPrinter {"); | ||
lines.set(i - 1, "import br.ufpe.cin.printers.S3MPrettyPrinter;"); | ||
for (int j = 1; j <= 6; j++) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
até entendo a necessidade da gambiarra, mas esse loop, com essas constantes hardcoded fica complicado de entender. eheheh qual o significado?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jvcoutinho falta o comentário ainda?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@guilhermejccavalcanti pronto, tinha esquecido de dar push
Cê tem razão, posso comentar ou extrair uma constante.
A ideia é encontrar a linha que começa a classe. Quando achar, muda a
herança, coloca um import na linha anterior e apaga as 6 linhas seguintes
(onde ficam os construtores).
Em ter, 20 de ago de 2019 11:32, Guilherme Cavalcanti <
[email protected]> escreveu:
… ***@***.**** commented on this pull request.
------------------------------
In src/main/java/br/ufpe/cin/generator/Generator.java
<#89 (comment)>
:
> }catch(Exception e){
System.err.println("Refresh the root project folder (F5). Try again.");
e.printStackTrace();
}
}
+
+ private static void alterInherits() throws IOException {
+ Path path = Paths.get("src/main/java/br/ufpe/cin/generated/SimplePrintVisitor.java");
+ List<String> lines = Files.readAllLines(path, StandardCharsets.UTF_8);
+
+ for (int i = 0; i < lines.size(); i++) {
+ if (lines.get(i).contains("extends AbstractFSTPrintVisitor")) {
+ lines.set(i, "public class SimplePrintVisitor extends S3MPrettyPrinter {");
+ lines.set(i - 1, "import br.ufpe.cin.printers.S3MPrettyPrinter;");
+ for (int j = 1; j <= 6; j++) {
até entendo a necessidade da gambiarra, mas esse loop, com essas
constantes hardcoded fica complicado de entender. eheheh qual o significado?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#89>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AGS5LZSHELTMGQJSLK2W4PDQFP56BANCNFSM4IGRSICQ>
.
|
Entendi!
Em ter, 20 de ago de 2019 às 11:37, João Victor <[email protected]>
escreveu:
… Cê tem razão, posso comentar ou extrair uma constante.
A ideia é encontrar a linha que começa a classe. Quando achar, muda a
herança, coloca um import na linha anterior e apaga as 6 linhas seguintes
(onde ficam os construtores).
Em ter, 20 de ago de 2019 11:32, Guilherme Cavalcanti <
***@***.***> escreveu:
> ***@***.**** commented on this pull request.
> ------------------------------
>
> In src/main/java/br/ufpe/cin/generator/Generator.java
> <
#89 (comment)
>
> :
>
> > }catch(Exception e){
>
> System.err.println("Refresh the root project folder (F5). Try again.");
>
> e.printStackTrace();
>
> }
>
> }
>
> +
>
> + private static void alterInherits() throws IOException {
>
> + Path path =
Paths.get("src/main/java/br/ufpe/cin/generated/SimplePrintVisitor.java");
>
> + List<String> lines = Files.readAllLines(path, StandardCharsets.UTF_8);
>
> +
>
> + for (int i = 0; i < lines.size(); i++) {
>
> + if (lines.get(i).contains("extends AbstractFSTPrintVisitor")) {
>
> + lines.set(i, "public class SimplePrintVisitor extends S3MPrettyPrinter
{");
>
> + lines.set(i - 1, "import br.ufpe.cin.printers.S3MPrettyPrinter;");
>
> + for (int j = 1; j <= 6; j++) {
>
>
> até entendo a necessidade da gambiarra, mas esse loop, com essas
> constantes hardcoded fica complicado de entender. eheheh qual o
significado?
>
> —
> You are receiving this because you authored the thread.
> Reply to this email directly, view it on GitHub
> <
#89
>,
> or mute the thread
> <
https://github.com/notifications/unsubscribe-auth/AGS5LZSHELTMGQJSLK2W4PDQFP56BANCNFSM4IGRSICQ
>
> .
>
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#89>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAZN6XLNCAYJPRJCYBHODM3QFP6RPANCNFSM4IGRSICQ>
.
|
Faz isso. E adiciona um comentário no método explicando o propósito disto.
…On 20 Aug 2019 11:37 -0300, João Victor ***@***.***>, wrote:
Cê tem razão, posso comentar ou extrair uma constante.
A ideia é encontrar a linha que começa a classe. Quando achar, muda a
herança, coloca um import na linha anterior e apaga as 6 linhas seguintes
(onde ficam os construtores).
Em ter, 20 de ago de 2019 11:32, Guilherme Cavalcanti <
***@***.***> escreveu:
> ***@***.**** commented on this pull request.
> ------------------------------
>
> In src/main/java/br/ufpe/cin/generator/Generator.java
> <#89 (comment)>
> :
>
> > }catch(Exception e){
>
> System.err.println("Refresh the root project folder (F5). Try again.");
>
> e.printStackTrace();
>
> }
>
> }
>
> +
>
> + private static void alterInherits() throws IOException {
>
> + Path path = Paths.get("src/main/java/br/ufpe/cin/generated/SimplePrintVisitor.java");
>
> + List<String> lines = Files.readAllLines(path, StandardCharsets.UTF_8);
>
> +
>
> + for (int i = 0; i < lines.size(); i++) {
>
> + if (lines.get(i).contains("extends AbstractFSTPrintVisitor")) {
>
> + lines.set(i, "public class SimplePrintVisitor extends S3MPrettyPrinter {");
>
> + lines.set(i - 1, "import br.ufpe.cin.printers.S3MPrettyPrinter;");
>
> + for (int j = 1; j <= 6; j++) {
>
>
> até entendo a necessidade da gambiarra, mas esse loop, com essas
> constantes hardcoded fica complicado de entender. eheheh qual o significado?
>
> —
> You are receiving this because you authored the thread.
> Reply to this email directly, view it on GitHub
> <#89>,
> or mute the thread
> <https://github.com/notifications/unsubscribe-auth/AGS5LZSHELTMGQJSLK2W4PDQFP56BANCNFSM4IGRSICQ>
> .
>
—
You are receiving this because your review was requested.
Reply to this email directly, view it on GitHub, or mute the thread.
|
This PR fixes #42.
Comments
Indentation