carp checkers: add carp checker and make it work
This commit is contained in:
1
Pond.package/CarpCheckExample.class/README.md
Normal file
1
Pond.package/CarpCheckExample.class/README.md
Normal file
@@ -0,0 +1 @@
|
|||||||
|
I’m an example for checking Carp code.
|
@@ -0,0 +1,6 @@
|
|||||||
|
examples
|
||||||
|
failingCarpChecker
|
||||||
|
^ CarpChecker new
|
||||||
|
carp: '/Users/veitheller/.local/bin/carp';
|
||||||
|
dir: '/Users/veitheller/Documents/Code/Github/carp/Carp/';
|
||||||
|
file: '(def x a)'
|
@@ -0,0 +1,6 @@
|
|||||||
|
examples
|
||||||
|
succeedingCarpChecker
|
||||||
|
^ CarpChecker new
|
||||||
|
carp: '/Users/veitheller/.local/bin/carp';
|
||||||
|
dir: '/Users/veitheller/Documents/Code/Github/carp/Carp/';
|
||||||
|
file: '(def x 1)'
|
11
Pond.package/CarpCheckExample.class/properties.json
Normal file
11
Pond.package/CarpCheckExample.class/properties.json
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"commentStamp" : "VeitHeller 12/16/2019 12:01",
|
||||||
|
"super" : "Object",
|
||||||
|
"category" : "Pond",
|
||||||
|
"classinstvars" : [ ],
|
||||||
|
"pools" : [ ],
|
||||||
|
"classvars" : [ ],
|
||||||
|
"instvars" : [ ],
|
||||||
|
"name" : "CarpCheckExample",
|
||||||
|
"type" : "normal"
|
||||||
|
}
|
1
Pond.package/CarpCheckParser.class/README.md
Normal file
1
Pond.package/CarpCheckParser.class/README.md
Normal file
@@ -0,0 +1 @@
|
|||||||
|
I’m a parser for the results of a Carp check.
|
7
Pond.package/CarpCheckParser.class/instance/parse..st
Normal file
7
Pond.package/CarpCheckParser.class/instance/parse..st
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
parsing
|
||||||
|
parse: aStream
|
||||||
|
| split contents |
|
||||||
|
contents := aStream upToEnd.
|
||||||
|
contents ifEmpty: [ ^ OrderedCollection new ].
|
||||||
|
split := contents splitOn: '\n'.
|
||||||
|
^ split collect: [ :s | self parseLine: s ]
|
13
Pond.package/CarpCheckParser.class/instance/parseLine..st
Normal file
13
Pond.package/CarpCheckParser.class/instance/parseLine..st
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
parsing
|
||||||
|
parseLine: aLine
|
||||||
|
| split res |
|
||||||
|
split := aLine splitOn: ':'.
|
||||||
|
split size == 3 ifFalse: [
|
||||||
|
^ CarpParseError new message: 'unparseable checker line: "' , aLine , '"'].
|
||||||
|
res := CarpParseError new
|
||||||
|
file: (split at: 1);
|
||||||
|
line: (split at: 2) asNumber.
|
||||||
|
split := (split at: 3) splitOn: ' '.
|
||||||
|
^ res
|
||||||
|
column: (split at: 1) asNumber;
|
||||||
|
message: (' ' join: split allButFirst)
|
11
Pond.package/CarpCheckParser.class/properties.json
Normal file
11
Pond.package/CarpCheckParser.class/properties.json
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"commentStamp" : "VeitHeller 12/16/2019 11:18",
|
||||||
|
"super" : "Object",
|
||||||
|
"category" : "Pond",
|
||||||
|
"classinstvars" : [ ],
|
||||||
|
"pools" : [ ],
|
||||||
|
"classvars" : [ ],
|
||||||
|
"instvars" : [ ],
|
||||||
|
"name" : "CarpCheckParser",
|
||||||
|
"type" : "normal"
|
||||||
|
}
|
1
Pond.package/CarpChecker.class/README.md
Normal file
1
Pond.package/CarpChecker.class/README.md
Normal file
@@ -0,0 +1 @@
|
|||||||
|
I’m a special case of a Carp process for checking errors.
|
9
Pond.package/CarpChecker.class/instance/check.st
Normal file
9
Pond.package/CarpChecker.class/instance/check.st
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
checking
|
||||||
|
check
|
||||||
|
| f |
|
||||||
|
f := FileReference newTempFilePrefix: 'checker' suffix: '.carp'.
|
||||||
|
f writeStreamDo: [:stream | stream nextPutAll: file].
|
||||||
|
proc arguments: {'--check' . f pathString }.
|
||||||
|
self run.
|
||||||
|
excepted ifNotNil: [ CarpError new messageText: excepted messageText ].
|
||||||
|
self died ifFalse: [ ^ CarpCheckParser new parse: proc stdoutStream ]
|
3
Pond.package/CarpChecker.class/instance/file..st
Normal file
3
Pond.package/CarpChecker.class/instance/file..st
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
checking
|
||||||
|
file: aString
|
||||||
|
file := aString
|
3
Pond.package/CarpChecker.class/instance/file.st
Normal file
3
Pond.package/CarpChecker.class/instance/file.st
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
checking
|
||||||
|
file
|
||||||
|
^ file
|
5
Pond.package/CarpChecker.class/instance/initialize.st
Normal file
5
Pond.package/CarpChecker.class/instance/initialize.st
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
checking
|
||||||
|
initialize
|
||||||
|
proc := OSSUnixSubprocess new command: 'carp';
|
||||||
|
redirectStdout;
|
||||||
|
addAllEnvVariablesFromParentWithoutOverride
|
4
Pond.package/CarpChecker.class/instance/run.st
Normal file
4
Pond.package/CarpChecker.class/instance/run.st
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
checking
|
||||||
|
run
|
||||||
|
[ [ proc run ] on: Error do: [ :err | excepted := err ] ] fork.
|
||||||
|
(Delay forMilliseconds: 500) wait.
|
13
Pond.package/CarpChecker.class/properties.json
Normal file
13
Pond.package/CarpChecker.class/properties.json
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
{
|
||||||
|
"commentStamp" : "VeitHeller 12/16/2019 10:34",
|
||||||
|
"super" : "CarpProcess",
|
||||||
|
"category" : "Pond",
|
||||||
|
"classinstvars" : [ ],
|
||||||
|
"pools" : [ ],
|
||||||
|
"classvars" : [ ],
|
||||||
|
"instvars" : [
|
||||||
|
"file"
|
||||||
|
],
|
||||||
|
"name" : "CarpChecker",
|
||||||
|
"type" : "normal"
|
||||||
|
}
|
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"commentStamp" : "VeitHeller 12/14/2019 17:49",
|
"commentStamp" : "VeitHeller 12/14/2019 17:49",
|
||||||
"super" : "Exception",
|
"super" : "Error",
|
||||||
"category" : "Pond",
|
"category" : "Pond",
|
||||||
"classinstvars" : [ ],
|
"classinstvars" : [ ],
|
||||||
"pools" : [ ],
|
"pools" : [ ],
|
||||||
@@ -9,6 +9,6 @@
|
|||||||
"parent",
|
"parent",
|
||||||
"error"
|
"error"
|
||||||
],
|
],
|
||||||
"name" : "CarpException",
|
"name" : "CarpError",
|
||||||
"type" : "normal"
|
"type" : "normal"
|
||||||
}
|
}
|
1
Pond.package/CarpParseError.class/README.md
Normal file
1
Pond.package/CarpParseError.class/README.md
Normal file
@@ -0,0 +1 @@
|
|||||||
|
I represent a line of Carp checker output.
|
3
Pond.package/CarpParseError.class/instance/column..st
Normal file
3
Pond.package/CarpParseError.class/instance/column..st
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
accessing
|
||||||
|
column: aNumber
|
||||||
|
column := aNumber
|
3
Pond.package/CarpParseError.class/instance/file..st
Normal file
3
Pond.package/CarpParseError.class/instance/file..st
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
accessing
|
||||||
|
file: aString
|
||||||
|
file := aString
|
3
Pond.package/CarpParseError.class/instance/line..st
Normal file
3
Pond.package/CarpParseError.class/instance/line..st
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
accessing
|
||||||
|
line: aNumber
|
||||||
|
line := aNumber
|
3
Pond.package/CarpParseError.class/instance/message..st
Normal file
3
Pond.package/CarpParseError.class/instance/message..st
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
accessing
|
||||||
|
message: aString
|
||||||
|
message := aString
|
13
Pond.package/CarpParseError.class/instance/printOn..st
Normal file
13
Pond.package/CarpParseError.class/instance/printOn..st
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
accessing
|
||||||
|
printOn: aStream
|
||||||
|
(file isNil or: [ line isNil or: column isNil ])
|
||||||
|
ifTrue: [ aStream nextPutAll: message ]
|
||||||
|
ifFalse: [
|
||||||
|
aStream nextPutAll: file.
|
||||||
|
aStream nextPutAll: ':'.
|
||||||
|
aStream nextPutAll: line asString.
|
||||||
|
aStream nextPutAll: ':'.
|
||||||
|
aStream nextPutAll: column asString.
|
||||||
|
aStream nextPutAll: ' '.
|
||||||
|
aStream nextPutAll: message.
|
||||||
|
]
|
16
Pond.package/CarpParseError.class/properties.json
Normal file
16
Pond.package/CarpParseError.class/properties.json
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
{
|
||||||
|
"commentStamp" : "VeitHeller 12/16/2019 11:26",
|
||||||
|
"super" : "Object",
|
||||||
|
"category" : "Pond",
|
||||||
|
"classinstvars" : [ ],
|
||||||
|
"pools" : [ ],
|
||||||
|
"classvars" : [ ],
|
||||||
|
"instvars" : [
|
||||||
|
"file",
|
||||||
|
"line",
|
||||||
|
"column",
|
||||||
|
"message"
|
||||||
|
],
|
||||||
|
"name" : "CarpParseError",
|
||||||
|
"type" : "normal"
|
||||||
|
}
|
@@ -1,3 +1,3 @@
|
|||||||
as yet unclassified
|
as yet unclassified
|
||||||
carp: aString
|
carp: aString
|
||||||
^ self new setCarp: aString
|
^ self new carp: aString
|
3
Pond.package/CarpProcess.class/instance/carp..st
Normal file
3
Pond.package/CarpProcess.class/instance/carp..st
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
accessing
|
||||||
|
carp: aString
|
||||||
|
proc command: aString
|
3
Pond.package/CarpProcess.class/instance/dir..st
Normal file
3
Pond.package/CarpProcess.class/instance/dir..st
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
accessing
|
||||||
|
dir: aString
|
||||||
|
proc environmentAt: 'CARP_DIR' put: aString
|
@@ -1,3 +0,0 @@
|
|||||||
accessing
|
|
||||||
setCarp: aString
|
|
||||||
proc command: aString
|
|
@@ -1,3 +0,0 @@
|
|||||||
accessing
|
|
||||||
setDir: aString
|
|
||||||
proc environmentAt: 'CARP_DIR' put: aString
|
|
@@ -7,8 +7,6 @@
|
|||||||
"classvars" : [ ],
|
"classvars" : [ ],
|
||||||
"instvars" : [
|
"instvars" : [
|
||||||
"proc",
|
"proc",
|
||||||
"out",
|
|
||||||
"in",
|
|
||||||
"excepted"
|
"excepted"
|
||||||
],
|
],
|
||||||
"name" : "CarpProcess",
|
"name" : "CarpProcess",
|
||||||
|
Reference in New Issue
Block a user