Move custom syntax to api.
This commit is contained in:
parent
4d226542fa
commit
9c7ced2b80
@ -18,6 +18,8 @@ pub mod limits;
|
||||
|
||||
pub mod events;
|
||||
|
||||
pub mod custom_syntax;
|
||||
|
||||
pub mod deprecated;
|
||||
|
||||
use crate::engine::Precedence;
|
||||
|
@ -1,7 +1,7 @@
|
||||
//! Main module defining the script evaluation [`Engine`].
|
||||
|
||||
use crate::api::custom_syntax::CustomSyntax;
|
||||
use crate::ast::{Expr, FnCallExpr, Ident, OpAssignment, Stmt, AST_OPTION_FLAGS::*};
|
||||
use crate::custom_syntax::CustomSyntax;
|
||||
use crate::func::native::{OnDebugCallback, OnParseTokenCallback, OnPrintCallback, OnVarCallback};
|
||||
use crate::func::{get_hasher, CallableFunction, IteratorFn};
|
||||
use crate::module::Namespace;
|
||||
|
@ -70,7 +70,6 @@ use std::prelude::v1::*;
|
||||
|
||||
mod api;
|
||||
mod ast;
|
||||
mod custom_syntax;
|
||||
mod engine;
|
||||
mod func;
|
||||
mod module;
|
||||
@ -140,8 +139,8 @@ pub type FLOAT = f32;
|
||||
pub type ExclusiveRange = std::ops::Range<INT>;
|
||||
pub type InclusiveRange = std::ops::RangeInclusive<INT>;
|
||||
|
||||
pub use api::custom_syntax::Expression;
|
||||
pub use ast::{FnAccess, AST};
|
||||
pub use custom_syntax::Expression;
|
||||
pub use engine::{
|
||||
Engine, EvalContext, OP_CONTAINS, OP_EQUALS, OP_EXCLUSIVE_RANGE, OP_INCLUSIVE_RANGE,
|
||||
};
|
||||
|
@ -1,11 +1,11 @@
|
||||
//! Main module defining the lexer and parser.
|
||||
|
||||
use crate::api::custom_syntax::{markers::*, CustomSyntax};
|
||||
use crate::api::options::LanguageOptions;
|
||||
use crate::ast::{
|
||||
BinaryExpr, CustomExpr, Expr, FnCallExpr, FnCallHashes, Ident, OpAssignment, ScriptFnDef, Stmt,
|
||||
StmtBlock, AST_OPTION_FLAGS::*,
|
||||
};
|
||||
use crate::custom_syntax::{markers::*, CustomSyntax};
|
||||
use crate::engine::{Precedence, KEYWORD_THIS, OP_CONTAINS};
|
||||
use crate::func::hashing::get_hasher;
|
||||
use crate::module::Namespace;
|
||||
@ -2190,24 +2190,19 @@ fn parse_custom_syntax(
|
||||
}
|
||||
},
|
||||
#[cfg(not(feature = "no_float"))]
|
||||
crate::custom_syntax::markers::CUSTOM_SYNTAX_MARKER_FLOAT => {
|
||||
match input.next().expect(NEVER_ENDS) {
|
||||
(Token::FloatConstant(f), pos) => {
|
||||
inputs.push(Expr::FloatConstant(f, pos));
|
||||
segments.push(f.to_string().into());
|
||||
tokens.push(state.get_identifier(
|
||||
"",
|
||||
crate::custom_syntax::markers::CUSTOM_SYNTAX_MARKER_FLOAT,
|
||||
));
|
||||
}
|
||||
(_, pos) => {
|
||||
return Err(PERR::MissingSymbol(
|
||||
"Expecting a floating-point number".to_string(),
|
||||
)
|
||||
.into_err(pos))
|
||||
}
|
||||
CUSTOM_SYNTAX_MARKER_FLOAT => match input.next().expect(NEVER_ENDS) {
|
||||
(Token::FloatConstant(f), pos) => {
|
||||
inputs.push(Expr::FloatConstant(f, pos));
|
||||
segments.push(f.to_string().into());
|
||||
tokens.push(state.get_identifier("", CUSTOM_SYNTAX_MARKER_FLOAT));
|
||||
}
|
||||
}
|
||||
(_, pos) => {
|
||||
return Err(PERR::MissingSymbol(
|
||||
"Expecting a floating-point number".to_string(),
|
||||
)
|
||||
.into_err(pos))
|
||||
}
|
||||
},
|
||||
CUSTOM_SYNTAX_MARKER_STRING => match input.next().expect(NEVER_ENDS) {
|
||||
(Token::StringConstant(s), pos) => {
|
||||
let s: ImmutableString = state.get_identifier("", s).into();
|
||||
|
Loading…
Reference in New Issue
Block a user