def skip_heredoc_string(self, s, i): #@+<< skip_heredoc docstrig >> #@+node:ekr.20161130044051.2: *4* << skip_heredoc docstrig >> #@@nocolor-node ''' 08-SEP-2002 DTHEIN: added function skip_heredoc_string A heredoc string in PHP looks like: <<<EOS This is my string. It is mine. I own it. No one else has it. EOS It begins with <<< plus a token (naming same as PHP variable names). It ends with the token on a line by itself (must start in first position. ''' #@-<< skip_heredoc docstrig >> j = i assert(g.match(s, i, "<<<")) # pylint: disable=anomalous-backslash-in-string m = re.match("\<\<\<([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)", s[i:]) if m is None: i += 3 return i # 14-SEP-2002 DTHEIN: needed to add \n to find word, not just string delim = m.group(1) + '\n' i = g.skip_line(s, i) # 14-SEP-2002 DTHEIN: look after \n, not before n = len(s) while i < n and not g.match(s, i, delim): i = g.skip_line(s, i) # 14-SEP-2002 DTHEIN: move past \n if i >= n: g.scanError("Run on string: " + s[j: i]) elif g.match(s, i, delim): i += len(delim) return i
def skip_heredoc_string(self, s, i): #@+<< skip_heredoc docstrig >> #@+node:ekr.20161130044051.2: *4* << skip_heredoc docstrig >> #@@nocolor-node ''' 08-SEP-2002 DTHEIN: added function skip_heredoc_string A heredoc string in PHP looks like: <<<EOS This is my string. It is mine. I own it. No one else has it. EOS It begins with <<< plus a token (naming same as PHP variable names). It ends with the token on a line by itself (must start in first position. ''' #@-<< skip_heredoc docstrig >> j = i assert (g.match(s, i, "<<<")) # pylint: disable=anomalous-backslash-in-string m = re.match("\<\<\<([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)", s[i:]) if m is None: i += 3 return i # 14-SEP-2002 DTHEIN: needed to add \n to find word, not just string delim = m.group(1) + '\n' i = g.skip_line(s, i) # 14-SEP-2002 DTHEIN: look after \n, not before n = len(s) while i < n and not g.match(s, i, delim): i = g.skip_line(s, i) # 14-SEP-2002 DTHEIN: move past \n if i >= n: g.scanError("Run on string: " + s[j:i]) elif g.match(s, i, delim): i += len(delim) return i