-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use full smalltalk parser when parsing refinement expression
This commit uses a full smalltalk parser (based on `PetitSmalltalk`) when parsing refining expression in refinement type (as opposed to simply reading everything up first closing bracket).
- Loading branch information
Showing
3 changed files
with
46 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
Class { | ||
#name : #RefinementExpressionParser, | ||
#superclass : #PPSmalltalkParser, | ||
#instVars : [ | ||
'binaryChar' | ||
], | ||
#category : #'SpriteLang-Parsing' | ||
} | ||
|
||
{ #category : #primitives } | ||
RefinementExpressionParser >> binary [ | ||
^binaryChar plus | ||
] | ||
|
||
{ #category : #primitives } | ||
RefinementExpressionParser >> binaryChar [ | ||
| scanner | | ||
|
||
"Here we delegate decisiton whether or not a character can occur in | ||
binary selector to RBScanner. For example: MathNotation hacks RBScanner | ||
to allow fancy math characters and we do not want to duplicate that code | ||
here." | ||
|
||
scanner := RBScanner on:'' readStream. | ||
^ (PPPredicateObjectParser on: [:c | (scanner classify: c) == #binary ] message:'binary') | ||
] | ||
|
||
{ #category : #accessing } | ||
RefinementExpressionParser >> start [ | ||
^sequence | ||
] |
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