LIR support for octal literals in pipeline definitions

Fixes #10828
This commit is contained in:
Dan Hermann 2019-05-28 08:31:05 -05:00
parent 682c050f1e
commit 78607d2bbb
2 changed files with 17 additions and 2 deletions

View file

@ -164,8 +164,8 @@ module LogStashCompilerLSCLGrammar; module LogStash; module Compiler; module LSC
class Number < Value
def expr
jdsl.eValue(source_meta, text_value.include?(".") ?
text_value.to_f :
text_value.to_i)
Float(text_value) :
Integer(text_value))
end
end

View file

@ -143,6 +143,21 @@ describe LogStashConfigParser do
expect(config).to be_nil
end
it "supports octal literals" do
parser = LogStashConfigParser.new
config = parser.parse(%q(
input {
example {
foo => 010
}
}
))
compiled_number = eval(config.recursive_select(LogStash::Config::AST::Number).first.compile)
expect(compiled_number).to be == 8
end
end
context "when config.support_escapes" do