Sha256: 9b51b47ce70ade0fe94166610266ecb81edf2fd62ac4ee8da4f63ba0c1704784
Contents?: true
Size: 1.13 KB
Versions: 2
Compression:
Stored size: 1.13 KB
Contents
grammar WLang::Grammar rule template (strconcat !.){ [:template, [:fn, captures[:strconcat].first.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, captures[:symbols].first.to_s] + captures[:functions].first.value } end rule functions function+ { matches.map{|fn| [:fn, fn.value]} } end rule function (fn_start strconcat fn_stop){ captures[:strconcat].first.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-2.3.1 | lib/wlang/compiler/grammar.citrus |
wlang-2.3.0 | lib/wlang/compiler/grammar.citrus |