-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Add missing class extensions - Add CarpDefinitionsElement and add it to module coder [fixes #9] - Add tests stub to carp module
- Loading branch information
Showing
5 changed files
with
271 additions
and
3 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
Class { | ||
#name : #CarpDefinitionsElement, | ||
#superclass : #BrExpander, | ||
#instVars : [ | ||
'module' | ||
], | ||
#category : #'Carp-Coder' | ||
} | ||
|
||
{ #category : #accessing } | ||
CarpDefinitionsElement >> addDefinitionEditorShortcutsTo: aPropertiesElement [ | ||
|
||
aPropertiesElement addShortcut: (BlShortcutWithAction new | ||
combination: BlKeyCombination arrowUp; | ||
action: [ :anEvent | | ||
anEvent currentTarget deepestFocusedChild ifNotNil: [ | ||
:aFocusedChild | | ||
BlFocusFinder new | ||
up; | ||
root: anEvent currentTarget; | ||
referenceElement: aFocusedChild; | ||
nextFocusDo: [ :aNextFocusElement | | ||
aNextFocusElement requestFocus ] ] ]). | ||
|
||
aPropertiesElement addShortcut: (BlShortcutWithAction new | ||
combination: BlKeyCombination arrowDown; | ||
action: [ :anEvent | | ||
anEvent currentTarget deepestFocusedChild ifNotNil: [ | ||
:aFocusedChild | | ||
BlFocusFinder new | ||
down; | ||
root: anEvent currentTarget; | ||
referenceElement: aFocusedChild; | ||
nextFocusDo: [ :aNextFocusElement | | ||
aNextFocusElement requestFocus ] ] ]) | ||
] | ||
|
||
{ #category : #accessing } | ||
CarpDefinitionsElement >> buildDefinitionEditor [ | ||
|
||
| theProperties | | ||
theProperties := BrHorizontalGrid new constraintsDo: [ :c | | ||
c horizontal matchParent. | ||
c vertical fitContent ]. | ||
|
||
self addDefinitionEditorShortcutsTo: theProperties. | ||
|
||
theProperties addChild: | ||
self module asGtMagritteViewModel asElement. | ||
|
||
^ theProperties | ||
] | ||
|
||
{ #category : #accessing } | ||
CarpDefinitionsElement >> buildDefinitionReader [ | ||
|
||
| theProperties theReaders | | ||
theProperties := BrHorizontalGrid new constraintsDo: [ :c | | ||
c horizontal matchParent. | ||
c vertical fitContent ]. | ||
|
||
theProperties addChild: | ||
(self module asGtMagritteViewModelWithDescription: | ||
self module usesDescription beReadOnly) asElement. | ||
|
||
^ theProperties | ||
] | ||
|
||
{ #category : #accessing } | ||
CarpDefinitionsElement >> initialize [ | ||
super initialize. | ||
|
||
self | ||
aptitude: GtCoderExpanderAptitude; | ||
hMatchParent; | ||
vFitContent | ||
] | ||
|
||
{ #category : #accessing } | ||
CarpDefinitionsElement >> module [ | ||
^ module | ||
] | ||
|
||
{ #category : #accessing } | ||
CarpDefinitionsElement >> module: aCarpModule [ | ||
module := aCarpModule. | ||
self updateElements | ||
] | ||
|
||
{ #category : #accessing } | ||
CarpDefinitionsElement >> updateElements [ | ||
|
||
self header: [ | ||
self buildDefinitionReader ]. | ||
self content: [ | ||
self buildDefinitionEditor ] | ||
] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
Extension { #name : #GtSmaCCParserStyler } | ||
|
||
{ #category : #'*Carp' } | ||
GtSmaCCParserStyler class >> carpStyler: aParserClass [ | ||
|
||
<smaccStyler: #CarpParser priority: 50> | ||
^ (self forParser: aParserClass) stylerRules: { | ||
(GtSmaCCKeywordTokensStylerRule styleBlock: [ :styler | | ||
styler | ||
bold; | ||
foreground: Color purple ]). | ||
(GtSmaCCCommentStylerRule styleBlock: [ :styler | | ||
styler foreground: Color lightGray ]). | ||
(GtSmaCCNodeStylerRule | ||
nodeClassName: #CarpNumberNode | ||
styleBlock: [ :styler | styler foreground: Color blue ]). | ||
(GtSmaCCNodeStylerRule | ||
nodeClassName: #CarpStringNode | ||
styleBlock: [ :styler | styler foreground: Color blue ]). | ||
(GtSmaCCNodeStylerRule | ||
nodeClassName: #CarpPatternNode | ||
styleBlock: [ :styler | styler foreground: Color blue ]). | ||
(GtSmaCCNodeStylerRule | ||
nodeClassName: #CarpListNode | ||
styleBlock: [ :styler :node :text | | ||
(node expressions notEmpty and: [ | ||
((node expressions first isKindOf: CarpVariableNode) or: | ||
(node expressions first isKindOf: CarpModuleOrTypeNode)) | ||
and: [ node isQuoted not ] ]) ifTrue: [ | ||
(text | ||
from: node expressions first startPosition | ||
to: node expressions first stopPosition) foreground: | ||
Color purple ]. | ||
CarpStylerUtilities | ||
colorAndHighlightParenthesesLeft: node startPosition | ||
right: node stopPosition | ||
atNestingLevel: node listDepth | ||
inText: text ]). | ||
(GtSmaCCNodeStylerRule | ||
nodeClassName: #CarpMapNode | ||
styleBlock: [ :styler :node :text | | ||
CarpStylerUtilities | ||
colorAndHighlightParenthesesLeft: node startPosition | ||
right: node stopPosition | ||
atNestingLevel: node listDepth | ||
inText: text ]). | ||
(GtSmaCCNodeStylerRule | ||
nodeClassName: #CarpArrayNode | ||
styleBlock: [ :styler :node :text | | ||
CarpStylerUtilities | ||
colorAndHighlightParenthesesLeft: node startPosition | ||
right: node stopPosition | ||
atNestingLevel: node listDepth | ||
inText: text ]). | ||
(GtSmaCCNodeStylerRule | ||
nodeClassName: #CarpVariableNode | ||
styleBlock: [ :styler | styler italic ]). | ||
(GtSmaCCNodeStylerRule | ||
nodeClassName: #CarpModuleOrTypeNode | ||
styleBlock: [ :styler :node :text | | ||
(text | ||
from: node module startPosition | ||
to: node module stopPosition) foreground: Color orange ]). | ||
(GtSmaCCNodeVariableStylerRule | ||
nodeClassName: #SmaCCErrorNode | ||
variableNames: #( dismissedTokens errorToken ) | ||
styleBlock: [ :styler | styler foreground: Color red ]) } | ||
] |
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,9 @@ | ||
Extension { #name : #LeLocalStore } | ||
|
||
{ #category : #'*Carp' } | ||
LeLocalStore >> carpLinkSettings [ | ||
"Answer the initialised LeCarpLinkSettings for this database" | ||
<return: #LeJSLinkSettings> | ||
|
||
^ LeJSLinkSettings new dbProperties: self | ||
] |