Skip to content

Commit

Permalink
NumberParser as standalone package
Browse files Browse the repository at this point in the history
  • Loading branch information
pavel-krivanek committed Nov 2, 2019
1 parent 70d198b commit 7ad5f86
Show file tree
Hide file tree
Showing 18 changed files with 46 additions and 40 deletions.
10 changes: 3 additions & 7 deletions src/AST-Core/ASTCache.class.st
Expand Up @@ -37,20 +37,16 @@ ASTCache class >> at: aCompiledMethod [

{ #category : #accessing }
ASTCache class >> default [
^ default
^ default ifNil: [
SessionManager default registerSystemClassNamed: self name.
default := self new ]
]

{ #category : #accessing }
ASTCache class >> default: anASTCache [
default := anASTCache
]

{ #category : #'class initialization' }
ASTCache class >> initialize [
default := self new.
SessionManager default registerSystemClassNamed: self name
]

{ #category : #initialization }
ASTCache class >> reset [
<script>
Expand Down
12 changes: 0 additions & 12 deletions src/AST-Core/Integer.extension.st
Expand Up @@ -7,18 +7,6 @@ Integer class >> readFrom: aStringOrStream [
^self readFrom: aStringOrStream base: 10
]

{ #category : #'*AST-Core-Parser' }
Integer class >> readFrom: aStringOrStream base: base [
"Answer an instance of one of the concrete subclasses if Integer.
Initial minus sign accepted, and bases > 10 use letters A-Z.
Imbedded radix specifiers not allowed; use Number
class readFrom: for that.
Raise an Error if there are no digits.
If stringOrStream dos not start with a valid number description, answer 0 for backward compatibility. This is not clever and should better be changed."

^(NumberParser on: aStringOrStream) nextIntegerBase: base
]

{ #category : #'*AST-Core-Parser' }
Integer class >> readFrom: aStringOrStream ifFail: aBlock [
"Answer an instance of one of the concrete subclasses if Integer.
Expand Down
8 changes: 0 additions & 8 deletions src/AST-Core/Number.extension.st
Expand Up @@ -11,14 +11,6 @@ Number class >> readFrom: stringOrStream [
^(NumberParser on: stringOrStream) nextNumber
]

{ #category : #'*AST-Core-Parser' }
Number class >> readFrom: stringOrStream base: base [
"Answer a number as described on aStream in the given number base.
If stringOrStream does not start with a valid number description, answer 0 for backward compatibility. This is not clever and should better be changed."

^(NumberParser on: stringOrStream) nextNumberBase: base
]

{ #category : #'*AST-Core-Parser' }
Number class >> readFrom: stringOrStream ifFail: aBlock [
"Answer a number as described on aStream. The number may
Expand Down
Expand Up @@ -96,6 +96,7 @@ BaselineOfPharoBootstrap >> baseline: spec [
spec package: 'Kernel'.
spec package: 'Kernel-BytecodeEncoders'.
spec package: 'Kernel-Chronology-Extras'.
spec package: 'NumberParser'.

spec package: 'Math-Operations-Extensions'.

Expand Down Expand Up @@ -188,6 +189,7 @@ BaselineOfPharoBootstrap >> baseline: spec [
'System-SessionManager'.
'System-Sources'.
'System-Support'.
'NumberParser'.

'UIManager'.
'Zinc-Character-Encoding-Core' }.
Expand Down
Expand Up @@ -14,7 +14,7 @@ ManifestCollectionsStrings class >> dependencies [

{ #category : #'meta-data - dependency analyser' }
ManifestCollectionsStrings class >> manuallyResolvedDependencies [
^ #(#'System-Support' #'AST-Core' #'OpalCompiler-Core')
^ #(#'System-Support' #'OpalCompiler-Core')
]

{ #category : #'meta-data' }
Expand Down
2 changes: 1 addition & 1 deletion src/Colors/ManifestColors.class.st
Expand Up @@ -9,5 +9,5 @@ Class {

{ #category : #'meta-data - dependency analyser' }
ManifestColors class >> manuallyResolvedDependencies [
^ #(#'Collections-Streams' #'AST-Core')
^ #(#'Collections-Streams')
]
2 changes: 1 addition & 1 deletion src/Kernel/ManifestKernel.class.st
Expand Up @@ -19,7 +19,7 @@ ManifestKernel class >> ignoredDependencies [

{ #category : #'meta-data - dependency analyser' }
ManifestKernel class >> manuallyResolvedDependencies [
^ #(#'System-Settings-Core' #'System-Sources' #'System-Platforms' #'Multilingual-TextConversion' #'AST-Core' #'Shift-ClassBuilder' #'Regex-Core' #'RPackage-Core' #'Zinc-Character-Encoding-Core' #Reflectivity #'Shift-ClassInstaller' #'FFI-Kernel')
^ #(#'System-Settings-Core' #'System-Sources' #'System-Platforms' #'Multilingual-TextConversion' #'Shift-ClassBuilder' #'Regex-Core' #'RPackage-Core' #'Zinc-Character-Encoding-Core' #Reflectivity #'Shift-ClassInstaller' #'FFI-Kernel')
]

{ #category : #'meta-data' }
Expand Down
Expand Up @@ -9,5 +9,5 @@ Class {

{ #category : #'meta-data - dependency analyser' }
ManifestMultilingualEncodings class >> manuallyResolvedDependencies [
^ #(#'Multilingual-TextConversion' #'AST-Core' #'Collections-Streams' #'Collections-Abstract')
^ #(#'Multilingual-TextConversion' #'Collections-Streams' #'Collections-Abstract')
]
2 changes: 1 addition & 1 deletion src/Network-UUID/ManifestNetworkUUID.class.st
Expand Up @@ -14,5 +14,5 @@ ManifestNetworkUUID class >> ignoredDependencies [

{ #category : #'meta-data - dependency analyser' }
ManifestNetworkUUID class >> manuallyResolvedDependencies [
^ #(#'AST-Core' #'Collections-Abstract')
^ #(#'Collections-Abstract')
]
13 changes: 13 additions & 0 deletions src/NumberParser/Integer.extension.st
@@ -0,0 +1,13 @@
Extension { #name : #Integer }

{ #category : #'*NumberParser' }
Integer class >> readFrom: aStringOrStream base: base [
"Answer an instance of one of the concrete subclasses if Integer.
Initial minus sign accepted, and bases > 10 use letters A-Z.
Imbedded radix specifiers not allowed; use Number
class readFrom: for that.
Raise an Error if there are no digits.
If stringOrStream dos not start with a valid number description, answer 0 for backward compatibility. This is not clever and should better be changed."

^(NumberParser on: aStringOrStream) nextIntegerBase: base
]
8 changes: 8 additions & 0 deletions src/NumberParser/ManifestNumberParser.class.st
@@ -0,0 +1,8 @@
"
NumberParser is parsing and building numbers from string/stream.
"
Class {
#name : #ManifestNumberParser,
#superclass : #PackageManifest,
#category : #'NumberParser-Manifest'
}
9 changes: 9 additions & 0 deletions src/NumberParser/Number.extension.st
@@ -0,0 +1,9 @@
Extension { #name : #Number }

{ #category : #'*NumberParser' }
Number class >> readFrom: stringOrStream base: base [
"Answer a number as described on aStream in the given number base.
If stringOrStream does not start with a valid number description, answer 0 for backward compatibility. This is not clever and should better be changed."

^(NumberParser on: stringOrStream) nextNumberBase: base
]
Expand Up @@ -33,7 +33,7 @@ Class {
'requestor',
'failBlock'
],
#category : #'AST-Core-Parser'
#category : #NumberParser
}

{ #category : #testing }
Expand Down
1 change: 1 addition & 0 deletions src/NumberParser/package.st
@@ -0,0 +1 @@
Package { #name : #NumberParser }
Expand Up @@ -14,7 +14,7 @@ ManifestPharoBootstrapInitialization class >> ignoredDependencies [

{ #category : #'meta-data - dependency analyser' }
ManifestPharoBootstrapInitialization class >> manuallyResolvedDependencies [
^ #(#'System-Finalization' #'SUnit-Core')
^ #(#'System-Finalization')
]

{ #category : #'meta-data - dependency analyser' }
Expand Down
Expand Up @@ -68,10 +68,7 @@ PharoBootstrapInitialization class >> initializeCommandLineHandlerAndErrorHandli
Smalltalk sourceFileVersionString: 'PharoV60'.
(Smalltalk class classVariableNamed: 'LastImagePath') value: Smalltalk imagePath. "set the default value"
SourceFiles := SourceFileArray new.

"Create the ASTCache and add it to the startup list"
ASTCache initialize.


Color initialize.
InstructionStream initialize.
SmallInteger initialize.
Expand Down
Expand Up @@ -101,7 +101,7 @@ SystemDependenciesTest >> knownKernelDependencies [

"ideally this list should be empty"

^ #(#'FileSystem-Core' #'OpalCompiler-Core' #'System-Changes' #'AST-Core')
^ #(#'FileSystem-Core' #'OpalCompiler-Core' #'System-Changes')
]

{ #category : #'known dependencies' }
Expand Down
2 changes: 1 addition & 1 deletion src/System-Hashing/ManifestSystemHashing.class.st
Expand Up @@ -9,6 +9,6 @@ Class {

{ #category : #'meta-data - dependency analyser' }
ManifestSystemHashing class >> manuallyResolvedDependencies [
^ #(#'Collections-Streams' #'System-Platforms' #'OpalCompiler-Core' #'AST-Core' #'Collections-Abstract')
^ #(#'Collections-Streams' #'System-Platforms' #'OpalCompiler-Core' #'Collections-Abstract')

]

0 comments on commit 7ad5f86

Please sign in to comment.