canAddTokenToEndOfRegion function
bool
canAddTokenToEndOfRegion(
- Map region,
- dynamic currentToken, {
- dynamic impliedHundreds,
})
Implementation
bool canAddTokenToEndOfRegion(Map region, currentToken, {impliedHundreds}) {
List tokens = region['tokens'];
var prevToken = tokens[tokens.length - 1];
if (!impliedHundreds &&
prevToken['type'] == TOKEN_TYPE['UNIT'] &&
currentToken['type'] == TOKEN_TYPE['UNIT'] &&
!region['hasDecimal']) {
return false;
}
if (!impliedHundreds &&
prevToken['type'] == TOKEN_TYPE['UNIT'] &&
currentToken['type'] == TOKEN_TYPE['TEN']) return false;
if (!impliedHundreds &&
prevToken['type'] == TOKEN_TYPE['TEN'] &&
currentToken['type'] == TOKEN_TYPE['TEN']) return false;
return true;
}