Module: LogStashCompilerLSCLGrammar::LogStash::Compiler::LSCL::AST::Helpers

Overview

Helpers for parsing LSCL files

Constant Summary collapse

BOOLEAN_DSL_METHOD_SIGNATURE =
[org.logstash.common.SourceWithMetadata, org.logstash.config.ir.expression.Expression, org.logstash.config.ir.expression.Expression]
AND_METHOD =
jdsl.java_method(:eAnd, BOOLEAN_DSL_METHOD_SIGNATURE)
NAND_METHOD =
jdsl.java_method(:eNand, BOOLEAN_DSL_METHOD_SIGNATURE)
OR_METHOD =
jdsl.java_method(:eOr, BOOLEAN_DSL_METHOD_SIGNATURE)
XOR_METHOD =
jdsl.java_method(:eXor, BOOLEAN_DSL_METHOD_SIGNATURE)

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.jdslObject



48
49
50
# File 'lib/logstash/compiler/lscl/helpers.rb', line 48

def self.jdsl
  org.logstash.config.ir.DSL
end

Instance Method Details

#base_idObject



23
24
25
# File 'lib/logstash/compiler/lscl/helpers.rb', line 23

def base_id
  self. ? self..id : 'config_ast'
end

#base_protocolObject



19
20
21
# File 'lib/logstash/compiler/lscl/helpers.rb', line 19

def base_protocol
  self. ? self..protocol : 'config_ast'
end

#base_source_with_metadataObject



15
16
17
# File 'lib/logstash/compiler/lscl/helpers.rb', line 15

def 
  get_meta(:base_source_with_metadata)
end

#base_source_with_metadata=(value) ⇒ Object



11
12
13
# File 'lib/logstash/compiler/lscl/helpers.rb', line 11

def base_source_with_metadata=(value)
  set_meta(:base_source_with_metadata, value)
end

#compose(*statements) ⇒ Object



27
28
29
# File 'lib/logstash/compiler/lscl/helpers.rb', line 27

def compose(*statements)
  compose_for(section_type.to_sym).call(source_meta, *statements)
end

#compose_for(section_sym) ⇒ Object



31
32
33
34
35
36
37
# File 'lib/logstash/compiler/lscl/helpers.rb', line 31

def compose_for(section_sym)
  if section_sym == :filter
    jdsl.method(:iComposeSequence)
  else
    jdsl.method(:iComposeParallel)
  end
end

#jdslObject



44
45
46
# File 'lib/logstash/compiler/lscl/helpers.rb', line 44

def jdsl
  org.logstash.config.ir.DSL
end

#line_and_columnObject



39
40
41
42
# File 'lib/logstash/compiler/lscl/helpers.rb', line 39

def line_and_column
  start = self.interval.first
  [self.input.line_of(start), self.input.column_of(start)]
end

#source_metaObject



6
7
8
9
# File 'lib/logstash/compiler/lscl/helpers.rb', line 6

def source_meta
  line, column = line_and_column
  org.logstash.common.SourceWithMetadata.new(base_protocol, base_id, line, column, self.text_value)
end