parsers/java/PJIntegerLiteralNode.st
changeset 435 3bc08fb90133
equal deleted inserted replaced
434:840942b96eea 435:3bc08fb90133
       
     1 "{ Package: 'stx:goodies/petitparser/parsers/java' }"
       
     2 
       
     3 "{ NameSpace: Smalltalk }"
       
     4 
       
     5 PJExpressionNode subclass:#PJIntegerLiteralNode
       
     6 	instanceVariableNames:'literalValue isLong'
       
     7 	classVariableNames:''
       
     8 	poolDictionaries:''
       
     9 	category:'PetitJava-AST'
       
    10 !
       
    11 
       
    12 PJIntegerLiteralNode comment:'A literal node of an integer valuse'
       
    13 !
       
    14 
       
    15 !PJIntegerLiteralNode class methodsFor:'as yet unclassified'!
       
    16 
       
    17 newFrom: literalString
       
    18 	| instanse |
       
    19 	instanse := super new.
       
    20 	instanse isLong: literalString last asUppercase = $L.
       
    21 	instanse literalValue: (
       
    22 		Integer readFromJavaString: (
       
    23 			instanse isLong ifTrue: [ literalString allButLast ] ifFalse: [ literalString ])).
       
    24 	^ instanse
       
    25 ! !
       
    26 
       
    27 !PJIntegerLiteralNode methodsFor:'accessing'!
       
    28 
       
    29 isLong
       
    30 	^ isLong
       
    31 !
       
    32 
       
    33 isLong: anObject
       
    34 	isLong := anObject
       
    35 !
       
    36 
       
    37 literalValue
       
    38 	^ literalValue
       
    39 !
       
    40 
       
    41 literalValue: aBoolean
       
    42 	literalValue := aBoolean
       
    43 ! !
       
    44 
       
    45 !PJIntegerLiteralNode methodsFor:'visiting'!
       
    46 
       
    47 acceptVisitor: aVisitor
       
    48 
       
    49 	^ aVisitor visitIntegerLiteralNode: self
       
    50 ! !
       
    51