-
Notifications
You must be signed in to change notification settings - Fork 1
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
50 keep new lines in arrays #85
Open
Yannis-Hofmann
wants to merge
33
commits into
master
Choose a base branch
from
50-keep-new-lines-in-arrays
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
14d9dd5
Implemented PPWindowFormatter and some tests for it.
racerX4004 8823659
Added some more acceptance tests
racerX4004 41e8dfb
Merge pull request #71 from hpi-swa-teaching/66-comma-and-spaces
EnnioEnnio 1702f70
Merge pull request #72 from hpi-swa-teaching/66-comma-and-spaces
Yannis-Hofmann 841d0b7
Merge branch 'Release_Branch' into 49-set-row-length-to-standard-brow…
racerX4004 cf3584b
Implementing Config for WindowFormatter
racerX4004 834a155
implementing no Linebreak in String
racerX4004 eea78cd
some renaming
racerX4004 7484b2d
Merge pull request #73 from hpi-swa-teaching/66-comma-and-spaces
simonmichaelnowack 05a1d4a
Adding more Test for a better covarage of PPWindowFormatter
janiswehen b1fb128
Merge branch 'Release_Branch' into 49-set-row-length-to-standard-brow…
Yannis-Hofmann 0fd3a77
Merge pull request #78 from hpi-swa-teaching/master
Yannis-Hofmann 6703f51
resetting because of merge mistakes
Yannis-Hofmann ac96454
fix another merge mistake
Yannis-Hofmann e2bd936
remove accidental changes
Yannis-Hofmann 737e1ed
move testAllMethods back to examples category
Yannis-Hofmann 6060712
poppy-print testAllMethods again
Yannis-Hofmann d2401f9
move testAllMethods to tests- examples
Yannis-Hofmann 0c7f83b
renaming and fixing typos
janiswehen 3748fbb
Merge branch 'Release_Branch' into 49-set-row-length-to-standard-brow…
janiswehen b3bb208
small refactoring and fixing more typos
janiswehen 97265b4
Merge pull request #76 from hpi-swa-teaching/49-set-row-length-to-sta…
kdauer e02476f
changing 'or:' and 'and:' styles
Yannis-Hofmann 7b3036d
change more or: and and:
Yannis-Hofmann 8144bc4
Merge branch 'Release_Branch' into 50-keep-new-lines-in-arrays
Yannis-Hofmann d378314
remove duplicate if-clause
Yannis-Hofmann ef21ccd
Merge branch '50-keep-new-lines-in-arrays' of https://github.com/hpi-…
Yannis-Hofmann 60d211c
remove duplicate if-clause again
Yannis-Hofmann ba45be4
fixing error where optionalEmptyLines where not removed
Yannis-Hofmann 88a5b9a
remove config option (to be implemented in different branch)
Yannis-Hofmann 074110c
update evaluateBraceStatement and remove defensive checks
Yannis-Hofmann 7d3bc56
Fix change suggestions
4e8907c
Update comment
Yannis-Hofmann File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
5 changes: 5 additions & 0 deletions
5
packages/PoppyPrint-Core.package/PPFormatter.class/instance/braceNodeHasMultiLineParts..st
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
helper | ||
braceNodeHasMultiLineParts: aNode | ||
|
||
^ (aNode elements anySatisfy: [:node | | ||
(self willBeMultiLine: node) or: [self isTypeOfNewLineMarker: node]]) or: [self isCaseOf: (self parentFor: aNode)] |
6 changes: 6 additions & 0 deletions
6
packages/PoppyPrint-Core.package/PPFormatter.class/instance/getBraceNodeLength..st
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
helper | ||
getBraceNodeLength: aNode | ||
|
||
^ aNode elements | ||
inject: 0 | ||
into: [:sum :node | sum + (self preFormat: node) size] |
4 changes: 4 additions & 0 deletions
4
packages/PoppyPrint-Core.package/PPFormatter.class/instance/isOptionalEmptyLineMarker..st
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
helper | ||
isOptionalEmptyLineMarker: aNode | ||
|
||
^ aNode isLiteralNode and: [aNode key = #ppOptionalEmptyLine] |
4 changes: 4 additions & 0 deletions
4
packages/PoppyPrint-Core.package/PPFormatter.class/instance/isOptionalNewLineMarker..st
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
helper | ||
isOptionalNewLineMarker: aNode | ||
|
||
^ aNode isLiteralNode and: [aNode key = #ppOptionalNewLine] |
4 changes: 4 additions & 0 deletions
4
packages/PoppyPrint-Core.package/PPFormatter.class/instance/isTypeOfNewLineMarker..st
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
helper | ||
isTypeOfNewLineMarker: aNode | ||
|
||
^ ((self isOptionalEmptyLineMarker: aNode) or: [self isOptionalNewLineMarker: aNode] or: (self isEmptyLineMarker: aNode)) |
16 changes: 16 additions & 0 deletions
16
...ges/PoppyPrint-Core.package/PPFormatter.class/instance/printBraceStatements.multiLine..st
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
helper | ||
printBraceStatements: aNode multiLine: multiLine | ||
|
||
aNode elements do: [:element | | isLast | | ||
isLast := element = aNode elements last. | ||
((self isOptionalNewLineMarker: element) and: [multiLine]) ifFalse: [ | ||
((self isEmptyLineMarker: element) or: [self isOptionalEmptyLineMarker: element]) | ||
ifTrue: [self newLine] | ||
ifFalse: [ | ||
(self isOptionalNewLineMarker: element) ifFalse: [ | ||
self visitNode: element. | ||
isLast ifFalse: [ | ||
config spaceBeforePointInArray ifTrue: [stream space]. | ||
self stream nextPut: $.]]. | ||
|
||
isLast ifFalse: [multiLine ifTrue: [self newLine] ifFalse: [self stream space]]]]] |
8 changes: 8 additions & 0 deletions
8
packages/PoppyPrint-Core.package/PPFormatter.class/instance/shouldSkipStatement..st
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
accessing | ||
shouldSkipStatement: aBoolean | ||
|
||
| element | | ||
^ self isEmptyLineMarker: element | ||
ifTrue: [self newLine] | ||
ifFalse: [ | ||
(self isOptionalEmptyLineMarker: element) or: [self isOptionalNewLineMarker: element]]. |
This file contains 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
This file contains 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
This file contains 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
4 changes: 4 additions & 0 deletions
4
packages/PoppyPrint-Core.package/PPFormatterConfig.class/instance/formatToMaxLineWidth..st
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
accessing | ||
formatToMaxLineWidth: aBoolean | ||
|
||
formatToMaxLineWidth := aBoolean |
4 changes: 4 additions & 0 deletions
4
packages/PoppyPrint-Core.package/PPFormatterConfig.class/instance/formatToMaxLineWidth.st
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
accessing | ||
formatToMaxLineWidth | ||
|
||
^ formatToMaxLineWidth ifNil: [formatToMaxLineWidth := false] |
4 changes: 4 additions & 0 deletions
4
packages/PoppyPrint-Core.package/PPFormatterConfig.class/instance/maxLineWidth..st
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
accessing | ||
maxLineWidth: anInteger | ||
|
||
maxLineWidth := anInteger |
4 changes: 4 additions & 0 deletions
4
packages/PoppyPrint-Core.package/PPFormatterConfig.class/instance/maxLineWidth.st
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
accessing | ||
maxLineWidth | ||
|
||
^ maxLineWidth ifNil: [maxLineWidth := 83] |
This file contains 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
This file contains 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
Empty file.
4 changes: 4 additions & 0 deletions
4
packages/PoppyPrint-Core.package/PPWindowFormatter.class/instance/charAt..st
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
accessing | ||
charAt: aNumber | ||
|
||
^ string at: aNumber |
4 changes: 4 additions & 0 deletions
4
packages/PoppyPrint-Core.package/PPWindowFormatter.class/instance/charAtIndex.st
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
accessing | ||
charAtIndex | ||
|
||
^ self charAt: index |
10 changes: 10 additions & 0 deletions
10
packages/PoppyPrint-Core.package/PPWindowFormatter.class/instance/countTabs.st
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
helper | ||
countTabs | ||
|
||
| i | | ||
i := index + 1. | ||
tabCount := 0. | ||
|
||
[i <= string size and: [(self charAt: i) = Character tab]] whileTrue: [ | ||
tabCount := tabCount + 1. | ||
i := i + 1] |
19 changes: 19 additions & 0 deletions
19
packages/PoppyPrint-Core.package/PPWindowFormatter.class/instance/format.withWindowWidth..st
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
formatting | ||
format: aString withWindowWidth: aNumber | ||
|
||
aString isEmpty ifTrue: [^ aString]. | ||
|
||
string := aString. | ||
maxWidth := aNumber. | ||
self reset. | ||
|
||
[index <= string size] whileTrue: [ | seperator | | ||
seperator := self charAtIndex. | ||
self getNextWord. | ||
|
||
seperator = Character cr ifTrue: [self putNewlineAndCountTabs] ifFalse: [ | ||
wordWidth + lineWidth + 1 > maxWidth | ||
ifTrue: [self putIndentedNewlineAndWord] | ||
ifFalse: [self putSeperatorAndWord]]]. | ||
|
||
^ resultStream contents |
13 changes: 13 additions & 0 deletions
13
packages/PoppyPrint-Core.package/PPWindowFormatter.class/instance/getNextWord.st
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
helper | ||
getNextWord | ||
|
||
| i | | ||
i := index + 1. | ||
wordWidth := 0. | ||
wordStream reset. | ||
|
||
[i <= string size and: [inString or: [(seperators occurrencesOf: (self charAt: i)) = 0]]] whileTrue: [ | ||
wordStream nextPut: (self charAt: i). | ||
(self charAt: i) = $' ifTrue: [inString := inString not]. | ||
wordWidth := wordWidth + 1. | ||
i := i + 1] |
8 changes: 8 additions & 0 deletions
8
...ges/PoppyPrint-Core.package/PPWindowFormatter.class/instance/putIndentedNewlineAndWord.st
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
put | ||
putIndentedNewlineAndWord | ||
|
||
resultStream nextPut: Character cr; | ||
next: tabCount + 1 put: Character tab; | ||
nextPutAll: wordStream contents. | ||
lineWidth := tabCount + 1 + wordWidth. | ||
index := index + wordWidth + 1 |
17 changes: 17 additions & 0 deletions
17
packages/PoppyPrint-Core.package/PPWindowFormatter.class/instance/putNewlineAndCountTabs.st
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
put | ||
putNewlineAndCountTabs | ||
|
||
self countTabs. | ||
|
||
resultStream nextPut: Character cr; | ||
next: tabCount put: Character tab. | ||
tabCount = 0 | ||
ifTrue: [ | ||
resultStream nextPutAll: wordStream contents. | ||
index := index + wordWidth + 1] | ||
ifFalse: [ | ||
index := index + tabCount. | ||
self getNextWord. | ||
resultStream nextPutAll: wordStream contents. | ||
index := index + wordWidth + 1]. | ||
lineWidth := tabCount + wordWidth |
7 changes: 7 additions & 0 deletions
7
packages/PoppyPrint-Core.package/PPWindowFormatter.class/instance/putSeperatorAndWord.st
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
put | ||
putSeperatorAndWord | ||
|
||
resultStream nextPut: self charAtIndex; | ||
nextPutAll: wordStream contents. | ||
lineWidth := lineWidth + wordWidth + 1. | ||
index := index + wordWidth + 1 |
13 changes: 13 additions & 0 deletions
13
packages/PoppyPrint-Core.package/PPWindowFormatter.class/instance/reset.st
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
initialize | ||
reset | ||
|
||
seperators := { Character cr. Character tab. Character space}. | ||
resultStream := '' writeStream. | ||
wordStream := '' writeStream. | ||
lineWidth := 0. | ||
wordWidth := 0. | ||
tabCount := 0. | ||
index := 1. | ||
inString := false. | ||
|
||
self skipToEndOfFirstWord |
8 changes: 8 additions & 0 deletions
8
packages/PoppyPrint-Core.package/PPWindowFormatter.class/instance/skipToEndOfFirstWord.st
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
initialize | ||
skipToEndOfFirstWord | ||
|
||
[index <= string size and: [inString or: [(seperators occurrencesOf: self charAtIndex) = 0]]] whileTrue: [ | ||
resultStream nextPut: self charAtIndex. | ||
self charAtIndex = $' ifTrue: [inString := inString not]. | ||
lineWidth := lineWidth + 1. | ||
index := index + 1] |
14 changes: 14 additions & 0 deletions
14
packages/PoppyPrint-Core.package/PPWindowFormatter.class/methodProperties.json
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"class" : { | ||
}, | ||
"instance" : { | ||
"charAt:" : "JW 5/31/2022 11:05", | ||
"charAtIndex" : "JW 5/31/2022 11:05", | ||
"countTabs" : "JW 5/31/2022 11:12", | ||
"format:withWindowWidth:" : "JW 6/1/2022 20:52", | ||
"getNextWord" : "JW 6/1/2022 20:09", | ||
"putIndentedNewlineAndWord" : "JW 6/23/2022 11:45", | ||
"putNewlineAndCountTabs" : "JW 6/23/2022 11:46", | ||
"putSeperatorAndWord" : "JW 6/23/2022 11:47", | ||
"reset" : "JW 6/1/2022 20:05", | ||
"skipToEndOfFirstWord" : "JW 6/1/2022 20:10" } } |
Oops, something went wrong.
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.
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.
I guess this was used during debugging only? or is there a reason to keep the temp var around?
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.
no, this is actually needed for the LineWidth