Skip to content

Does not handle // comments at end of line, and error message does not say which line #6

@mathieulb

Description

@mathieulb

RuntimeError because some of my lines didn't end with ";", while Xcode (or whichever Apple tool handles this) doesn't have any problem with it (not even a warning).

I believe that a "//" comment at the end of a line should be considered a comment belonging to the previous pair if on the same line, whereas when it is on a line of its own it should be attached to the following one instead. Personally I only use #to_hash(with_comments:false) but for those who do care about keeping comments, this rule would match how people use "//" in any source code that I know.

Also, error messages should say which line of the file it failed in, and ideally which file too, though for the latter it's easier to trace from one's own program, whereas for the line number I had to edit Apfel's dot_strings_parser.rb to add numbers, e.g.

linenum=0
@read_file.each do |content_line|
  linenum+=1
  current_line = begin Line.new(content_line)
    rescue Exception => e
    throw RuntimeError.new("at line #{linenum}: #{e.message}") end

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions