2021-11-03 16:34:05 +08:00
|
|
|
//! This crate can be used to parse python sourcecode into a so
|
|
|
|
//! called AST (abstract syntax tree).
|
|
|
|
//!
|
|
|
|
//! The stages involved in this process are lexical analysis and
|
|
|
|
//! parsing. The lexical analysis splits the sourcecode into
|
|
|
|
//! tokens, and the parsing transforms those tokens into an AST.
|
|
|
|
//!
|
|
|
|
//! For example, one could do this:
|
|
|
|
//!
|
|
|
|
//! ```
|
2021-11-03 17:11:00 +08:00
|
|
|
//! use nac3parser::{parser, ast};
|
2021-11-03 16:34:05 +08:00
|
|
|
//!
|
|
|
|
//! let python_source = "print('Hello world')";
|
|
|
|
//! let python_ast = parser::parse_expression(python_source).unwrap();
|
|
|
|
//!
|
|
|
|
//! ```
|
|
|
|
|
2024-06-12 12:27:35 +08:00
|
|
|
#![deny(clippy::all)]
|
|
|
|
#![warn(clippy::pedantic)]
|
|
|
|
#![allow(
|
|
|
|
clippy::default_trait_access,
|
|
|
|
clippy::doc_markdown,
|
|
|
|
clippy::enum_glob_use,
|
|
|
|
clippy::fn_params_excessive_bools,
|
|
|
|
clippy::if_not_else,
|
|
|
|
clippy::implicit_clone,
|
|
|
|
clippy::match_same_arms,
|
|
|
|
clippy::missing_errors_doc,
|
|
|
|
clippy::missing_panics_doc,
|
|
|
|
clippy::module_name_repetitions,
|
|
|
|
clippy::must_use_candidate,
|
|
|
|
clippy::redundant_closure_for_method_calls,
|
|
|
|
clippy::semicolon_if_nothing_returned,
|
|
|
|
clippy::single_match_else,
|
|
|
|
clippy::too_many_lines,
|
|
|
|
clippy::uninlined_format_args,
|
|
|
|
clippy::unnested_or_patterns,
|
|
|
|
clippy::unused_self,
|
|
|
|
clippy::wildcard_imports
|
|
|
|
)]
|
|
|
|
|
2021-11-03 16:34:05 +08:00
|
|
|
#[macro_use]
|
|
|
|
extern crate log;
|
|
|
|
use lalrpop_util::lalrpop_mod;
|
2021-11-03 17:11:00 +08:00
|
|
|
pub use nac3ast as ast;
|
2021-11-03 16:34:05 +08:00
|
|
|
|
|
|
|
pub mod error;
|
|
|
|
mod fstring;
|
|
|
|
mod function;
|
|
|
|
pub mod lexer;
|
|
|
|
pub mod mode;
|
|
|
|
pub mod parser;
|
|
|
|
lalrpop_mod!(
|
2024-06-12 12:27:35 +08:00
|
|
|
#[allow(clippy::all, clippy::pedantic)]
|
2021-11-03 16:34:05 +08:00
|
|
|
#[allow(unused)]
|
|
|
|
python
|
|
|
|
);
|
2021-11-04 15:00:27 +08:00
|
|
|
pub mod config_comment_helper;
|
2024-06-12 14:45:03 +08:00
|
|
|
pub mod token;
|