Compare commits

...

4 Commits

Author SHA1 Message Date
235910b863 Be better on startup 2022-06-14 16:28:44 +02:00
33cb150cf0 Be better on startup 2022-06-14 16:25:53 +02:00
66fe79f2bf Fix metacello load order 2022-06-14 16:10:55 +02:00
d75b000ad1 A better IDE 2022-06-14 15:54:07 +02:00
13 changed files with 108 additions and 47 deletions

View File

@@ -13,6 +13,6 @@ BaselineOfCarp >> baseline: spec [
baseline: 'GToolkit4SmaCC' baseline: 'GToolkit4SmaCC'
with: [ spec repository: 'github://feenkcom/gt4smacc:main/src' ]. with: [ spec repository: 'github://feenkcom/gt4smacc:main/src' ].
spec package: 'Carp' with: [ spec requires: #('GToolkit4SmaCC') ]. spec package: 'Carp' with: [ spec requires: #('GToolkit4SmaCC') ].
spec package: 'Carp-Parser' with: [ spec requires: #('GToolkit4SmaCC') ]. spec package: 'Carp-AST' with: [ spec requires: #('GToolkit4SmaCC') ].
spec package: 'Carp-AST' with: [ spec requires: #('GToolkit4SmaCC') ] ] spec package: 'Carp-Parser' with: [ spec requires: #('GToolkit4SmaCC') ] ]
] ]

View File

@@ -21,6 +21,11 @@ CarpExpressionNode >> isDefinition [
^ false ^ false
] ]
{ #category : #accessing }
CarpExpressionNode >> isDefinitionPredicate [
^ false
]
{ #category : #accessing } { #category : #accessing }
CarpExpressionNode >> isQuoted [ CarpExpressionNode >> isQuoted [
^ parent ifNil: [ false ] ifNotNil: [ parent isQuoted ] ^ parent ifNil: [ false ] ifNotNil: [ parent isQuoted ]

View File

@@ -51,8 +51,18 @@ CarpListNode >> initialize [
{ #category : #accessing } { #category : #accessing }
CarpListNode >> intoModel [ CarpListNode >> intoModel [
^ CarpList ^ self isDefinition
contents: (expressions collect: #intoModel) ifTrue: [ | binding |
binding := (CarpBinding perform: self expressions first value source asSymbol)
name: self definitionVariable intoModel.
self expressions size = 3
ifTrue: [ binding binding: self expressions third intoModel ].
self expressions size = 4
ifTrue: [ binding
arguments: self expressions third intoModel;
body: self expressions fourth intoModel ].
binding ]
ifFalse: [ CarpList contents: (expressions collect: #intoModel) ]
] ]
{ #category : #accessing } { #category : #accessing }

View File

@@ -7,6 +7,31 @@ Class {
#category : #'Carp-IDE' #category : #'Carp-IDE'
} }
{ #category : #'instance creation' }
CarpBinding class >> def [
^ CarpStaticVariable new
]
{ #category : #'instance creation' }
CarpBinding class >> defdynamic [
^ CarpDynamicVariable new
]
{ #category : #'instance creation' }
CarpBinding class >> defmacro [
^ CarpMacro new
]
{ #category : #'instance creation' }
CarpBinding class >> defn [
^ CarpStaticFunction new
]
{ #category : #'instance creation' }
CarpBinding class >> defndynamic [
^ CarpDynamicFunction new
]
{ #category : #accessing } { #category : #accessing }
CarpBinding >> bindingName [ CarpBinding >> bindingName [
^ self subclassResponsibility ^ self subclassResponsibility

View File

@@ -14,9 +14,13 @@ CarpExpression >> asElement [
{ #category : #accessing } { #category : #accessing }
CarpExpression >> asElementWithModule: aModule [ CarpExpression >> asElementWithModule: aModule [
^ ((GtCarpIDECoderModel code: self toCarp) | applicationStrategy |
module: aModule; applicationStrategy := LeCarpApplicationStrategy new.
expression: self) asElement ^ (GtExpandableSourceCoderElement new
coderViewModel: ((GtCarpIDECoderModel code: self toCarp)
module: aModule;
carpLinkApplicationStrategy: applicationStrategy;
expression: self) asCoderViewModel) collapse
] ]
{ #category : #accessing } { #category : #accessing }

View File

@@ -84,6 +84,7 @@ CarpModule >> carpCoderStreamingMethodsFor: aView context: aPhlowContext [
ifNotNil: [ :aContents | aNewMethodCoderViewModel := aContents ] ifNotNil: [ :aContents | aNewMethodCoderViewModel := aContents ]
ifNil: [ aNewMethodCoder := GtCarpNewFunctionCoderModel new ifNil: [ aNewMethodCoder := GtCarpNewFunctionCoderModel new
module: self; module: self;
carpLinkApplicationStrategy: LeCarpApplicationStrategy new;
onSave: [ aButton fireEvent: BrDropdownHideWish new. onSave: [ aButton fireEvent: BrDropdownHideWish new.
coderElement initializeForModule ]. coderElement initializeForModule ].

View File

@@ -12,6 +12,17 @@ Class {
#category : #'Carp-Coder' #category : #'Carp-Coder'
} }
{ #category : #accessing }
CarpModuleCoderElement >> build [
| application commandFactory |
application := CarpApplication start.
commandFactory := application newCommandFactory.
^ commandFactory
<< self module toCarp;
sendAndWait
]
{ #category : #accessing } { #category : #accessing }
CarpModuleCoderElement >> buildContentPane [ CarpModuleCoderElement >> buildContentPane [
@@ -91,6 +102,13 @@ CarpModuleCoderElement >> buildModuleLabel [
action: [ :aButton | action: [ :aButton |
aButton phlow spawnObject: self module toCarp ]). aButton phlow spawnObject: self module toCarp ]).
aContainer addChild: (BrButton new
aptitude: BrGlamorousButtonWithIconAptitude;
icon: BrGlamorousVectorIcons refresh;
beSmallSize;
label: 'Build';
action: [ self build ]).
^ aContainer ^ aContainer
] ]
@@ -133,7 +151,8 @@ CarpModuleCoderElement >> coderViewModel: aCarpCoderViewModel [
container ifNotNil: #removeFromParent. container ifNotNil: #removeFromParent.
container := self buildContentPane. container := self buildContentPane.
self addChildFirst: container self addChildFirst: container.
self build
] ]
{ #category : #accessing } { #category : #accessing }

View File

@@ -9,6 +9,12 @@ CarpPythonProcess class >> program [
^ 'python' ^ 'python'
] ]
{ #category : #accessing }
CarpPythonProcess class >> resolveCarpPath [
"TODO: make more robust"
^ '/usr/bin/python' asFileReference
]
{ #category : #accessing } { #category : #accessing }
CarpPythonProcess >> processArguments [ CarpPythonProcess >> processArguments [
| args | | args |

View File

@@ -23,6 +23,11 @@ CarpSequence >> contents: aCollection [
contents := aCollection contents := aCollection
] ]
{ #category : #accessing }
CarpSequence >> do: aBlock [
contents do: aBlock
]
{ #category : #accessing } { #category : #accessing }
CarpSequence >> open [ CarpSequence >> open [
^ self subclassResponsibility ^ self subclassResponsibility

View File

@@ -12,6 +12,11 @@ CarpSymbol class >> named: aString [
^ self new name: aString ^ self new name: aString
] ]
{ #category : #accessing }
CarpSymbol >> name [
^ name
]
{ #category : #accessing } { #category : #accessing }
CarpSymbol >> name: aString [ CarpSymbol >> name: aString [
name := aString name := aString

View File

@@ -7,6 +7,12 @@ Class {
#category : #'Carp-Coder' #category : #'Carp-Coder'
} }
{ #category : #accessing }
GtCarpIDECoderModel >> collapsedTextPromise [
^ self expression name name , ' : '
, (self bindAndExecute: '(type ' , module name, '.', self expression name name , ')') value
]
{ #category : #accessing } { #category : #accessing }
GtCarpIDECoderModel >> expression [ GtCarpIDECoderModel >> expression [
^ expression ^ expression
@@ -30,7 +36,8 @@ GtCarpIDECoderModel >> initializeAddOns: addOns [
{ #category : #accessing } { #category : #accessing }
GtCarpIDECoderModel >> remove [ GtCarpIDECoderModel >> remove [
^ module removeExpression: self expression module removeExpression: self expression.
self bindAndExecute: module toCarp
] ]
{ #category : #accessing } { #category : #accessing }
@@ -38,5 +45,6 @@ GtCarpIDECoderModel >> save [
module removeExpression: expression. module removeExpression: expression.
module module
addExpression: (CarpParser parse: sourceCode availableSource text) intoModel. addExpression: (CarpParser parse: sourceCode availableSource text) intoModel.
self bindAndExecute: module toCarp.
onSave ifNotNil: [ onSave value ] onSave ifNotNil: [ onSave value ]
] ]

View File

@@ -10,14 +10,14 @@ Class {
{ #category : #accessing } { #category : #accessing }
GtCarpNewFunctionCoderModel >> initializeAddOns: addOns [ GtCarpNewFunctionCoderModel >> initializeAddOns: addOns [
super initializeAddOns: addOns. addOns
addStyler: (GtCoderAstSmaCCParserStyler new smaccStyler: CarpParser gtStyler).
addOns addOns
addMainAction: 'Save' translated addMainAction: 'Save' translated
icon: BrGlamorousVectorIcons accept icon: BrGlamorousVectorIcons accept
action: [ :aCoderUIModel :anElement | action: [ :aCoderUIModel :anElement | self save ]
self save ] id: GtMethodCoderSaveActionId
id: GtMethodCoderSaveActionId.
] ]
{ #category : #coders } { #category : #coders }
@@ -32,6 +32,9 @@ GtCarpNewFunctionCoderModel >> onSave: aBlock [
{ #category : #accessing } { #category : #accessing }
GtCarpNewFunctionCoderModel >> save [ GtCarpNewFunctionCoderModel >> save [
module addExpression: (CarpParser parse: sourceCode currentSourceText value text) intoModel. | expression |
expression := (CarpParser parse: sourceCode currentSourceText value text) intoModel.
module addExpression: expression.
self bindAndExecute: module toCarp.
onSave ifNotNil: [ onSave value ] onSave ifNotNil: [ onSave value ]
] ]

View File

@@ -13,9 +13,6 @@ LeCarpApplicationStrategy class >> strategyName [
{ #category : #accessing } { #category : #accessing }
LeCarpApplicationStrategy >> applicationServer [ LeCarpApplicationStrategy >> applicationServer [
content database isDatabase ifFalse: [ ^ nil ].
CarpApplication uniqueInstance ifNil:
[ CarpApplication uniqueInstance: (self newCarpApplicationFor: content database) ].
^ CarpApplication uniqueInstance ^ CarpApplication uniqueInstance
] ]
@@ -27,32 +24,5 @@ LeCarpApplicationStrategy >> applicationSettings [
^ CarpApplication isRunning ifTrue: ^ CarpApplication isRunning ifTrue:
[ CarpApplication uniqueInstance settings ] [ CarpApplication uniqueInstance settings ]
ifFalse: ifFalse:
[ self updatedSettings: CarpApplication defaultSettings ] [ CarpApplication defaultSettings ]
]
{ #category : #accessing }
LeCarpApplicationStrategy >> newCarpApplicationFor: aLeDatabase [
^ CarpApplication new initializeWith:
(self updatedSettings: LanguageLinkSettings carpDefaultSettings).
]
{ #category : #accessing }
LeCarpApplicationStrategy >> updatedSettings: applicationCarpSettings [
"Update the supplied settings with the lepiter configuration"
| lepiterCarpSettings lepiterDatabase carpDir |
lepiterDatabase := content database.
(lepiterDatabase isKindOf: LeNullDatabase)
ifTrue: [ ^ applicationCarpSettings ].
lepiterCarpSettings := lepiterDatabase properties carpLinkSettings.
lepiterCarpSettings directory
ifNotNil: [ :relativeDir |
carpDir := lepiterDatabase localStoreRootDirectory resolve: relativeDir.
applicationCarpSettings workingDirectory: carpDir ]. "lepiterCarpSettings carpPath ifNotNil:
[ :carpPath | applicationCarpSettings serverExecutable: carpPath ]."
applicationCarpSettings serverDebugMode: lepiterCarpSettings serverDebugMode.
^ applicationCarpSettings
] ]