Files
revive/crates/yul/src/lexer/token/lexeme/comment/mod.rs
T
xermicus bd4e108bb0 resolc crate (#328)
- Factor the YUL crate out of `revive-solidity`.
- `revive-solidity` is in reality not a Solidity implementation but the
revive solidity compiler driver (`resolc`). By renaming we not only get
this straight but also a binary with the same name as the crate which
should be less confusing.

---------

Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
2025-05-27 09:48:43 +02:00

33 lines
860 B
Rust

//! The comment lexeme.
pub mod multi_line;
pub mod single_line;
use crate::lexer::token::Token;
use self::multi_line::Comment as MultiLineComment;
use self::single_line::Comment as SingleLineComment;
/// The comment lexeme.
#[derive(Debug, Clone, PartialEq, Eq)]
#[allow(dead_code)]
pub enum Comment {
/// The single-line comment.
SingleLine(SingleLineComment),
/// The multi-line comment.
MultiLine(MultiLineComment),
}
impl Comment {
/// Returns the comment's length, including the trimmed whitespace around it.
pub fn parse(input: &str) -> Option<Token> {
if input.starts_with(SingleLineComment::START) {
Some(SingleLineComment::parse(input))
} else if input.starts_with(MultiLineComment::START) {
Some(MultiLineComment::parse(input))
} else {
None
}
}
}