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'
with: [ spec repository: 'github://feenkcom/gt4smacc:main/src' ].
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
]
{ #category : #accessing }
CarpExpressionNode >> isDefinitionPredicate [
^ false
]
{ #category : #accessing }
CarpExpressionNode >> isQuoted [
^ parent ifNil: [ false ] ifNotNil: [ parent isQuoted ]

View File

@@ -51,8 +51,18 @@ CarpListNode >> initialize [
{ #category : #accessing }
CarpListNode >> intoModel [
^ CarpList
contents: (expressions collect: #intoModel)
^ self isDefinition
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 }

View File

@@ -7,6 +7,31 @@ Class {
#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 }
CarpBinding >> bindingName [
^ self subclassResponsibility

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -10,14 +10,14 @@ Class {
{ #category : #accessing }
GtCarpNewFunctionCoderModel >> initializeAddOns: addOns [
super initializeAddOns: addOns.
addOns
addStyler: (GtCoderAstSmaCCParserStyler new smaccStyler: CarpParser gtStyler).
addOns
addMainAction: 'Save' translated
icon: BrGlamorousVectorIcons accept
action: [ :aCoderUIModel :anElement |
self save ]
id: GtMethodCoderSaveActionId.
addMainAction: 'Save' translated
icon: BrGlamorousVectorIcons accept
action: [ :aCoderUIModel :anElement | self save ]
id: GtMethodCoderSaveActionId
]
{ #category : #coders }
@@ -32,6 +32,9 @@ GtCarpNewFunctionCoderModel >> onSave: aBlock [
{ #category : #accessing }
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 ]
]

View File

@@ -13,9 +13,6 @@ LeCarpApplicationStrategy class >> strategyName [
{ #category : #accessing }
LeCarpApplicationStrategy >> applicationServer [
content database isDatabase ifFalse: [ ^ nil ].
CarpApplication uniqueInstance ifNil:
[ CarpApplication uniqueInstance: (self newCarpApplicationFor: content database) ].
^ CarpApplication uniqueInstance
]
@@ -27,32 +24,5 @@ LeCarpApplicationStrategy >> applicationSettings [
^ CarpApplication isRunning ifTrue:
[ CarpApplication uniqueInstance settings ]
ifFalse:
[ self updatedSettings: 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
[ CarpApplication defaultSettings ]
]