Module: PlatformosCheck::LanguageServer::VariableLookupFinder::Constants

Included in:
PlatformosCheck::LanguageServer::VariableLookupFinder, LiquidFixer
Defined in:
lib/platformos_check/language_server/variable_lookup_finder/constants.rb

Constant Summary collapse

ANY_STARTING_TAG =
/\s*#{Liquid::AnyStartingTag}/
ANY_ENDING_TAG =
/#{Liquid::TagEnd}|#{Liquid::VariableEnd}\s*^/om
UNCLOSED_SQUARE_BRACKET =
/\[[^\]]*\Z/
ENDS_IN_BRACKET_POSITION_THAT_CANT_BE_COMPLETED =
/
  (
    # quotes not preceded by a [
    (?<!\[)['"]|
    # closing ]
    \]|
    # opening [
    \[
  )$
/x
VARIABLE_START =
/\s*#{Liquid::VariableStart}/
VARIABLE_LOOKUP_CHARACTERS =
/[a-z0-9_.'"\]\[]/i
VARIABLE_LOOKUP =
/#{VARIABLE_LOOKUP_CHARACTERS}+/o
SYMBOLS_PRECEDING_POTENTIAL_LOOKUPS =
/
  (?:
    \s(?:
      if|elsif|unless|and|or|#{Liquid::Condition.operators.keys.join("|")}
      |echo
      |return
      |log
      |paginate
      |case|when
      |cycle
      |in
    )
    |[:,=]
  )
  \s+
/omix
ENDS_WITH_BLANK_POTENTIAL_LOOKUP =
/#{SYMBOLS_PRECEDING_POTENTIAL_LOOKUPS}$/oimx
ENDS_WITH_POTENTIAL_LOOKUP =
/#{SYMBOLS_PRECEDING_POTENTIAL_LOOKUPS}#{VARIABLE_LOOKUP}$/oimx