Sha256: 557ab41f4ad07bd2c2238b9a6b707297b5d5dd21b66386858e186623dc11d354

Contents?: true

Size: 1.28 KB

Versions: 9

Compression:

Stored size: 1.28 KB

Contents

# vim: syntax=ruby

require 'yaml'
require 'puppetdb'

class PuppetDB::Lexer
macro
STR        [\w_:]
rule
  \s                # whitespace no action
  \(                { [:LPAREN, text] }
  \)                { [:RPAREN, text] }
  \[                { [:LBRACK, text] }
  \]                { [:RBRACK, text] }
  \{                { [:LBRACE, text] }
  \}                { [:RBRACE, text] }
  =                 { [:EQUALS, text] }
  \!=               { [:NOTEQUALS, text] }
  ~                 { [:MATCH, text] }
  \!~               { [:NOTMATCH, text] }
  <=                { [:LESSTHANEQ, text] }
  <                 { [:LESSTHAN, text] }
  >=                { [:GREATERTHANEQ, text] }
  >                 { [:GREATERTHAN, text] }
  \*                { [:ASTERISK, text] }
  \#                { [:HASH, text] }
  \.                { [:DOT, text] }
  not(?!{STR})      { [:NOT, text] }
  and(?!{STR})      { [:AND, text] }
  or(?!{STR})       { [:OR, text] }
  true(?!{STR})     { [:BOOLEAN, true]}
  false(?!{STR})    { [:BOOLEAN, false]}
  -?\d+             { [:NUMBER, text.to_i] }
  \"(\\.|[^\\"])*\" { [:STRING, YAML.load(text)] }
  \'(\\.|[^\\'])*\' { [:STRING, YAML.load(text)] }
  {STR}+            { [:STRING, text] }
  @@                { [:EXPORTED, text] }
  @                 { [:AT, text] }
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
ruby-puppetdb-3.0.1 lib/puppetdb/lexer.rex
ruby-puppetdb-3.0.0 lib/puppetdb/lexer.rex
ruby-puppetdb-2.3.0 lib/puppetdb/lexer.rex
ruby-puppetdb-2.2.0 lib/puppetdb/lexer.rex
ruby-puppetdb-2.1.1 lib/puppetdb/lexer.rex
ruby-puppetdb-2.1.0 lib/puppetdb/lexer.rex
ruby-puppetdb-2.0.3 lib/puppetdb/lexer.rex
ruby-puppetdb-2.0.2 lib/puppetdb/lexer.rex
ruby-puppetdb-2.0.1 lib/puppetdb/lexer.rex