Sha256: dbe7d8078989a734d1102bdeaf3788e3127c8126b1f050b03bbfc679598d80f9

Contents?: true

Size: 551 Bytes

Versions: 2

Compression:

Stored size: 551 Bytes

Contents

# encoding: utf-8

module Antelope
  class Grammar
    class Token
      # Defines an epsilon token.  An epsilon token represents
      # nothing.  This is used to say that a nonterminal can
      # reduce to nothing.
      class Epsilon < Token
        # Initialize.  Technically takes no arguments.  Sets
        # the name of the token to be `:$empty`.
        def initialize(*)
          super :"$empty"
        end

        # (see Token#epsilon?)
        def epsilon?
          true
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
antelope-0.3.2 lib/antelope/grammar/token/epsilon.rb
antelope-0.3.0 lib/antelope/grammar/token/epsilon.rb