Sha256: 7790adede2f11a51fee3305bba4765b8ca484f1cb0ec48431ff07f22362be43a

Contents?: true

Size: 849 Bytes

Versions: 1

Compression:

Stored size: 849 Bytes

Contents

module Lrama
  class Grammar
    class ParameterizingRules
      class Builder
        class List < Base
          def build
            validate_argument_number!

            rules = []
            list_token = Lrama::Lexer::Token::Ident.new(s_value: "list_#{@token.s_value}")
            rules << Rule.new(id: @rule_counter.increment, _lhs: @lhs, _rhs: [list_token], token_code: @user_code, precedence_sym: @precedence_sym, lineno: @line)
            rules << Rule.new(id: @rule_counter.increment, _lhs: list_token, _rhs: [], token_code: @user_code, precedence_sym: @precedence_sym, lineno: @line)
            rules << Rule.new(id: @rule_counter.increment, _lhs: list_token, _rhs: [list_token, @token], token_code: @user_code, precedence_sym: @precedence_sym, lineno: @line)
            rules
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
lrama-0.5.10 lib/lrama/grammar/parameterizing_rules/builder/list.rb