2018-09-12 08:05


  • parsing

I've been writing this Php parser in Go, but I seem to have hit a little problem, which is that sometimes the final line is not added to the new file I am writing.

Basically I go over the original Php file, do some obfuscating, and then write those obfuscated lines to a new file.

Problem is that at times I run into a file that does not have a newline at the end, and I assume that line, err := reader.ReadString(' ') will not read a string if it does not have the delimiting character at the end?

Is there an easy solution for this that doesn't involve using Scanner, because a lot of the parsing code is dependent on interpreting newlines...

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享