add (:) meta-predicate argument indicator (#1302)
This commit is contained in:
@@ -267,6 +267,7 @@ pub enum MetaSpec {
|
|||||||
Minus,
|
Minus,
|
||||||
Plus,
|
Plus,
|
||||||
Either,
|
Either,
|
||||||
|
Colon,
|
||||||
RequiresExpansionWithArgument(usize),
|
RequiresExpansionWithArgument(usize),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -213,6 +213,9 @@ inner_meta_specs(0, HeadArg, InnerHeadArgs, InnerMetaSpecs) :-
|
|||||||
InnerMetaSpecs0 =.. [_ | InnerMetaSpecs],
|
InnerMetaSpecs0 =.. [_ | InnerMetaSpecs],
|
||||||
HeadArg =.. [_ | InnerHeadArgs].
|
HeadArg =.. [_ | InnerHeadArgs].
|
||||||
|
|
||||||
|
inner_meta_specs((:), _, [], []) :-
|
||||||
|
!.
|
||||||
|
|
||||||
inner_meta_specs(N, HeadArg, InnerHeadArgs, InnerMetaSpecs) :-
|
inner_meta_specs(N, HeadArg, InnerHeadArgs, InnerMetaSpecs) :-
|
||||||
integer(N),
|
integer(N),
|
||||||
N >= 0,
|
N >= 0,
|
||||||
@@ -636,6 +639,7 @@ expand_module_name(ESG0, MS, M, ESG) :-
|
|||||||
; ESG0 = _:_ ->
|
; ESG0 = _:_ ->
|
||||||
ESG = ESG0
|
ESG = ESG0
|
||||||
; functor(ESG0, F, A0),
|
; functor(ESG0, F, A0),
|
||||||
|
integer(MS),
|
||||||
A is A0 + MS,
|
A is A0 + MS,
|
||||||
functor(EESG0, F, A),
|
functor(EESG0, F, A),
|
||||||
predicate_property(EESG0, built_in) ->
|
predicate_property(EESG0, built_in) ->
|
||||||
@@ -647,6 +651,7 @@ expand_module_name(ESG0, MS, M, ESG) :-
|
|||||||
expand_meta_predicate_subgoals([SG | SGs], [MS | MSs], M, [ESG | ESGs], HeadVars) :-
|
expand_meta_predicate_subgoals([SG | SGs], [MS | MSs], M, [ESG | ESGs], HeadVars) :-
|
||||||
( ( integer(MS),
|
( ( integer(MS),
|
||||||
MS >= 0
|
MS >= 0
|
||||||
|
; MS == (:)
|
||||||
) ->
|
) ->
|
||||||
( var(SG),
|
( var(SG),
|
||||||
pairs:same_key(SG, HeadVars, [_|_], _) ->
|
pairs:same_key(SG, HeadVars, [_|_], _) ->
|
||||||
|
|||||||
@@ -2200,6 +2200,7 @@ impl Machine {
|
|||||||
MetaSpec::Minus => atom_as_cell!(atom!("+")),
|
MetaSpec::Minus => atom_as_cell!(atom!("+")),
|
||||||
MetaSpec::Plus => atom_as_cell!(atom!("-")),
|
MetaSpec::Plus => atom_as_cell!(atom!("-")),
|
||||||
MetaSpec::Either => atom_as_cell!(atom!("?")),
|
MetaSpec::Either => atom_as_cell!(atom!("?")),
|
||||||
|
MetaSpec::Colon => atom_as_cell!(atom!(":")),
|
||||||
MetaSpec::RequiresExpansionWithArgument(ref arg_num) => {
|
MetaSpec::RequiresExpansionWithArgument(ref arg_num) => {
|
||||||
fixnum_as_cell!(Fixnum::build_with(*arg_num as i64))
|
fixnum_as_cell!(Fixnum::build_with(*arg_num as i64))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -296,6 +296,7 @@ fn setup_meta_predicate<'a, LS: LoadState<'a>>(
|
|||||||
atom!("+") => MetaSpec::Plus,
|
atom!("+") => MetaSpec::Plus,
|
||||||
atom!("-") => MetaSpec::Minus,
|
atom!("-") => MetaSpec::Minus,
|
||||||
atom!("?") => MetaSpec::Either,
|
atom!("?") => MetaSpec::Either,
|
||||||
|
atom!(":") => MetaSpec::Colon,
|
||||||
_ => return Err(CompilationError::InvalidMetaPredicateDecl),
|
_ => return Err(CompilationError::InvalidMetaPredicateDecl),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user