finish #214, add needed ambiguity checks if 0 is the final character

This commit is contained in:
Mark Thom
2019-10-27 19:23:35 -06:00
parent 0dcd9e5805
commit e594ade84d
4 changed files with 28 additions and 18 deletions

View File

@@ -329,8 +329,7 @@ pub fn requires_space(atom: &str, op: &str) -> bool {
.next()
.map(|oc| {
if ac == '0' {
oc == 'b' || oc == 'x' || oc == 'o' || oc == '\''
|| oc == '(' || alpha_numeric_char!(oc)
oc == '\'' || oc == '(' || alpha_numeric_char!(oc)
} else if alpha_numeric_char!(ac) {
oc == '(' || alpha_numeric_char!(oc)
} else if graphic_token_char!(ac) {

View File

@@ -1030,9 +1030,18 @@ fn compile_work_impl(
wam.indices.remove_module(clause_name!("user"), module);
}
if module.is_impromptu_module {
add_module_code(wam, module, module_code, indices);
add_toplevel_code(wam, toplvl_code, results.toplevel_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);
} else {
add_non_module_code(

View File

@@ -458,8 +458,9 @@ impl Machine {
let result = load_result.and_then(|name| {
let module = self.indices.take_module(name.clone()).unwrap();
self.indices.use_module(&mut self.code_repo, self.machine_st.flags,
&module)?;
if !module.is_impromptu_module {
self.indices.use_module(&mut self.code_repo, self.machine_st.flags, &module)?;
}
Ok(self.indices.insert_module(module))
});
@@ -502,10 +503,12 @@ impl Machine {
let result = load_result.and_then(|name| {
let module = self.indices.take_module(name.clone()).unwrap();
if !module.is_impromptu_module {
self.indices.use_qualified_module(&mut self.code_repo,
self.machine_st.flags,
&module,
&exports)?;
}
Ok(self.indices.insert_module(module))
});

View File

@@ -28,9 +28,8 @@
'$$compile_batch' :- '$compile_batch'.
'$instruction_match'([Item], []) :-
( atom(Item) ->
( atom(Item) -> !,
( Item == user ->
!,
catch('$$compile_batch', E, '$print_exception_with_check'(E))
; consult(Item)
)