Sha256: 19a5729e0258f131c3261b957754faf5ded8f82334b94f45ea2c4149b2d5a84a

Contents?: true

Size: 1.58 KB

Versions: 6

Compression:

Stored size: 1.58 KB

Contents

# The Patterns module contains common regular expression patters for the Puppet DSL language
module Puppet::Pops::Patterns

  # NUMERIC matches hex, octal, decimal, and floating point and captures three parts
  # 0 = entire matched number, leading and trailing whitespace included
  # 1 = hexadecimal number
  # 2 = non hex integer portion, possibly with leading 0 (octal)
  # 3 = floating point part, starts with ".", decimals and optional exponent
  #
  # Thus, a hex number has group 1 value, an octal value has group 2 (if it starts with 0), and no group 3
  # and a floating point value has group 2 and group 3.
  #
  NUMERIC = %r{^\s*(?:(0[xX][0-9A-Fa-f]+)|(0?\d+)((?:\.\d+)?(?:[eE]-?\d+)?))\s*$}

  # ILLEGAL_P3_1_HOSTNAME matches if a hostname contains illegal characters.
  # This check does not prevent pathological names like 'a....b', '.....', "---". etc.
  ILLEGAL_HOSTNAME_CHARS = %r{[^-\w.]}

  # NAME matches a name the same way as the lexer.
  # This name includes hyphen, which may be illegal in variables, and names in general.
  NAME = %r{\A((::)?[a-z0-9]\w*)(::[a-z0-9]\w*)*\z}

  # CLASSREF_EXT matches a class reference the same way as the lexer - i.e. the external source form
  # where each part must start with a capital letter A-Z.
  # This name includes hyphen, which may be illegal in some cases.
  #
  CLASSREF_EXT = %r{\A((::){0,1}[A-Z][-\w]*)+\z}

  # CLASSREF matches a class reference the way it is represented internally in the
  # model (i.e. in lower case).
  # This name includes hyphen, which may be illegal in some cases.
  #
  CLASSREF = %r{\A((::){0,1}[a-z][-\w]*)+\z}

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
puppet-3.4.3 lib/puppet/pops/patterns.rb
puppet-3.4.2 lib/puppet/pops/patterns.rb
puppet-3.4.1 lib/puppet/pops/patterns.rb
puppet-3.4.0 lib/puppet/pops/patterns.rb
puppet-3.4.0.rc2 lib/puppet/pops/patterns.rb
puppet-3.4.0.rc1 lib/puppet/pops/patterns.rb