Basic indenter for RARS - #116
Open
ElTitoDG wants to merge 4 commits into
Open
Conversation
privat
requested changes
Jul 2, 2025
privat
left a comment
Collaborator
There was a problem hiding this comment.
I have exception that pop
Exception in thread "AWT-EventQueue-0" java.lang.IllegalArgumentException: 2 > 1
at java.base/java.util.Arrays.copyOfRange(Arrays.java:3804)
at java.base/java.util.Arrays.copyOfRange(Arrays.java:3764)
at rars.util.Indenter.indent(Indenter.java:57)
at rars.util.Indenter.indentAssembly(Indenter.java:107)
at rars.venus.VenusUI$24.actionPerformed(VenusUI.java:511)
it seems to fail when there is a loce label for instance
foo:
bar
Author
|
Resolve all the request by @privat |
Shin-703
suggested changes
May 25, 2026
|
|
||
| // Handle empty lines and comments/directives | ||
| if (trimmedLine.isEmpty() || trimmedLine.startsWith("#")) { | ||
| if (trimmedLine.isEmpty() || trimmedLine.startsWith("#") || trimmedLine.startsWith("//")) { |
There was a problem hiding this comment.
"//" is an invalid language element, there should not be a special case for it.
| */ | ||
| public class Indenter { | ||
| // Column positions for alignment | ||
| private static final int LABEL_COLUMN = 0; // Column for labels |
There was a problem hiding this comment.
All labels should be aligned the same way, starting at 0 made sense. Now we can have inconsistency in the indentation of the labels.
| @@ -502,7 +466,7 @@ public void handler(boolean value) { | |||
| "Information about Rars", null, null, mainUI); | |||
|
|
|||
| // Nueva acción para el indentador | |||
| for (int i = 0; i < line.length(); i++) { | ||
| char c = line.charAt(i); | ||
|
|
||
| if (!inQuotes && (c == '"' || c == '\'')) { |
There was a problem hiding this comment.
The single quotes are invalid language element, you can remove it from here.
| quoteChar = c; | ||
| } else if (inQuotes && c == quoteChar) { | ||
| // Check if it's escaped | ||
| if (i == 0 || line.charAt(i - 1) != '\\') { |
There was a problem hiding this comment.
i == 0 is always false here, you can remove it
| if (codePart.isEmpty() && !commentPart.isEmpty()) { | ||
| indentedLines.add(line); | ||
| continue; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Implemented basic indenter for RARS
Solution to #23