Sha256: 622a245d226f5e74c585915c84ff544215b2594cc4fc109080689d3f9cc0a51b

Contents?: true

Size: 753 Bytes

Versions: 1

Compression:

Stored size: 753 Bytes

Contents

# vim: syntax=ruby

require 'json'

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] }
	<			{ [:LESSTHAN, text] }
	>			{ [:GREATERTHAN, text] }
	not(?!{STR})		{ [:NOT, text] }
	and(?!{STR})		{ [:AND, text] }
	or(?!{STR})		{ [:OR, text] }
	true(?!{STR})		{ [:BOOLEAN, true]}
	false(?!{STR})		{ [:BOOLEAN, false]}
	-?\d+\.\d+		{ [:NUMBER, text.to_f] }
	-?\d+			{ [:NUMBER, text.to_i] }
	\"(\\.|[^\\"])*\"	{ [:STRING, JSON.load(text)] }
	{STR}+			{ [:STRING, text] }
	@@			{ [:EXPORTED, text] }
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ruby-puppetdb-1.1.0 lib/puppetdb/lexer.l