100
|
1 |
"{ Package: 'stx:goodies/petitparser/devtools' }"
|
|
2 |
|
|
3 |
Object subclass:#PPCompositeParserGenerator
|
|
4 |
instanceVariableNames:'productions klass changeset'
|
|
5 |
classVariableNames:''
|
|
6 |
poolDictionaries:''
|
|
7 |
category:'PetitParser-Utils'
|
|
8 |
!
|
|
9 |
|
|
10 |
|
|
11 |
!PPCompositeParserGenerator methodsFor:'accessing'!
|
|
12 |
|
|
13 |
changeset
|
|
14 |
^ changeset
|
|
15 |
!
|
|
16 |
|
|
17 |
klass
|
|
18 |
^ klass
|
|
19 |
!
|
|
20 |
|
|
21 |
klass:something
|
|
22 |
klass := something.
|
|
23 |
!
|
|
24 |
|
|
25 |
productions
|
|
26 |
^ productions
|
|
27 |
!
|
|
28 |
|
|
29 |
productions:something
|
|
30 |
productions := something.
|
|
31 |
! !
|
|
32 |
|
|
33 |
!PPCompositeParserGenerator methodsFor:'generating'!
|
|
34 |
|
|
35 |
generate
|
|
36 |
| instvars classchange |
|
|
37 |
|
|
38 |
changeset := ChangeSet fromStream: Dart::Parser definition readStream.
|
|
39 |
classchange := changeset anElement.
|
|
40 |
classchange setupFromSource.
|
|
41 |
|
|
42 |
instvars := productions keys.
|
|
43 |
instvars add: classchange instanceVariableNames.
|
|
44 |
classchange instanceVariableNames: (instvars asSortedCollection asStringWith:' ').
|
|
45 |
|
|
46 |
|
|
47 |
productions do:[:p|
|
124
|
48 |
| method |
|
100
|
49 |
|
124
|
50 |
method := MethodDefinitionChange new
|
|
51 |
class: klass;
|
|
52 |
selector: p name asSymbol;
|
|
53 |
source: (PPPrinter print: p);
|
|
54 |
category: 'grammar';
|
|
55 |
yourself.
|
|
56 |
changeset add: method.
|
100
|
57 |
].
|
|
58 |
|
|
59 |
"Created: / 10-01-2013 / 12:57:28 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
124
|
60 |
"Modified: / 11-01-2013 / 09:52:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
100
|
61 |
! !
|
|
62 |
|
|
63 |
!PPCompositeParserGenerator class methodsFor:'documentation'!
|
|
64 |
|
|
65 |
version
|
124
|
66 |
^ '$Header: /cvs/stx/stx/goodies/petitparser/devtools/PPCompositeParserGenerator.st,v 1.2 2013-01-11 09:57:49 vrany Exp $'
|
100
|
67 |
!
|
|
68 |
|
|
69 |
version_CVS
|
124
|
70 |
^ '$Header: /cvs/stx/stx/goodies/petitparser/devtools/PPCompositeParserGenerator.st,v 1.2 2013-01-11 09:57:49 vrany Exp $'
|
100
|
71 |
! !
|