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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
//! The vocabulary the front end, the interpreter and a compiled program share: source positions
//! and the small enums of the data division, INSPECT and OPEN.
use std::fmt;
/// Where a diagnostic points: 1-based source line and column.
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
pub struct Pos {
/// Index into the program's file table: 0 for the program itself, then each COPY member.
pub file: u16,
pub line: u32,
pub col: u32,
}
impl fmt::Display for Pos {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{}:{}", self.line, self.col)
}
}
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum SignPosition {
Leading,
Trailing,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub struct SignClause {
pub position: SignPosition,
pub separate: bool,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum InspectMode {
Characters,
All,
Leading,
First,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Figurative {
Zero,
Space,
HighValue,
LowValue,
Quote,
Null,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum BinOp {
Add,
Sub,
Mul,
Div,
Pow,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum RelOp {
Eq,
Ne,
Lt,
Le,
Gt,
Ge,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum OpenMode {
Input,
Output,
Extend,
InputOutput,
}
/// The phrases CLOSE can write after a file-name.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Closing {
/// REEL or UNIT, with FOR REMOVAL, WITH NO REWIND or neither: the volume, not the file.
Volume,
NoRewind,
/// WITH LOCK: the file cannot be opened again while the program is in the run unit.
Lock,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum AcceptFrom {
Sysin,
Date { four_digit_year: bool },
Day { four_digit_year: bool },
DayOfWeek,
Time,
/// Under `--compliance extended`, the job step's PARM program arguments, as Micro Focus and
/// GnuCOBOL give the command line.
CommandLine,
/// Under `--compliance extended`, how many words the PARM's program arguments hold.
ArgumentNumber,
/// Under `--compliance extended`, the next word of the PARM's program arguments.
ArgumentValue,
}