[ragel-users] string representation of entities in dot files

Adrian Thurston thurston at complang.org
Wed Dec 3 14:57:52 UTC 2008


Yes there is, ragel -h will show you the -p option for writing printable
label on transitions.

Cheers,
 Adrian

Gaspard Bucher wrote:
> Hi list !
> 
> Anyone knows if there is an option to "ragel -V" to show litteral
> values instead of numerical ones in the "dot" generated file ?
> 
> A --- 34 ---> B
> 
> is less readable then
> 
> A --- " ---> B
> 
> If there is no such option and such a filter could help others, here's
> a simple ruby script that does the job.
> 
> ====== filter.rb =======
> #!/usr/bin/env ruby
> STDIN.read.split("\n").each do |l|
>   new_l = l.sub(/([^\"]*)\"([^\"]*)\"/) do
>     pre = $1
>     str = $2
>     str.gsub!(/([0-9]+)/) do
>       val = $1.to_i
>       if val <= 31
>         val.to_s
>       elsif val == 32
>         "' '"
>       elsif val == 47
>         "'/'"
>       elsif val == 34
>         "\\\""
>       elsif val == 92
>         "'\\\\'"
>       elsif val < 126
>         val.chr
>       else
>         val.to_s
>       end
>     end
>     "#{pre}\"#{str}\""
>   end
>   puts new_l
> end
> ===================
> 
> 
> Gaspard
> 
> _______________________________________________
> ragel-users mailing list
> ragel-users at complang.org
> http://www.complang.org/mailman/listinfo/ragel-users




More information about the ragel-users mailing list