-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
A first implementation of preserving underscores when trying to find …
…a method in an attribute to apply to a node.
- Loading branch information
1 parent
3bf594e
commit 425ea3e
Showing
16 changed files
with
89 additions
and
9 deletions.
There are no files selected for viewing
17 changes: 17 additions & 0 deletions
17
...GenerationTest.class/instance/testAttributesCanPreserveTheUnderscoreInlineMessageNames.st
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,17 @@ | ||
tests | ||
testAttributesCanPreserveTheUnderscoreInlineMessageNames | ||
|
||
| g cst collector result | | ||
g := OhmGrammar new: 'G { | ||
Start = RuleOne Rule | ||
RuleOne = "hello" | ||
Rule = | ||
"world" -- one | ||
| "and others" -- two }'. | ||
|
||
collector := g synthesizedAttribute: OhmAttributeGenerationTestUnderscoreAttribute new. | ||
|
||
cst := g match: 'hello world' startingFrom: 'Start'. | ||
result := collector value: cst. | ||
|
||
self assert: (result includes: #Rule_one). |
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
Empty file.
4 changes: 4 additions & 0 deletions
4
...m-Core.package/OhmAttributeGenerationTestUnderscoreAttribute.class/instance/Rule.with..st
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,4 @@ | ||
rules | ||
Rule: aNode with: opt | ||
|
||
^ self value: opt |
4 changes: 4 additions & 0 deletions
4
...ore.package/OhmAttributeGenerationTestUnderscoreAttribute.class/instance/RuleOne.with..st
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,4 @@ | ||
rules | ||
RuleOne: aNode with: worldString | ||
|
||
^ {#RuleOne} |
4 changes: 4 additions & 0 deletions
4
...re.package/OhmAttributeGenerationTestUnderscoreAttribute.class/instance/Rule_one.with..st
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,4 @@ | ||
rules | ||
Rule_one: aNode with: string | ||
|
||
^ {#Rule_one} |
4 changes: 4 additions & 0 deletions
4
...re.package/OhmAttributeGenerationTestUnderscoreAttribute.class/instance/Rule_two.with..st
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,4 @@ | ||
rules | ||
Rule_two: aNode with: string | ||
|
||
^ {#Rule_two} |
4 changes: 4 additions & 0 deletions
4
....package/OhmAttributeGenerationTestUnderscoreAttribute.class/instance/Start.with.with..st
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,4 @@ | ||
rules | ||
Start: aNode with: a with: b | ||
|
||
^ (self value: a) , (self value: b) |
4 changes: 4 additions & 0 deletions
4
...AttributeGenerationTestUnderscoreAttribute.class/instance/wantsOriginalInlineRuleNames.st
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,4 @@ | ||
as yet unclassified | ||
wantsOriginalInlineRuleNames | ||
|
||
^ true |
10 changes: 10 additions & 0 deletions
10
...hm-Core.package/OhmAttributeGenerationTestUnderscoreAttribute.class/methodProperties.json
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,10 @@ | ||
{ | ||
"class" : { | ||
}, | ||
"instance" : { | ||
"Rule:with:" : "pre 5/4/2021 17:35", | ||
"RuleOne:with:" : "pre 5/4/2021 17:35", | ||
"Rule_one:with:" : "pre 5/4/2021 17:35", | ||
"Rule_two:with:" : "pre 5/4/2021 17:35", | ||
"Start:with:with:" : "pre 5/4/2021 17:34", | ||
"wantsOriginalInlineRuleNames" : "pre 5/4/2021 17:40" } } |
14 changes: 14 additions & 0 deletions
14
...ages/Ohm-Core.package/OhmAttributeGenerationTestUnderscoreAttribute.class/properties.json
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,14 @@ | ||
{ | ||
"category" : "Ohm-Core-Tests", | ||
"classinstvars" : [ | ||
], | ||
"classvars" : [ | ||
], | ||
"commentStamp" : "", | ||
"instvars" : [ | ||
], | ||
"name" : "OhmAttributeGenerationTestUnderscoreAttribute", | ||
"pools" : [ | ||
], | ||
"super" : "OhmSemanticAction", | ||
"type" : "normal" } |
4 changes: 4 additions & 0 deletions
4
packages/Ohm-Core.package/OhmAttributes.class/class/originalRuleNameAsMessageName..st
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,4 @@ | ||
converting | ||
originalRuleNameAsMessageName: ruleName | ||
|
||
^ (ruleName , ':') asSymbol |
8 changes: 3 additions & 5 deletions
8
packages/Ohm-Core.package/OhmAttributes.class/class/ruleNameToMessageName..st
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 |
---|---|---|
@@ -1,13 +1,11 @@ | ||
converting | ||
ruleNameToMessageName: ruleName | ||
|
||
| name nameParts | | ||
nameParts := (ruleName subStrings: '_') asOrderedCollection. | ||
nameParts ifEmpty: [ ^ 'anything:' asSymbol ]. | ||
|
||
name := nameParts removeFirst. | ||
nameParts | ||
ifNotEmpty:[ name := name , | ||
(nameParts inject: '' | ||
into: [ :result :new | result , new capitalized ])]. | ||
nameParts ifNotEmpty: [ | ||
name := name , (nameParts inject: '' into: [:result :new | result , new capitalized])]. | ||
^ (name , ':') asSymbol |
7 changes: 5 additions & 2 deletions
7
packages/Ohm-Core.package/OhmAttributes.class/instance/value..st
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
7 changes: 7 additions & 0 deletions
7
packages/Ohm-Core.package/OhmAttributes.class/instance/wantsOriginalInlineRuleNames.st
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,7 @@ | ||
configuration | ||
wantsOriginalInlineRuleNames | ||
|
||
"If set to true, the attribute will use the original rule name as the prefix | ||
to find the correct method to apply. This will preserve the underscore | ||
used in inline rules." | ||
^ false |
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