Ignore:
Timestamp:
Sep 26, 2018, 3:45:37 AM (7 years ago)
Author:
[email protected]
Message:

[JSC] offlineasm parser should handle CRLF in asm files
https://bugs.webkit.org/show_bug.cgi?id=189949

Patch by Koby Boyango <[email protected]> on 2018-09-26
Reviewed by Mark Lam.

  • offlineasm/parser.rb:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/offlineasm/parser.rb

    r222549 r236499  
    841841end
    842842
     843def readTextFile(fileName)
     844    data = IO::read(fileName)
     845
     846    # On Windows, files may contain CRLF line endings (for example, git client might
     847    # automatically replace \n with \r\n on Windows) which will fail our parsing.
     848    # Thus, we'll just remove all \r from the data (keeping just the \n characters)
     849    data.delete!("\r")
     850
     851    return data
     852end
     853
    843854def parseData(data, fileName)
    844855    parser = Parser.new(data, SourceFile.new(fileName))
     
    847858
    848859def parse(fileName)
    849     parseData(IO::read(fileName), fileName)
     860    parseData(readTextFile(fileName), fileName)
    850861end
    851862
    852863def parseHash(fileName)
    853     parser = Parser.new(IO::read(fileName), SourceFile.new(fileName))
     864    parser = Parser.new(readTextFile(fileName), SourceFile.new(fileName))
    854865    fileList = parser.parseIncludes(nil, "")
    855866    fileListHash(fileList)
Note: See TracChangeset for help on using the changeset viewer.