blob: 358d6f66726ebc49b9a593f5217c9c3c0df13a9e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
<!-- $NetBSD: chap.statemachines.xml,v 1.3 2006/07/27 09:19:37 rillig Exp $ -->
<chapter id="statemachines">
<title>State machines</title>
<para>This chapter explains the various state machines that are
used in &pkglint;. It also provides graphical representations of
them that are much easier to read than the source code.</para>
<para>The opaque arrows in the figures represent transitions
that have a regular expression as condition. The hollow arrows
are the default transitions if nothing else matches. When
multiple regular expressions match in a state, the one that
appears first in the source code is chosen.</para>
<sect1 id="statemachines.shellword">
<title>The state machine for shell words</title>
<para>The state machine for single shell words is pretty simple,
and I think it can be understood from the source code alone. So
no graphical representation is provided.</para>
</sect1>
<sect1 id="statemachines.shellcommand">
<title>The state machine for shell commands</title>
<figure id="statemachine.shellcommand">
<title>The state transitions for shell commands</title>
<mediaobject>
<imageobject>
<imagedata fileref="statemachine.shellcmd.png" format="PNG"/>
</imageobject>
<textobject>(Here should be a drawing of the state transitions.)</textobject>
</mediaobject>
</figure>
<para>The punch card symbols provide a means to go to a certain
state whenever the input matches the text on the punch
card.</para>
</sect1>
<sect1 id="statemachines.patch">
<title>The state machine for patch files</title>
<para>The state machine for patch files is the newest of the
state machines. Here, the state transitions are separated from
the code, which makes the code itself pretty small. I don't know
yet if this programming style is elegant or not. Time will
show.</para>
<figure id="statemachine.patch">
<title>The state transitions for patch files</title>
<mediaobject>
<imageobject>
<imagedata fileref="statemachine.patch.png" format="PNG"/>
</imageobject>
<textobject>(Here should be a drawing of the state transitions.)</textobject>
</mediaobject>
</figure>
<para>The states on the left side are for parsing context diffs,
the ones on the right side are for unified diffs. Some of the
state names are highly abbreviated as follows. The first letter
gives the format of the patch, which is <quote>c</quote> for
context diffs and <quote>u</quote> for unified diffs. The second
letter gives the current syntactical level, which is
<quote>f</quote> for a file header, <quote>h</quote> for a hunk
header, or <quote>l</quote> for the hunk lines. The third letter
describes the action that belongs to the line, which is
<quote>a</quote> for an addition, and <quote>d</quote> for a
deletion.</para>
</sect1>
</chapter>
|