Module: AtCoderFriends::Parser::InputFormatConstants

Included in:
InputFormat, InputFormatMatcherConstants, InputFormatUtils
Defined in:
lib/at_coder_friends/parser/input_format.rb

Constant Summary collapse

SECTIONS =
[Problem::SECTION_IN_FMT, Problem::SECTION_IO_FMT].freeze
DELIMS =
%w[- / :].freeze
RE_SINGLE =
/[A-Za-z{][A-Za-z_0-9{}]*/.freeze
RE_ITEM =
/\{*[A-Za-z]+(?:_[A-Za-z]+)*\}*/.freeze
RE_0 =
/[0-9]+/.freeze
RE_00 =
/[01][,_]?[01]/.freeze
RE_99 =
/[0-9]+[,_]?[0-9]+/.freeze
ADD_TAG =
->(tag, re) { /(?<#{tag}>#{re})/ }
TO_SUFFIX =
->(re) { /(_\{*#{re}\}*|\{+#{re}\}+)/ }
TO_SUFFIX_STR =
->(str) { "(_\\{*#{str}\\}*|\\{+#{str}\\}+)" }
RE_IX =
RE_IX_0 =
TO_SUFFIX[ADD_TAG['ix0', RE_0]
RE_IX_00 =
TO_SUFFIX[ADD_TAG['ix0', RE_00]
RE_IX_99 =
RE_SZ =
TO_SUFFIX[ADD_TAG['sz', /\S+?/]
RE_SZ_0 =
TO_SUFFIX[ADD_TAG['sz', RE_0]
RE_SZ_00 =
TO_SUFFIX[ADD_TAG['sz', RE_00]
RE_SZ_99 =
TO_SUFFIX[ADD_TAG['sz', RE_99]
RE_SZ_REF =
RE_SZ2_0 =
TO_SUFFIX[ADD_TAG['sz2', RE_0]
RE_SZ2_REF =
RE_BLOCK =
/(?<bl>\{(?:[^{}]|\g<bl>)*\})/.freeze
DIMENSION_TBL =
{
  single: 0,
  varray: 1,
  harray: 1,
  matrix: 2,
  varray_matrix: 2,
  matrix_varray: 2,
  vmatrix: 2,
  hmatrix: 2
}.freeze