//skip comments //TODO unescape escaped sequences public override int Peek() { if (_cache.Count > 0) { return(_cache.Peek()); } int p = _reader.Peek(); if (p <= 0) { return(p); } if (unchecked ((char)p) != '/') { return(p); } _cache.Enqueue(unchecked ((char)_reader.Read())); p = _reader.Peek(); if (p <= 0) { return(_cache.Peek()); } if (unchecked ((char)p) != '*') { return(_cache.Peek()); } _cache.Clear(); _reader.Read(); //consume the '*' bool hasStar = false; while (true) { var next = _reader.Read(); if (next <= 0) { return(next); } if (unchecked ((char)next) == '*') { hasStar = true; } else if (hasStar && unchecked ((char)next) == '/') { return(Peek()); //recursively call self for comments following comments } else { hasStar = false; } } }
internal static T FindDescendantView <T>(this UIView view) where T : UIView { var queue = new FormsQueue <UIView>(); queue.Enqueue(view); while (queue.Count > 0) { var descendantView = queue.Dequeue(); var result = descendantView as T; if (result != null) { return(result); } for (var i = 0; i < descendantView.Subviews?.Length; i++) { queue.Enqueue(descendantView.Subviews[i]); } } return(null); }
public void WaitForElement(string query) { _result.Enqueue(query); }
public void Tap(string button) { _buttons.Enqueue(button); }