forked from sunaku/glove80-keymaps
-
Notifications
You must be signed in to change notification settings - Fork 0
/
define.dot.erb
40 lines (36 loc) · 932 Bytes
/
define.dot.erb
1
2
3
4
5
6
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
34
35
36
37
38
39
40
digraph settings {
graph [rankdir=RL]
subgraph defaults {
<%
require 'set'
numbers = Set.new
settings = {}
`grep -A1 '^#ifndef' keymap.dtsi.min | grep '^#define'`.lines.each do |define|
(_define, key, value) = define.split
case value
when /^["']/
value = value.inspect
when /^\d+$/
numbers << value
value = "NUMBER_#{value}"
when "\\"
warn({ skip: define })
next # skip this setting -- it's a complex multi-line definition
end
settings[key] = value
%>
<%= key %> -> <%= value %>
<%
end
%>
}
subgraph values {
graph [rank=same]
<% settings.values.grep(/^".*"$/).uniq.each do |string| %>
<%= string %> [label=<%= string %>, style=filled, fillcolor=cyan, shape=diamond]
<% end %>
<% numbers.each do |number| %>
NUMBER_<%= number %> [label="<%= number %>", style=filled, fillcolor=yellow, shape=diamond]
<% end %>
}
}