author | vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177 |
Fri, 09 Nov 2012 12:09:13 +0000 | |
changeset 38 | c3d02ed6a645 |
parent 36 | 41cb88196e69 |
child 39 | 10e693b3e034 |
permissions | -rw-r--r-- |
34 | 1 |
"{ Package: 'stx:libscm/mercurial' }" |
2 |
||
3 |
Object subclass:#HGCommandParser |
|
36 | 4 |
instanceVariableNames:'stream' |
34 | 5 |
classVariableNames:'' |
6 |
poolDictionaries:'' |
|
7 |
category:'SCM-Mercurial-Internal' |
|
8 |
! |
|
9 |
||
10 |
||
36 | 11 |
!HGCommandParser class methodsFor:'instance creation'! |
12 |
||
13 |
on: aStream |
|
14 |
^self new stream: aStream |
|
15 |
||
16 |
"Created: / 23-10-2012 / 11:07:52 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
17 |
! ! |
|
18 |
||
19 |
!HGCommandParser methodsFor:'accessing'! |
|
20 |
||
21 |
stream |
|
22 |
^ stream |
|
23 |
! |
|
24 |
||
25 |
stream:something |
|
26 |
stream := something. |
|
27 |
! ! |
|
28 |
||
29 |
!HGCommandParser methodsFor:'error reporting'! |
|
30 |
||
31 |
parseStatus |
|
32 |
| c | |
|
33 |
stream skipSeparators. |
|
34 |
c := stream peek. |
|
35 |
self halt. |
|
36 |
||
37 |
"Created: / 22-10-2012 / 21:43:03 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
38 |
! ! |
|
39 |
||
40 |
!HGCommandParser methodsFor:'parsing'! |
|
41 |
||
42 |
parseCommandStatus |
|
43 |
| statusesAndPaths | |
|
44 |
statusesAndPaths := OrderedCollection new. |
|
45 |
[ stream atEnd ] whileFalse:[ |
|
46 |
| status path | |
|
47 |
||
48 |
status := HGStatus forCode: self next. |
|
49 |
self nextSpace. |
|
50 |
path := self nextLine. |
|
51 |
statusesAndPaths add: { status . path } |
|
52 |
]. |
|
53 |
^ statusesAndPaths |
|
54 |
||
55 |
"Created: / 23-10-2012 / 10:57:06 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
56 |
! ! |
|
57 |
||
58 |
!HGCommandParser methodsFor:'parsing-utils'! |
|
59 |
||
60 |
next |
|
61 |
^stream next. |
|
62 |
||
63 |
"Created: / 23-10-2012 / 10:57:24 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
64 |
! |
|
65 |
||
66 |
nextLine |
|
38
c3d02ed6a645
- HGWorkingCopyFile
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
36
diff
changeset
|
67 |
^stream nextLine |
36 | 68 |
|
69 |
"Created: / 23-10-2012 / 11:05:47 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
38
c3d02ed6a645
- HGWorkingCopyFile
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
36
diff
changeset
|
70 |
"Modified: / 09-11-2012 / 12:02:08 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
36 | 71 |
! |
72 |
||
73 |
nextSpace |
|
74 |
| c | |
|
38
c3d02ed6a645
- HGWorkingCopyFile
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
36
diff
changeset
|
75 |
((c := stream next) ~= Character space) ifTrue:[ |
36 | 76 |
self error:'Space expected. ''', c , ''' found!!' |
77 |
] |
|
78 |
||
79 |
"Created: / 23-10-2012 / 10:58:20 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
38
c3d02ed6a645
- HGWorkingCopyFile
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
36
diff
changeset
|
80 |
"Modified: / 09-11-2012 / 11:59:45 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
36 | 81 |
! ! |
82 |
||
34 | 83 |
!HGCommandParser class methodsFor:'documentation'! |
84 |
||
85 |
version_SVN |
|
86 |
^ '$Id:: $' |
|
87 |
! ! |