PPParser.st
author sr
Thu, 05 Jul 2018 09:23:25 +0200
changeset 626 5159b1039a8f
parent 366 225737f7f83f
child 377 6112a403a52d
child 637 b19fe5d5f1dc
permissions -rw-r--r--
order
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4
90de244a7fa2 move to package
Claus Gittinger <cg@exept.de>
parents: 0
diff changeset
     1
"{ Package: 'stx:goodies/petitparser' }"
0
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     2
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     3
Object subclass:#PPParser
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     4
	instanceVariableNames:'properties'
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     5
	classVariableNames:''
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     6
	poolDictionaries:''
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     7
	category:'PetitParser-Parsers'
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     8
!
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     9
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    10
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    11
!PPParser class methodsFor:'instance creation'!
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    12
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    13
named: aString
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    14
	^ self new name: aString
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    15
!
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    16
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    17
new
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    18
	^ self basicNew initialize
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    19
! !
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    20
173
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
    21
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
    22
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
    23
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
    24
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
    25
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
    26
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
    27
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
    28
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
    29
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
    30
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
    31
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
    32
0
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    33
!PPParser methodsFor:'accessing'!
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    34
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    35
children
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    36
	"Answer a set of child parsers that could follow the receiver."
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    37
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    38
	^ #()
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    39
!
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    40
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    41
name
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    42
	"Answer the production name of the receiver."
22
c540c8649226 Checkin from browser
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4
diff changeset
    43
	
0
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    44
	^ self propertyAt: #name ifAbsent: [ nil ]
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    45
!
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    46
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    47
name: aString
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    48
	self propertyAt: #name put: aString
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    49
! !
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    50
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    51
!PPParser methodsFor:'accessing-properties'!
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    52
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    53
hasProperty: aKey
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    54
	"Test if the property aKey is present."
22
c540c8649226 Checkin from browser
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4
diff changeset
    55
	
0
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    56
	^ properties notNil and: [ properties includesKey: aKey ]
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    57
!
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    58
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    59
propertyAt: aKey
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    60
	"Answer the property value associated with aKey."
22
c540c8649226 Checkin from browser
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4
diff changeset
    61
	
0
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    62
	^ self propertyAt: aKey ifAbsent: [ self error: 'Property not found' ]
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    63
!
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    64
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    65
propertyAt: aKey ifAbsent: aBlock
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    66
	"Answer the property value associated with aKey or, if aKey isn't found, answer the result of evaluating aBlock."
22
c540c8649226 Checkin from browser
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4
diff changeset
    67
	
0
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    68
	^ properties isNil
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    69
		ifTrue: [ aBlock value ]
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    70
		ifFalse: [ properties at: aKey ifAbsent: aBlock ]
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    71
!
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    72
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    73
propertyAt: aKey ifAbsentPut: aBlock
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    74
	"Answer the property associated with aKey or, if aKey isn't found store the result of evaluating aBlock as new value."
22
c540c8649226 Checkin from browser
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4
diff changeset
    75
	
0
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    76
	^ self propertyAt: aKey ifAbsent: [ self propertyAt: aKey put: aBlock value ]
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    77
!
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    78
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    79
propertyAt: aKey put: anObject
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    80
	"Set the property at aKey to be anObject. If aKey is not found, create a new entry for aKey and set is value to anObject. Answer anObject."
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    81
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    82
	^ (properties ifNil: [ properties := Dictionary new: 1 ])
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    83
		at: aKey put: anObject
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    84
!
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    85
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    86
removeProperty: aKey
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    87
	"Remove the property with aKey. Answer the property or raise an error if aKey isn't found."
22
c540c8649226 Checkin from browser
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4
diff changeset
    88
	
0
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    89
	^ self removeProperty: aKey ifAbsent: [ self error: 'Property not found' ]
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    90
!
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    91
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    92
removeProperty: aKey ifAbsent: aBlock
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    93
	"Remove the property with aKey. Answer the value or, if aKey isn't found, answer the result of evaluating aBlock."
22
c540c8649226 Checkin from browser
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4
diff changeset
    94
	
0
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    95
	| answer |
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    96
	properties isNil ifTrue: [ ^ aBlock value ].
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    97
	answer := properties removeKey: aKey ifAbsent: aBlock.
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    98
	properties isEmpty ifTrue: [ properties := nil ].
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    99
	^ answer
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   100
! !
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   101
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   102
!PPParser methodsFor:'converting'!
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   103
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   104
asParser
173
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   105
	"Answer the receiving parser."
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   106
	
0
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   107
	^ self
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   108
! !
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   109
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   110
!PPParser methodsFor:'copying'!
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   111
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   112
postCopy
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   113
	super postCopy.
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   114
	properties := properties copy
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   115
! !
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   116
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   117
!PPParser methodsFor:'initialization'!
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   118
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   119
initialize
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   120
! !
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   121
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   122
!PPParser methodsFor:'operations'!
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   123
22
c540c8649226 Checkin from browser
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4
diff changeset
   124
, aParser 
0
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   125
	"Answer a new parser that parses the receiver followed by aParser."
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   126
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   127
	^ PPSequenceParser with: self with: aParser
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   128
!
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   129
22
c540c8649226 Checkin from browser
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4
diff changeset
   130
/ aParser 
0
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   131
	"Answer a new parser that parses the receiver, if the receiver fails try with aParser (ordered-choice)."
22
c540c8649226 Checkin from browser
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4
diff changeset
   132
	
0
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   133
	^ PPChoiceParser with: self with: aParser
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   134
!
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   135
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   136
and
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   137
	"Answer a new parser (logical and-predicate) that succeeds whenever the receiver does, but never consumes input."
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   138
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   139
	^ PPAndParser on: self
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   140
!
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   141
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   142
def: aParser
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   143
	"Redefine the receiver as the argument aParser. This method is useful when defining recursive parsers: instantiate a PPUnresolvedParser and later redefine it with another one."
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   144
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   145
	^ self becomeForward: (aParser name: self name)
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   146
!
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   147
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   148
end
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   149
	"Answer a new parser that succeeds at the end of the input and return the result of the receiver."
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   150
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   151
	^ PPEndOfInputParser on: self
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   152
!
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   153
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   154
memoized
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   155
	"Answer a new memoized parser, for refraining redundant computations. This ensures polynomial time O(n^4) for left-recursive grammars and O(n^3) for non left-recursive grammars in the worst case. Not necessary for most grammars that are carefully written and in O(n) anyway."
22
c540c8649226 Checkin from browser
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4
diff changeset
   156
	
0
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   157
	^ PPMemoizedParser on: self
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   158
!
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   159
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   160
negate
92
a95137a3ab6a class: PPToken
Claus Gittinger <cg@exept.de>
parents: 22
diff changeset
   161
        "Answer a new parser consumes any input token but the receiver."
a95137a3ab6a class: PPToken
Claus Gittinger <cg@exept.de>
parents: 22
diff changeset
   162
        
a95137a3ab6a class: PPToken
Claus Gittinger <cg@exept.de>
parents: 22
diff changeset
   163
        ^ self not , #any asParser ==> #second
0
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   164
!
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   165
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   166
not
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   167
	"Answer a new parser (logical not-predicate) that succeeds whenever the receiver fails, but never consumes input."
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   168
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   169
	^ PPNotParser on: self
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   170
!
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   171
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   172
optional
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   173
	"Answer a new parser that parses the receiver, if possible."
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   174
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   175
	^ PPOptionalParser on: self
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   176
!
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   177
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   178
times: anInteger
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   179
	"Answer a new parser that parses the receiver exactly anInteger times."
22
c540c8649226 Checkin from browser
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4
diff changeset
   180
	
0
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   181
	^ self min: anInteger max: anInteger
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   182
!
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   183
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   184
wrapped
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   185
	"Answer a new parser that is simply wrapped."
22
c540c8649226 Checkin from browser
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4
diff changeset
   186
	
0
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   187
	^ PPDelegateParser on: self
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   188
!
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   189
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   190
| aParser
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   191
	"Answer a new parser that either parses the receiver or aParser. Fail if both pass or fail (exclusive choice, unordered choice)."
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   192
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   193
	^ (self not , aParser) / (aParser not , self) ==> #second
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   194
! !
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   195
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   196
!PPParser methodsFor:'operations-convenience'!
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   197
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   198
delimitedBy: aParser
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   199
	"Answer a new parser that parses the receiver one or more times, separated and possibly ended by aParser."
22
c540c8649226 Checkin from browser
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4
diff changeset
   200
	
0
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   201
	^ (self separatedBy: aParser) , (aParser optional) ==> [ :node |
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   202
		node second isNil
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   203
			ifTrue: [ node first ]
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   204
			ifFalse: [ node first copyWith: node second ] ]
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   205
!
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   206
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   207
separatedBy: aParser
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   208
	"Answer a new parser that parses the receiver one or more times, separated by aParser."
22
c540c8649226 Checkin from browser
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4
diff changeset
   209
	
0
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   210
	^ (PPSequenceParser with: self with: (PPSequenceParser with: aParser with: self) star) ==> [ :nodes |
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   211
		| result |
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   212
		result := Array new: 2 * nodes second size + 1.
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   213
		result at: 1 put: nodes first.
22
c540c8649226 Checkin from browser
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4
diff changeset
   214
		nodes second 
0
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   215
			keysAndValuesDo: [ :index :pair | result replaceFrom: 2 * index to: 2 * index + 1 with: pair startingAt: 1 ].
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   216
		result ]
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   217
! !
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   218
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   219
!PPParser methodsFor:'operations-mapping'!
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   220
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   221
==> aBlock
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   222
	"Answer a new parser that performs aBlock as action handler on success."
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   223
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   224
	^ PPActionParser on: self block: aBlock
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   225
!
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   226
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   227
>=> aBlock
366
225737f7f83f class: PPParser
Claus Gittinger <cg@exept.de>
parents: 173
diff changeset
   228
        "Answer a new parser that wraps the receiving parser with a two argument block. 
225737f7f83f class: PPParser
Claus Gittinger <cg@exept.de>
parents: 173
diff changeset
   229
         The first argument is the parsed stream, the second argument a continuation block on the delegate parser."
0
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   230
366
225737f7f83f class: PPParser
Claus Gittinger <cg@exept.de>
parents: 173
diff changeset
   231
        ^ PPWrappingParser on: self block: aBlock
0
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   232
!
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   233
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   234
answer: anObject
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   235
	"Answer a new parser that always returns anObject from a successful parse."
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   236
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   237
	^ self ==> [ :nodes | anObject ]
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   238
!
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   239
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   240
flatten
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   241
	"Answer a new parser that flattens the underlying collection."
22
c540c8649226 Checkin from browser
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4
diff changeset
   242
	
0
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   243
	^ PPFlattenParser on: self
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   244
!
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   245
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   246
token
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   247
	"Answer a new parser that transforms the input to a token."
22
c540c8649226 Checkin from browser
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4
diff changeset
   248
	
0
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   249
	^ PPTokenParser on: self
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   250
!
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   251
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   252
token: aTokenClass
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   253
	"Answer a new parser that transforms the input to a token of class aTokenClass."
22
c540c8649226 Checkin from browser
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4
diff changeset
   254
	
0
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   255
	^ self token tokenClass: aTokenClass
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   256
!
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   257
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   258
trim
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   259
	"Answer a new parser that consumes spaces before and after the receiving parser."
22
c540c8649226 Checkin from browser
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4
diff changeset
   260
	
0
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   261
	^ self trimSpaces
173
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   262
! !
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   263
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   264
!PPParser methodsFor:'operators-convenience'!
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   265
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   266
withoutSeparators
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   267
	"Filters out the separators from a parse result produced by one of the productions #delimitedBy: or #separatedBy:."
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   268
	
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   269
	^ self ==> [ :items |
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   270
		| result |
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   271
		result := Array new: items size + 1 // 2.
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   272
		1 to: result size do: [ :index | result at: index put: (items at: 2 * index - 1) ].
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   273
		result ]
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   274
! !
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   275
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   276
!PPParser methodsFor:'operators-mapping'!
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   277
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   278
foldLeft: aBlock
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   279
	"Answer a new parser that that folds the result of the receiver from left-to-right into aBlock. The argument aBlock must take two or more arguments."
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   280
	
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   281
	| size args |
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   282
	size := aBlock numArgs.
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   283
	args := Array new: size.
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   284
	^ self ==> [ :nodes |
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   285
		args at: 1 put: nodes first.
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   286
		2 to: nodes size by: size - 1 do: [ :index |
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   287
			args
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   288
				replaceFrom: 2 to: size with: nodes startingAt: index;
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   289
				at: 1 put: (aBlock valueWithArguments: args) ].
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   290
		args first ]
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   291
!
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   292
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   293
foldRight: aBlock
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   294
	"Answer a new parser that that folds the result of the receiver from right-to-left into aBlock. The argument aBlock must take two or more arguments."
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   295
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   296
	| size args |
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   297
	size := aBlock numArgs.
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   298
	args := Array new: size.
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   299
	^ self ==> [ :nodes |
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   300
		args at: size put: nodes last.
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   301
		nodes size - size + 1 to: 1 by: 1 - size do: [ :index |
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   302
			args
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   303
				replaceFrom: 1 to: size - 1 with: nodes startingAt: index;
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   304
				at: size put: (aBlock valueWithArguments: args) ].
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   305
		args at: size ]
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   306
!
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   307
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   308
map: aBlock
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   309
	"Answer a new parser that works on the receiving sequence an passes in each element as a block argument."
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   310
	
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   311
	^ aBlock numArgs = 1
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   312
		ifTrue: [ self ==> aBlock ]
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   313
		ifFalse: [ self error: aBlock numArgs asString , ' arguments expected.' ]
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   314
!
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   315
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   316
trim: aParser
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   317
	"Answer a new parser that consumes and ignores aParser repeatedly before and after the receiving parser."
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   318
	
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   319
	^ PPTrimmingParser on: self trimmer: aParser
0
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   320
!
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   321
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   322
trimBlanks
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   323
	"Answer a new parser that consumes blanks before and after the receiving parser."
22
c540c8649226 Checkin from browser
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4
diff changeset
   324
	
173
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   325
	^ self trim: #blank asParser
0
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   326
!
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   327
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   328
trimSpaces
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   329
	"Answer a new parser that consumes spaces before and after the receiving parser."
22
c540c8649226 Checkin from browser
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4
diff changeset
   330
	
173
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   331
	^ self trim: #space asParser
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   332
! !
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   333
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   334
!PPParser methodsFor:'operators-repeating'!
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   335
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   336
max: anInteger
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   337
	"Answer a new parser that parses the receiver at most anInteger times."
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   338
	
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   339
	^ self star setMax: anInteger
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   340
!
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   341
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   342
max: anInteger greedy: aParser
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   343
	"Answer a new parser that parses the receiver at most anInteger times until it reaches aParser. This is a greedy non-blind implementation. aParser is not consumed."
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   344
	
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   345
	^ (self starGreedy: aParser) setMax: anInteger
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   346
!
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   347
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   348
max: anInteger lazy: aParser
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   349
	"Answer a new parser that parses the receiver at most anInteger times until it reaches aParser. This is a lazy non-blind implementation. aParser is not consumed."
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   350
	
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   351
	^ (self starLazy: aParser) setMax: anInteger
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   352
!
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   353
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   354
min: anInteger
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   355
	"Answer a new parser that parses the receiver at least anInteger times."
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   356
	
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   357
	^ self star setMin: anInteger
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   358
!
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   359
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   360
min: anInteger greedy: aParser
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   361
	"Answer a new parser that parses the receiver at least anInteger times until it reaches aParser. This is a greedy non-blind implementation. aParser is not consumed."
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   362
	
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   363
	^ (self starGreedy: aParser) setMin: anInteger
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   364
!
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   365
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   366
min: anInteger lazy: aParser
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   367
	"Answer a new parser that parses the receiver at least anInteger times until it reaches aParser. This is a lazy non-blind implementation. aParser is not consumed."
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   368
	
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   369
	^ (self starLazy: aParser) setMin: anInteger
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   370
!
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   371
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   372
min: aMinInteger max: aMaxInteger
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   373
	"Answer a new parser that parses the receiver at least aMinInteger and at most aMaxInteger times."
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   374
	
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   375
	^ self star setMin: aMinInteger; setMax: aMaxInteger
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   376
!
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   377
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   378
min: aMinInteger max: aMaxInteger greedy: aParser
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   379
	"Answer a new parser that parses the receiver at least aMinInteger and at most aMaxInteger times until it reaches aParser. This is a greedy non-blind implementation. aParser is not consumed."
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   380
	
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   381
	^ (self starGreedy: aParser) setMin: aMinInteger; setMax: aMaxInteger
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   382
!
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   383
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   384
min: aMinInteger max: aMaxInteger lazy: aParser
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   385
	"Answer a new parser that parses the receiver at least aMinInteger and at most aMaxInteger times until it reaches aParser. This is a greedy non-blind implementation. aParser is not consumed."
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   386
	
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   387
	^ (self starLazy: aParser) setMin: aMinInteger; setMax: aMaxInteger
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   388
!
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   389
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   390
plus
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   391
	"Answer a new parser that parses the receiver one or more times."
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   392
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   393
	^ self star setMin: 1
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   394
!
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   395
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   396
plusGreedy: aParser
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   397
	"Answer a new parser that parses the receiver one or more times until it reaches aParser. This is a greedy non-blind implementation of the star operator. aParser is not consumed."
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   398
	
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   399
	^ (self starGreedy: aParser) setMin: 1
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   400
!
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   401
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   402
plusLazy: aParser
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   403
	"Answer a new parser that parses the receiver one or more times until it reaches aParser. This is a lazy non-blind implementation of the star operator. aParser is not consumed."
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   404
	
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   405
	^ (self starLazy: aParser) setMin: 1
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   406
!
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   407
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   408
star
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   409
	"Answer a new parser that parses the receiver zero or more times. This is a greedy and blind implementation that tries to consume as much input as possible and it does not consider what comes afterwards."
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   410
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   411
	^ PPPossessiveRepeatingParser on: self
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   412
!
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   413
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   414
starGreedy: aParser
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   415
	"Answer a new parser that parses the receiver zero or more times until it reaches aParser. This is a greedy non-blind implementation of the star operator. aParser is not consumed."
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   416
	
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   417
	^ PPGreedyRepeatingParser on: self limit: aParser
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   418
!
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   419
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   420
starLazy: aParser
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   421
	"Answer a new parser that parses the receiver zero or more times until it reaches aParser. This is a lazy non-blind implementation of the star operator. aParser is not consumed."
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   422
	
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   423
	^ PPLazyRepeatingParser on: self limit: aParser
0
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   424
! !
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   425
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   426
!PPParser methodsFor:'parsing'!
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   427
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   428
matches: anObject
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   429
	"Answer if anObject can be parsed by the receiver."
22
c540c8649226 Checkin from browser
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4
diff changeset
   430
	
0
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   431
	^ (self parse: anObject) isPetitFailure not
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   432
!
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   433
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   434
matchesIn: anObject
173
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   435
	"Search anObject repeatedly for the matches of the receiver. Answered an OrderedCollection of the matched parse-trees."
0
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   436
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   437
	| result |
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   438
	result := OrderedCollection new.
22
c540c8649226 Checkin from browser
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4
diff changeset
   439
	self 
0
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   440
		matchesIn: anObject
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   441
		do: [ :each | result addLast: each ].
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   442
	^ result
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   443
!
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   444
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   445
matchesIn: anObject do: aBlock
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   446
	"Search anObject repeatedly for the matches of the receiver. Evaluate aBlock for each match with the matched parse-tree as the argument. Make sure to always consume exactly one character with each step, to not miss any match."
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   447
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   448
	((self and ==> aBlock , #any asParser) / #any asParser) star parse: anObject
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   449
!
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   450
173
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   451
matchesSkipIn: anObject
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   452
	"Search anObject repeatedly for the matches of the receiver. Answer an OrderedCollection of the matched parse-trees. Skip over matches."
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   453
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   454
	| result |
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   455
	result := OrderedCollection new.
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   456
	self 
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   457
		matchesSkipIn: anObject
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   458
		do: [ :each | result addLast: each ].
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   459
	^ result
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   460
!
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   461
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   462
matchesSkipIn: anObject do: aBlock
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   463
	"Search anObject repeatedly for the matches of the receiver. Evaluate aBlock for each match with the matched parse-tree as the argument. Skip over matches."
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   464
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   465
	(self ==> aBlock / #any asParser) star parse: anObject
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   466
!
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   467
0
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   468
matchingRangesIn: anObject
173
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   469
	"Search anObject repeatedly for the matches of the receiver. Answer an OrderedCollection of ranges of each match (index of first character to: index of last character)."
22
c540c8649226 Checkin from browser
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4
diff changeset
   470
	
0
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   471
	| result |
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   472
	result := OrderedCollection new.
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   473
	self
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   474
		matchingRangesIn: anObject
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   475
		do: [ :value | result addLast: value ].
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   476
	^ result
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   477
!
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   478
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   479
matchingRangesIn: anObject do: aBlock
173
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   480
	"Search anObject repeatedly for the matches of the receiver. Evaluate aBlock with the range of each match (index of first character to: index of last character)."
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   481
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   482
	self token
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   483
		matchesIn: anObject
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   484
		do: [ :token | aBlock value: (token start to: token stop) ]
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   485
!
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   486
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   487
matchingSkipRangesIn: anObject
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   488
	"Search anObject repeatedly for the matches of the receiver. Skip over matches. Answer an OrderedCollection of ranges of each match (index of first character to: index of last character)."
22
c540c8649226 Checkin from browser
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4
diff changeset
   489
	
0
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   490
	| result |
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   491
	result := OrderedCollection new.
173
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   492
	self
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   493
		matchingSkipRangesIn: anObject
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   494
		do: [ :value | result addLast: value ].
0
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   495
	^ result
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   496
!
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   497
173
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   498
matchingSkipRangesIn: anObject do: aBlock
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   499
	"Search anObject repeatedly for the matches of the receiver. Skip over matches. Evaluate aBlock with the range of each match (index of first character to: index of last character)."
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   500
	
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   501
	self token
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   502
		matchesSkipIn: anObject
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   503
		do: [ :token | aBlock value: (token start to: token stop) ]
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   504
!
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   505
0
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   506
parse: anObject
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   507
	"Parse anObject with the receiving parser and answer the parse-result or an instance of PPFailure."
22
c540c8649226 Checkin from browser
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4
diff changeset
   508
	
0
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   509
	^ self parseOn: anObject asPetitStream
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   510
!
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   511
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   512
parse: anObject onError: aBlock
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   513
	"Parse anObject with the receiving parser and answer the parse-result or answer the result of evaluating aBlock. Depending on the number of arguments of the block it is simply evaluated, evaluated with the failure object, or evaluated with the error message and position."
22
c540c8649226 Checkin from browser
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4
diff changeset
   514
	
0
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   515
	| result |
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   516
	result := self parse: anObject.
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   517
	result isPetitFailure
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   518
		ifFalse: [ ^ result ].
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   519
	aBlock numArgs = 0
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   520
		ifTrue: [ ^ aBlock value ].
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   521
	aBlock numArgs = 1
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   522
		ifTrue: [ ^ aBlock value: result ].
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   523
	^ aBlock value: result message value: result position
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   524
!
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   525
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   526
parseOn: aStream
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   527
	"Parse aStream with the receiving parser and answer the parse-result or an instance of PPFailure. Override this method in subclasses to specify custom parse behavior. Do not call this method from outside, instead use #parse:."
22
c540c8649226 Checkin from browser
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4
diff changeset
   528
	
0
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   529
	self subclassResponsibility
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   530
! !
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   531
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   532
!PPParser methodsFor:'printing'!
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   533
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   534
printNameOn: aStream
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   535
	self name isNil
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   536
		ifTrue: [ aStream print: self hash ]
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   537
		ifFalse: [ aStream nextPutAll: self name ]
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   538
!
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   539
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   540
printOn: aStream
173
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   541
	super printOn: aStream.
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   542
	aStream nextPut: $(.
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   543
	self printNameOn: aStream.
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   544
	aStream nextPut: $)
0
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   545
! !
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   546
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   547
!PPParser methodsFor:'testing'!
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   548
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   549
isPetitParser
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   550
	^ true
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   551
!
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   552
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   553
isUnresolved
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   554
	^ false
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   555
! !
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   556
366
225737f7f83f class: PPParser
Claus Gittinger <cg@exept.de>
parents: 173
diff changeset
   557
0
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   558
!PPParser class methodsFor:'documentation'!
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   559
22
c540c8649226 Checkin from browser
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4
diff changeset
   560
version
366
225737f7f83f class: PPParser
Claus Gittinger <cg@exept.de>
parents: 173
diff changeset
   561
    ^ '$Header: /cvs/stx/stx/goodies/petitparser/PPParser.st,v 1.7 2014-03-04 23:58:41 cg Exp $'
22
c540c8649226 Checkin from browser
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4
diff changeset
   562
!
c540c8649226 Checkin from browser
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4
diff changeset
   563
c540c8649226 Checkin from browser
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4
diff changeset
   564
version_CVS
366
225737f7f83f class: PPParser
Claus Gittinger <cg@exept.de>
parents: 173
diff changeset
   565
    ^ '$Header: /cvs/stx/stx/goodies/petitparser/PPParser.st,v 1.7 2014-03-04 23:58:41 cg Exp $'
22
c540c8649226 Checkin from browser
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4
diff changeset
   566
!
c540c8649226 Checkin from browser
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4
diff changeset
   567
0
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   568
version_SVN
366
225737f7f83f class: PPParser
Claus Gittinger <cg@exept.de>
parents: 173
diff changeset
   569
    ^ '$Id: PPParser.st,v 1.7 2014-03-04 23:58:41 cg Exp $'
0
739fe9b7253e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   570
! !
173
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   571