pub enum Token {
Show 43 variants
Level(u8),
Level66,
Level77,
Level88,
Pic,
Usage,
Display,
Comp,
Comp3,
Comp1,
Comp2,
Binary,
Redefines,
Renames,
Occurs,
Depending,
On,
To,
Times,
Synchronized,
Value,
Thru,
Through,
Sign,
Leading,
Is,
Trailing,
Separate,
Blank,
When,
Zero,
PicClause(String),
EditedPic(String),
Number(u32),
Identifier(String),
StringLiteral(String),
Period,
Comma,
LeftParen,
RightParen,
InlineComment(String),
Newline,
Eof,
}Expand description
COBOL copybook tokens
§Examples
use copybook_lexer::Token;
use logos::Logos;
let mut lex = Token::lexer("01 FIELD PIC X(10).");
assert_eq!(lex.next(), Some(Ok(Token::Level(1))));Variants§
Level(u8)
COBOL level number (01–49).
Level66
Level-66 (RENAMES).
Level77
Level-77 (standalone working-storage).
Level88
Level-88 (condition name).
Pic
PIC or PICTURE keyword.
Usage
USAGE keyword.
Display
DISPLAY usage keyword.
Comp
COMP / COMPUTATIONAL keyword (binary native).
Comp3
COMP-3 / COMPUTATIONAL-3 keyword (packed decimal).
Comp1
COMP-1 / COMPUTATIONAL-1 keyword (single-precision float).
Comp2
COMP-2 / COMPUTATIONAL-2 keyword (double-precision float).
Binary
BINARY usage keyword.
Redefines
REDEFINES keyword.
Renames
RENAMES keyword (level-66).
Occurs
OCCURS keyword.
Depending
DEPENDING keyword (part of OCCURS DEPENDING ON).
On
ON keyword.
To
TO keyword.
Times
TIMES keyword.
Synchronized
SYNCHRONIZED / SYNC keyword.
Value
VALUE keyword.
Thru
THRU keyword (range delimiter).
Through
THROUGH keyword (range delimiter, synonym of THRU).
Sign
SIGN keyword.
Leading
LEADING keyword (sign position).
Is
IS keyword.
Trailing
TRAILING keyword (sign position).
Separate
SEPARATE keyword (sign storage).
Blank
BLANK keyword.
When
WHEN keyword.
Zero
ZERO / ZEROS / ZEROES keyword.
PicClause(String)
Standard PIC clause pattern (e.g. 9(5)V9(2)).
EditedPic(String)
Edited PIC pattern (e.g. ZZZ9, $ZZ,ZZZ.99).
Number(u32)
Unsigned integer literal.
Identifier(String)
COBOL identifier or data name.
StringLiteral(String)
Quoted string literal (single or double quotes).
Period
Period (.) statement terminator.
Comma
Comma separator.
LeftParen
Left parenthesis.
RightParen
Right parenthesis.
InlineComment(String)
COBOL-2002 inline comment (*>).
Newline
Line break (LF or CRLF).
Eof
Sentinel marking end of input.
Trait Implementations§
Source§impl<'s> Logos<'s> for Token
impl<'s> Logos<'s> for Token
Source§type Error = ()
type Error = ()
#[logos(error = MyError)]. Defaults to () if not set.Source§type Extras = ()
type Extras = ()
Extras for the particular lexer. This can be set using
#[logos(extras = MyExtras)] and accessed inside callbacks.Source§type Source = str
type Source = str
str,
unless one of the defined patterns explicitly uses non-unicode byte values
or byte slices, in which case that implementation will use [u8].Source§fn lex(
lex: &mut Lexer<'s, Self>,
) -> Option<Result<Self, <Self as Logos<'s>>::Error>>
fn lex( lex: &mut Lexer<'s, Self>, ) -> Option<Result<Self, <Self as Logos<'s>>::Error>>
Lexer. The implementation for this function
is generated by the logos-derive crate.