author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Thu, 30 Oct 2014 23:01:54 +0000 | |
changeset 398 | b3e47bab2de6 |
parent 380 | 8fe3cb4e607f |
permissions | -rw-r--r-- |
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 |
|
292 | 55 |
^ '$Header: /cvs/stx/stx/goodies/petitparser/analyzer/PPRule.st,v 1.2 2014-03-04 20:27:51 cg Exp $' |
203 | 56 |
! |
57 |
||
58 |
version_CVS |
|
292 | 59 |
^ '$Header: /cvs/stx/stx/goodies/petitparser/analyzer/PPRule.st,v 1.2 2014-03-04 20:27:51 cg Exp $' |
380
8fe3cb4e607f
Remove Pharoisms to make code more portable and running on Smalltalk/X
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
292
diff
changeset
|
60 |
! |
8fe3cb4e607f
Remove Pharoisms to make code more portable and running on Smalltalk/X
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
292
diff
changeset
|
61 |
|
8fe3cb4e607f
Remove Pharoisms to make code more portable and running on Smalltalk/X
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
292
diff
changeset
|
62 |
version_HG |
8fe3cb4e607f
Remove Pharoisms to make code more portable and running on Smalltalk/X
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
292
diff
changeset
|
63 |
|
8fe3cb4e607f
Remove Pharoisms to make code more portable and running on Smalltalk/X
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
292
diff
changeset
|
64 |
^ '$Changeset: <not expanded> $' |
203 | 65 |
! ! |
66 |