finish #214, add needed ambiguity checks if 0 is the final character
This commit is contained in:
@@ -329,8 +329,7 @@ pub fn requires_space(atom: &str, op: &str) -> bool {
|
|||||||
.next()
|
.next()
|
||||||
.map(|oc| {
|
.map(|oc| {
|
||||||
if ac == '0' {
|
if ac == '0' {
|
||||||
oc == 'b' || oc == 'x' || oc == 'o' || oc == '\''
|
oc == '\'' || oc == '(' || alpha_numeric_char!(oc)
|
||||||
|| oc == '(' || alpha_numeric_char!(oc)
|
|
||||||
} else if alpha_numeric_char!(ac) {
|
} else if alpha_numeric_char!(ac) {
|
||||||
oc == '(' || alpha_numeric_char!(oc)
|
oc == '(' || alpha_numeric_char!(oc)
|
||||||
} else if graphic_token_char!(ac) {
|
} else if graphic_token_char!(ac) {
|
||||||
|
|||||||
@@ -1015,8 +1015,8 @@ fn compile_work_impl(
|
|||||||
if let Some(mut module) = compiler.module.take() {
|
if let Some(mut module) = compiler.module.take() {
|
||||||
if module.is_impromptu_module {
|
if module.is_impromptu_module {
|
||||||
module.module_decl.exports = indices.code_dir.keys().cloned()
|
module.module_decl.exports = indices.code_dir.keys().cloned()
|
||||||
.filter(|(name, _)| name.owning_module().as_str() != "builtins")
|
.filter(|(name, _)| name.owning_module().as_str() != "builtins")
|
||||||
.collect();
|
.collect();
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut clause_code_generator =
|
let mut clause_code_generator =
|
||||||
@@ -1030,9 +1030,18 @@ fn compile_work_impl(
|
|||||||
wam.indices.remove_module(clause_name!("user"), module);
|
wam.indices.remove_module(clause_name!("user"), module);
|
||||||
}
|
}
|
||||||
|
|
||||||
add_module_code(wam, module, module_code, indices);
|
if module.is_impromptu_module {
|
||||||
add_toplevel_code(wam, toplvl_code, results.toplevel_indices);
|
add_module_code(wam, module, module_code, indices);
|
||||||
|
|
||||||
|
let module = wam.indices.take_module(compiler.listing_src.clone()).unwrap();
|
||||||
|
|
||||||
|
wam.indices.use_module(&mut wam.code_repo, wam.machine_st.flags, &module)?;
|
||||||
|
wam.indices.insert_module(module);
|
||||||
|
} else {
|
||||||
|
add_module_code(wam, module, module_code, indices);
|
||||||
|
}
|
||||||
|
|
||||||
|
add_toplevel_code(wam, toplvl_code, results.toplevel_indices);
|
||||||
clause_code_generator.add_clause_code(wam, results.dynamic_clause_map);
|
clause_code_generator.add_clause_code(wam, results.dynamic_clause_map);
|
||||||
} else {
|
} else {
|
||||||
add_non_module_code(
|
add_non_module_code(
|
||||||
|
|||||||
@@ -456,14 +456,15 @@ impl Machine {
|
|||||||
};
|
};
|
||||||
|
|
||||||
let result = load_result.and_then(|name| {
|
let result = load_result.and_then(|name| {
|
||||||
let module = self.indices.take_module(name.clone()).unwrap();
|
let module = self.indices.take_module(name.clone()).unwrap();
|
||||||
|
|
||||||
self.indices.use_module(&mut self.code_repo, self.machine_st.flags,
|
if !module.is_impromptu_module {
|
||||||
&module)?;
|
self.indices.use_module(&mut self.code_repo, self.machine_st.flags, &module)?;
|
||||||
|
}
|
||||||
Ok(self.indices.insert_module(module))
|
|
||||||
|
Ok(self.indices.insert_module(module))
|
||||||
});
|
});
|
||||||
|
|
||||||
self.code_repo.cached_query = cached_query;
|
self.code_repo.cached_query = cached_query;
|
||||||
|
|
||||||
if let Err(e) = result {
|
if let Err(e) = result {
|
||||||
@@ -502,10 +503,12 @@ impl Machine {
|
|||||||
let result = load_result.and_then(|name| {
|
let result = load_result.and_then(|name| {
|
||||||
let module = self.indices.take_module(name.clone()).unwrap();
|
let module = self.indices.take_module(name.clone()).unwrap();
|
||||||
|
|
||||||
self.indices.use_qualified_module(&mut self.code_repo,
|
if !module.is_impromptu_module {
|
||||||
self.machine_st.flags,
|
self.indices.use_qualified_module(&mut self.code_repo,
|
||||||
&module,
|
self.machine_st.flags,
|
||||||
&exports)?;
|
&module,
|
||||||
|
&exports)?;
|
||||||
|
}
|
||||||
|
|
||||||
Ok(self.indices.insert_module(module))
|
Ok(self.indices.insert_module(module))
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -28,9 +28,8 @@
|
|||||||
'$$compile_batch' :- '$compile_batch'.
|
'$$compile_batch' :- '$compile_batch'.
|
||||||
|
|
||||||
'$instruction_match'([Item], []) :-
|
'$instruction_match'([Item], []) :-
|
||||||
( atom(Item) ->
|
( atom(Item) -> !,
|
||||||
( Item == user ->
|
( Item == user ->
|
||||||
!,
|
|
||||||
catch('$$compile_batch', E, '$print_exception_with_check'(E))
|
catch('$$compile_batch', E, '$print_exception_with_check'(E))
|
||||||
; consult(Item)
|
; consult(Item)
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user