plugin feature flag

This commit is contained in:
Fernando Herrera
2021-11-02 20:56:00 +00:00
parent dfb846dec6
commit 12eed1f98a
11 changed files with 34 additions and 44 deletions

View File

@ -11,6 +11,9 @@ pub use flatten::{flatten_block, FlatShape};
pub use lex::{lex, Token, TokenContents};
pub use lite_parse::{lite_parse, LiteBlock};
pub use parse_keywords::{
parse_alias, parse_def, parse_def_predecl, parse_let, parse_module, parse_plugin, parse_use,
parse_alias, parse_def, parse_def_predecl, parse_let, parse_module, parse_use,
};
pub use parser::{find_captures_in_expr, parse, Import, VarDecl};
#[cfg(feature = "plugin")]
pub use parse_keywords::parse_plugin;

View File

@ -1,4 +1,3 @@
use nu_plugin::plugin::{get_signature, PluginDeclaration};
use nu_protocol::{
ast::{Block, Call, Expr, Expression, ImportPattern, ImportPatternMember, Pipeline, Statement},
engine::StateWorkingSet,
@ -6,6 +5,9 @@ use nu_protocol::{
};
use std::path::Path;
#[cfg(feature = "plugin")]
use nu_plugin::plugin::{get_signature, PluginDeclaration};
use crate::{
lex, lite_parse,
parser::{
@ -925,6 +927,7 @@ pub fn parse_source(
)
}
#[cfg(feature = "plugin")]
pub fn parse_plugin(
working_set: &mut StateWorkingSet,
spans: &[Span],

View File

@ -15,10 +15,12 @@ use nu_protocol::{
};
use crate::parse_keywords::{
parse_alias, parse_def, parse_def_predecl, parse_hide, parse_let, parse_module, parse_plugin,
parse_use,
parse_alias, parse_def, parse_def_predecl, parse_hide, parse_let, parse_module, parse_use,
};
#[cfg(feature = "plugin")]
use crate::parse_keywords::parse_plugin;
#[derive(Debug, Clone)]
pub enum Import {}
@ -3007,6 +3009,7 @@ pub fn parse_statement(
Some(ParseError::UnexpectedKeyword("export".into(), spans[0])),
),
b"hide" => parse_hide(working_set, spans),
#[cfg(feature = "plugin")]
b"register" => parse_plugin(working_set, spans),
_ => {
let (expr, err) = parse_expression(working_set, spans, true);