public static bool TryParse(string input, SymbolTable symbolTable, out AddressSyntax addressSyntax, BracketExpectation bracketExpectation = BracketExpectation.NotPresent) { bool isSuccess; bool isAddress = IsAddress(input.Trim('[', ']'), symbolTable, out byte address, out string undefinedLabel); bool isSurroundedByBrackets = input.StartsWith("[") && input.EndsWith("]"); if (bracketExpectation == BracketExpectation.Present) { isSuccess = isAddress && isSurroundedByBrackets; } else { isSuccess = isAddress && !isSurroundedByBrackets; } if (isSuccess) { addressSyntax = new AddressSyntax(address, undefinedLabel); } else { addressSyntax = null; } return(isSuccess); }
public InstructionByte(AddressSyntax address, int lineNumber) { _address = address; if (address.ContainsUndefinedLabel) { _addressType = AddressType.Label; } else { _addressType = AddressType.DirectValue; _byte = _address.Value; } _lineNumber = lineNumber; }
public InstructionByte(AddressSyntax address) { _address = address; if (address.ContainsUndefinedLabel) _addressType = AddressType.Label; else { _addressType = AddressType.DirectValue; _byte = _address.Value; } }
public static bool TryParseAddress(string input, out AddressSyntax addressSyntax, BracketExpectation bracketExpectation = BracketExpectation.NotPresent) { bool isSuccess; byte address; string undefinedLabel; bool isAddress = IsAddress(input.Trim('[', ']'), out address, out undefinedLabel); bool isSurroundedByBrackets = input.StartsWith("[") && input.EndsWith("]"); if (bracketExpectation == BracketExpectation.Present) isSuccess = isAddress && isSurroundedByBrackets; else isSuccess = isAddress && !isSurroundedByBrackets; if (isSuccess) addressSyntax = new AddressSyntax(address, undefinedLabel); else addressSyntax = null; return isSuccess; }