Add Lepiter snippets for Carp

This commit is contained in:
2022-04-16 18:32:16 +02:00
parent 60321973fb
commit f1cac9749e
34 changed files with 597 additions and 61 deletions

View File

@@ -1,27 +0,0 @@
Class {
#name : #CarpApplication,
#superclass : #LanguageLinkApplication,
#instVars : [
'uniqueInstance'
],
#category : #'Carp-LanguageLink'
}
{ #category : #'start-stop' }
CarpApplication class >> start [
^ self startWith: LanguageLinkSettings jsDefaultSettings.
]
{ #category : #accessing }
CarpApplication >> baseApplication [
^ CarpApplication
]
{ #category : #accessing }
CarpApplication >> initializeHandlers [
loggingHandler := LanguageLinkLoggingHandler application: self.
communicationHandler := LanguageLinkCommunicationHandler application: self.
processHandler := LanguageLinkServerHandler application: self.
"executionHandler := CarpExecutionHandler application: self"
]

View File

@@ -1,40 +0,0 @@
Class {
#name : #CarpArrayNode,
#superclass : #CarpExpressionNode,
#instVars : [
'expressions'
],
#category : #'Carp-AST'
}
{ #category : #generated }
CarpArrayNode >> acceptVisitor: anExpressionVisitor [
^ anExpressionVisitor visitArray: self
]
{ #category : #generated }
CarpArrayNode >> compositeNodeVariables [
^ #( #expressions )
]
{ #category : #generated }
CarpArrayNode >> expressions [
^ expressions
]
{ #category : #generated }
CarpArrayNode >> expressions: anOrderedCollection [
self setParents: self expressions to: nil.
expressions := anOrderedCollection.
self setParents: self expressions to: self
]
{ #category : #'generated-initialize-release' }
CarpArrayNode >> initialize [
super initialize.
expressions := OrderedCollection new: 2.
]

View File

@@ -1,32 +0,0 @@
Class {
#name : #CarpCharacterNode,
#superclass : #CarpExpressionNode,
#instVars : [
'value'
],
#category : #'Carp-AST'
}
{ #category : #generated }
CarpCharacterNode >> acceptVisitor: anExpressionVisitor [
^ anExpressionVisitor visitCharacter: self
]
{ #category : #generated }
CarpCharacterNode >> tokenVariables [
^ #( #value )
]
{ #category : #generated }
CarpCharacterNode >> value [
^ value
]
{ #category : #generated }
CarpCharacterNode >> value: aSmaCCToken [
value := aSmaCCToken
]

View File

@@ -1,34 +0,0 @@
Class {
#name : #CarpDerefNode,
#superclass : #CarpExpressionNode,
#instVars : [
'value'
],
#category : #'Carp-AST'
}
{ #category : #generated }
CarpDerefNode >> acceptVisitor: anExpressionVisitor [
^ anExpressionVisitor visitDeref: self
]
{ #category : #generated }
CarpDerefNode >> nodeVariables [
^ #( #value )
]
{ #category : #generated }
CarpDerefNode >> value [
^ value
]
{ #category : #generated }
CarpDerefNode >> value: aCarpExpressionNode [
self value notNil ifTrue: [ self value parent: nil ].
value := aCarpExpressionNode.
self value notNil ifTrue: [ self value parent: self ]
]

View File

@@ -1,11 +0,0 @@
Class {
#name : #CarpExpressionNode,
#superclass : #SmaCCParseNode,
#category : #'Carp-AST'
}
{ #category : #generated }
CarpExpressionNode >> acceptVisitor: anExpressionVisitor [
^ anExpressionVisitor visitExpression: self
]

View File

@@ -1,7 +0,0 @@
Class {
#name : #CarpExpressionNodeVisitor,
#superclass : #Object,
#traits : 'TCarpExpressionNodeVisitor',
#classTraits : 'TCarpExpressionNodeVisitor classTrait',
#category : #'Carp-Parser'
}

View File

@@ -1,36 +0,0 @@
Class {
#name : #CarpFile,
#superclass : #Object,
#instVars : [
'fileName',
'contents'
],
#category : #'Carp-Parser'
}
{ #category : #'instance creation' }
CarpFile class >> for: aFileName [
^ self new for: aFileName
]
{ #category : #accessing }
CarpFile >> contents [
^ contents
]
{ #category : #accessing }
CarpFile >> contents: aString [
contents := aString
]
{ #category : #accessing }
CarpFile >> fileName: aFileName [
fileName := aFileName
]
{ #category : #accessing }
CarpFile >> for: aFileName [
self fileName: aFileName.
self contents: (CarpParser parse: aFileName asFileReference contents).
]

View File

@@ -1,40 +0,0 @@
Class {
#name : #CarpListNode,
#superclass : #CarpExpressionNode,
#instVars : [
'expressions'
],
#category : #'Carp-AST'
}
{ #category : #generated }
CarpListNode >> acceptVisitor: anExpressionVisitor [
^ anExpressionVisitor visitList: self
]
{ #category : #generated }
CarpListNode >> compositeNodeVariables [
^ #( #expressions )
]
{ #category : #generated }
CarpListNode >> expressions [
^ expressions
]
{ #category : #generated }
CarpListNode >> expressions: anOrderedCollection [
self setParents: self expressions to: nil.
expressions := anOrderedCollection.
self setParents: self expressions to: self
]
{ #category : #'generated-initialize-release' }
CarpListNode >> initialize [
super initialize.
expressions := OrderedCollection new: 2.
]

View File

@@ -1,40 +0,0 @@
Class {
#name : #CarpMapNode,
#superclass : #CarpExpressionNode,
#instVars : [
'pairs'
],
#category : #'Carp-AST'
}
{ #category : #generated }
CarpMapNode >> acceptVisitor: anExpressionVisitor [
^ anExpressionVisitor visitMap: self
]
{ #category : #generated }
CarpMapNode >> compositeNodeVariables [
^ #( #pairs )
]
{ #category : #'generated-initialize-release' }
CarpMapNode >> initialize [
super initialize.
pairs := OrderedCollection new: 2.
]
{ #category : #generated }
CarpMapNode >> pairs [
^ pairs
]
{ #category : #generated }
CarpMapNode >> pairs: anOrderedCollection [
self setParents: self pairs to: nil.
pairs := anOrderedCollection.
self setParents: self pairs to: self
]

View File

@@ -1,34 +0,0 @@
Class {
#name : #CarpModuleOrTypeNode,
#superclass : #CarpExpressionNode,
#instVars : [
'value'
],
#category : #'Carp-AST'
}
{ #category : #generated }
CarpModuleOrTypeNode >> acceptVisitor: anExpressionVisitor [
^ anExpressionVisitor visitModuleOrType: self
]
{ #category : #generated }
CarpModuleOrTypeNode >> otherVariables [
^ #( #value )
]
{ #category : #generated }
CarpModuleOrTypeNode >> value [
^ value
]
{ #category : #generated }
CarpModuleOrTypeNode >> value: anObject [
self setParent: self value to: nil.
value := anObject.
self setParent: self value to: self
]

View File

@@ -1,32 +0,0 @@
Class {
#name : #CarpNumberNode,
#superclass : #CarpExpressionNode,
#instVars : [
'value'
],
#category : #'Carp-AST'
}
{ #category : #generated }
CarpNumberNode >> acceptVisitor: anExpressionVisitor [
^ anExpressionVisitor visitNumber: self
]
{ #category : #generated }
CarpNumberNode >> tokenVariables [
^ #( #value )
]
{ #category : #generated }
CarpNumberNode >> value [
^ value
]
{ #category : #generated }
CarpNumberNode >> value: aSmaCCToken [
value := aSmaCCToken
]

View File

@@ -1,49 +0,0 @@
Class {
#name : #CarpPairNode,
#superclass : #CarpExpressionNode,
#instVars : [
'key',
'value'
],
#category : #'Carp-AST'
}
{ #category : #generated }
CarpPairNode >> acceptVisitor: anExpressionVisitor [
^ anExpressionVisitor visitPair: self
]
{ #category : #generated }
CarpPairNode >> key [
^ key
]
{ #category : #generated }
CarpPairNode >> key: aCarpExpressionNode [
self key notNil ifTrue: [ self key parent: nil ].
key := aCarpExpressionNode.
self key notNil ifTrue: [ self key parent: self ]
]
{ #category : #generated }
CarpPairNode >> nodeVariables [
^ #( #key #value )
]
{ #category : #generated }
CarpPairNode >> value [
^ value
]
{ #category : #generated }
CarpPairNode >> value: aCarpExpressionNode [
self value notNil ifTrue: [ self value parent: nil ].
value := aCarpExpressionNode.
self value notNil ifTrue: [ self value parent: self ]
]

View File

@@ -1,467 +0,0 @@
Class {
#name : #CarpParser,
#superclass : #SmaCCGLRParser,
#category : #'Carp-Parser'
}
{ #category : #'generated-accessing' }
CarpParser class >> cacheId [
^'2022-03-20T20:34:27.408287+01:00'
]
{ #category : #generated }
CarpParser class >> definitionComment [
"%glr;
%root Expression;
%prefix Carp;
%suffix Node;
<escape>
: \\ (. | u[0-9A-F]{4,4} | o[0-7]{3,3} | newline | return | space | tab | space | backspace | formfeed) # other character types
;
<string_literal>
: \"" ([^\""\\] | <escape>)* \""
;
<open_paren>
: \(
;
<close_paren>
: \)
;
<quote>
: \' | \`
;
<variable_start>
: <isLowercase> | _ | \$ | \+ | \* | \/ | \? | ! | > | < | = | : | -
;
default <variable>
: <variable_start> <variable_part>*
;
<variable_part>
: <variable_start> | <isDigit> | <isUppercase>
;
<module>
: <isUppercase> <variable_part>*
;
<dot>
: \.
;
<open_bracket>
: \[
;
<close_bracket>
: \]
;
<binary_integer>
: 0 b [0-1]
;
<hex_integer>
: 0 x [0-9a-fA-F]
;
<decimal_integer>
: [0-9]+
;
<sign>
: \-
;
<decimal>
: <sign>? (<decimal_integer> \. <decimal_integer> f?)
| <sign>? (<decimal_integer> (f|l|b)?)
;
<numeric_literal>
: <decimal> | <hex_integer> | <binary_integer>
;
<comment>
: \; [^\r\n]*
| \, # commas are treated as whitespace, but whitespace is not saved, so I made them comments instead
;
<whitespace>
: \s+
;
<character>
: \\ (. | u[0-9A-F]{4,4} | o[0-7]{3,3} | newline | return | space | tab | space | backspace | formfeed) # other character types
;Start
: Expressions {{}}
;
Expressions
:
| Expressions Expression 'expression'
;
Expression
: Literal
| Deref
| Ref
| RefCall
| Unquote
;
RefCall
: ""~"" Expression 'value' {{}}
;
Unquote
: (""%"" | ""%@"") Expression 'value' {{}}
;
Ref
: ""&"" Expression 'value' {{}}
;
Deref
: ""@"" Expression 'value' {{}}
;
Literal
: String | List | Array | Symbol | Quote | Number | Character | Pattern | Map
;
Map
: ""{"" MapPairs ""}"" {{}}
;
MapPairs
:
| MapPairs MapPair 'pair'
;
MapPair
: Expression 'key' Expression 'value' {{Pair}}
;
Pattern
: ""#"" <string_literal> 'value' {{}}
;
Character
: <character> 'value' {{}}
;
Number
: <numeric_literal> 'value' {{}}
;
Array
: <open_bracket> Expressions <close_bracket> {{}}
;
Quote
: <quote> Expression 'value' {{}}
;
Symbol
: ModuleOrType | Variable
;
Variable
: <variable> 'value' {{}}
;
ModuleOrType
: <module> <dot> Symbol 'value' {{}}
| <module> 'value' {{}}
;
List
: <open_paren> Expressions <close_paren> {{}}
;
String
: <string_literal> 'value' {{}}
;"
]
{ #category : #generated }
CarpParser class >> reduceTable [
^#(
#(24 0 #reduceActionForExpressions1: 1289217 false)
#(23 1 #reduceActionForStart1: 1258497 false)
#(32 0 #reduceActionForExpressions1: 1712129 false)
#(43 1 #reduceActionForString1: 2274305 false)
#(40 1 #reduceActionForVariable1: 2097153 false)
#(41 1 #reduceActionForModuleOrType2: 2137090 false)
#(36 1 #reduceActionForNumber1: 1906689 false)
#(35 1 #reduceActionForCharacter1: 1864705 false)
#(24 2 #reduceActionForExpressions2: 1289218 false)
#(25 1 #liftFirstValue: 1347588 false)
#(25 1 #liftFirstValue: 1347589 false)
#(25 1 #liftFirstValue: 1347587 false)
#(25 1 #liftFirstValue: 1347586 false)
#(25 1 #liftFirstValue: 1347585 false)
#(30 1 #liftFirstValue: 1587209 false)
#(30 1 #liftFirstValue: 1587208 false)
#(30 1 #liftFirstValue: 1587207 false)
#(30 1 #liftFirstValue: 1587206 false)
#(30 1 #liftFirstValue: 1587203 false)
#(30 1 #liftFirstValue: 1587205 false)
#(30 1 #liftFirstValue: 1587204 false)
#(39 1 #liftFirstValue: 2059266 false)
#(39 1 #liftFirstValue: 2059265 false)
#(30 1 #liftFirstValue: 1587202 false)
#(30 1 #liftFirstValue: 1587201 false)
#(34 2 #reduceActionForPattern1: 1815553 false)
#(27 2 #reduceActionForUnquote1: 1455105 false)
#(27 2 #reduceActionForUnquote1: 1455106 false)
#(28 2 #reduceActionForRef1: 1507329 false)
#(29 2 #reduceActionForDeref1: 1546241 false)
#(26 2 #reduceActionForRefCall1: 1412097 false)
#(38 2 #reduceActionForQuote1: 2014209 false)
#(31 3 #reduceActionForMap1: 1679361 false)
#(32 2 #reduceActionForExpressions2: 1712130 false)
#(42 3 #reduceActionForList1: 2217985 false)
#(41 3 #reduceActionForModuleOrType1: 2137089 false)
#(37 3 #reduceActionForArray1: 1952769 false)
#(33 2 #reduceActionForMapPair1: 1755137 false)
).
]
{ #category : #generated }
CarpParser class >> scannerClass [
^CarpScanner
]
{ #category : #generated }
CarpParser class >> startingStateForStart [
^ 1
]
{ #category : #generated }
CarpParser class >> symbolNames [
^ #( '"#"' '"%"' '"%@"' '"&"' '"@"' '"{"' '"}"' '"~"' '<string_literal>'
'<open_paren>' '<close_paren>' '<quote>' '<variable>'
'<module>' '<dot>' '<open_bracket>' '<close_bracket>'
'<numeric_literal>' '<comment>' '<whitespace>' '<character>'
'B e g i n' 'Start' 'Expressions' 'Expression' 'RefCall'
'Unquote' 'Ref' 'Deref' 'Literal' 'Map' 'MapPairs' 'MapPair'
'Pattern' 'Character' 'Number' 'Array' 'Quote' 'Symbol' 'Variable'
'ModuleOrType' 'List' 'String' 'E O F' 'error' )
]
{ #category : #generated }
CarpParser class >> symbolTypes [
^ #( #SmaCCToken #SmaCCToken #SmaCCToken #SmaCCToken #SmaCCToken
#SmaCCToken #SmaCCToken #SmaCCToken #SmaCCToken #SmaCCToken
#SmaCCToken #SmaCCToken #SmaCCToken #SmaCCToken #SmaCCToken
#SmaCCToken #SmaCCToken #SmaCCToken #SmaCCToken #SmaCCToken
#SmaCCToken #CarpStartNode #CarpStartNode #OrderedCollection
#CarpExpressionNode #CarpRefCallNode #CarpUnquoteNode
#CarpRefNode #CarpDerefNode #CarpExpressionNode
#CarpMapNode #OrderedCollection #CarpPairNode #CarpPatternNode
#CarpCharacterNode #CarpNumberNode #CarpArrayNode #CarpQuoteNode
#CarpExpressionNode #CarpVariableNode #CarpModuleOrTypeNode
#CarpListNode #CarpStringNode #SmaCCToken #SmaCCErrorNode )
]
{ #category : #generated }
CarpParser class >> transitionTable [
^#(
#[1 0 6 0 1 0 6 0 2 0 6 0 3 0 6 0 4 0 6 0 5 0 6 0 6 0 6 0 8 0 6 0 9 0 6 0 10 0 6 0 12 0 6 0 13 0 6 0 14 0 6 0 16 0 6 0 18 0 6 0 21 0 9 0 23 0 13 0 24 0 6 0 44]
#[0 0 0 0 44]
#[1 0 17 0 1 0 21 0 2 0 25 0 3 0 29 0 4 0 33 0 5 0 37 0 6 0 41 0 8 0 45 0 9 0 49 0 10 0 53 0 12 0 57 0 13 0 61 0 14 0 65 0 16 0 69 0 18 0 73 0 21 0 77 0 25 0 77 0 26 0 77 0 27 0 77 0 28 0 77 0 29 0 77 0 30 0 77 0 31 0 77 0 34 0 77 0 35 0 77 0 36 0 77 0 37 0 77 0 38 0 77 0 39 0 77 0 40 0 77 0 41 0 77 0 42 0 77 0 43 0 10 0 44]
#[0 0 145 0 9]
#[1 0 17 0 1 0 21 0 2 0 25 0 3 0 29 0 4 0 33 0 5 0 37 0 6 0 41 0 8 0 45 0 9 0 49 0 10 0 53 0 12 0 57 0 13 0 61 0 14 0 65 0 16 0 69 0 18 0 73 0 21 0 149 0 25 0 149 0 26 0 149 0 27 0 149 0 28 0 149 0 29 0 149 0 30 0 149 0 31 0 149 0 34 0 149 0 35 0 149 0 36 0 149 0 37 0 149 0 38 0 149 0 39 0 149 0 40 0 149 0 41 0 149 0 42 0 149 0 43]
#[1 0 17 0 1 0 21 0 2 0 25 0 3 0 29 0 4 0 33 0 5 0 37 0 6 0 41 0 8 0 45 0 9 0 49 0 10 0 53 0 12 0 57 0 13 0 61 0 14 0 65 0 16 0 69 0 18 0 73 0 21 0 153 0 25 0 153 0 26 0 153 0 27 0 153 0 28 0 153 0 29 0 153 0 30 0 153 0 31 0 153 0 34 0 153 0 35 0 153 0 36 0 153 0 37 0 153 0 38 0 153 0 39 0 153 0 40 0 153 0 41 0 153 0 42 0 153 0 43]
#[1 0 17 0 1 0 21 0 2 0 25 0 3 0 29 0 4 0 33 0 5 0 37 0 6 0 41 0 8 0 45 0 9 0 49 0 10 0 53 0 12 0 57 0 13 0 61 0 14 0 65 0 16 0 69 0 18 0 73 0 21 0 157 0 25 0 157 0 26 0 157 0 27 0 157 0 28 0 157 0 29 0 157 0 30 0 157 0 31 0 157 0 34 0 157 0 35 0 157 0 36 0 157 0 37 0 157 0 38 0 157 0 39 0 157 0 40 0 157 0 41 0 157 0 42 0 157 0 43]
#[1 0 17 0 1 0 21 0 2 0 25 0 3 0 29 0 4 0 33 0 5 0 37 0 6 0 41 0 8 0 45 0 9 0 49 0 10 0 53 0 12 0 57 0 13 0 61 0 14 0 65 0 16 0 69 0 18 0 73 0 21 0 161 0 25 0 161 0 26 0 161 0 27 0 161 0 28 0 161 0 29 0 161 0 30 0 161 0 31 0 161 0 34 0 161 0 35 0 161 0 36 0 161 0 37 0 161 0 38 0 161 0 39 0 161 0 40 0 161 0 41 0 161 0 42 0 161 0 43]
#[1 0 14 0 1 0 14 0 2 0 14 0 3 0 14 0 4 0 14 0 5 0 14 0 6 0 14 0 7 0 14 0 8 0 14 0 9 0 14 0 10 0 14 0 12 0 14 0 13 0 14 0 14 0 14 0 16 0 14 0 18 0 14 0 21 0 165 0 32]
#[1 0 17 0 1 0 21 0 2 0 25 0 3 0 29 0 4 0 33 0 5 0 37 0 6 0 41 0 8 0 45 0 9 0 49 0 10 0 53 0 12 0 57 0 13 0 61 0 14 0 65 0 16 0 69 0 18 0 73 0 21 0 169 0 25 0 169 0 26 0 169 0 27 0 169 0 28 0 169 0 29 0 169 0 30 0 169 0 31 0 169 0 34 0 169 0 35 0 169 0 36 0 169 0 37 0 169 0 38 0 169 0 39 0 169 0 40 0 169 0 41 0 169 0 42 0 169 0 43]
#[0 0 18 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0 9 0 10 0 11 0 12 0 13 0 14 0 16 0 17 0 18 0 21 0 44]
#[1 0 6 0 1 0 6 0 2 0 6 0 3 0 6 0 4 0 6 0 5 0 6 0 6 0 6 0 8 0 6 0 9 0 6 0 10 0 6 0 11 0 6 0 12 0 6 0 13 0 6 0 14 0 6 0 16 0 6 0 18 0 6 0 21 0 173 0 24]
#[1 0 17 0 1 0 21 0 2 0 25 0 3 0 29 0 4 0 33 0 5 0 37 0 6 0 41 0 8 0 45 0 9 0 49 0 10 0 53 0 12 0 57 0 13 0 61 0 14 0 65 0 16 0 69 0 18 0 73 0 21 0 177 0 25 0 177 0 26 0 177 0 27 0 177 0 28 0 177 0 29 0 177 0 30 0 177 0 31 0 177 0 34 0 177 0 35 0 177 0 36 0 177 0 37 0 177 0 38 0 177 0 39 0 177 0 40 0 177 0 41 0 177 0 42 0 177 0 43]
#[0 0 22 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0 9 0 10 0 11 0 12 0 13 0 14 0 16 0 17 0 18 0 21 0 44]
#[1 0 26 0 1 0 26 0 2 0 26 0 3 0 26 0 4 0 26 0 5 0 26 0 6 0 26 0 7 0 26 0 8 0 26 0 9 0 26 0 10 0 26 0 11 0 26 0 12 0 26 0 13 0 26 0 14 0 181 0 15 0 26 0 16 0 26 0 17 0 26 0 18 0 26 0 21 0 26 0 44]
#[1 0 6 0 1 0 6 0 2 0 6 0 3 0 6 0 4 0 6 0 5 0 6 0 6 0 6 0 8 0 6 0 9 0 6 0 10 0 6 0 12 0 6 0 13 0 6 0 14 0 6 0 16 0 6 0 17 0 6 0 18 0 6 0 21 0 185 0 24]
#[0 0 30 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0 9 0 10 0 11 0 12 0 13 0 14 0 16 0 17 0 18 0 21 0 44]
#[0 0 34 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0 9 0 10 0 11 0 12 0 13 0 14 0 16 0 17 0 18 0 21 0 44]
#[0 0 38 0 1 0 2 0 3 0 4 0 5 0 6 0 8 0 9 0 10 0 11 0 12 0 13 0 14 0 16 0 17 0 18 0 21 0 44]
#[0 0 42 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0 9 0 10 0 11 0 12 0 13 0 14 0 16 0 17 0 18 0 21 0 44]
#[0 0 46 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0 9 0 10 0 11 0 12 0 13 0 14 0 16 0 17 0 18 0 21 0 44]
#[0 0 50 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0 9 0 10 0 11 0 12 0 13 0 14 0 16 0 17 0 18 0 21 0 44]
#[0 0 54 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0 9 0 10 0 11 0 12 0 13 0 14 0 16 0 17 0 18 0 21 0 44]
#[0 0 58 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0 9 0 10 0 11 0 12 0 13 0 14 0 16 0 17 0 18 0 21 0 44]
#[0 0 62 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0 9 0 10 0 11 0 12 0 13 0 14 0 16 0 17 0 18 0 21 0 44]
#[0 0 66 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0 9 0 10 0 11 0 12 0 13 0 14 0 16 0 17 0 18 0 21 0 44]
#[0 0 70 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0 9 0 10 0 11 0 12 0 13 0 14 0 16 0 17 0 18 0 21 0 44]
#[0 0 74 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0 9 0 10 0 11 0 12 0 13 0 14 0 16 0 17 0 18 0 21 0 44]
#[0 0 78 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0 9 0 10 0 11 0 12 0 13 0 14 0 16 0 17 0 18 0 21 0 44]
#[0 0 82 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0 9 0 10 0 11 0 12 0 13 0 14 0 16 0 17 0 18 0 21 0 44]
#[0 0 86 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0 9 0 10 0 11 0 12 0 13 0 14 0 16 0 17 0 18 0 21 0 44]
#[0 0 90 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0 9 0 10 0 11 0 12 0 13 0 14 0 16 0 17 0 18 0 21 0 44]
#[0 0 94 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0 9 0 10 0 11 0 12 0 13 0 14 0 16 0 17 0 18 0 21 0 44]
#[0 0 98 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0 9 0 10 0 11 0 12 0 13 0 14 0 16 0 17 0 18 0 21 0 44]
#[0 0 102 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0 9 0 10 0 11 0 12 0 13 0 14 0 16 0 17 0 18 0 21 0 44]
#[0 0 106 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0 9 0 10 0 11 0 12 0 13 0 14 0 16 0 17 0 18 0 21 0 44]
#[0 0 110 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0 9 0 10 0 11 0 12 0 13 0 14 0 16 0 17 0 18 0 21 0 44]
#[0 0 114 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0 9 0 10 0 11 0 12 0 13 0 14 0 16 0 17 0 18 0 21 0 44]
#[0 0 118 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0 9 0 10 0 11 0 12 0 13 0 14 0 16 0 17 0 18 0 21 0 44]
#[0 0 122 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0 9 0 10 0 11 0 12 0 13 0 14 0 16 0 17 0 18 0 21 0 44]
#[1 0 17 0 1 0 21 0 2 0 25 0 3 0 29 0 4 0 33 0 5 0 37 0 6 0 189 0 7 0 41 0 8 0 45 0 9 0 49 0 10 0 53 0 12 0 57 0 13 0 61 0 14 0 65 0 16 0 69 0 18 0 73 0 21 0 193 0 25 0 193 0 26 0 193 0 27 0 193 0 28 0 193 0 29 0 193 0 30 0 193 0 31 0 197 0 33 0 193 0 34 0 193 0 35 0 193 0 36 0 193 0 37 0 193 0 38 0 193 0 39 0 193 0 40 0 193 0 41 0 193 0 42 0 193 0 43]
#[0 0 126 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0 9 0 10 0 11 0 12 0 13 0 14 0 16 0 17 0 18 0 21 0 44]
#[1 0 17 0 1 0 21 0 2 0 25 0 3 0 29 0 4 0 33 0 5 0 37 0 6 0 41 0 8 0 45 0 9 0 49 0 10 0 201 0 11 0 53 0 12 0 57 0 13 0 61 0 14 0 65 0 16 0 69 0 18 0 73 0 21 0 77 0 25 0 77 0 26 0 77 0 27 0 77 0 28 0 77 0 29 0 77 0 30 0 77 0 31 0 77 0 34 0 77 0 35 0 77 0 36 0 77 0 37 0 77 0 38 0 77 0 39 0 77 0 40 0 77 0 41 0 77 0 42 0 77 0 43]
#[0 0 130 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0 9 0 10 0 11 0 12 0 13 0 14 0 16 0 17 0 18 0 21 0 44]
#[1 0 57 0 13 0 61 0 14 0 205 0 39 0 205 0 40 0 205 0 41]
#[1 0 17 0 1 0 21 0 2 0 25 0 3 0 29 0 4 0 33 0 5 0 37 0 6 0 41 0 8 0 45 0 9 0 49 0 10 0 53 0 12 0 57 0 13 0 61 0 14 0 65 0 16 0 209 0 17 0 69 0 18 0 73 0 21 0 77 0 25 0 77 0 26 0 77 0 27 0 77 0 28 0 77 0 29 0 77 0 30 0 77 0 31 0 77 0 34 0 77 0 35 0 77 0 36 0 77 0 37 0 77 0 38 0 77 0 39 0 77 0 40 0 77 0 41 0 77 0 42 0 77 0 43]
#[0 0 134 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0 9 0 10 0 11 0 12 0 13 0 14 0 16 0 17 0 18 0 21 0 44]
#[1 0 17 0 1 0 21 0 2 0 25 0 3 0 29 0 4 0 33 0 5 0 37 0 6 0 41 0 8 0 45 0 9 0 49 0 10 0 53 0 12 0 57 0 13 0 61 0 14 0 65 0 16 0 69 0 18 0 73 0 21 0 213 0 25 0 213 0 26 0 213 0 27 0 213 0 28 0 213 0 29 0 213 0 30 0 213 0 31 0 213 0 34 0 213 0 35 0 213 0 36 0 213 0 37 0 213 0 38 0 213 0 39 0 213 0 40 0 213 0 41 0 213 0 42 0 213 0 43]
#[0 0 138 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0 9 0 10 0 12 0 13 0 14 0 16 0 18 0 21]
#[0 0 142 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0 9 0 10 0 11 0 12 0 13 0 14 0 16 0 17 0 18 0 21 0 44]
#[0 0 146 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0 9 0 10 0 11 0 12 0 13 0 14 0 16 0 17 0 18 0 21 0 44]
#[0 0 150 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0 9 0 10 0 11 0 12 0 13 0 14 0 16 0 17 0 18 0 21 0 44]
#[0 0 154 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0 9 0 10 0 12 0 13 0 14 0 16 0 18 0 21]
).
]
{ #category : #'generated-reduction actions' }
CarpParser >> reduceActionForArray1: nodes [
| result |
result := CarpArrayNode new.
result addNodes: (nodes at: 2) to: result expressions.
^ result
]
{ #category : #'generated-reduction actions' }
CarpParser >> reduceActionForCharacter1: nodes [
| result |
result := CarpCharacterNode new.
result value: (nodes at: 1).
^ result
]
{ #category : #'generated-reduction actions' }
CarpParser >> reduceActionForDeref1: nodes [
| result |
result := CarpDerefNode new.
result value: (nodes at: 2).
^ result
]
{ #category : #'generated-reduction actions' }
CarpParser >> reduceActionForExpressions1: nodes [
| result |
result := OrderedCollection new: 2.
^ result
]
{ #category : #'generated-reduction actions' }
CarpParser >> reduceActionForExpressions2: nodes [
| result |
result := nodes at: 1.
self add: (nodes at: 2) to: result.
^ result
]
{ #category : #'generated-reduction actions' }
CarpParser >> reduceActionForList1: nodes [
| result |
result := CarpListNode new.
result addNodes: (nodes at: 2) to: result expressions.
^ result
]
{ #category : #'generated-reduction actions' }
CarpParser >> reduceActionForMap1: nodes [
| result |
result := CarpMapNode new.
result addNodes: (nodes at: 2) to: result pairs.
^ result
]
{ #category : #'generated-reduction actions' }
CarpParser >> reduceActionForMapPair1: nodes [
| result |
result := CarpPairNode new.
result key: (nodes at: 1).
result value: (nodes at: 2).
^ result
]
{ #category : #'generated-reduction actions' }
CarpParser >> reduceActionForModuleOrType1: nodes [
| result |
result := CarpModuleOrTypeNode new.
result value: (nodes at: 3).
^ result
]
{ #category : #'generated-reduction actions' }
CarpParser >> reduceActionForModuleOrType2: nodes [
| result |
result := CarpModuleOrTypeNode new.
result value: (nodes at: 1).
^ result
]
{ #category : #'generated-reduction actions' }
CarpParser >> reduceActionForNumber1: nodes [
| result |
result := CarpNumberNode new.
result value: (nodes at: 1).
^ result
]
{ #category : #'generated-reduction actions' }
CarpParser >> reduceActionForPattern1: nodes [
| result |
result := CarpPatternNode new.
result value: (nodes at: 2).
^ result
]
{ #category : #'generated-reduction actions' }
CarpParser >> reduceActionForQuote1: nodes [
| result |
result := CarpQuoteNode new.
result value: (nodes at: 2).
^ result
]
{ #category : #'generated-reduction actions' }
CarpParser >> reduceActionForRef1: nodes [
| result |
result := CarpRefNode new.
result value: (nodes at: 2).
^ result
]
{ #category : #'generated-reduction actions' }
CarpParser >> reduceActionForRefCall1: nodes [
| result |
result := CarpRefCallNode new.
result value: (nodes at: 2).
^ result
]
{ #category : #'generated-reduction actions' }
CarpParser >> reduceActionForStart1: nodes [
| result |
result := CarpStartNode new.
result addNodes: (nodes at: 1) to: result expressions.
^ result
]
{ #category : #'generated-reduction actions' }
CarpParser >> reduceActionForString1: nodes [
| result |
result := CarpStringNode new.
result value: (nodes at: 1).
^ result
]
{ #category : #'generated-reduction actions' }
CarpParser >> reduceActionForUnquote1: nodes [
| result |
result := CarpUnquoteNode new.
result value: (nodes at: 2).
^ result
]
{ #category : #'generated-reduction actions' }
CarpParser >> reduceActionForVariable1: nodes [
| result |
result := CarpVariableNode new.
result value: (nodes at: 1).
^ result
]

View File

@@ -1,32 +0,0 @@
Class {
#name : #CarpPatternNode,
#superclass : #CarpExpressionNode,
#instVars : [
'value'
],
#category : #'Carp-AST'
}
{ #category : #generated }
CarpPatternNode >> acceptVisitor: anExpressionVisitor [
^ anExpressionVisitor visitPattern: self
]
{ #category : #generated }
CarpPatternNode >> tokenVariables [
^ #( #value )
]
{ #category : #generated }
CarpPatternNode >> value [
^ value
]
{ #category : #generated }
CarpPatternNode >> value: aSmaCCToken [
value := aSmaCCToken
]

View File

@@ -1,34 +0,0 @@
Class {
#name : #CarpQuoteNode,
#superclass : #CarpExpressionNode,
#instVars : [
'value'
],
#category : #'Carp-AST'
}
{ #category : #generated }
CarpQuoteNode >> acceptVisitor: anExpressionVisitor [
^ anExpressionVisitor visitQuote: self
]
{ #category : #generated }
CarpQuoteNode >> nodeVariables [
^ #( #value )
]
{ #category : #generated }
CarpQuoteNode >> value [
^ value
]
{ #category : #generated }
CarpQuoteNode >> value: aCarpExpressionNode [
self value notNil ifTrue: [ self value parent: nil ].
value := aCarpExpressionNode.
self value notNil ifTrue: [ self value parent: self ]
]

View File

@@ -1,34 +0,0 @@
Class {
#name : #CarpRefCallNode,
#superclass : #CarpExpressionNode,
#instVars : [
'value'
],
#category : #'Carp-AST'
}
{ #category : #generated }
CarpRefCallNode >> acceptVisitor: anExpressionVisitor [
^ anExpressionVisitor visitRefCall: self
]
{ #category : #generated }
CarpRefCallNode >> nodeVariables [
^ #( #value )
]
{ #category : #generated }
CarpRefCallNode >> value [
^ value
]
{ #category : #generated }
CarpRefCallNode >> value: aCarpExpressionNode [
self value notNil ifTrue: [ self value parent: nil ].
value := aCarpExpressionNode.
self value notNil ifTrue: [ self value parent: self ]
]

View File

@@ -1,34 +0,0 @@
Class {
#name : #CarpRefNode,
#superclass : #CarpExpressionNode,
#instVars : [
'value'
],
#category : #'Carp-AST'
}
{ #category : #generated }
CarpRefNode >> acceptVisitor: anExpressionVisitor [
^ anExpressionVisitor visitRef: self
]
{ #category : #generated }
CarpRefNode >> nodeVariables [
^ #( #value )
]
{ #category : #generated }
CarpRefNode >> value [
^ value
]
{ #category : #generated }
CarpRefNode >> value: aCarpExpressionNode [
self value notNil ifTrue: [ self value parent: nil ].
value := aCarpExpressionNode.
self value notNil ifTrue: [ self value parent: self ]
]

View File

@@ -1,382 +0,0 @@
Class {
#name : #CarpScanner,
#superclass : #SmaCCScanner,
#category : #'Carp-Parser'
}
{ #category : #generated }
CarpScanner >> emptySymbolTokenId [
^ 44
]
{ #category : #generated }
CarpScanner >> errorTokenId [
^ 45
]
{ #category : #generated }
CarpScanner >> scan1 [
[
self step.
currentCharacter == $" ifTrue: [ ^ self recordAndReportMatch: #( 9 ) ].
currentCharacter == $\ ifTrue: [
self step.
^ self scan1 ].
true ] whileTrue
]
{ #category : #generated }
CarpScanner >> scan2 [
self recordMatch: #( 13 ).
self step.
currentCharacter isDigit ifTrue: [ ^ self scan3 ].
(currentCharacter isLowercase or: [
currentCharacter isUppercase or: [
('!$' includes: currentCharacter) or: [
(currentCharacter between: $* and: $+) or: [
('-/:' includes: currentCharacter) or: [
(currentCharacter between: $< and: $?) or: [
currentCharacter == $_ ] ] ] ] ] ]) ifTrue: [
[
self recordMatch: #( 13 ).
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 == $_ ] ] ] ] ] ] ] ] whileTrue ].
^ self reportLastMatch
]
{ #category : #generated }
CarpScanner >> scan3 [
[
self recordMatch: #( 13 18 ).
self step.
currentCharacter == $. ifTrue: [ ^ self scan4 ].
currentCharacter isDigit ] whileTrue.
('bfl' includes: currentCharacter) 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.
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 ].
(currentCharacter isUppercase or: [
currentCharacter isLowercase or: [
('!$' includes: currentCharacter) or: [
(currentCharacter between: $* and: $+) or: [
('-/:' includes: currentCharacter) or: [
(currentCharacter between: $< and: $?) or: [
currentCharacter == $_ ] ] ] ] ] ]) ifTrue: [
[
self recordMatch: #( 13 ).
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 == $_ ] ] ] ] ] ] ] ] whileTrue ].
^ self reportLastMatch
]
{ #category : #generated }
CarpScanner >> scan4 [
self step.
currentCharacter isDigit ifTrue: [
[
self recordMatch: #( 18 ).
self step.
currentCharacter == $f ifTrue: [
^ self recordAndReportMatch: #( 18 ) ].
currentCharacter isDigit ] whileTrue ].
^ self reportLastMatch
]
{ #category : #generated }
CarpScanner >> scan5 [
[
self recordMatch: #( 18 ).
self step.
currentCharacter == $. ifTrue: [ ^ self scan4 ].
currentCharacter isDigit ] whileTrue.
('bfl' includes: currentCharacter) ifTrue: [
^ self recordAndReportMatch: #( 18 ) ].
^ self reportLastMatch
]
{ #category : #generated }
CarpScanner >> scan6 [
(self scanForString: 'ac') ifTrue: [ ^ self scan7 ].
^ self reportLastMatch
]
{ #category : #generated }
CarpScanner >> scan7 [
self step.
currentCharacter == $e ifTrue: [
^ self recordAndReportMatch: #( 21 ) ].
^ self reportLastMatch
]
{ #category : #generated }
CarpScanner >> scanForToken [
self step.
currentCharacter == $" ifTrue: [ ^ self scan1 ].
currentCharacter == $# ifTrue: [ ^ self recordAndReportMatch: #( 1 ) ].
currentCharacter == $% ifTrue: [ ^ self scanForTokenX7 ].
currentCharacter == $& ifTrue: [ ^ self recordAndReportMatch: #( 4 ) ].
^ self scanForTokenX9
]
{ #category : #generated }
CarpScanner >> scanForTokenX1 [
self step.
currentCharacter == $b ifTrue: [
self recordMatch: #( 21 ).
self step.
currentCharacter == $a ifTrue: [
(self scanForString: 'cksp') ifTrue: [ ^ self scan6 ] ].
^ self reportLastMatch ].
currentCharacter == $f ifTrue: [
self recordMatch: #( 21 ).
self step.
currentCharacter == $o ifTrue: [
(self scanForString: 'rmfeed') ifTrue: [
^ self recordAndReportMatch: #( 21 ) ] ].
^ self reportLastMatch ].
currentCharacter == $n ifTrue: [
self recordMatch: #( 21 ).
self step.
currentCharacter == $e ifTrue: [
(self scanForString: 'wlin') ifTrue: [ ^ self scan7 ] ].
^ self reportLastMatch ].
currentCharacter == $o ifTrue: [
self recordMatch: #( 21 ).
self step.
(currentCharacter between: $0 and: $7) ifTrue: [
self step.
(currentCharacter between: $0 and: $7) ifTrue: [
self step.
(currentCharacter between: $0 and: $7) ifTrue: [
^ self recordAndReportMatch: #( 21 ) ] ] ].
^ self reportLastMatch ].
currentCharacter == $r ifTrue: [
self recordMatch: #( 21 ).
self step.
currentCharacter == $e ifTrue: [
(self scanForString: 'turn') ifTrue: [
^ self recordAndReportMatch: #( 21 ) ] ].
^ self reportLastMatch ].
currentCharacter == $s ifTrue: [
self recordMatch: #( 21 ).
self step.
currentCharacter == $p ifTrue: [ ^ self scan6 ].
^ self reportLastMatch ].
currentCharacter == $t ifTrue: [
self recordMatch: #( 21 ).
self step.
currentCharacter == $a ifTrue: [
self step.
currentCharacter == $b ifTrue: [
^ self recordAndReportMatch: #( 21 ) ] ].
^ self reportLastMatch ].
currentCharacter == $u ifTrue: [ ^ self scanForTokenX1X1 ].
^ self recordAndReportMatch: #( 21 )
]
{ #category : #generated }
CarpScanner >> scanForTokenX1X1 [
self recordMatch: #( 21 ).
self step.
(currentCharacter isDigit or: [ currentCharacter between: $A and: $F ])
ifTrue: [
self step.
(currentCharacter isDigit or: [
currentCharacter between: $A and: $F ]) ifTrue: [
self step.
(currentCharacter isDigit or: [
currentCharacter between: $A and: $F ]) ifTrue: [
self step.
(currentCharacter isDigit or: [
currentCharacter between: $A and: $F ]) ifTrue: [
^ self recordAndReportMatch: #( 21 ) ] ] ] ].
^ self reportLastMatch
]
{ #category : #generated }
CarpScanner >> scanForTokenX2 [
self recordMatch: #( 18 ).
self step.
currentCharacter == $. ifTrue: [ ^ self scan4 ].
currentCharacter == $b ifTrue: [
self recordMatch: #( 18 ).
self step.
(currentCharacter between: $0 and: $1) ifTrue: [
^ self recordAndReportMatch: #( 18 ) ].
^ self reportLastMatch ].
currentCharacter == $x ifTrue: [
self step.
(currentCharacter isDigit or: [
(currentCharacter between: $A and: $F) or: [
currentCharacter between: $a and: $f ] ]) ifTrue: [
^ self recordAndReportMatch: #( 18 ) ].
^ self reportLastMatch ].
currentCharacter isDigit ifTrue: [ ^ self scan5 ].
('fl' includes: currentCharacter) ifTrue: [
^ self recordAndReportMatch: #( 18 ) ].
^ self reportLastMatch
]
{ #category : #generated }
CarpScanner >> scanForTokenX3 [
[
self recordMatch: #( 14 ).
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 == $_ ] ] ] ] ] ] ] ] whileTrue.
^ self reportLastMatch
]
{ #category : #generated }
CarpScanner >> scanForTokenX4 [
[
self recordMatch: #( 13 ).
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 == $_ ] ] ] ] ] ] ] ] whileTrue
]
{ #category : #generated }
CarpScanner >> scanForTokenX5 [
[
self recordMatch: #( 19 ).
self step.
currentCharacter <= Character tab or: [
(currentCharacter between: Character pageUp and: Character newPage)
or: [ currentCharacter >= (Character value: 14) ] ] ] whileTrue.
^ self reportLastMatch
]
{ #category : #generated }
CarpScanner >> scanForTokenX6 [
[
self recordMatch: #( 20 ).
self step.
currentCharacter isSeparator or: [
currentCharacter == Character pageUp ] ] whileTrue.
^ self reportLastMatch
]
{ #category : #generated }
CarpScanner >> scanForTokenX7 [
self recordMatch: #( 2 ).
self step.
currentCharacter == $@ ifTrue: [ ^ self recordAndReportMatch: #( 3 ) ].
^ self reportLastMatch
]
{ #category : #generated }
CarpScanner >> scanForTokenX8 [
currentCharacter == $} ifTrue: [ ^ self recordAndReportMatch: #( 7 ) ].
currentCharacter == $~ ifTrue: [ ^ self recordAndReportMatch: #( 8 ) ].
currentCharacter isDigit ifTrue: [ ^ self scan5 ].
('''`' includes: currentCharacter) ifTrue: [
^ self recordAndReportMatch: #( 12 ) ].
(currentCharacter isSeparator or: [
currentCharacter == Character pageUp ]) ifTrue: [
^ self scanForTokenX6 ].
currentCharacter isUppercase ifTrue: [ ^ self scanForTokenX3 ].
(currentCharacter isLowercase or: [
('!$' includes: currentCharacter) or: [
(currentCharacter between: $* and: $+) or: [
('/:' includes: currentCharacter) or: [
(currentCharacter between: $< and: $?) or: [
currentCharacter == $_ ] ] ] ] ]) ifTrue: [
self scanForTokenX4 ].
^ self reportLastMatch
]
{ #category : #generated }
CarpScanner >> scanForTokenX9 [
currentCharacter == $( ifTrue: [
^ self recordAndReportMatch: #( 10 ) ].
currentCharacter == $) ifTrue: [
^ self recordAndReportMatch: #( 11 ) ].
currentCharacter == $, ifTrue: [
^ self recordAndReportMatch: #( 19 ) ].
currentCharacter == $- ifTrue: [ ^ self scan2 ].
currentCharacter == $. ifTrue: [
^ self recordAndReportMatch: #( 15 ) ].
currentCharacter == $0 ifTrue: [ ^ self scanForTokenX2 ].
currentCharacter == $; ifTrue: [ ^ self scanForTokenX5 ].
currentCharacter == $@ ifTrue: [ ^ self recordAndReportMatch: #( 5 ) ].
currentCharacter == $[ ifTrue: [
^ self recordAndReportMatch: #( 16 ) ].
currentCharacter == $\ ifTrue: [ ^ self scanForTokenX1 ].
currentCharacter == $] ifTrue: [
^ self recordAndReportMatch: #( 17 ) ].
currentCharacter == ${ ifTrue: [ ^ self recordAndReportMatch: #( 6 ) ].
^ self scanForTokenX8
]
{ #category : #generated }
CarpScanner >> tokenActions [
^ #( nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil
nil nil #comment #whitespace )
]

View File

@@ -1,40 +0,0 @@
Class {
#name : #CarpStartNode,
#superclass : #CarpExpressionNode,
#instVars : [
'expressions'
],
#category : #'Carp-AST'
}
{ #category : #generated }
CarpStartNode >> acceptVisitor: anExpressionVisitor [
^ anExpressionVisitor visitStart: self
]
{ #category : #generated }
CarpStartNode >> compositeNodeVariables [
^ #( #expressions )
]
{ #category : #generated }
CarpStartNode >> expressions [
^ expressions
]
{ #category : #generated }
CarpStartNode >> expressions: anOrderedCollection [
self setParents: self expressions to: nil.
expressions := anOrderedCollection.
self setParents: self expressions to: self
]
{ #category : #'generated-initialize-release' }
CarpStartNode >> initialize [
super initialize.
expressions := OrderedCollection new: 2.
]

View File

@@ -1,32 +0,0 @@
Class {
#name : #CarpStringNode,
#superclass : #CarpExpressionNode,
#instVars : [
'value'
],
#category : #'Carp-AST'
}
{ #category : #generated }
CarpStringNode >> acceptVisitor: anExpressionVisitor [
^ anExpressionVisitor visitString: self
]
{ #category : #generated }
CarpStringNode >> tokenVariables [
^ #( #value )
]
{ #category : #generated }
CarpStringNode >> value [
^ value
]
{ #category : #generated }
CarpStringNode >> value: aSmaCCToken [
value := aSmaCCToken
]

View File

@@ -1,34 +0,0 @@
Class {
#name : #CarpUnquoteNode,
#superclass : #CarpExpressionNode,
#instVars : [
'value'
],
#category : #'Carp-AST'
}
{ #category : #generated }
CarpUnquoteNode >> acceptVisitor: anExpressionVisitor [
^ anExpressionVisitor visitUnquote: self
]
{ #category : #generated }
CarpUnquoteNode >> nodeVariables [
^ #( #value )
]
{ #category : #generated }
CarpUnquoteNode >> value [
^ value
]
{ #category : #generated }
CarpUnquoteNode >> value: aCarpExpressionNode [
self value notNil ifTrue: [ self value parent: nil ].
value := aCarpExpressionNode.
self value notNil ifTrue: [ self value parent: self ]
]

View File

@@ -1,32 +0,0 @@
Class {
#name : #CarpVariableNode,
#superclass : #CarpExpressionNode,
#instVars : [
'value'
],
#category : #'Carp-AST'
}
{ #category : #generated }
CarpVariableNode >> acceptVisitor: anExpressionVisitor [
^ anExpressionVisitor visitVariable: self
]
{ #category : #generated }
CarpVariableNode >> tokenVariables [
^ #( #value )
]
{ #category : #generated }
CarpVariableNode >> value [
^ value
]
{ #category : #generated }
CarpVariableNode >> value: aSmaCCToken [
value := aSmaCCToken
]

View File

@@ -0,0 +1,129 @@
Class {
#name : #GtCarpCoderModel,
#superclass : #GtSourceCoder,
#instVars : [
'pharoBindings',
'carpLinkApplicationStrategy'
],
#category : #'Carp-Coder'
}
{ #category : #converting }
GtCarpCoderModel >> asCoderViewModel [
^ GtSourceCoderViewModel new coder: self
]
{ #category : #accessing }
GtCarpCoderModel >> bindAndExecute: sourceString [
"Answer the source code with all declared variables returned in an immediate dictionary"
<gtIgnoreConstraint: #GtRBAcceptVisitorCalledFromNonVisitingMethods>
| carpSource trimmedSource ast varNames lastStatement application commandFactory |
trimmedSource := SmaCCString on: sourceString trimRight.
ast := JSParser parse: trimmedSource.
"The variables to be returned are names that are in pharoBindings"
varNames := pharoBindings bindingNames asSet.
"Assign the final statement to snippetResult"
lastStatement := ast items last.
trimmedSource
insert: '(defdynamic snippetResult '
at: lastStatement startPosition.
varNames add: 'snippetResult'.
"Get the final source to execute"
carpSource := self sourceFrom: trimmedSource asString returnedVarNames: varNames.
application := carpLinkApplicationStrategy applicationServer.
application isRunning ifFalse: [ application start ].
commandFactory := application newCommandFactory.
^ commandFactory
<< carpSource;
sendAndWait.
]
{ #category : #accessing }
GtCarpCoderModel >> carpLinkApplicationStrategy: anApplicationStrategy [
carpLinkApplicationStrategy := anApplicationStrategy
]
{ #category : #accessing }
GtCarpCoderModel >> computeAst: theSourceString [
^ CarpParser
parseWithErrors: theSourceString
]
{ #category : #accessing }
GtCarpCoderModel >> initializeAddOns: addOns [
super initializeAddOns: addOns.
addOns addStyler: (GtCoderAstSmaCCParserStyler new smaccStyler: CarpParser gtStyler).
addOns
addMainAction: 'Evaluate' translated
icon: BrGlamorousVectorIcons play
action: [ :aCoderUIModel :anElement |
GtCoderCodeExecutor doIt
coderViewModel: aCoderUIModel;
element: anElement;
execute ]
id: GtSourceCoderDoItActionId.
addOns
addMainAction: 'Inspect' translated
icon: BrGlamorousVectorIcons playinspect
action: [ :aCoderUIModel :anElement |
GtCoderCodeExecutor doItAndGo
coderViewModel: aCoderUIModel;
element: anElement;
execute ]
id: GtSourceCoderDoItAndGoActionId.
]
{ #category : #accessing }
GtCarpCoderModel >> initializeShortcuts: addOns [
super initializeShortcuts: addOns.
addOns
addShortcut: GtSourceCoderDoItShortcut new;
addShortcut: GtSourceCoderDoItAndInspectShortcut new
]
{ #category : #accessing }
GtCarpCoderModel >> newCompletionStrategy [
^ GtCompletionStrategy new
]
{ #category : #accessing }
GtCarpCoderModel >> pharoBindings: anObject [
pharoBindings := anObject
]
{ #category : #accessing }
GtCarpCoderModel >> sourceFrom: trimmedSourceString returnedVarNames: varNames [
"Answer the modified source to return the declared variables"
^ String streamContents: [ :stream |
stream << trimmedSourceString.
stream
cr
<< '{ '.
varNames do: [ :varName |
stream
<< '(quote ';
<< varName;
<< ') ';
<< varName;
<< ' ' ].
"Answer the variable dictionary as an immediate object"
stream
<< '(quote carpLinkImmediate) true }' ]
]
{ #category : #accessing }
GtCarpCoderModel >> variableBindings: aGtSnippetBindings [
^ self pharoBindings: aGtSnippetBindings
]

View File

@@ -0,0 +1,57 @@
Class {
#name : #LeCarpApplicationStrategy,
#superclass : #LeExternalServerStrategy,
#category : #'Carp-Lepiter'
}
{ #category : #accessing }
LeCarpApplicationStrategy class >> strategyName [
^ #global
]
{ #category : #accessing }
LeCarpApplicationStrategy >> applicationServer [
content database isDatabase ifFalse: [ ^ nil ].
JSLinkApplication uniqueInstance ifNil:
[ JSLinkApplication uniqueInstance: (self newJavaScriptApplicationFor: content database) ].
^ JSLinkApplication uniqueInstance
]
{ #category : #accessing }
LeCarpApplicationStrategy >> applicationSettings [
"Answer the settings that will be used by the server.
This musn't actually start the server as that should be deferred until a snippet is evaluated for the first time."
^ JSLinkApplication isRunning ifTrue:
[ JSLinkApplication uniqueInstance settings ]
ifFalse:
[ self updatedSettings: JSLinkApplication defaultSettings ]
]
{ #category : #accessing }
LeCarpApplicationStrategy >> newJavaScriptApplicationFor: aLeDatabase [
^ JSLinkApplication new initializeWith:
(self updatedSettings: LanguageLinkSettings carpDefaultSettings).
]
{ #category : #accessing }
LeCarpApplicationStrategy >> updatedSettings: applicationCarpSettings [
"Update the supplied settings with the lepiter configuration"
| lepiterCarpSettings lepiterDatabase carpDir |
lepiterDatabase := content database.
lepiterCarpSettings := lepiterDatabase properties carpLinkSettings.
lepiterCarpSettings directory ifNotNil:
[ :relativeDir |
carpDir := lepiterDatabase localStoreRootDirectory resolve: relativeDir.
applicationCarpSettings workingDirectory: carpDir ].
"lepiterCarpSettings carpPath ifNotNil:
[ :carpPath | applicationCarpSettings serverExecutable: carpPath ]."
applicationCarpSettings serverDebugMode: lepiterCarpSettings serverDebugMode.
^ applicationCarpSettings
]

View File

@@ -0,0 +1,42 @@
Class {
#name : #LeCarpSnippet,
#superclass : #LeCodeSnippet,
#category : #'Carp-Lepiter'
}
{ #category : #'api - accessing menu' }
LeCarpSnippet class >> contextMenuItemSpecification [
<leSnippetSpecification>
^ LeContextMenuItemSpecification new
snippetClass: self;
title: 'Carp'
]
{ #category : #'lepiter-store' }
LeCarpSnippet class >> leJsonV3Name [
^ 'carpSnippet'
]
{ #category : #'lepiter-store' }
LeCarpSnippet class >> leJsonV4Name [
^ 'carpSnippet'
]
{ #category : #visiting }
LeCarpSnippet >> acceptVisitor: aVisitor [
^ aVisitor visitCarpSnippet: self
]
{ #category : #converting }
LeCarpSnippet >> asSnippetViewModel [
<return: #LeSnippetViewModel>
^ LeCarpSnippetViewModel new snippetModel: self
]
{ #category : #accessing }
LeCarpSnippet >> newCoder [
^ GtCarpCoderModel new
]

View File

@@ -0,0 +1,36 @@
Class {
#name : #LeCarpSnippetElement,
#superclass : #LeExternalEvaluatedSnippetElement,
#category : #'Carp-Lepiter'
}
{ #category : #accessing }
LeCarpSnippetElement >> onSnippetViewModelChanged [
super onSnippetViewModelChanged.
self updateLanguageLabel.
self coder
carpLinkApplicationStrategy: self serverStrategy;
pharoBindings: self snippetViewModel snippetBindings
]
{ #category : #accessing }
LeCarpSnippetElement >> serverStrategy [
^ serverStrategy ifNil:
[ serverStrategy := LeCarpApplicationStrategy new content: self ].
]
{ #category : #accessing }
LeCarpSnippetElement >> updateLanguageLabel [
| serverAddress label |
serverAddress := self serverStrategy applicationSettings serverSocketAddress.
label := String streamContents: [ :stream |
stream
<< 'Carp @ ';
<< serverAddress ipOrName;
<< ':';
print: serverAddress port ].
languageElement text: (label asRopedText glamorousRegularFont foreground: BrGlamorousColors textMarkupColor).
]

View File

@@ -0,0 +1,29 @@
Class {
#name : #LeCarpSnippetViewModel,
#superclass : #LeCodeSnippetViewModel,
#category : #'Carp-Lepiter'
}
{ #category : #accessing }
LeCarpSnippetViewModel >> initializeCoderAddOns: aCoderViewModel [
"Initialise the keyboard shortcuts in the code editor"
aCoderViewModel
"Create New snippet (after the current snippet)"
addShortcut: (LeSnippetSplitSnippetShortcut new combination: (self keyboardShortcut: #SplitSnippet));
"Delete previous character, or merge with previous snippet"
addShortcut: (LeSnippetDeletePreviousShortcut new combination: (self keyboardShortcut: #DeletePrevious));
"Indent LeSnippet"
addShortcut: (LeSnippetIndentSnippetShortcut new combination: (self keyboardShortcut: #IndentSnippet));
"Unindent LeSnippet"
addShortcut: (LeSnippetUnindentSnippetShortcut new combination: (self keyboardShortcut: #UnindentSnippet));
"Move Snippet up"
addShortcut: (LeSnippetMoveSnippetUpShortcut new combination: (self keyboardShortcut: #MoveSnippetUp));
"Move Snippet down"
addShortcut: (LeSnippetMoveSnippetDownShortcut new combination: (self keyboardShortcut: #MoveSnippetDown))
]
{ #category : #accessing }
LeCarpSnippetViewModel >> snippetElementClass [
^ LeCarpSnippetElement
]

View File

@@ -0,0 +1,13 @@
Extension { #name : #LeRoamJSONExportVisitor }
{ #category : #'*Carp' }
LeRoamJSONExportVisitor >> visitCarpSnippet: aSnippet [
^ String streamContents: [ :aStream |
aStream
<< '```javascript';
cr;
<< aSnippet code;
cr;
<< '```' ]
]

View File

@@ -1,108 +0,0 @@
Trait {
#name : #TCarpExpressionNodeVisitor,
#traits : 'TSmaCCParseNodeVisitor',
#classTraits : 'TSmaCCParseNodeVisitor classTrait',
#category : #'Carp-Parser'
}
{ #category : #generated }
TCarpExpressionNodeVisitor >> visitArray: anArray [
^ self visitExpression: anArray
]
{ #category : #generated }
TCarpExpressionNodeVisitor >> visitCharacter: aCharacter [
^ self visitExpression: aCharacter
]
{ #category : #generated }
TCarpExpressionNodeVisitor >> visitDeref: aDeref [
^ self visitExpression: aDeref
]
{ #category : #generated }
TCarpExpressionNodeVisitor >> visitExpression: anExpression [
^ self visitSmaCCParseNode: anExpression
]
{ #category : #generated }
TCarpExpressionNodeVisitor >> visitList: aList [
^ self visitExpression: aList
]
{ #category : #generated }
TCarpExpressionNodeVisitor >> visitMap: aMap [
^ self visitExpression: aMap
]
{ #category : #generated }
TCarpExpressionNodeVisitor >> visitModuleOrType: aModuleOrType [
^ self visitExpression: aModuleOrType
]
{ #category : #generated }
TCarpExpressionNodeVisitor >> visitNumber: aNumber [
^ self visitExpression: aNumber
]
{ #category : #generated }
TCarpExpressionNodeVisitor >> visitPair: aPair [
^ self visitExpression: aPair
]
{ #category : #generated }
TCarpExpressionNodeVisitor >> visitPattern: aPattern [
^ self visitExpression: aPattern
]
{ #category : #generated }
TCarpExpressionNodeVisitor >> visitQuote: aQuote [
^ self visitExpression: aQuote
]
{ #category : #generated }
TCarpExpressionNodeVisitor >> visitRef: aRef [
^ self visitExpression: aRef
]
{ #category : #generated }
TCarpExpressionNodeVisitor >> visitRefCall: aRefCall [
^ self visitExpression: aRefCall
]
{ #category : #generated }
TCarpExpressionNodeVisitor >> visitStart: aStart [
^ self visitExpression: aStart
]
{ #category : #generated }
TCarpExpressionNodeVisitor >> visitString: aString [
^ self visitExpression: aString
]
{ #category : #generated }
TCarpExpressionNodeVisitor >> visitUnquote: anUnquote [
^ self visitExpression: anUnquote
]
{ #category : #generated }
TCarpExpressionNodeVisitor >> visitVariable: aVariable [
^ self visitExpression: aVariable
]

View File

@@ -0,0 +1,6 @@
Extension { #name : #TLeModelVisitor }
{ #category : #'*Carp' }
TLeModelVisitor >> visitCarpSnippet: aSnippet [
^ self visitTextualSnippet: aSnippet
]