count single character atoms as characters when generating first argument indices
This commit is contained in:
@@ -74,6 +74,15 @@ impl CodeOffsets {
|
||||
code.push(Self::add_index(is_initial_index, index));
|
||||
}
|
||||
&Term::Constant(_, ref constant) => {
|
||||
if let Constant::Atom(ref name, _) = constant {
|
||||
if !name.as_str().is_empty() && name.as_str().chars().skip(1).next().is_none() {
|
||||
let c = name.as_str().chars().next().unwrap();
|
||||
let code = self.constants.entry(Constant::Char(c)).or_insert(vec![]);
|
||||
|
||||
code.push(Self::add_index(code.is_empty(), index));
|
||||
}
|
||||
}
|
||||
|
||||
let code = self.constants.entry(constant.clone()).or_insert(Vec::new());
|
||||
|
||||
let is_initial_index = code.is_empty();
|
||||
|
||||
@@ -1806,7 +1806,7 @@ impl MachineState {
|
||||
let a1 = self.registers[1].clone();
|
||||
let addr = self.store(self.deref(a1));
|
||||
|
||||
let offset = match addr {
|
||||
let offset = match addr {
|
||||
Addr::Con(constant) => match hm.get(&constant) {
|
||||
Some(offset) => *offset,
|
||||
_ => 0,
|
||||
|
||||
Reference in New Issue
Block a user