Skip to content

Commit

Permalink
Merge pull request #118 from hpi-swa-teaching/dev
Browse files Browse the repository at this point in the history
Release
  • Loading branch information
BraunTom authored Aug 5, 2020
2 parents 5a1a7ab + b3b64cb commit 84d4f17
Show file tree
Hide file tree
Showing 356 changed files with 2,340 additions and 26 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# This is a basic workflow to help you get started with Actions

name: CI

# Controls when the action will run. Triggers the workflow on push or pull request
on:
push:

jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
# Select platform(s)
os: [ ubuntu-latest, macos-latest, windows-latest ]
# Select compatible Smalltalk image(s)
smalltalk: [ Squeak64-trunk, Squeak64-5.3, Squeak64-5.2 ]
name: ${{ matrix.smalltalk }} on ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: hpi-swa/setup-smalltalkCI@v1
with:
smalltalk-version: ${{ matrix.smalltalk }}
- run: smalltalkci -s ${{ matrix.smalltalk }}
timeout-minutes: 15
11 changes: 11 additions & 0 deletions .smalltalk.ston
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
SmalltalkCISpec {
#loading : [
SCIMetacelloLoadSpec {
#baseline : 'OmegaPrint',
#directory : 'packages',
#platforms : [ #squeak ],
#load : [ 'tests' ],
#useLatestMetacello : true
}
]
}
6 changes: 3 additions & 3 deletions .squot
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
OrderedDictionary {
'packages\/BaselineOfOhmPrettyPrint.package' : #SquotCypressCodeSerializer,
'packages\/OmegaPrint-Core.package' : #SquotCypressCodeSerializer,
'packages\/OhmPrettyPrint.package' : #SquotCypressCodeSerializer
}
'packages\/OmegaPrint-Tests.package' : #SquotCypressCodeSerializer,
'packages\/BaselineOfOmegaPrint.package' : #SquotCypressCodeSerializer
}
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
# OhmPrettyPrint
dev: ![CI](https://github.com/hpi-swa-teaching/OhmPrettyPrint/workflows/CI/badge.svg?branch=dev)
master: ![CI](https://github.com/hpi-swa-teaching/OhmPrettyPrint/workflows/CI/badge.svg?branch=master)

## How to install
```
```smalltalk
Metacello new
baseline: 'OhmPrettyPrint';
repository: 'github://hpi-swa-teaching/OhmPrettyPrint';
load.
repository: 'github://HPI-SWA-Teaching/OhmPrettyPrint:dev/packages';
load
```

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
baseline
baseline: spec
<baseline>
spec for: #common do: [
spec baseline: 'Ohm' with: [
spec
repository: 'github://felixauringer/ohm-s:swt-submission/packages'].
spec
package: 'OmegaPrint-Core' with: [spec requires: #('Ohm')];
package: 'OmegaPrint-Tests' with: [ spec requires: #('default') ];
group: 'default' with: #('OmegaPrint-Core');
group: 'tests' with: #('OmegaPrint-Tests')
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
accessing
projectClass

^ Smalltalk
at: #MetacelloCypressBaselineProject
ifAbsent: [ super projectClass ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"class" : {
},
"instance" : {
"baseline:" : "fau 8/4/2020 09:49",
"projectClass" : "PK 8/2/2020 20:17" } }
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"category" : "BaselineOfOhmPrettyPrint",
"category" : "BaselineOfOmegaPrint",
"classinstvars" : [
],
"classvars" : [
],
"commentStamp" : "",
"instvars" : [
],
"name" : "BaselineOfOhmPrettyPrint",
"name" : "BaselineOfOmegaPrint",
"pools" : [
],
"super" : "BaselineOf",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
SystemOrganization addCategory: #BaselineOfOmegaPrint!

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
*OmegaPrint-Core
isModeStyleable
"determine whether the current mode can be styled"
^ self showingSource or: [ self showingPrettyPrint ] or: [ self isShowingOmegaPrint ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
*OmegaPrint-Core
isShowingOmegaPrint

^ contentsSymbol = #omegaPrint
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
*OmegaPrint-Core
omegaPrintString
"returns a string whether omegaPrint is displayed"
^ ((contentsSymbol = #omegaPrint)
ifTrue: ['<yes>']
ifFalse: ['<no>']) , 'omegaPrint'
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
*OmegaPrint-Core
sourceStringPrettifiedAndDiffed
"Answer a copy of the source code for the selected message, transformed by diffing and pretty-printing exigencies"
| class selector sourceString prettifierClass |
class := self selectedClassOrMetaClass.
selector := self selectedMessageName.
(class isNil or: [ selector isNil ]) ifTrue: [ ^ 'missing' ].
sourceString := class
ultimateSourceCodeAt: selector
ifAbsent: [ ^ 'error' ].
self
validateMessageSource: sourceString
forSelector: selector
inClass: class.
(#(#prettyPrint #prettyDiffs) includes: contentsSymbol)
ifTrue: [ prettifierClass := class prettyPrinterClass ].
(#omegaPrint = contentsSymbol)
ifTrue: [ prettifierClass := OPPrinter ].
prettifierClass ifNotNil:
[ sourceString := prettifierClass
format: sourceString
in: class
notifying: nil ].
self showingAnyKindOfDiffs
ifTrue: [ sourceString := self diffFromPriorSourceFor: sourceString ].
^ sourceString
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
*OmegaPrint-Core
toggleOmegaPrint

self restoreTextualCodingPane.
self okToChange ifTrue: [ self isShowingOmegaPrint
ifTrue: [ contentsSymbol := #source ]
ifFalse: [ contentsSymbol := #omegaPrint ].
self setContentsToForceRefetch.
self contentsChanged ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"class" : {
},
"instance" : {
"isModeStyleable" : "PK 6/1/2020 18:27",
"isShowingOmegaPrint" : "fau 8/4/2020 10:22",
"omegaPrintString" : "fau 8/4/2020 10:22",
"sourceStringPrettifiedAndDiffed" : "PK 6/3/2020 13:21",
"toggleOmegaPrint" : "PS 8/4/2020 07:04" } }
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
{
"name" : "CodeHolder" }
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
*OmegaPrint-Core
aboutToStyle: aStyler
"This is a notification that aStyler is about to re-style its text.
Answer true to allow styling to proceed, or false to veto the styling"
| type |
self isModeStyleable ifFalse: [ ^ false ].
type := self editSelection.
(#( newMessage editMessage editClass newClass ) includes: type) ifFalse: [ ^ false ].
aStyler classOrMetaClass: ((type = #editClass or: [ type = #newClass ]) ifFalse: [ self selectedClassOrMetaClass ]).
^ true
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
*OmegaPrint-Core
editSelection

^ editSelection
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
*OmegaPrint-Core
initialize

super initialize.
self
messageList: OrderedCollection new;
editSelection: #editMessage
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
*OmegaPrint-Core
messageList: aCollection

messageList := aCollection
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"class" : {
},
"instance" : {
"aboutToStyle:" : "TA 6/25/2020 20:30",
"editSelection" : "TA 6/25/2020 19:49",
"initialize" : "PK 7/2/2020 14:34",
"messageList:" : "PK 7/2/2020 14:34" } }
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
{
"name" : "MessageSet" }
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
format
evaluate: aString startingFrom: aSymbol

| matchResult evaluator |
matchResult := OhmExplicitSendsSmalltalk
match: aString
startingFrom: aSymbol.
evaluator := OhmExplicitSendsSmalltalk synthesizedAttribute: OPPrinter new.
^ evaluator value: matchResult cst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
format
format: aString in: aClass notifying: ignored
"interface as used by content display in squeak"
^ self
evaluate: aString
startingFrom: #MethodDeclaration
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
actions
BinaryMessageSend: aNode with: aBinaryMessageReceiver and: aBinaryMessage

^ self
join: { aBinaryMessageReceiver . aBinaryMessage }
separatedBy: ' '
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
actions
BlockLiteralNormal: aNode with: aTerminal and: blockArguments and: executableCode and: anotherTerminal

| result resultArguments resultVariables resultCode separator |
self increaseIndentation.
resultArguments := self value: blockArguments.
resultCode := self value: executableCode.
resultVariables := self value: executableCode firstChild.
separator := self
spaceInBlockWith: resultArguments
and: resultVariables
and: resultCode.
result := self
join: { resultArguments . resultCode }
separatedBy: separator.
self decreaseIndentation.
^ self
include: result
between: '['
and: ']'
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
actions
ByteArrayLiteral: aNode with: aTerminal and: integerLiterals and: anotherTerminal

^ self
include: (self value: integerLiterals)
between: '#['
and: ']'
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
actions
CascadedMessages: aNode with: aMessageChain and: aTerminal and: messageChains

^ self
join: { aMessageChain } , messageChains children
separatedBy: ';' , self newline
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
actions
ExecutableCode: aNode with: aLocalVariableDeclarationList and: pragmas and: moreExecutableCode

^ self
join: { aLocalVariableDeclarationList . pragmas . moreExecutableCode }
separatedBy: self newline
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
actions
ExpressionBinaryCascade: aNode with: aBinaryMessageSend and: cascadedMessages

^ self
cascadeWith: aBinaryMessageSend
and: cascadedMessages
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
actions
ExpressionOperandCascade: aNode with: anOperand and: cascadedMessages

^ self
cascadeWith: anOperand
and: cascadedMessages
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
actions
ExpressionUnaryCascade: aNode with: anUnaryMessageSend and: cascadedMessages

^ self
cascadeWith: anUnaryMessageSend
and: cascadedMessages
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
actions
FinalStatement: aNode with: aTerminal and: aStatement and: anotherTerminal

^ self
join: { aTerminal . aStatement }
separatedBy: ' '
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
actions
KeywordMessageSend: aNode with: aKeywordMessageReceiver and: keywordMessageSegments

| separator result |
self increaseIndentation.
keywordMessageSegments numberOfChildren < 2
ifTrue: [ separator := String space ]
ifFalse: [ separator := self newline ].
self decreaseIndentation.
result := self
join: { aKeywordMessageReceiver } , keywordMessageSegments children
separatedBy: separator.
^ result
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
actions
LiteralArrayLiteral: aNode with: aTerminal and: literalArrayLiteralElements and: anotherTerminal

^ self literalArrayWith: literalArrayLiteralElements
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
actions
LiteralArrayLiteralInLiteralArray: aNode with: aTerminal and: anotherTerminal and: literalArrayLiteralElements and: yetAnotherTerminal

^ self literalArrayWith: literalArrayLiteralElements
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
actions
MethodDeclaration: aNode with: aMethodHeader and: pragmas and: executableCode

| result resultBody resultHeader |
resultHeader := self value: aMethodHeader.
self increaseIndentation.
resultBody := self
join: { pragmas . executableCode . self lastComment: aNode }
separatedBy: self newline.
result := self
join: { resultHeader . resultBody }
separatedBy: String cr , self newline.
self decreaseIndentation.
^ result
Loading

0 comments on commit 84d4f17

Please sign in to comment.