pushAsset method
Append an asset */
Implementation
void pushAsset(String s) {
s = s.trim();
var pos = 0;
var amount = '';
var precision = 0;
if (s[pos] == '-') {
amount += '-';
++pos;
}
var foundDigit = false;
while (pos < s.length && s.codeUnitAt(pos) >= '0'.codeUnitAt(0) && s.codeUnitAt(pos) <= '9'.codeUnitAt(0)) {
foundDigit = true;
amount += s[pos];
++pos;
}
if (!foundDigit) {
throw 'Asset must begin with a number';
}
if (s[pos] == '.') {
++pos;
while (pos < s.length && s.codeUnitAt(pos) >= '0'.codeUnitAt(0) && s.codeUnitAt(pos) <= '9'.codeUnitAt(0)) {
amount += s[pos];
++precision;
++pos;
}
}
var name = s.substring(pos).trim();
pushArray(numeric.signedDecimalToBinary(8, amount));
pushSymbol(Symbol(name: name, precision: precision));
}