public Instruction(LogicalCodeLine line, int startColumn, int endColumn, string content) { _line = line; _startColumn = startColumn == 0 ? 1 : startColumn; _endColumn = endColumn == 0 ? startColumn : endColumn; _content = content; int index; if (_content.HasComment(out index)) { _comment = _content.TrimStart().Substring(index - _content.TakeWhile(c => c == ' ').Count()).Trim(); _instruction = _content.TrimStart().Substring(0, index - _content.TakeWhile(c => c == ' ').Count()); } else { _comment = string.Empty; _instruction = _content.TrimEnd().EndsWith(":") ? _content.TrimEnd().Substring(0, _content.TrimEnd().Length - 1) : _content; } }
public static Instruction Empty(LogicalCodeLine line) { return(new Instruction(line, 1, 1, string.Empty)); }