Sha256: c421c3e1d3c1f55294bc92163b0da37653f85fe4e7ccad9438a56fd3d1abdaf0

Contents?: true

Size: 1.26 KB

Versions: 2

Compression:

Stored size: 1.26 KB

Contents

Productions:
<%
len = grammar.all_productions.size.to_s.size
productions = recognizer.states.map(&:rules).inject(:merge).
  select(&:final?).map { |x| [x.to_s(false), x.production.block] }
body = productions.map { |_| _[0].size }.max
productions.each do |prod|
-%>
  <%= sprintf("%-#{body}s", prod[0]) %> <%= prod[1] %>
<% end -%>

<%
if table.each_with_index.any? { |_, i| tableizer.conflicts[i].each.
  select { |(_, v)| v[:result] == 0 || directives.output.verbose }.any? }
-%>
Error:
<%
  table.each_with_index do |_, i|
    conflicts = tableizer.conflicts[i].each.
      select { |(_, v)| v[:result] == 0 || directives.output.verbose }
    next unless conflicts.any?
-%>
  Conflicts in State <%= i %>:
    <%- conflicts.each do |token, value| -%>
    On <%= token %><%= ' (resolved)' if value[:result] != 0 %>:
      <%= value[:data][0].join(' ') %>/<%= value[:data][1].join(' ') %> (<%= value[:prec] %> vs <%= value[:terminal] %>, <%= value[:result] %>)
      Rules:
      <%- value[:rules].each do |rule| -%>
        <%= rule %>
          {<%= rule.lookahead.to_a.join(', ') %>}
      <%- end -%>
      Transitions:
      <%- value[:transitions].each do |transition| -%>
        <%= transition %>
      <%- end -%>
    <%- end -%>
  <%- end -%>
<%- else -%>
No errors :)
<%- end -%>

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
antelope-0.4.1 lib/antelope/generator/templates/error.erb
antelope-0.4.0 lib/antelope/generator/templates/error.erb