microsoft/qdk
Publicmirrored fromhttps://github.com/microsoft/qdkAvailable
compiler/qsc_parse/src/lex.rs
51lines · modecode
| 1 | // Copyright (c) Microsoft Corporation. |
| 2 | // Licensed under the MIT License. |
| 3 | |
| 4 | mod cooked; |
| 5 | mod raw; |
| 6 | |
| 7 | use enum_iterator::Sequence; |
| 8 | |
| 9 | pub(super) use cooked::{ClosedBinOp, Error, Lexer, StringToken, Token, TokenKind}; |
| 10 | |
| 11 | /// A delimiter token. |
| 12 | #[derive(Clone, Copy, Debug, Eq, PartialEq, Sequence)] |
| 13 | pub(super) enum Delim { |
| 14 | /// `{` or `}` |
| 15 | Brace, |
| 16 | /// `[` or `]` |
| 17 | Bracket, |
| 18 | /// `(` or `)` |
| 19 | Paren, |
| 20 | } |
| 21 | |
| 22 | #[derive(Clone, Copy, Debug, Eq, PartialEq, Sequence)] |
| 23 | pub(super) enum Radix { |
| 24 | Binary, |
| 25 | Octal, |
| 26 | Decimal, |
| 27 | Hexadecimal, |
| 28 | } |
| 29 | |
| 30 | impl From<Radix> for u32 { |
| 31 | fn from(value: Radix) -> Self { |
| 32 | match value { |
| 33 | Radix::Binary => 2, |
| 34 | Radix::Octal => 8, |
| 35 | Radix::Decimal => 10, |
| 36 | Radix::Hexadecimal => 16, |
| 37 | } |
| 38 | } |
| 39 | } |
| 40 | |
| 41 | #[derive(Clone, Copy, Debug, Eq, PartialEq, Sequence)] |
| 42 | pub(super) enum InterpolatedStart { |
| 43 | DollarQuote, |
| 44 | RBrace, |
| 45 | } |
| 46 | |
| 47 | #[derive(Clone, Copy, Debug, Eq, PartialEq, Sequence)] |
| 48 | pub(super) enum InterpolatedEnding { |
| 49 | Quote, |
| 50 | LBrace, |
| 51 | } |
| 52 | |