summaryrefslogtreecommitdiff
path: root/doc/start_finish_ranges.html
blob: d69c60ef0a76183052eed074bdb1fd2c1bd2338b (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

<!DOCTYPE html>

<html lang="en">
  <head>
    <meta charset="utf-8">
    <title>Start and Finish Ranges - Packrat Docs</title>
    <link href="default.css" rel="stylesheet">
  </head>

  <body>


  <h2>Start and Finish Ranges</h2>

  <a href="index.html">Return to Contents</a>


  <p>When parsing input, the start position and finish position that
  describe a parsed or lexed chunk are the index of the first item and
  the last item of that chunk. This was done to match the idea with
  how array slicing is done in Ada, but it has a few other implications.</p>

  <p>Empty chunks are described by a finish position that is less than
  the start position. For consistency, this is always done as the finish
  position being only one less than the start.</p>

  <p>This convention also differs from the convention used by Frost, Hafiz,
  and Callaghan (2008). They used start positions corresponding to the first
  item in a chunk, but finish positions corresponding to the first item after
  the chunk had ended. Care should be taken to keep this in mind to avoid
  off-by-one errors.</p>


  </body>
</html>