module basic/Areas

imports basic/NatCon

exports

sorts Area
context-free syntax
  %% Areas describe the boundaries of substrings in files in a one dimensional
  %% fashion, but taking newlines into account. The begin-line, begin-column
  %% are styled after the UNIX standard. We offer both line-column and 
  %% offset-length representations because neither representation can be 
  %% computed from the other without the original file.

  %% All characters, including tabs and newlines, are counted as one character.
  %% Positions are calculated based on the original file, not as the file is
  %% displayed on screen. The '\n' character increases the line and returns
  %% the column position to 0.

  %% begin-line: the first line in a file is 1
  %% begin-column: the first column on a line is 0
  %% end-line: line on which the end-column occurs
  %% end-column: first column beyond last character

  %% Example: describing the area starting at T of "This" up to and including 
  %% R of "constructoR"

  %%  0123456789012345
  %% 1  This is an
  %% 2area constructoR
  %%       
  %%  area(1,2,2,16,2,26)

  "area" "("
    begin-line:NatCon "," 
    begin-column:NatCon ","
    end-line:NatCon ","
    end-column:NatCon ","
    offset:NatCon ","
    length:NatCon ")"
  -> Area {cons("area")}
