rustpython-bytecode -> rustpython-compiler-core

This commit is contained in:
Jeong YunWon 2022-08-22 07:34:30 +09:00
parent acde8bb625
commit c16e650071
7 changed files with 18 additions and 16 deletions

View file

@ -6,7 +6,7 @@ authors = ["RustPython Team"]
edition = "2021"
[dependencies]
rustpython-bytecode = { path = "bytecode" }
rustpython-compiler-core = { path = "core" }
rustpython-codegen = { path = "codegen" }
rustpython-parser = { path = "parser" }

View file

@ -12,5 +12,5 @@ unparse = ["rustpython-common"]
[dependencies]
num-bigint = "0.4.3"
rustpython-bytecode = { path = "../bytecode" }
rustpython-compiler-core = { path = "../core" }
rustpython-common = { path = "../../common", optional = true }

View file

@ -1,5 +1,5 @@
use num_bigint::BigInt;
pub use rustpython_bytecode::ConversionFlag;
pub use rustpython_compiler_core::ConversionFlag;
#[derive(Debug, PartialEq)]
pub enum Constant {

View file

@ -1,5 +1,5 @@
[package]
name = "rustpython-bytecode"
name = "rustpython-compiler-core"
description = "RustPython specific bytecode."
version = "0.1.2"
authors = ["RustPython Team"]

View file

@ -1,12 +1,6 @@
//! Implement python as a virtual machine with bytecodes. This module
//! implements bytecode structure.
#![doc(html_logo_url = "https://raw.githubusercontent.com/RustPython/RustPython/main/logo.png")]
#![doc(html_root_url = "https://docs.rs/rustpython-bytecode/")]
mod mode;
pub use mode::Mode;
use bitflags::bitflags;
use bstr::ByteSlice;
use itertools::Itertools;
@ -27,7 +21,7 @@ impl Location {
///
/// # Example
/// ```
/// use rustpython_bytecode::Location;
/// use rustpython_compiler_core::Location;
/// let loc = Location::new(10, 10);
/// ```
pub fn new(row: usize, column: usize) -> Self {
@ -433,7 +427,7 @@ bitflags! {
///
/// # Examples
/// ```
/// use rustpython_bytecode::ConstantData;
/// use rustpython_compiler_core::ConstantData;
/// let a = ConstantData::Float {value: 120f64};
/// let b = ConstantData::Boolean {value: false};
/// assert_ne!(a, b);
@ -599,8 +593,8 @@ pub enum TestOperator {
/// # Examples
///
/// ```
/// use rustpython_bytecode::Instruction::BinaryOperation;
/// use rustpython_bytecode::BinaryOperator::Add;
/// use rustpython_compiler_core::Instruction::BinaryOperation;
/// use rustpython_compiler_core::BinaryOperator::Add;
/// let op = BinaryOperation {op: Add};
/// ```
#[derive(Debug, Copy, Clone, PartialEq, Eq, Serialize, Deserialize)]
@ -943,7 +937,7 @@ impl Instruction {
/// # Examples
///
/// ```
/// use rustpython_bytecode::{Instruction, Label};
/// use rustpython_compiler_core::{Instruction, Label};
/// let label = Label(0xF);
/// let jump_inst = Instruction::Jump {target: label};
/// assert!(jump_inst.unconditional_branch())
@ -960,7 +954,7 @@ impl Instruction {
/// # Examples
///
/// ```
/// use rustpython_bytecode::{Instruction, Label, UnaryOperator};
/// use rustpython_compiler_core::{Instruction, Label, UnaryOperator};
/// let jump_instruction = Instruction::Jump {target: Label(0xF)};
/// let invert_instruction = Instruction::UnaryOperation {op: UnaryOperator::Invert};
/// assert_eq!(jump_instruction.stack_effect(true), 0);

8
core/src/lib.rs Normal file
View file

@ -0,0 +1,8 @@
#![doc(html_logo_url = "https://raw.githubusercontent.com/RustPython/RustPython/main/logo.png")]
#![doc(html_root_url = "https://docs.rs/rustpython-compiler-core/")]
pub mod bytecode;
mod mode;
pub use bytecode::*;
pub use mode::Mode;