parsers/java/PJTraditionalCommentsNode.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Fri, 19 Jun 2015 07:14:07 +0100
changeset 500 cf3cbf3933f1
parent 436 e1c44b571db9
permissions -rw-r--r--
Use RBVariableNode>>name: to change variable's name. The old way - `node token value:` is working in Pharo - there's no token in RBVariableNode. Sigh.

"{ Package: 'stx:goodies/petitparser/parsers/java' }"

"{ NameSpace: Smalltalk }"

PJCommentsNode subclass:#PJTraditionalCommentsNode
	instanceVariableNames:''
	classVariableNames:''
	poolDictionaries:''
	category:'PetitJava-AST'
!


!PJTraditionalCommentsNode methodsFor:'as yet unclassified'!

comment: anArray
	| temp temp2 |
	temp := OrderedCollection new.
	temp2 := anArray.
	temp2
		ifNotNil: [ 
			[ temp2 first = '*' and: temp2 second = '/' ]
				whileFalse: [ 
					temp2 first = '*'
						ifFalse: [ temp2 first second ifNotNil: [ temp add: temp2 first second ] ]
						ifTrue: [ temp2 first first ifNotNil: [ temp add: temp2 first first ] ].
					temp2 := temp2 second ].
			comment := (temp collect: #asciiValue) asByteArray asString ].
	anArray isNil
		ifTrue: [ comment := '' ]
!

printOn: aStream
	^	aStream 
		nextPutAll: 'comment value ==> ';
		nextPutAll: self comment.
  
! !

!PJTraditionalCommentsNode class methodsFor:'documentation'!

version_HG

    ^ '$Changeset: <not expanded> $'
! !