revive-yul 0.5.0

The revive YUL parser library.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
//! The YUL code block.

use crate::lexer::error::Error as LexerError;
use crate::lexer::token::Token;
use crate::lexer::Lexer;

pub mod error;
pub mod identifier;
pub mod statement;
pub mod r#type;

/// Returns the `token` value if it is `Some(_)`, otherwise takes the next token from the `stream`.
pub fn take_or_next(mut token: Option<Token>, lexer: &mut Lexer) -> Result<Token, LexerError> {
    match token.take() {
        Some(token) => Ok(token),
        None => lexer.next(),
    }
}