PPTokenParser.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Tue, 16 Jun 2015 07:49:21 +0100
changeset 491 82b272c7dc37
parent 181 6e0a8571dd88
permissions -rw-r--r--
Codegen: added support for smart action node compiling. Avoid creation of intermediate result collection for action nodes if all references to action block's argument (i.e., the nodes collection) is in form of: * <nodes> at: <numeric constant> * <nodes> first (second, third...

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

PPFlattenParser subclass:#PPTokenParser
	instanceVariableNames:'tokenClass'
	classVariableNames:''
	poolDictionaries:''
	category:'PetitParser-Parsers'
!


!PPTokenParser methodsFor:'*petitanalyzer-matching'!

match: aParser inContext: aDictionary seen: anIdentitySet
	^ (super match: aParser inContext: aDictionary seen: anIdentitySet) and: [ self tokenClass = aParser tokenClass ]
! !

!PPTokenParser methodsFor:'accessing'!

tokenClass
	^ tokenClass
!

tokenClass: aTokenClass
	tokenClass := aTokenClass
! !

!PPTokenParser methodsFor:'initialization'!

initialize
	tokenClass := self defaultTokenClass
	
! !

!PPTokenParser methodsFor:'private'!

create: aCollection start: aStartInteger stop: aStopInteger
	^ self tokenClass on: aCollection start: aStartInteger stop: aStopInteger
!

defaultTokenClass
	^ PPToken
!

on: aCollection start: aStartInteger stop: aStopInteger value: anObject
	^ self tokenClass on: aCollection start: aStartInteger stop: aStopInteger value: anObject
! !

!PPTokenParser class methodsFor:'documentation'!

version
    ^ '$Header: /cvs/stx/stx/goodies/petitparser/PPTokenParser.st,v 1.4 2014-03-04 14:33:27 cg Exp $'
!

version_CVS
    ^ '$Header: /cvs/stx/stx/goodies/petitparser/PPTokenParser.st,v 1.4 2014-03-04 14:33:27 cg Exp $'
!

version_SVN
    ^ '$Id: PPTokenParser.st,v 1.4 2014-03-04 14:33:27 cg Exp $'
! !