Skip to content

Commit

Permalink
dclexer/dcparser: Add 'bool' token as alias to 'uint8' type
Browse files Browse the repository at this point in the history
  • Loading branch information
maxrdz committed Mar 2, 2024
1 parent d2649a5 commit d06e379
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
5 changes: 4 additions & 1 deletion libdonet/src/dclexer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ pub enum DCToken {
Int32T, // "int32"
Int64T, // "int64"
UInt8T, // "uint8"
BoolT, // "bool"
UInt16T, // "uint16"
UInt32T, // "uint32"
UInt64T, // "uint64"
Expand Down Expand Up @@ -156,6 +157,7 @@ lexer! {
r#"int32"# => (DCToken::Int32T, text),
r#"int64"# => (DCToken::Int64T, text),
r#"uint8"# => (DCToken::UInt8T, text),
r#"bool"# => (DCToken::BoolT, text),
r#"uint16"# => (DCToken::UInt16T, text),
r#"uint32"# => (DCToken::UInt32T, text),
r#"uint64"# => (DCToken::UInt64T, text),
Expand Down Expand Up @@ -424,6 +426,7 @@ mod unit_testing {
#[rustfmt::skip]
let target: Vec<DCToken> = vec![
DCToken::CharT,
DCToken::BoolT,
// Signed / Unsigned Integers
DCToken::Int8T, DCToken::Int16T, DCToken::Int32T, DCToken::Int64T,
DCToken::UInt8T, DCToken::UInt16T, DCToken::UInt32T, DCToken::UInt64T,
Expand All @@ -440,7 +443,7 @@ mod unit_testing {
DCToken::Blob32T,
];
lexer_test_for_target(
"char \
"char bool \
int8 int16 int32 int64 \
uint8 uint16 uint32 uint64 \
int8array int16array int32array \
Expand Down
1 change: 1 addition & 0 deletions libdonet/src/dcparser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -612,6 +612,7 @@ parser! {

numeric_type_token: DCToken {
CharT => CharT,
BoolT => BoolT,
signed_integer_type[tok] => tok,
unsigned_integer_type[tok] => tok,
Float32T => Float32T,
Expand Down

0 comments on commit d06e379

Please sign in to comment.