Skip to content

Commit

Permalink
dc: add tla+, utility funcs
Browse files Browse the repository at this point in the history
  • Loading branch information
tom95 committed Nov 30, 2023
1 parent c77efc6 commit 2d6c155
Show file tree
Hide file tree
Showing 22 changed files with 10,594 additions and 249 deletions.
3 changes: 2 additions & 1 deletion .squot
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,6 @@ OrderedDictionary {
'packages/DomainCode-Parser' : #SquotTonelSerializer,
'packages/DomainCode-Core' : #SquotTonelSerializer,
'packages/DomainCode-Diff' : #SquotTonelSerializer,
'packages/DomainCode-Truediff' : #SquotTonelSerializer
'packages/DomainCode-Truediff' : #SquotTonelSerializer,
'packages/Sandblocks-Tlaplus' : #SquotTonelSerializer
}
2 changes: 1 addition & 1 deletion packages/DomainCode-Core/CompiledMethod.extension.st
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Extension { #name : #CompiledMethod }
{ #category : #'*DomainCode-Core' }
CompiledMethod >> openDC: convert [
<convert>
<convertPriority: 11>
<convertPriority: 1>

convert do: [DCSmalltalkMethod for: self]
]
8 changes: 7 additions & 1 deletion packages/DomainCode-Core/Morph.extension.st
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ Morph >> childCount [
{ #category : #'*DomainCode-Core' }
Morph >> children [

^ submorphs
^ Array streamContents: [:s | self childrenDo: [:c | s nextPut: c]]
]

{ #category : #'*DomainCode-Core' }
Expand Down Expand Up @@ -174,6 +174,12 @@ Morph >> setBoundsDirect: aRectangle [
box = priorBounds ifFalse: [self invalidRect: (priorBounds quickMerge: box)]
]

{ #category : #'*DomainCode-Core' }
Morph >> showInQuery [

^ false
]

{ #category : #'*DomainCode-Core' }
Morph >> treeSize [

Expand Down
30 changes: 30 additions & 0 deletions packages/DomainCode-Core/SBTSLanguage.extension.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
Extension { #name : #SBTSLanguage }

{ #category : #'*DomainCode-Core' }
SBTSLanguage class >> grammarRule: aSymbol [

^ self rawGrammar rules at: aSymbol
]

{ #category : #'*DomainCode-Core' }
SBTSLanguage class >> rawGrammar [

^ RawGrammar ifNil: [RawGrammar := Json readFrom: self grammarJson readStream]
]

{ #category : #'*DomainCode-Core' }
SBTSLanguage class >> ruleIsInlined: aSymbol [

^ ((self rawGrammar at: #inline) includes: aSymbol) or: [aSymbol first = $_]
]

{ #category : #'*DomainCode-Core' }
SBTSLanguage class >> supertype: aSymbol includes: anotherSymbol [

^ ((self rawGrammar supertypes includes: aSymbol) or: [self ruleIsInlined: aSymbol])
ifTrue: [ | nestedRule |
nestedRule := self grammarRule: aSymbol.
nestedRule type = 'CHOICE' ifFalse: [nestedRule := nestedRule content].
nestedRule members anySatisfy: [:rule | self supertype: (rule name ifNil: [rule content name]) includes: anotherSymbol]]
ifFalse: [aSymbol = anotherSymbol]
]
Loading

0 comments on commit 2d6c155

Please sign in to comment.