203
|
1 |
"{ Package: 'stx:goodies/petitparser/analyzer' }"
|
|
2 |
|
|
3 |
Object subclass:#PPRule
|
|
4 |
instanceVariableNames:'owner search'
|
|
5 |
classVariableNames:''
|
|
6 |
poolDictionaries:''
|
|
7 |
category:'PetitAnalyzer-Core'
|
|
8 |
!
|
|
9 |
|
|
10 |
|
|
11 |
!PPRule class methodsFor:'instance creation'!
|
|
12 |
|
|
13 |
new
|
|
14 |
^ self basicNew initialize
|
|
15 |
!
|
|
16 |
|
|
17 |
searchFor: aParser
|
|
18 |
^ self new setSearch: aParser
|
|
19 |
! !
|
|
20 |
|
|
21 |
!PPRule methodsFor:'initialization'!
|
|
22 |
|
|
23 |
initialize
|
|
24 |
!
|
|
25 |
|
|
26 |
setOwner: aGrammarSearcher
|
|
27 |
owner := aGrammarSearcher
|
|
28 |
!
|
|
29 |
|
|
30 |
setSearch: aParser
|
|
31 |
search := aParser
|
|
32 |
! !
|
|
33 |
|
|
34 |
!PPRule methodsFor:'matching'!
|
|
35 |
|
|
36 |
canMatch: aParser
|
|
37 |
^ true
|
|
38 |
!
|
|
39 |
|
|
40 |
foundMatchFor: aParser
|
|
41 |
self subclassResponsibility
|
|
42 |
!
|
|
43 |
|
|
44 |
performOn: aParser
|
|
45 |
(search match: aParser inContext: owner context)
|
|
46 |
ifFalse: [ ^ nil ].
|
|
47 |
(self canMatch: aParser)
|
|
48 |
ifFalse: [ ^ nil ].
|
|
49 |
^ self foundMatchFor: aParser
|
|
50 |
! !
|
|
51 |
|
|
52 |
!PPRule class methodsFor:'documentation'!
|
|
53 |
|
|
54 |
version
|
|
55 |
^ '$Header: /cvs/stx/stx/goodies/petitparser/analyzer/PPRule.st,v 1.1 2014-03-04 15:42:06 cg Exp $'
|
|
56 |
!
|
|
57 |
|
|
58 |
version_CVS
|
|
59 |
^ '$Header: /cvs/stx/stx/goodies/petitparser/analyzer/PPRule.st,v 1.1 2014-03-04 15:42:06 cg Exp $'
|
|
60 |
! !
|
|
61 |
|