Sha256: d0f8f063d637ca06167d66ba364abfe07d0ce7672af33875f7cc169096d7d4a6

Contents?: true

Size: 1.29 KB

Versions: 1

Compression:

Stored size: 1.29 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
        "B" ("ot" / "OT") <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

1 entries across 1 versions & 1 rubygems

Version Path
fonte-0.2.0 lib/fonte/parsers/steam_id.treetop