]> Repositorios git - scryer-prolog.git/commitdiff
Make macros private
authorbakaq <[email protected]>
Fri, 6 Sep 2024 19:51:10 +0000 (16:51 -0300)
committerbakaq <[email protected]>
Fri, 6 Sep 2024 20:17:04 +0000 (17:17 -0300)
15 files changed:
build/instructions_template.rs
build/static_string_indexing.rs
src/arena.rs
src/atom_table.rs
src/codegen.rs
src/heap_print.rs
src/machine/arithmetic_ops.rs
src/machine/attributed_variables.rs
src/machine/dispatch.rs
src/machine/loader.rs
src/machine/mod.rs
src/machine/term_stream.rs
src/macros.rs
src/parser/ast.rs
src/parser/macros.rs

index 86cde2f36e461463e798cb806bbdf6b794afe1f3..100d3d4fdc4cd082f0daac30ea26efd5246c7fcf 100644 (file)
@@ -3281,14 +3281,14 @@ pub fn generate_instructions_rs() -> TokenStream {
             }
         }
 
-        #[macro_export]
         macro_rules! _instr {
             #(
                 #instr_macro_arms
             );*
         }
 
-        pub use _instr as instr; // https://github.com/rust-lang/rust/pull/52234#issuecomment-976702997
+        // https://github.com/rust-lang/rust/pull/52234#issuecomment-976702997
+        pub(crate) use _instr as instr;
     }
 }
 
index e6ed11eb6a1e55c56ed2592d33ad85e94acde620..02b853f66f85fde115391cc5dff6d6bc6b8b8a78 100644 (file)
@@ -164,7 +164,6 @@ pub fn index_static_strings(instruction_rs_path: &std::path::Path) -> TokenStrea
             )*
         ];
 
-        #[macro_export]
         macro_rules! atom {
             #((#static_strs) => { Atom { index: #indices_iter } };)*
         }
index 3d1293a6eb234c4d768711644a3df3fa7c679c6f..01d45758d8305037bfcf4174fbf14f959736622d 100644 (file)
@@ -29,7 +29,6 @@ use std::ptr::addr_of_mut;
 use std::ptr::NonNull;
 use std::sync::RwLock;
 
-#[macro_export]
 macro_rules! arena_alloc {
     ($e:expr, $arena:expr) => {{
         let result = $e;
@@ -37,7 +36,6 @@ macro_rules! arena_alloc {
     }};
 }
 
-#[macro_export]
 macro_rules! float_alloc {
     ($e:expr, $arena:expr) => {{
         let result = $e;
index ea3a3a782e25f04e77ce06e0d3fc5646b552a5b5..b84cfbfda888dd0f7e1d621bf651ce53e2aba856 100644 (file)
@@ -124,7 +124,6 @@ impl Hash for Atom {
     }
 }
 
-#[macro_export]
 macro_rules! is_char {
     ($s:expr) => {
         !$s.is_empty() && $s.chars().nth(1).is_none()
index 23c592386ed1a066fc1fe4eaff77f77644605c6f..a8049d684d7de1430f77016df4fbdf88e5e3d8d3 100644 (file)
@@ -8,11 +8,9 @@ use crate::instructions::*;
 use crate::iterators::*;
 use crate::parser::ast::*;
 use crate::targets::*;
-use crate::temp_v;
 use crate::types::*;
 use crate::variable_records::*;
 
-use crate::instr;
 use crate::machine::disjuncts::*;
 use crate::machine::machine_errors::*;
 
index a25406172f2fdbe76329e1721e57e159435097b0..3c83b0292dd59d4c884455c6c14c80b29f8c8d2b 100644 (file)
@@ -4,11 +4,6 @@ use crate::parser::ast::*;
 use crate::parser::dashu::base::RemEuclid;
 use crate::parser::dashu::integer::Sign;
 use crate::parser::dashu::{ibig, Integer, Rational};
-use crate::{
-    alpha_numeric_char, capital_letter_char, cut_char, decimal_digit_char, graphic_token_char,
-    semicolon_char, sign_char, single_quote_char, small_letter_char, solo_char,
-    variable_indicator_char,
-};
 
 use crate::forms::*;
 use crate::heap_iter::*;
index a1e715e319d3ebcbf49b3d73eafb5140ad290be0..64e66f4de35e49ec5525c143b707171dde3a8120 100644 (file)
@@ -15,8 +15,6 @@ use crate::parser::ast::*;
 use crate::parser::dashu::{Integer, Rational};
 use crate::types::*;
 
-use crate::fixnum;
-
 use ordered_float::{Float, OrderedFloat};
 
 use std::cmp;
@@ -24,7 +22,6 @@ use std::convert::TryFrom;
 use std::f64;
 use std::mem;
 
-#[macro_export]
 macro_rules! try_numeric_result {
     ($e: expr, $stub_gen: expr) => {
         match $e {
index 2f117afcfe10f88b83e7cecd8ef64d439612fa87..d84822fe86f792a78dc4d1a8ef0c646d5f8f0e51 100644 (file)
@@ -1,7 +1,6 @@
 use crate::heap_iter::*;
 use crate::machine::*;
 use crate::parser::ast::*;
-use crate::temp_v;
 use crate::types::*;
 
 use indexmap::IndexSet;
index 7fac89934a3e618404217f796becc99555c7ee35..25c0cc01e93f0e3dd8a9973892699ec2bef15049 100644 (file)
@@ -7,8 +7,6 @@ use crate::machine::machine_state::*;
 use crate::machine::*;
 use crate::types::*;
 
-use crate::try_numeric_result;
-
 use fxhash::FxBuildHasher;
 
 macro_rules! step_or_fail {
index b3e1fddec42bf5834217b149aac2a4ee3815bbf6..bf754bd0d986b3e89d7d46f1cd4bb1172a7ce51e 100644 (file)
@@ -211,7 +211,6 @@ impl PredicateQueue {
     }
 }
 
-#[macro_export]
 macro_rules! predicate_queue {
     [$($v:expr),*] => (
         PredicateQueue {
index cb89edc78c0171f946fd1675f2a6fc11dc18687d..dfc6cd3a7b430fc90ac8dda5836aea51550d8f68 100644 (file)
@@ -1,4 +1,5 @@
 pub mod args;
+#[macro_use]
 pub mod arithmetic_ops;
 pub mod attributed_variables;
 pub mod code_walker;
index c236193762282cdd97b2d97d72e7b4fe44edda59..686a8c197bea9b69d327b46e4c32b09a65baf88f 100644 (file)
@@ -7,8 +7,6 @@ use crate::parser::ast::*;
 use crate::parser::parser::*;
 use crate::read::devour_whitespace;
 
-use crate::predicate_queue;
-
 use fxhash::FxBuildHasher;
 use indexmap::IndexSet;
 
index ca55651348956d0e851e0e644e0a1c0dd2b91d60..30a863cac21439ac9ca57cd1890febcaf1c660dc 100644 (file)
@@ -144,7 +144,6 @@ macro_rules! stack_loc_as_cell {
     };
 }
 
-#[macro_export]
 macro_rules! heap_loc_as_cell {
     ($h:expr) => {
         HeapCellValue::build_with(HeapCellValueTag::Var, $h as u64)
index ec699c21136fde4a52dd443541b0e1907414d9c0..a9c3f2fb08159f8ce2bc8459617943b7378430ee 100644 (file)
@@ -139,7 +139,6 @@ pub const BTERM: u32 = 0x11000;
 
 pub const NEGATIVE_SIGN: u32 = 0x0200;
 
-#[macro_export]
 macro_rules! fixnum {
     ($wrapper:tt, $n:expr, $arena:expr) => {
         Fixnum::build_with_checked($n)
@@ -180,21 +179,18 @@ macro_rules! is_negate {
     };
 }
 
-#[macro_export]
 macro_rules! is_prefix {
     ($x:expr) => {
         $x as u32 & ($crate::parser::ast::FX as u32 | $crate::parser::ast::FY as u32) != 0
     };
 }
 
-#[macro_export]
 macro_rules! is_postfix {
     ($x:expr) => {
         $x as u32 & ($crate::parser::ast::XF as u32 | $crate::parser::ast::YF as u32) != 0
     };
 }
 
-#[macro_export]
 macro_rules! is_infix {
     ($x:expr) => {
         ($x as u32
@@ -205,48 +201,41 @@ macro_rules! is_infix {
     };
 }
 
-#[macro_export]
 macro_rules! is_xfx {
     ($x:expr) => {
         ($x as u32 & $crate::parser::ast::XFX as u32) != 0
     };
 }
 
-#[macro_export]
 macro_rules! is_xfy {
     ($x:expr) => {
         ($x as u32 & $crate::parser::ast::XFY as u32) != 0
     };
 }
 
-#[macro_export]
 macro_rules! is_yfx {
     ($x:expr) => {
         ($x as u32 & $crate::parser::ast::YFX as u32) != 0
     };
 }
-#[macro_export]
 macro_rules! is_yf {
     ($x:expr) => {
         ($x as u32 & $crate::parser::ast::YF as u32) != 0
     };
 }
 
-#[macro_export]
 macro_rules! is_xf {
     ($x:expr) => {
         ($x as u32 & $crate::parser::ast::XF as u32) != 0
     };
 }
 
-#[macro_export]
 macro_rules! is_fx {
     ($x:expr) => {
         ($x as u32 & $crate::parser::ast::FX as u32) != 0
     };
 }
 
-#[macro_export]
 macro_rules! is_fy {
     ($x:expr) => {
         ($x as u32 & $crate::parser::ast::FY as u32) != 0
@@ -317,14 +306,12 @@ impl Default for VarReg {
     }
 }
 
-#[macro_export]
 macro_rules! temp_v {
     ($x:expr) => {
         $crate::parser::ast::RegType::Temp($x)
     };
 }
 
-#[macro_export]
 macro_rules! perm_v {
     ($x:expr) => {
         $crate::parser::ast::RegType::Perm($x)
index ecf629f8d18f5a6c3ab5995ad8483b4b71b51844..7027ebe8b00c56dad891b30c6a0fb803ddc6ba7c 100644 (file)
-#[macro_export]
 macro_rules! char_class {
     ($c: expr, [$head:expr]) => ($c == $head);
-    ($c: expr, [$head:expr $(, $cs:expr)+]) => ($c == $head || $crate::char_class!($c, [$($cs),*]));
+    ($c: expr, [$head:expr $(, $cs:expr)+]) => ($c == $head || char_class!($c, [$($cs),*]));
 }
 
-#[macro_export]
 macro_rules! alpha_char {
     ($c: expr) => {
         (!$c.is_numeric()
             && !$c.is_whitespace()
             && !$c.is_control()
-            && !$crate::graphic_token_char!($c)
-            && !$crate::layout_char!($c)
-            && !$crate::meta_char!($c)
-            && !$crate::solo_char!($c))
+            && !graphic_token_char!($c)
+            && !layout_char!($c)
+            && !meta_char!($c)
+            && !solo_char!($c))
             || $c == '_'
     };
 }
 
-#[macro_export]
 macro_rules! alpha_numeric_char {
     ($c: expr) => {
-        $crate::alpha_char!($c) || $c.is_numeric()
+        alpha_char!($c) || $c.is_numeric()
     };
 }
 
-#[macro_export]
 macro_rules! backslash_char {
     ($c: expr) => {
         $c == '\\'
     };
 }
 
-#[macro_export]
 macro_rules! back_quote_char {
     ($c: expr) => {
         $c == '`'
     };
 }
 
-#[macro_export]
 macro_rules! octet_char {
     ($c: expr) => {
         ('\u{0000}'..='\u{00FF}').contains(&$c)
     };
 }
 
-#[macro_export]
 macro_rules! capital_letter_char {
     ($c: expr) => {
         $c.is_uppercase()
     };
 }
 
-#[macro_export]
 macro_rules! comment_1_char {
     ($c: expr) => {
         $c == '/'
     };
 }
 
-#[macro_export]
 macro_rules! comment_2_char {
     ($c: expr) => {
         $c == '*'
     };
 }
 
-#[macro_export]
 macro_rules! cut_char {
     ($c: expr) => {
         $c == '!'
     };
 }
 
-#[macro_export]
 macro_rules! decimal_digit_char {
     ($c: expr) => {
         $c.is_ascii_digit()
     };
 }
 
-#[macro_export]
 macro_rules! decimal_point_char {
     ($c: expr) => {
         $c == '.'
     };
 }
 
-#[macro_export]
 macro_rules! double_quote_char {
     ($c: expr) => {
         $c == '"'
     };
 }
 
-#[macro_export]
 macro_rules! end_line_comment_char {
     ($c: expr) => {
         $c == '%'
     };
 }
 
-#[macro_export]
 macro_rules! exponent_char {
     ($c: expr) => {
         $c == 'e' || $c == 'E'
     };
 }
 
-#[macro_export]
 macro_rules! graphic_char {
-    ($c: expr) => ($crate::char_class!($c, ['#', '$', '&', '*', '+', '-', '.', '/', ':',
+    ($c: expr) => (char_class!($c, ['#', '$', '&', '*', '+', '-', '.', '/', ':',
                                             '<', '=', '>', '?', '@', '^', '~']))
 }
 
-#[macro_export]
 macro_rules! graphic_token_char {
     ($c: expr) => {
-        $crate::graphic_char!($c) || $crate::backslash_char!($c)
+        graphic_char!($c) || backslash_char!($c)
     };
 }
 
-#[macro_export]
 macro_rules! hexadecimal_digit_char {
     ($c: expr) => {
         $c.is_ascii_digit() || ('A'..='F').contains(&$c) || ('a'..='f').contains(&$c)
     };
 }
 
-#[macro_export]
 macro_rules! layout_char {
     ($c: expr) => {
-        $crate::char_class!($c, [' ', '\r', '\n', '\t', '\u{0B}', '\u{0C}'])
+        char_class!($c, [' ', '\r', '\n', '\t', '\u{0B}', '\u{0C}'])
     };
 }
 
-#[macro_export]
 macro_rules! meta_char {
     ($c: expr) => {
-        $crate::char_class!($c, ['\\', '\'', '"', '`'])
+        char_class!($c, ['\\', '\'', '"', '`'])
     };
 }
 
-#[macro_export]
 macro_rules! new_line_char {
     ($c: expr) => {
         $c == '\n'
     };
 }
 
-#[macro_export]
 macro_rules! octal_digit_char {
     ($c: expr) => {
         ('0'..='7').contains(&$c)
     };
 }
 
-#[macro_export]
 macro_rules! binary_digit_char {
     ($c: expr) => {
         $c == '0' || $c == '1'
     };
 }
 
-#[macro_export]
 macro_rules! prolog_char {
     ($c: expr) => {
-        $crate::graphic_char!($c)
-            || $crate::alpha_numeric_char!($c)
-            || $crate::solo_char!($c)
-            || $crate::layout_char!($c)
-            || $crate::meta_char!($c)
+        graphic_char!($c)
+            || alpha_numeric_char!($c)
+            || solo_char!($c)
+            || layout_char!($c)
+            || meta_char!($c)
     };
 }
 
-#[macro_export]
 macro_rules! semicolon_char {
     ($c: expr) => {
         $c == ';'
     };
 }
 
-#[macro_export]
 macro_rules! sign_char {
     ($c: expr) => {
         $c == '-' || $c == '+'
     };
 }
 
-#[macro_export]
 macro_rules! single_quote_char {
     ($c: expr) => {
         $c == '\''
     };
 }
 
-#[macro_export]
 macro_rules! small_letter_char {
     ($c: expr) => {
         $c.is_alphabetic() && !$c.is_uppercase()
     };
 }
 
-#[macro_export]
 macro_rules! solo_char {
     ($c: expr) => {
-        $crate::char_class!($c, ['!', '(', ')', ',', ';', '[', ']', '{', '}', '|', '%'])
+        char_class!($c, ['!', '(', ')', ',', ';', '[', ']', '{', '}', '|', '%'])
     };
 }
 
-#[macro_export]
 macro_rules! space_char {
     ($c: expr) => {
         $c == ' '
     };
 }
 
-#[macro_export]
 macro_rules! symbolic_control_char {
     ($c: expr) => {
-        $crate::char_class!($c, ['a', 'b', 'f', 'n', 'r', 't', 'v', '0'])
+        char_class!($c, ['a', 'b', 'f', 'n', 'r', 't', 'v', '0'])
     };
 }
 
-#[macro_export]
 macro_rules! symbolic_hexadecimal_char {
     ($c: expr) => {
         $c == 'x'
     };
 }
 
-#[macro_export]
 macro_rules! variable_indicator_char {
     ($c: expr) => {
         $c == '_'