-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
22 changed files
with
10,594 additions
and
249 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
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,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] | ||
] |
Oops, something went wrong.