MCPcopy Index your code
hub / github.com/lutzroeder/netron / _skipWhitespace

Method _skipWhitespace

source/python.js:1889–1915  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1887 }
1888 }
1889 _skipWhitespace() {
1890 while (this._position < this._text.length) {
1891 const c = this._text[this._position];
1892 if (c === '#') {
1893 this._skipLine();
1894 } else if (ast._Tokenizer._isSpace(c)) {
1895 this._position++;
1896 } else if (c === '\\') {
1897 // Explicit Line Continuation
1898 this._position++;
1899 if (ast._Tokenizer._isNewline(this._get(this._position))) {
1900 this._position = this._newLine(this._position);
1901 this.linepos = this._position;
1902 this.lineno += 1;
1903 } else {
1904 throw new python.Error(`Unexpected '${this._text[this._position]}' after line continuation ${this.location()}`);
1905 }
1906 } else if (this._brackets > 0 && ast._Tokenizer._isNewline(c)) {
1907 // Implicit Line Continuation
1908 this._position = this._newLine(this._position);
1909 this.linepos = this._position;
1910 this.lineno += 1;
1911 } else {
1912 break;
1913 }
1914 }
1915 }
1916 _newLine(position) {
1917 if ((this._get(position) === '\n' && this._get(position + 1) === '\r') || (this._get(position) === '\r' && this._get(position + 1) === '\n')) {
1918 return position + 2;

Callers 1

_tokenizeMethod · 0.45

Calls 6

_skipLineMethod · 0.45
_isSpaceMethod · 0.45
_isNewlineMethod · 0.45
_getMethod · 0.45
_newLineMethod · 0.45
locationMethod · 0.45

Tested by

no test coverage detected