Sha256: b2f2a32d85c7e93e7607a3d213523a4aef7c13b08efda300130181907fd85c71

Contents?: true

Size: 1.28 KB

Versions: 2

Compression:

Stored size: 1.28 KB

Contents

module Fonte
  module Parsers
    grammar SteamID
      include Number

      rule steam_id
          steam_id_pending
        / steam_id_bot
        / steam_id_console
        / steam_id_invalid
        / universe:steam_universe ":" id_part:steam_id_part ":" account_number:steam_account_number <Fonte::Nodes::SteamIDNode> {
          def value
            text_value
          end
        }
      end

      rule steam_id_pending
        "STEAM_ID_PENDING" <Fonte::Nodes::SteamIDNode> {
          def pending?
            true
          end
        }
      end

      rule steam_id_bot
        "Bot" <Fonte::Nodes::SteamIDNode> {
          def bot?
            true
          end
        }
      end

      rule steam_id_console
        "Console" <Fonte::Nodes::SteamIDNode> {
          def console?
            true
          end
        }
      end

      rule steam_id_invalid
        "UNKNOWN" <Fonte::Nodes::SteamIDNode> {
          def unknown?
            true
          end
        }
      end

      rule steam_universe
        "STEAM_" universe:[0-9] <Fonte::Nodes::SteamIDUniverseNode>
      end

      rule steam_id_part
        [01] {
          def value
            text_value.to_i
          end
        }
      end

      rule steam_account_number
        integer
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
fonte-0.1.0 lib/fonte/parsers/steam_id.treetop
fonte-0.0.1 lib/fonte/parsers/steam_id.treetop