Sha256: b47fe3c15861b267e40e602e998978d4ee0de838880aacffce190d583ed9997f

Contents?: true

Size: 746 Bytes

Versions: 2

Compression:

Stored size: 746 Bytes

Contents

class SGF::IdentityToken
  def still_inside? char, token_so_far, sgf_stream
    char != "["
  end

  def transform token
    token.gsub "\n", ""
  end
end

class SGF::CommentToken
  def still_inside? char, token_so_far, sgf_stream
    char != "]" || (char == "]" && token_so_far[-1..-1] == "\\")
  end

  def transform token
    token.gsub "\\]", "]"
  end
end

class SGF::MultiPropertyToken
  def still_inside? char, token_so_far, sgf_stream
    return true if char != "]"
    sgf_stream.peek_skipping_whitespace == "["
  end

  def transform token
    token.gsub("][", ",").split(",")
  end
end

class SGF::GenericPropertyToken
  def still_inside? char, token_so_far, sgf_stream
    char != "]"
  end

  def transform token
    token
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
SgfParser-3.0.1 lib/sgf/parsing_tokens.rb
SgfParser-3.0.0 lib/sgf/parsing_tokens.rb