diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2012-01-24 09:15:09 +0100 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2012-01-24 09:15:09 +0100 |
commit | dbb576957737a14d68a2cba602a731e1c8062856 (patch) | |
tree | fada6db22236d61243c297e0c1c25c252e776917 /tools | |
parent | ba92e1cfe9b646055e18c01b301a2cb6d29939ef (diff) | |
download | ffi-efl-dbb576957737a14d68a2cba602a731e1c8062856.zip ffi-efl-dbb576957737a14d68a2cba602a731e1c8062856.tar.gz |
tools/sed-enums, tools/genruby: take care of multilines DEF=(A|B|C)
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/genruby.rb | 7 | ||||
-rw-r--r-- | tools/sed-enums | 9 |
2 files changed, 12 insertions, 4 deletions
diff --git a/tools/genruby.rb b/tools/genruby.rb index 2315da0..58e5f91 100755 --- a/tools/genruby.rb +++ b/tools/genruby.rb @@ -169,6 +169,13 @@ def gen_enums path, indent elsif v.nil? h[s]=i i+=1 + elsif v=~/\|/ + els = v.gsub(/[\(\)]/,'').split(/\|/) + puts h.inspect + puts els.inspect + v = els.inject('') { |s,e| s+="#{h[e]}|" }[0..-2] + h[s]=v + i=eval(v).to_i+1 else h[s]=v i=eval(v).to_i+1 diff --git a/tools/sed-enums b/tools/sed-enums index 870e030..aa44675 100644 --- a/tools/sed-enums +++ b/tools/sed-enums @@ -7,9 +7,9 @@ T;h :attrs;n # read again if { /^\s*\{/ b attrs -# append each item -s/^\s*([A-Z0-9_]+)(\s*=\s*[^,\/]+)?.*$/\1\2, / -# goto next if subsitution fails, append pattern, loop +# append each item finished by , or \/ +s/^\s*([A-Z0-9_]+)(\s*=\s*[^,\/]+)?\s*([,|\)])?[\/]?.*$/\1\2\3 / +# goto next if subsitution fails, append pattern, loop to attrs T next;H;b attrs :next # try again if } not found @@ -29,4 +29,5 @@ H;x s/\n//g # replace multi spaces with one s/ {2,}/ /g -s/, }/ }/p +s/, }/ }/ +p |