PPConditionalParser.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Sat, 19 Mar 2016 00:12:47 +0100
changeset 556 51c6afba5c91
parent 427 a7f5e6de19d2
permissions -rw-r--r--
CI: Use VM provided by Pharo team on both Linux and Windows. Hand-crafter Pharo VM is no longer needed as the Linux slave in SWING build farm has been upgraded so it has compatible GLIBC. This makes CI scripts simpler and more usable for other people.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
427
a7f5e6de19d2 Merged JK's version from Monticello
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     1
"{ Package: 'stx:goodies/petitparser' }"
a7f5e6de19d2 Merged JK's version from Monticello
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     2
a7f5e6de19d2 Merged JK's version from Monticello
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     3
"{ NameSpace: Smalltalk }"
a7f5e6de19d2 Merged JK's version from Monticello
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     4
a7f5e6de19d2 Merged JK's version from Monticello
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     5
PPDelegateParser subclass:#PPConditionalParser
a7f5e6de19d2 Merged JK's version from Monticello
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     6
	instanceVariableNames:'block'
a7f5e6de19d2 Merged JK's version from Monticello
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     7
	classVariableNames:''
a7f5e6de19d2 Merged JK's version from Monticello
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     8
	poolDictionaries:''
a7f5e6de19d2 Merged JK's version from Monticello
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     9
	category:'PetitParser-Parsers'
a7f5e6de19d2 Merged JK's version from Monticello
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    10
!
a7f5e6de19d2 Merged JK's version from Monticello
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    11
a7f5e6de19d2 Merged JK's version from Monticello
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    12
!PPConditionalParser class methodsFor:'as yet unclassified'!
a7f5e6de19d2 Merged JK's version from Monticello
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    13
a7f5e6de19d2 Merged JK's version from Monticello
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    14
on: aPPParser block: block
a7f5e6de19d2 Merged JK's version from Monticello
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    15
	^ (PPConditionalParser on: aPPParser)
a7f5e6de19d2 Merged JK's version from Monticello
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    16
		block: block;
a7f5e6de19d2 Merged JK's version from Monticello
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    17
		yourself
a7f5e6de19d2 Merged JK's version from Monticello
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    18
! !
a7f5e6de19d2 Merged JK's version from Monticello
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    19
a7f5e6de19d2 Merged JK's version from Monticello
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    20
!PPConditionalParser methodsFor:'accessing'!
a7f5e6de19d2 Merged JK's version from Monticello
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    21
a7f5e6de19d2 Merged JK's version from Monticello
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    22
block: aBlock
a7f5e6de19d2 Merged JK's version from Monticello
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    23
	block := aBlock
a7f5e6de19d2 Merged JK's version from Monticello
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    24
! !
a7f5e6de19d2 Merged JK's version from Monticello
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    25
a7f5e6de19d2 Merged JK's version from Monticello
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    26
!PPConditionalParser methodsFor:'parsing'!
a7f5e6de19d2 Merged JK's version from Monticello
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    27
a7f5e6de19d2 Merged JK's version from Monticello
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    28
parseOn: aPPContext
a7f5e6de19d2 Merged JK's version from Monticello
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    29
	^ (block value: aPPContext) 
a7f5e6de19d2 Merged JK's version from Monticello
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    30
		ifTrue: [ parser parseOn: aPPContext ]
a7f5e6de19d2 Merged JK's version from Monticello
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    31
		ifFalse: [ PPFailure message: block asString, ' was not evaluated to true.' context: aPPContext ]
a7f5e6de19d2 Merged JK's version from Monticello
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    32
! !
a7f5e6de19d2 Merged JK's version from Monticello
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    33