Sha256: 51543227e5cb389b6b43398e071ce92f3742a76e3ac520c7e5e163a4878dec3e

Contents?: true

Size: 528 Bytes

Versions: 2

Compression:

Stored size: 528 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.4.1 lib/antelope/grammar/token/epsilon.rb
antelope-0.4.0 lib/antelope/grammar/token/epsilon.rb