7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# File 'opal/lib/opal/magic_comments.rb', line 7
def self.parse(sexp, )
flags = {}
if sexp
first_line = sexp.loc.line
= .take(first_line)
end
.each do ||
next if first_line && .loc.line >= first_line
if (parts = .text.scan(MAGIC_COMMENT_RE)).any? ||
(parts = .text.scan(EMACS_MAGIC_COMMENT_RE)).any?
parts.each do |key, value|
flags[key.to_sym] =
case value
when 'true' then true
when 'false' then false
else value
end
end
end
end
flags
end
|