summaryrefslogtreecommitdiff
path: root/tool/lrama/lib/lrama/lexer/grammar_file.rb
blob: 6be07670041453d96343a15e775fbe0f04508be9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
module Lrama
  class Lexer
    class GrammarFile
      attr_reader :path, :text

      def initialize(path, text)
        @path = path
        @text = text.freeze
      end

      def ==(other)
        self.class == other.class &&
        self.path == other.path
      end

      def lines
        @lines ||= text.split("\n")
      end
    end
  end
end