Evaluation works!
This commit is contained in:
@@ -13,6 +13,11 @@ CarpCharacterNode >> acceptVisitor: anExpressionVisitor [
|
|||||||
^ anExpressionVisitor visitCharacter: self
|
^ anExpressionVisitor visitCharacter: self
|
||||||
]
|
]
|
||||||
|
|
||||||
|
{ #category : #accessing }
|
||||||
|
CarpCharacterNode >> toPharo [
|
||||||
|
^ value source asCharacter
|
||||||
|
]
|
||||||
|
|
||||||
{ #category : #generated }
|
{ #category : #generated }
|
||||||
CarpCharacterNode >> tokenVariables [
|
CarpCharacterNode >> tokenVariables [
|
||||||
|
|
||||||
|
@@ -25,3 +25,8 @@ CarpExpressionNode >> isQuoted [
|
|||||||
CarpExpressionNode >> listDepth [
|
CarpExpressionNode >> listDepth [
|
||||||
^ parent ifNil: [ 0 ] ifNotNil: [ parent listDepth + 1 ]
|
^ parent ifNil: [ 0 ] ifNotNil: [ parent listDepth + 1 ]
|
||||||
]
|
]
|
||||||
|
|
||||||
|
{ #category : #accessing }
|
||||||
|
CarpExpressionNode >> toPharo [
|
||||||
|
^ self subclassResponsibility
|
||||||
|
]
|
||||||
|
@@ -13,6 +13,11 @@ CarpNumberNode >> acceptVisitor: anExpressionVisitor [
|
|||||||
^ anExpressionVisitor visitNumber: self
|
^ anExpressionVisitor visitNumber: self
|
||||||
]
|
]
|
||||||
|
|
||||||
|
{ #category : #accessing }
|
||||||
|
CarpNumberNode >> toPharo [
|
||||||
|
^ value source asInteger
|
||||||
|
]
|
||||||
|
|
||||||
{ #category : #generated }
|
{ #category : #generated }
|
||||||
CarpNumberNode >> tokenVariables [
|
CarpNumberNode >> tokenVariables [
|
||||||
|
|
||||||
|
@@ -34,6 +34,11 @@ CarpPairNode >> nodeVariables [
|
|||||||
^ #( #key #value )
|
^ #( #key #value )
|
||||||
]
|
]
|
||||||
|
|
||||||
|
{ #category : #accessing }
|
||||||
|
CarpPairNode >> toPharo [
|
||||||
|
^ Association key: key toPharo value: value toPharo
|
||||||
|
]
|
||||||
|
|
||||||
{ #category : #generated }
|
{ #category : #generated }
|
||||||
CarpPairNode >> value [
|
CarpPairNode >> value [
|
||||||
|
|
||||||
|
@@ -29,6 +29,11 @@ CarpQuoteNode >> nodeVariables [
|
|||||||
^ #( #value )
|
^ #( #value )
|
||||||
]
|
]
|
||||||
|
|
||||||
|
{ #category : #accessing }
|
||||||
|
CarpQuoteNode >> toPharo [
|
||||||
|
^ {#quote . value toPharo }
|
||||||
|
]
|
||||||
|
|
||||||
{ #category : #generated }
|
{ #category : #generated }
|
||||||
CarpQuoteNode >> value [
|
CarpQuoteNode >> value [
|
||||||
|
|
||||||
|
@@ -38,3 +38,8 @@ CarpStartNode >> initialize [
|
|||||||
super initialize.
|
super initialize.
|
||||||
expressions := OrderedCollection new: 2.
|
expressions := OrderedCollection new: 2.
|
||||||
]
|
]
|
||||||
|
|
||||||
|
{ #category : #accessing }
|
||||||
|
CarpStartNode >> toPharo [
|
||||||
|
^ expressions collect: #toPharo
|
||||||
|
]
|
||||||
|
@@ -13,6 +13,11 @@ CarpStringNode >> acceptVisitor: anExpressionVisitor [
|
|||||||
^ anExpressionVisitor visitString: self
|
^ anExpressionVisitor visitString: self
|
||||||
]
|
]
|
||||||
|
|
||||||
|
{ #category : #accessing }
|
||||||
|
CarpStringNode >> toPharo [
|
||||||
|
^ value source
|
||||||
|
]
|
||||||
|
|
||||||
{ #category : #generated }
|
{ #category : #generated }
|
||||||
CarpStringNode >> tokenVariables [
|
CarpStringNode >> tokenVariables [
|
||||||
|
|
||||||
|
@@ -13,6 +13,11 @@ CarpVariableNode >> acceptVisitor: anExpressionVisitor [
|
|||||||
^ anExpressionVisitor visitVariable: self
|
^ anExpressionVisitor visitVariable: self
|
||||||
]
|
]
|
||||||
|
|
||||||
|
{ #category : #accessing }
|
||||||
|
CarpVariableNode >> toPharo [
|
||||||
|
^ value source asSymbol
|
||||||
|
]
|
||||||
|
|
||||||
{ #category : #generated }
|
{ #category : #generated }
|
||||||
CarpVariableNode >> tokenVariables [
|
CarpVariableNode >> tokenVariables [
|
||||||
|
|
||||||
|
@@ -65,6 +65,11 @@ CarpArrayNode >> rightBracket: aSmaCCToken [
|
|||||||
rightBracket := aSmaCCToken
|
rightBracket := aSmaCCToken
|
||||||
]
|
]
|
||||||
|
|
||||||
|
{ #category : #accessing }
|
||||||
|
CarpArrayNode >> toPharo [
|
||||||
|
^ expressions collect: #toPharo
|
||||||
|
]
|
||||||
|
|
||||||
{ #category : #generated }
|
{ #category : #generated }
|
||||||
CarpArrayNode >> tokenVariables [
|
CarpArrayNode >> tokenVariables [
|
||||||
|
|
||||||
|
@@ -32,6 +32,11 @@ CarpDerefNode >> nodeVariables [
|
|||||||
^ #( #value )
|
^ #( #value )
|
||||||
]
|
]
|
||||||
|
|
||||||
|
{ #category : #accessing }
|
||||||
|
CarpDerefNode >> toPharo [
|
||||||
|
^ {#deref . value toPharo}
|
||||||
|
]
|
||||||
|
|
||||||
{ #category : #generated }
|
{ #category : #generated }
|
||||||
CarpDerefNode >> tokenVariables [
|
CarpDerefNode >> tokenVariables [
|
||||||
|
|
||||||
|
@@ -65,6 +65,11 @@ CarpListNode >> rightParen: aSmaCCToken [
|
|||||||
rightParen := aSmaCCToken
|
rightParen := aSmaCCToken
|
||||||
]
|
]
|
||||||
|
|
||||||
|
{ #category : #accessing }
|
||||||
|
CarpListNode >> toPharo [
|
||||||
|
^ expressions collect: #toPharo
|
||||||
|
]
|
||||||
|
|
||||||
{ #category : #generated }
|
{ #category : #generated }
|
||||||
CarpListNode >> tokenVariables [
|
CarpListNode >> tokenVariables [
|
||||||
|
|
||||||
|
@@ -65,6 +65,11 @@ CarpMapNode >> rightBrace: aSmaCCToken [
|
|||||||
rightBrace := aSmaCCToken
|
rightBrace := aSmaCCToken
|
||||||
]
|
]
|
||||||
|
|
||||||
|
{ #category : #accessing }
|
||||||
|
CarpMapNode >> toPharo [
|
||||||
|
^ (pairs collect: #toPharo) asDictionary
|
||||||
|
]
|
||||||
|
|
||||||
{ #category : #generated }
|
{ #category : #generated }
|
||||||
CarpMapNode >> tokenVariables [
|
CarpMapNode >> tokenVariables [
|
||||||
|
|
||||||
|
@@ -32,6 +32,11 @@ CarpModuleOrTypeNode >> nodeVariables [
|
|||||||
^ #( #value )
|
^ #( #value )
|
||||||
]
|
]
|
||||||
|
|
||||||
|
{ #category : #accessing }
|
||||||
|
CarpModuleOrTypeNode >> toPharo [
|
||||||
|
^ value source asSymbol
|
||||||
|
]
|
||||||
|
|
||||||
{ #category : #generated }
|
{ #category : #generated }
|
||||||
CarpModuleOrTypeNode >> tokenVariables [
|
CarpModuleOrTypeNode >> tokenVariables [
|
||||||
|
|
||||||
|
@@ -6,7 +6,7 @@ Class {
|
|||||||
|
|
||||||
{ #category : #'generated-accessing' }
|
{ #category : #'generated-accessing' }
|
||||||
CarpParser class >> cacheId [
|
CarpParser class >> cacheId [
|
||||||
^'2022-04-17T17:01:25.369965+02:00'
|
^'2022-06-13T14:48:36.40126+02:00'
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #generated }
|
{ #category : #generated }
|
||||||
@@ -16,6 +16,26 @@ CarpParser class >> definitionComment [
|
|||||||
%root Expression;
|
%root Expression;
|
||||||
%prefix Carp;
|
%prefix Carp;
|
||||||
%suffix Node;
|
%suffix Node;
|
||||||
|
|
||||||
|
%hierarchy Expression (
|
||||||
|
Array
|
||||||
|
Deref
|
||||||
|
List
|
||||||
|
Map
|
||||||
|
ModuleOrType
|
||||||
|
Pattern
|
||||||
|
RefCall
|
||||||
|
Ref
|
||||||
|
Unquote
|
||||||
|
Character
|
||||||
|
Number
|
||||||
|
Pair
|
||||||
|
Quote
|
||||||
|
Start
|
||||||
|
String
|
||||||
|
Variable
|
||||||
|
);
|
||||||
|
|
||||||
<escape>
|
<escape>
|
||||||
: \\ (. | u[0-9A-F]{4,4} | o[0-7]{3,3} | newline | return | space | tab | space | backspace | formfeed) # other character types
|
: \\ (. | u[0-9A-F]{4,4} | o[0-7]{3,3} | newline | return | space | tab | space | backspace | formfeed) # other character types
|
||||||
;
|
;
|
||||||
@@ -155,44 +175,44 @@ String
|
|||||||
{ #category : #generated }
|
{ #category : #generated }
|
||||||
CarpParser class >> reduceTable [
|
CarpParser class >> reduceTable [
|
||||||
^#(
|
^#(
|
||||||
#(24 0 #reduceActionForExpressions1: 1289217 false)
|
#(24 0 #reduceActionForExpressions1: 1449985 false)
|
||||||
#(23 1 #reduceActionForStart1: 1258497 false)
|
#(23 1 #reduceActionForStart1: 1419265 false)
|
||||||
#(32 0 #reduceActionForExpressions1: 1803265 false)
|
#(32 0 #reduceActionForExpressions1: 1964033 false)
|
||||||
#(43 1 #reduceActionForString1: 2446337 false)
|
#(43 1 #reduceActionForString1: 2607105 false)
|
||||||
#(40 1 #reduceActionForVariable1: 2233345 false)
|
#(40 1 #reduceActionForVariable1: 2394113 false)
|
||||||
#(41 1 #reduceActionForModuleOrType2: 2273282 false)
|
#(41 1 #reduceActionForModuleOrType2: 2434050 false)
|
||||||
#(36 1 #reduceActionForNumber1: 2013185 false)
|
#(36 1 #reduceActionForNumber1: 2173953 false)
|
||||||
#(35 1 #reduceActionForCharacter1: 1971201 false)
|
#(35 1 #reduceActionForCharacter1: 2131969 false)
|
||||||
#(24 2 #reduceActionForExpressions2: 1289218 false)
|
#(24 2 #reduceActionForExpressions2: 1449986 false)
|
||||||
#(25 1 #liftFirstValue: 1347588 false)
|
#(25 1 #liftFirstValue: 1508356 false)
|
||||||
#(25 1 #liftFirstValue: 1347589 false)
|
#(25 1 #liftFirstValue: 1508357 false)
|
||||||
#(25 1 #liftFirstValue: 1347587 false)
|
#(25 1 #liftFirstValue: 1508355 false)
|
||||||
#(25 1 #liftFirstValue: 1347586 false)
|
#(25 1 #liftFirstValue: 1508354 false)
|
||||||
#(25 1 #liftFirstValue: 1347585 false)
|
#(25 1 #liftFirstValue: 1508353 false)
|
||||||
#(30 1 #liftFirstValue: 1652745 false)
|
#(30 1 #liftFirstValue: 1813513 false)
|
||||||
#(30 1 #liftFirstValue: 1652744 false)
|
#(30 1 #liftFirstValue: 1813512 false)
|
||||||
#(30 1 #liftFirstValue: 1652743 false)
|
#(30 1 #liftFirstValue: 1813511 false)
|
||||||
#(30 1 #liftFirstValue: 1652742 false)
|
#(30 1 #liftFirstValue: 1813510 false)
|
||||||
#(30 1 #liftFirstValue: 1652739 false)
|
#(30 1 #liftFirstValue: 1813507 false)
|
||||||
#(30 1 #liftFirstValue: 1652741 false)
|
#(30 1 #liftFirstValue: 1813509 false)
|
||||||
#(30 1 #liftFirstValue: 1652740 false)
|
#(30 1 #liftFirstValue: 1813508 false)
|
||||||
#(39 1 #liftFirstValue: 2195458 false)
|
#(39 1 #liftFirstValue: 2356226 false)
|
||||||
#(39 1 #liftFirstValue: 2195457 false)
|
#(39 1 #liftFirstValue: 2356225 false)
|
||||||
#(30 1 #liftFirstValue: 1652738 false)
|
#(30 1 #liftFirstValue: 1813506 false)
|
||||||
#(30 1 #liftFirstValue: 1652737 false)
|
#(30 1 #liftFirstValue: 1813505 false)
|
||||||
#(34 2 #reduceActionForPattern1: 1906689 false)
|
#(34 2 #reduceActionForPattern1: 2067457 false)
|
||||||
#(27 2 #reduceActionForUnquote1: 1466369 false)
|
#(27 2 #reduceActionForUnquote1: 1627137 false)
|
||||||
#(27 2 #reduceActionForUnquote1: 1466370 false)
|
#(27 2 #reduceActionForUnquote1: 1627138 false)
|
||||||
#(28 2 #reduceActionForRef1: 1548289 false)
|
#(28 2 #reduceActionForRef1: 1709057 false)
|
||||||
#(29 2 #reduceActionForDeref1: 1598465 false)
|
#(29 2 #reduceActionForDeref1: 1759233 false)
|
||||||
#(26 2 #reduceActionForRefCall1: 1412097 false)
|
#(26 2 #reduceActionForRefCall1: 1572865 false)
|
||||||
#(38 2 #reduceActionForQuote1: 2150401 false)
|
#(38 2 #reduceActionForQuote1: 2311169 false)
|
||||||
#(31 3 #reduceActionForMap1: 1744897 false)
|
#(31 3 #reduceActionForMap1: 1905665 false)
|
||||||
#(32 2 #reduceActionForExpressions2: 1803266 false)
|
#(32 2 #reduceActionForExpressions2: 1964034 false)
|
||||||
#(42 3 #reduceActionForList1: 2364417 false)
|
#(42 3 #reduceActionForList1: 2525185 false)
|
||||||
#(41 3 #reduceActionForModuleOrType1: 2273281 false)
|
#(41 3 #reduceActionForModuleOrType1: 2434049 false)
|
||||||
#(37 3 #reduceActionForArray1: 2059265 false)
|
#(37 3 #reduceActionForArray1: 2220033 false)
|
||||||
#(33 2 #reduceActionForMapPair1: 1846273 false)
|
#(33 2 #reduceActionForMapPair1: 2007041 false)
|
||||||
).
|
).
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@@ -26,6 +26,11 @@ CarpPatternNode >> patternGlyph: aSmaCCToken [
|
|||||||
patternGlyph := aSmaCCToken
|
patternGlyph := aSmaCCToken
|
||||||
]
|
]
|
||||||
|
|
||||||
|
{ #category : #accessing }
|
||||||
|
CarpPatternNode >> toPharo [
|
||||||
|
^ value source
|
||||||
|
]
|
||||||
|
|
||||||
{ #category : #generated }
|
{ #category : #generated }
|
||||||
CarpPatternNode >> tokenVariables [
|
CarpPatternNode >> tokenVariables [
|
||||||
|
|
||||||
|
@@ -32,6 +32,11 @@ CarpRefCallNode >> refGlyph: aSmaCCToken [
|
|||||||
refGlyph := aSmaCCToken
|
refGlyph := aSmaCCToken
|
||||||
]
|
]
|
||||||
|
|
||||||
|
{ #category : #accessing }
|
||||||
|
CarpRefCallNode >> toPharo [
|
||||||
|
^ {#'ref-call' . value toPharo}
|
||||||
|
]
|
||||||
|
|
||||||
{ #category : #generated }
|
{ #category : #generated }
|
||||||
CarpRefCallNode >> tokenVariables [
|
CarpRefCallNode >> tokenVariables [
|
||||||
|
|
||||||
|
@@ -32,6 +32,11 @@ CarpRefNode >> refGlyph: aSmaCCToken [
|
|||||||
refGlyph := aSmaCCToken
|
refGlyph := aSmaCCToken
|
||||||
]
|
]
|
||||||
|
|
||||||
|
{ #category : #accessing }
|
||||||
|
CarpRefNode >> toPharo [
|
||||||
|
^ {#ref . value toPharo}
|
||||||
|
]
|
||||||
|
|
||||||
{ #category : #generated }
|
{ #category : #generated }
|
||||||
CarpRefNode >> tokenVariables [
|
CarpRefNode >> tokenVariables [
|
||||||
|
|
||||||
|
@@ -30,80 +30,72 @@ CarpScanner >> scan1 [
|
|||||||
|
|
||||||
{ #category : #generated }
|
{ #category : #generated }
|
||||||
CarpScanner >> scan2 [
|
CarpScanner >> scan2 [
|
||||||
|
self recordMatch: #(13).
|
||||||
self recordMatch: #( 13 ).
|
|
||||||
self step.
|
self step.
|
||||||
currentCharacter isDigit ifTrue: [ ^ self scan3 ].
|
currentCharacter isDigit ifTrue: [ ^ self scan3 ].
|
||||||
(currentCharacter isLowercase or: [
|
(currentCharacter isLowercase
|
||||||
currentCharacter isUppercase or: [
|
or: [ currentCharacter isUppercase
|
||||||
('!$' includes: currentCharacter) or: [
|
or: [ ('!$' includes: currentCharacter)
|
||||||
(currentCharacter between: $* and: $+) or: [
|
or: [ (currentCharacter between: $* and: $+)
|
||||||
('-/:' includes: currentCharacter) or: [
|
or: [ currentCharacter == $-
|
||||||
(currentCharacter between: $< and: $?) or: [
|
or: [ (currentCharacter between: $/ and: $:)
|
||||||
currentCharacter == $_ ] ] ] ] ] ]) ifTrue: [
|
or: [ (currentCharacter between: $< and: $?) or: [ currentCharacter == $_ ] ] ] ] ] ] ])
|
||||||
[
|
ifTrue: [ [ self recordMatch: #(13).
|
||||||
self recordMatch: #( 13 ).
|
self step.
|
||||||
self step.
|
currentCharacter isLowercase
|
||||||
currentCharacter isLowercase or: [
|
or: [ currentCharacter isUppercase
|
||||||
currentCharacter isUppercase or: [
|
or: [ currentCharacter isDigit
|
||||||
currentCharacter isDigit or: [
|
or: [ ('!$' includes: currentCharacter)
|
||||||
('!$' includes: currentCharacter) or: [
|
or: [ (currentCharacter between: $* and: $+)
|
||||||
(currentCharacter between: $* and: $+) or: [
|
or: [ ('-/:' includes: currentCharacter)
|
||||||
('-/:' includes: currentCharacter) or: [
|
or: [ (currentCharacter between: $< and: $?) or: [ currentCharacter == $_ ] ] ] ] ] ] ] ]
|
||||||
(currentCharacter between: $< and: $?) or: [
|
whileTrue ].
|
||||||
currentCharacter == $_ ] ] ] ] ] ] ] ] whileTrue ].
|
|
||||||
^ self reportLastMatch
|
^ self reportLastMatch
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #generated }
|
{ #category : #generated }
|
||||||
CarpScanner >> scan3 [
|
CarpScanner >> scan3 [
|
||||||
|
[ self recordMatch: #(13 18).
|
||||||
[
|
|
||||||
self recordMatch: #( 13 18 ).
|
|
||||||
self step.
|
self step.
|
||||||
currentCharacter == $. ifTrue: [ ^ self scan4 ].
|
currentCharacter == $. ifTrue: [ ^ self scan4 ].
|
||||||
currentCharacter isDigit ] whileTrue.
|
currentCharacter isDigit ] whileTrue.
|
||||||
('bfl' includes: currentCharacter) ifTrue: [
|
('bfl' includes: currentCharacter)
|
||||||
self recordMatch: #( 13 18 ).
|
ifTrue: [ self recordMatch: #(13 18).
|
||||||
self step.
|
|
||||||
(currentCharacter isLowercase or: [
|
|
||||||
currentCharacter isUppercase or: [
|
|
||||||
currentCharacter isDigit or: [
|
|
||||||
('!$' includes: currentCharacter) or: [
|
|
||||||
(currentCharacter between: $* and: $+) or: [
|
|
||||||
('-/:' includes: currentCharacter) or: [
|
|
||||||
(currentCharacter between: $< and: $?) or: [
|
|
||||||
currentCharacter == $_ ] ] ] ] ] ] ]) ifTrue: [
|
|
||||||
[
|
|
||||||
self recordMatch: #( 13 ).
|
|
||||||
self step.
|
self step.
|
||||||
currentCharacter isLowercase or: [
|
(currentCharacter isLowercase
|
||||||
currentCharacter isUppercase or: [
|
or: [ currentCharacter isUppercase
|
||||||
currentCharacter isDigit or: [
|
or: [ currentCharacter isDigit
|
||||||
('!$' includes: currentCharacter) or: [
|
or: [ ('!$' includes: currentCharacter)
|
||||||
(currentCharacter between: $* and: $+) or: [
|
or: [ (currentCharacter between: $* and: $+)
|
||||||
('-/:' includes: currentCharacter) or: [
|
or: [ ('-/:' includes: currentCharacter)
|
||||||
(currentCharacter between: $< and: $?) or: [
|
or: [ (currentCharacter between: $< and: $?) or: [ currentCharacter == $_ ] ] ] ] ] ] ])
|
||||||
currentCharacter == $_ ] ] ] ] ] ] ] ] whileTrue ].
|
ifTrue: [ [ self recordMatch: #(13).
|
||||||
^ self reportLastMatch ].
|
self step.
|
||||||
(currentCharacter isUppercase or: [
|
currentCharacter isLowercase
|
||||||
currentCharacter isLowercase or: [
|
or: [ currentCharacter isUppercase
|
||||||
('!$' includes: currentCharacter) or: [
|
or: [ currentCharacter isDigit
|
||||||
(currentCharacter between: $* and: $+) or: [
|
or: [ ('!$' includes: currentCharacter)
|
||||||
('-/:' includes: currentCharacter) or: [
|
or: [ (currentCharacter between: $* and: $+)
|
||||||
(currentCharacter between: $< and: $?) or: [
|
or: [ ('-/:' includes: currentCharacter)
|
||||||
currentCharacter == $_ ] ] ] ] ] ]) ifTrue: [
|
or: [ (currentCharacter between: $< and: $?) or: [ currentCharacter == $_ ] ] ] ] ] ] ] ]
|
||||||
[
|
whileTrue ].
|
||||||
self recordMatch: #( 13 ).
|
^ self reportLastMatch ].
|
||||||
self step.
|
(currentCharacter isUppercase
|
||||||
currentCharacter isLowercase or: [
|
or: [ currentCharacter isLowercase
|
||||||
currentCharacter isUppercase or: [
|
or: [ ('!$' includes: currentCharacter)
|
||||||
currentCharacter isDigit or: [
|
or: [ (currentCharacter between: $* and: $+)
|
||||||
('!$' includes: currentCharacter) or: [
|
or: [ (currentCharacter between: $- and: $:)
|
||||||
(currentCharacter between: $* and: $+) or: [
|
or: [ (currentCharacter between: $< and: $?) or: [ currentCharacter == $_ ] ] ] ] ] ])
|
||||||
('-/:' includes: currentCharacter) or: [
|
ifTrue: [ [ self recordMatch: #(13).
|
||||||
(currentCharacter between: $< and: $?) or: [
|
self step.
|
||||||
currentCharacter == $_ ] ] ] ] ] ] ] ] whileTrue ].
|
currentCharacter isLowercase
|
||||||
|
or: [ currentCharacter isUppercase
|
||||||
|
or: [ currentCharacter isDigit
|
||||||
|
or: [ ('!$' includes: currentCharacter)
|
||||||
|
or: [ (currentCharacter between: $* and: $+)
|
||||||
|
or: [ ('-/:' includes: currentCharacter)
|
||||||
|
or: [ (currentCharacter between: $< and: $?) or: [ currentCharacter == $_ ] ] ] ] ] ] ] ]
|
||||||
|
whileTrue ].
|
||||||
^ self reportLastMatch
|
^ self reportLastMatch
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -152,12 +144,9 @@ CarpScanner >> scan7 [
|
|||||||
|
|
||||||
{ #category : #generated }
|
{ #category : #generated }
|
||||||
CarpScanner >> scanForToken [
|
CarpScanner >> scanForToken [
|
||||||
|
|
||||||
self step.
|
self step.
|
||||||
currentCharacter == $" ifTrue: [ ^ self scan1 ].
|
currentCharacter == $" ifTrue: [ ^ self scan1 ].
|
||||||
currentCharacter == $# ifTrue: [ ^ self recordAndReportMatch: #( 1 ) ].
|
currentCharacter == $# ifTrue: [ ^ self recordAndReportMatch: #(1) ].
|
||||||
currentCharacter == $% ifTrue: [ ^ self scanForTokenX7 ].
|
|
||||||
currentCharacter == $& ifTrue: [ ^ self recordAndReportMatch: #( 4 ) ].
|
|
||||||
^ self scanForTokenX9
|
^ self scanForTokenX9
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -330,47 +319,36 @@ CarpScanner >> scanForTokenX7 [
|
|||||||
|
|
||||||
{ #category : #generated }
|
{ #category : #generated }
|
||||||
CarpScanner >> scanForTokenX8 [
|
CarpScanner >> scanForTokenX8 [
|
||||||
|
currentCharacter == $] ifTrue: [ ^ self recordAndReportMatch: #(17) ].
|
||||||
currentCharacter == $} ifTrue: [ ^ self recordAndReportMatch: #( 7 ) ].
|
currentCharacter == ${ ifTrue: [ ^ self recordAndReportMatch: #(6) ].
|
||||||
currentCharacter == $~ ifTrue: [ ^ self recordAndReportMatch: #( 8 ) ].
|
currentCharacter == $} ifTrue: [ ^ self recordAndReportMatch: #(7) ].
|
||||||
|
currentCharacter == $~ ifTrue: [ ^ self recordAndReportMatch: #(8) ].
|
||||||
currentCharacter isDigit ifTrue: [ ^ self scan5 ].
|
currentCharacter isDigit ifTrue: [ ^ self scan5 ].
|
||||||
('''`' includes: currentCharacter) ifTrue: [
|
('''`' includes: currentCharacter)
|
||||||
^ self recordAndReportMatch: #( 12 ) ].
|
ifTrue: [ ^ self recordAndReportMatch: #(12) ].
|
||||||
(currentCharacter isSeparator or: [
|
(currentCharacter isSeparator or: [ currentCharacter == Character pageUp ])
|
||||||
currentCharacter == Character pageUp ]) ifTrue: [
|
ifTrue: [ ^ self scanForTokenX6 ].
|
||||||
^ self scanForTokenX6 ].
|
|
||||||
currentCharacter isUppercase ifTrue: [ ^ self scanForTokenX3 ].
|
currentCharacter isUppercase ifTrue: [ ^ self scanForTokenX3 ].
|
||||||
(currentCharacter isLowercase or: [
|
(currentCharacter isLowercase
|
||||||
('!$' includes: currentCharacter) or: [
|
or: [ (currentCharacter between: $! and: $?) or: [ currentCharacter == $_ ] ])
|
||||||
(currentCharacter between: $* and: $+) or: [
|
ifTrue: [ self scanForTokenX4 ].
|
||||||
('/:' includes: currentCharacter) or: [
|
|
||||||
(currentCharacter between: $< and: $?) or: [
|
|
||||||
currentCharacter == $_ ] ] ] ] ]) ifTrue: [
|
|
||||||
self scanForTokenX4 ].
|
|
||||||
^ self reportLastMatch
|
^ self reportLastMatch
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #generated }
|
{ #category : #generated }
|
||||||
CarpScanner >> scanForTokenX9 [
|
CarpScanner >> scanForTokenX9 [
|
||||||
|
currentCharacter == $% ifTrue: [ ^ self scanForTokenX7 ].
|
||||||
currentCharacter == $( ifTrue: [
|
currentCharacter == $& ifTrue: [ ^ self recordAndReportMatch: #(4) ].
|
||||||
^ self recordAndReportMatch: #( 10 ) ].
|
currentCharacter == $( ifTrue: [ ^ self recordAndReportMatch: #(10) ].
|
||||||
currentCharacter == $) ifTrue: [
|
currentCharacter == $) ifTrue: [ ^ self recordAndReportMatch: #(11) ].
|
||||||
^ self recordAndReportMatch: #( 11 ) ].
|
currentCharacter == $, ifTrue: [ ^ self recordAndReportMatch: #(19) ].
|
||||||
currentCharacter == $, ifTrue: [
|
|
||||||
^ self recordAndReportMatch: #( 19 ) ].
|
|
||||||
currentCharacter == $- ifTrue: [ ^ self scan2 ].
|
currentCharacter == $- ifTrue: [ ^ self scan2 ].
|
||||||
currentCharacter == $. ifTrue: [
|
currentCharacter == $. ifTrue: [ ^ self recordAndReportMatch: #(15) ].
|
||||||
^ self recordAndReportMatch: #( 15 ) ].
|
|
||||||
currentCharacter == $0 ifTrue: [ ^ self scanForTokenX2 ].
|
currentCharacter == $0 ifTrue: [ ^ self scanForTokenX2 ].
|
||||||
currentCharacter == $; ifTrue: [ ^ self scanForTokenX5 ].
|
currentCharacter == $; ifTrue: [ ^ self scanForTokenX5 ].
|
||||||
currentCharacter == $@ ifTrue: [ ^ self recordAndReportMatch: #( 5 ) ].
|
currentCharacter == $@ ifTrue: [ ^ self recordAndReportMatch: #(5) ].
|
||||||
currentCharacter == $[ ifTrue: [
|
currentCharacter == $[ ifTrue: [ ^ self recordAndReportMatch: #(16) ].
|
||||||
^ self recordAndReportMatch: #( 16 ) ].
|
|
||||||
currentCharacter == $\ ifTrue: [ ^ self scanForTokenX1 ].
|
currentCharacter == $\ ifTrue: [ ^ self scanForTokenX1 ].
|
||||||
currentCharacter == $] ifTrue: [
|
|
||||||
^ self recordAndReportMatch: #( 17 ) ].
|
|
||||||
currentCharacter == ${ ifTrue: [ ^ self recordAndReportMatch: #( 6 ) ].
|
|
||||||
^ self scanForTokenX8
|
^ self scanForTokenX8
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@@ -25,6 +25,11 @@ CarpUnquoteNode >> nodeVariables [
|
|||||||
^ #( #value )
|
^ #( #value )
|
||||||
]
|
]
|
||||||
|
|
||||||
|
{ #category : #accessing }
|
||||||
|
CarpUnquoteNode >> toPharo [
|
||||||
|
^ {#unquote . value toPharo}
|
||||||
|
]
|
||||||
|
|
||||||
{ #category : #generated }
|
{ #category : #generated }
|
||||||
CarpUnquoteNode >> tokenVariables [
|
CarpUnquoteNode >> tokenVariables [
|
||||||
|
|
||||||
|
@@ -22,7 +22,7 @@ CarpApplication >> baseApplication [
|
|||||||
CarpApplication >> debuggerClientFor: anException [
|
CarpApplication >> debuggerClientFor: anException [
|
||||||
"Answer the debugger client to be used by the Gt Post Mortem debugger"
|
"Answer the debugger client to be used by the Gt Post Mortem debugger"
|
||||||
|
|
||||||
^ GtPythonPostMortemDebugger new exception: anException
|
^ CarpPostMortemDebugger new exception: anException
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
|
10
src/Carp/CarpCommand.class.st
Normal file
10
src/Carp/CarpCommand.class.st
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
Class {
|
||||||
|
#name : #CarpCommand,
|
||||||
|
#superclass : #LanguageLinkCommand,
|
||||||
|
#category : #'Carp-LanguageLink'
|
||||||
|
}
|
||||||
|
|
||||||
|
{ #category : #accessing }
|
||||||
|
CarpCommand >> codeForRemote [
|
||||||
|
^ (Character space join: self instructions) copyReplaceAll: Character cr asString with: Character lf asString
|
||||||
|
]
|
@@ -3,3 +3,13 @@ Class {
|
|||||||
#superclass : #LanguageLinkCommandFactory,
|
#superclass : #LanguageLinkCommandFactory,
|
||||||
#category : #'Carp-Execution'
|
#category : #'Carp-Execution'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{ #category : #accessing }
|
||||||
|
CarpCommandFactory >> command [
|
||||||
|
^ command
|
||||||
|
]
|
||||||
|
|
||||||
|
{ #category : #accessing }
|
||||||
|
CarpCommandFactory >> instructionsWithNotifyAtEnd [
|
||||||
|
^ instructions
|
||||||
|
]
|
||||||
|
@@ -4,19 +4,19 @@ Class {
|
|||||||
#category : #'Carp-Serialization'
|
#category : #'Carp-Serialization'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{ #category : #'instance creation' }
|
||||||
|
CarpDeserializer class >> deserialize: anObject [
|
||||||
|
^ self new
|
||||||
|
deserialize: anObject
|
||||||
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
CarpDeserializer >> buildProxyFor: rawObject [
|
CarpDeserializer >> buildProxyFor: rawObject [
|
||||||
| proxy |
|
| proxy |
|
||||||
proxy := CarpProxyObject
|
proxy := CarpProxyObject
|
||||||
carpType: (rawObject at: #carptype)
|
carpType: (rawObject at: #carptype)
|
||||||
var: (rawObject at: #carpvar) asJSGI
|
var: (rawObject at: #carpvar)
|
||||||
application: self application.
|
application: self application.
|
||||||
self executionHandler registerObject: proxy.
|
self executionHandler registerObject: proxy.
|
||||||
^ proxy
|
^ proxy
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
|
||||||
CarpDeserializer >> deserialize: anObject [
|
|
||||||
^ self new
|
|
||||||
deserialize: anObject
|
|
||||||
]
|
|
||||||
|
@@ -23,7 +23,7 @@ CarpPostMortemDebugger >> exception: anException [
|
|||||||
CarpPostMortemDebugger >> initialize [
|
CarpPostMortemDebugger >> initialize [
|
||||||
|
|
||||||
super initialize.
|
super initialize.
|
||||||
frameRegex := '\s+at.+\(([^:]+)\:(\d+)\:(\d+)\)' asRegexIgnoringCase.
|
frameRegex := '(.*)\s+at.+([^:]+)\:(\d+)\:(\d+)\.' asRegexIgnoringCase.
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
@@ -37,16 +37,19 @@ CarpPostMortemDebugger >> sourceStyler [
|
|||||||
CarpPostMortemDebugger >> stackFrameFromLine: aString ordinal: ordinal [
|
CarpPostMortemDebugger >> stackFrameFromLine: aString ordinal: ordinal [
|
||||||
"Answer a frame if the supplied string contains a valid file and line number, or nil"
|
"Answer a frame if the supplied string contains a valid file and line number, or nil"
|
||||||
<return: #GtPythonPostMortemStackFrame or: nil>
|
<return: #GtPythonPostMortemStackFrame or: nil>
|
||||||
| file line column |
|
| file line column source |
|
||||||
|
|
||||||
^ (frameRegex search: aString) ifTrue:
|
^ (frameRegex search: aString) ifTrue:
|
||||||
[ file := frameRegex subexpression: 2.
|
[ file := frameRegex subexpression: 2.
|
||||||
line := frameRegex subexpression: 3.
|
file := frameRegex subexpression: 3.
|
||||||
column := frameRegex subexpression: 4.
|
line := frameRegex subexpression: 4.
|
||||||
|
column := frameRegex subexpression: 5.
|
||||||
|
self halt.
|
||||||
CarpPostMortemStackFrame new
|
CarpPostMortemStackFrame new
|
||||||
ordinal: ordinal;
|
ordinal: ordinal;
|
||||||
displayString: aString;
|
displayString: aString;
|
||||||
exception: exception;
|
exception: exception;
|
||||||
|
source: source;
|
||||||
file: file asFileReference;
|
file: file asFileReference;
|
||||||
line: line asNumber;
|
line: line asNumber;
|
||||||
column: column asNumber ]
|
column: column asNumber ]
|
||||||
|
@@ -1,5 +1,18 @@
|
|||||||
Class {
|
Class {
|
||||||
#name : #CarpPostMortemStackFrame,
|
#name : #CarpPostMortemStackFrame,
|
||||||
#superclass : #GtJavaScriptPostMortemStackFrame,
|
#superclass : #GtJavaScriptPostMortemStackFrame,
|
||||||
|
#instVars : [
|
||||||
|
'source'
|
||||||
|
],
|
||||||
#category : #'Carp-Debugger'
|
#category : #'Carp-Debugger'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{ #category : #accessing }
|
||||||
|
CarpPostMortemStackFrame >> source: aString [
|
||||||
|
source := aString
|
||||||
|
]
|
||||||
|
|
||||||
|
{ #category : #accessing }
|
||||||
|
CarpPostMortemStackFrame >> sourceText [
|
||||||
|
^ source
|
||||||
|
]
|
||||||
|
@@ -3,7 +3,8 @@ Class {
|
|||||||
#superclass : #GtSourceCoder,
|
#superclass : #GtSourceCoder,
|
||||||
#instVars : [
|
#instVars : [
|
||||||
'pharoBindings',
|
'pharoBindings',
|
||||||
'carpLinkApplicationStrategy'
|
'carpLinkApplicationStrategy',
|
||||||
|
'exception'
|
||||||
],
|
],
|
||||||
#category : #'Carp-Coder'
|
#category : #'Carp-Coder'
|
||||||
}
|
}
|
||||||
@@ -24,35 +25,37 @@ GtCarpCoderModel >> asCoderViewModel [
|
|||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
GtCarpCoderModel >> bindAndExecute: sourceString [
|
GtCarpCoderModel >> bindAndExecute: sourceString [
|
||||||
"Answer the source code with all declared variables returned in an immediate dictionary"
|
"Answer the source code with all declared variables returned in an immediate dictionary"
|
||||||
|
|
||||||
<gtIgnoreConstraint: #GtRBAcceptVisitorCalledFromNonVisitingMethods>
|
<gtIgnoreConstraint: #GtRBAcceptVisitorCalledFromNonVisitingMethods>
|
||||||
| carpSource trimmedSource ast varNames lastStatement application commandFactory |
|
<remoteDebuggerSignal>
|
||||||
|
| carpSource trimmedSource ast varNames lastStatement application commandFactory res |
|
||||||
trimmedSource := SmaCCString on: sourceString trimRight.
|
trimmedSource := SmaCCString on: sourceString trimRight.
|
||||||
ast := CarpParser parse: trimmedSource.
|
ast := CarpParser parse: trimmedSource. "The variables to be returned are names that are in pharoBindings"
|
||||||
"The variables to be returned are names that are in pharoBindings"
|
varNames := pharoBindings bindingNames asSet. "Assign the final statement to snippetResult"
|
||||||
varNames := pharoBindings bindingNames asSet.
|
|
||||||
|
|
||||||
"Assign the final statement to snippetResult"
|
|
||||||
lastStatement := ast expressions last.
|
lastStatement := ast expressions last.
|
||||||
trimmedSource
|
trimmedSource
|
||||||
insert: '(defdynamic snippetResult '
|
insert: '(defdynamic snippetResult '
|
||||||
at: lastStatement startPosition.
|
at: lastStatement startPosition.
|
||||||
trimmedSource
|
trimmedSource insert: ')' at: lastStatement stopPosition.
|
||||||
insert: ')'
|
varNames add: 'snippetResult'. "Get the final source to execute"
|
||||||
at: lastStatement stopPosition.
|
carpSource := self
|
||||||
varNames add: 'snippetResult'.
|
sourceFrom: trimmedSource asString
|
||||||
|
returnedVarNames: varNames.
|
||||||
"Get the final source to execute"
|
|
||||||
carpSource := self sourceFrom: trimmedSource asString returnedVarNames: varNames.
|
|
||||||
|
|
||||||
application := carpLinkApplicationStrategy applicationServer.
|
application := carpLinkApplicationStrategy applicationServer.
|
||||||
application isRunning ifFalse: [ application start ].
|
application isRunning ifFalse: [ application start ].
|
||||||
commandFactory := application newCommandFactory.
|
commandFactory := application newCommandFactory.
|
||||||
|
|
||||||
^ commandFactory
|
res := commandFactory
|
||||||
<< carpSource;
|
<< carpSource;
|
||||||
sendAndWait.
|
sendAndWait.
|
||||||
|
|
||||||
|
(res at: #result) = 'success' ifTrue: [ ^ res at: #value ].
|
||||||
|
exception := (PharoLinkRemoteError new
|
||||||
|
application: application;
|
||||||
|
command: commandFactory command;
|
||||||
|
trace: (res at: #value)).
|
||||||
|
exception signal
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
@@ -66,6 +69,11 @@ GtCarpCoderModel >> computeAst: theSourceString [
|
|||||||
parseWithErrors: theSourceString
|
parseWithErrors: theSourceString
|
||||||
]
|
]
|
||||||
|
|
||||||
|
{ #category : #accessing }
|
||||||
|
GtCarpCoderModel >> exception [
|
||||||
|
^ exception
|
||||||
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
GtCarpCoderModel >> initializeAddOns: addOns [
|
GtCarpCoderModel >> initializeAddOns: addOns [
|
||||||
super initializeAddOns: addOns.
|
super initializeAddOns: addOns.
|
||||||
@@ -113,36 +121,17 @@ GtCarpCoderModel >> pharoBindings: anObject [
|
|||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
GtCarpCoderModel >> primitiveEvaluate: aSourceString inContext: aGtSourceCoderEvaluationContext onFailDo: anEvaluationFailBlock [
|
GtCarpCoderModel >> primitiveEvaluate: aSourceString inContext: aGtSourceCoderEvaluationContext onFailDo: anEvaluationFailBlock [
|
||||||
| result |
|
^ (CarpParser parse: (self bindAndExecute: aSourceString)) expressions first toPharo
|
||||||
|
|
||||||
result := self bindAndExecute: aSourceString.
|
|
||||||
result associationsDo: [ :binding |
|
|
||||||
(pharoBindings bindingOf: binding key asSymbol) value: binding value ].
|
|
||||||
|
|
||||||
^ result
|
|
||||||
at: 'snippetResult'
|
|
||||||
ifAbsent: anEvaluationFailBlock
|
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
GtCarpCoderModel >> sourceFrom: trimmedSourceString returnedVarNames: varNames [
|
GtCarpCoderModel >> sourceFrom: trimmedSourceString returnedVarNames: varNames [
|
||||||
"Answer the modified source to return the declared variables"
|
"Answer the modified source to return the declared variables"
|
||||||
|
|
||||||
^ String streamContents: [ :stream |
|
^ String
|
||||||
stream << trimmedSourceString.
|
streamContents: [ :stream |
|
||||||
stream
|
stream << trimmedSourceString.
|
||||||
cr
|
stream lf << 'snippetResult' ]
|
||||||
<< '{ '.
|
|
||||||
varNames do: [ :varName |
|
|
||||||
stream
|
|
||||||
<< '(quote ';
|
|
||||||
<< varName;
|
|
||||||
<< ') ';
|
|
||||||
<< varName;
|
|
||||||
<< ' ' ].
|
|
||||||
"Answer the variable dictionary as an immediate object"
|
|
||||||
stream
|
|
||||||
<< '(quote carpLinkImmediate) true }' ]
|
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
|
@@ -12,7 +12,7 @@ LanguageLinkSettings class >> carpDefaultSettings [
|
|||||||
serverProcessClass: CarpPythonProcess;
|
serverProcessClass: CarpPythonProcess;
|
||||||
platform: CarpPlatform new;
|
platform: CarpPlatform new;
|
||||||
commandFactoryClass: CarpCommandFactory;
|
commandFactoryClass: CarpCommandFactory;
|
||||||
commandClass: LanguageLinkCommand;
|
commandClass: CarpCommand;
|
||||||
serializerClass: LanguageLinkSerializer;
|
serializerClass: LanguageLinkSerializer;
|
||||||
deserializerClass: CarpDeserializer;
|
deserializerClass: CarpDeserializer;
|
||||||
parserClass: CarpParser;
|
parserClass: CarpParser;
|
||||||
|
@@ -41,15 +41,16 @@ LeCarpApplicationStrategy >> newCarpApplicationFor: aLeDatabase [
|
|||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
LeCarpApplicationStrategy >> updatedSettings: applicationCarpSettings [
|
LeCarpApplicationStrategy >> updatedSettings: applicationCarpSettings [
|
||||||
"Update the supplied settings with the lepiter configuration"
|
"Update the supplied settings with the lepiter configuration"
|
||||||
| lepiterCarpSettings lepiterDatabase carpDir |
|
|
||||||
|
|
||||||
|
| lepiterCarpSettings lepiterDatabase carpDir |
|
||||||
lepiterDatabase := content database.
|
lepiterDatabase := content database.
|
||||||
|
(lepiterDatabase isKindOf: LeNullDatabase)
|
||||||
|
ifTrue: [ ^ applicationCarpSettings ].
|
||||||
lepiterCarpSettings := lepiterDatabase properties carpLinkSettings.
|
lepiterCarpSettings := lepiterDatabase properties carpLinkSettings.
|
||||||
lepiterCarpSettings directory ifNotNil:
|
lepiterCarpSettings directory
|
||||||
[ :relativeDir |
|
ifNotNil: [ :relativeDir |
|
||||||
carpDir := lepiterDatabase localStoreRootDirectory resolve: relativeDir.
|
carpDir := lepiterDatabase localStoreRootDirectory resolve: relativeDir.
|
||||||
applicationCarpSettings workingDirectory: carpDir ].
|
applicationCarpSettings workingDirectory: carpDir ]. "lepiterCarpSettings carpPath ifNotNil:
|
||||||
"lepiterCarpSettings carpPath ifNotNil:
|
|
||||||
[ :carpPath | applicationCarpSettings serverExecutable: carpPath ]."
|
[ :carpPath | applicationCarpSettings serverExecutable: carpPath ]."
|
||||||
applicationCarpSettings serverDebugMode: lepiterCarpSettings serverDebugMode.
|
applicationCarpSettings serverDebugMode: lepiterCarpSettings serverDebugMode.
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user