Module: Build::Makefile::Parser
- Defined in:
- lib/build/makefile.rb
Constant Summary collapse
- SOURCE_PATH =
/(\\\s|[^\s])+/- SOURCE_SEPARATOR =
/((:?\\\n|\s|\n)+)/
Class Method Summary collapse
Class Method Details
.parse(scanner) ⇒ Object
87 88 89 90 91 |
# File 'lib/build/makefile.rb', line 87 def self.parse(scanner) while definition = parse_statement(scanner) yield definition end end |
.parse_rule(scanner) ⇒ Object
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/build/makefile.rb', line 60 def self.parse_rule(scanner) if scanner.scan(/(.*):/) rule = [:rule] target = scanner[1].strip rule << target # Parse dependencies: dependencies = [] until scanner.scan(/\s*\n/) or scanner.eos? scanner.scan(/(\s|\\\n)*/) scanner.scan(SOURCE_PATH) # Need to remove escaped whitespace from path: dependencies << scanner[0].gsub(/\\ /, ' ') end rule << dependencies return rule end end |
.parse_statement(scanner) ⇒ Object
83 84 85 |
# File 'lib/build/makefile.rb', line 83 def self.parse_statement(scanner) parse_rule(scanner) end |