Sha256: 0c9af756e0832cca2bf7b68a0f0022db8ee16bb10f191ca45c524e35cf72b7f0
Contents?: true
Size: 1.08 KB
Versions: 2
Compression:
Stored size: 1.08 KB
Contents
grammar WLang::Grammar rule template (strconcat !.){ [:template, [:fn, capture(: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, capture(:fn_start).to_s], capture(:strconcat).value, [:static, capture(:fn_stop).to_s]] } end rule wlang (symbols functions){ [:wlang, capture(:symbols).to_s] + capture(:functions).value } end rule functions function+ { matches.map{|fn| [:fn, fn.value]} } end rule function (fn_start strconcat fn_stop){ capture(: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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
wlang-3.0.1 | lib/wlang/compiler/grammar.citrus |
wlang-3.0.0 | lib/wlang/compiler/grammar.citrus |