Sha256: f1f0d426f7f21b1704d333c67f530ea082db26d8d1787909bfd7ec6e1920a5d4
Contents?: true
Size: 1.06 KB
Versions: 6
Compression:
Stored size: 1.06 KB
Contents
grammar WLang::Grammar rule template (strconcat !.){ [:template, [:fn, strconcat.value]] } end rule strconcat (non_static | static)* { if matches.size == 1 matches.first.value else [:strconcat] + matches.map(&:value) end } end rule static (!stop_char .)+ { [:static, to_s] } end rule non_static block | wlang end rule block (fn_start strconcat fn_stop){ [:strconcat, [:static, captures[:fn_start].first.to_s], captures[:strconcat].first.value, [:static, captures[:fn_stop].first.to_s]] } end rule wlang (symbols functions){ [:wlang, symbols.to_s] + functions.value } end rule functions function+ { matches.map{|fn| [:fn, fn.value]} } end rule function (fn_start strconcat fn_stop){ strconcat.value } end rule stop_char fn_start | fn_stop | (symbols fn_start) end rule symbols /[!\^%"\$&'\*\+\?@~\#,\-\.\/:;=<>\|_`]+/ end rule fn_start '{' end rule fn_stop '}' end end
Version data entries
6 entries across 6 versions & 1 rubygems