From 74bebbc0bc63172d364630cac88f99abe9a4428d Mon Sep 17 00:00:00 2001 From: Kaitai Bot Date: Sat, 2 Mar 2024 12:47:04 +0000 Subject: [PATCH] Regen master kaitai-io/kaitai_struct@6c384d091c32a2d7ae62fd0c0aded1d92951e37e --- compiled/construct/expr_fstring_0.py | 16 +++ compiled/cpp_stl_11/expr_fstring_0.cpp | 84 +++++++++++ compiled/cpp_stl_11/expr_fstring_0.h | 86 ++++++++++++ compiled/cpp_stl_98/expr_fstring_0.cpp | 90 ++++++++++++ compiled/cpp_stl_98/expr_fstring_0.h | 88 ++++++++++++ compiled/csharp/ExprFstring0.cs | 132 ++++++++++++++++++ .../go/src/test_formats/expr_fstring_0.go | 109 +++++++++++++++ compiled/html/expr_fstring_0.html | 56 ++++++++ .../struct/testformats/ExprFstring0.java | 91 ++++++++++++ compiled/javascript/ExprFstring0.js | 84 +++++++++++ compiled/lua/expr_fstring_0.lua | 93 ++++++++++++ compiled/nim/expr_fstring_0.nim | 106 ++++++++++++++ compiled/perl/ExprFstring0.pm | 101 ++++++++++++++ compiled/php/ExprFstring0.php | 69 +++++++++ compiled/python/expr_fstring_0.py | 78 +++++++++++ compiled/ruby/expr_fstring_0.rb | 57 ++++++++ compiled/rust/expr_fstring_0.rs | 108 ++++++++++++++ 17 files changed, 1448 insertions(+) create mode 100644 compiled/construct/expr_fstring_0.py create mode 100644 compiled/cpp_stl_11/expr_fstring_0.cpp create mode 100644 compiled/cpp_stl_11/expr_fstring_0.h create mode 100644 compiled/cpp_stl_98/expr_fstring_0.cpp create mode 100644 compiled/cpp_stl_98/expr_fstring_0.h create mode 100644 compiled/csharp/ExprFstring0.cs create mode 100644 compiled/go/src/test_formats/expr_fstring_0.go create mode 100644 compiled/html/expr_fstring_0.html create mode 100644 compiled/java/src/io/kaitai/struct/testformats/ExprFstring0.java create mode 100644 compiled/javascript/ExprFstring0.js create mode 100644 compiled/lua/expr_fstring_0.lua create mode 100644 compiled/nim/expr_fstring_0.nim create mode 100644 compiled/perl/ExprFstring0.pm create mode 100644 compiled/php/ExprFstring0.php create mode 100644 compiled/python/expr_fstring_0.py create mode 100644 compiled/ruby/expr_fstring_0.rb create mode 100644 compiled/rust/expr_fstring_0.rs diff --git a/compiled/construct/expr_fstring_0.py b/compiled/construct/expr_fstring_0.py new file mode 100644 index 00000000..38cdc686 --- /dev/null +++ b/compiled/construct/expr_fstring_0.py @@ -0,0 +1,16 @@ +from construct import * +from construct.lib import * + +expr_fstring_0 = Struct( + 'seq_str' / FixedSized(5, GreedyString(encoding='ASCII')), + 'seq_int' / Int8ub, + 'empty' / Computed(lambda this: u""), + 'head_and_int' / Computed(lambda this: u"abc=" + str(this.seq_int)), + 'head_and_int_literal' / Computed(lambda this: u"abc=" + str(123)), + 'head_and_str' / Computed(lambda this: u"abc=" + this.seq_str), + 'head_and_str_literal' / Computed(lambda this: u"abc=" + u"foo"), + 'literal' / Computed(lambda this: u"abc"), + 'literal_with_escapes' / Computed(lambda this: u"abc\n\tt"), +) + +_schema = expr_fstring_0 diff --git a/compiled/cpp_stl_11/expr_fstring_0.cpp b/compiled/cpp_stl_11/expr_fstring_0.cpp new file mode 100644 index 00000000..bfdcbf0e --- /dev/null +++ b/compiled/cpp_stl_11/expr_fstring_0.cpp @@ -0,0 +1,84 @@ +// This is a generated file! Please edit source .ksy file and use kaitai-struct-compiler to rebuild + +#include "expr_fstring_0.h" + +expr_fstring_0_t::expr_fstring_0_t(kaitai::kstream* p__io, kaitai::kstruct* p__parent, expr_fstring_0_t* p__root) : kaitai::kstruct(p__io) { + m__parent = p__parent; + m__root = this; + f_empty = false; + f_head_and_int = false; + f_head_and_int_literal = false; + f_head_and_str = false; + f_head_and_str_literal = false; + f_literal = false; + f_literal_with_escapes = false; + _read(); +} + +void expr_fstring_0_t::_read() { + m_seq_str = kaitai::kstream::bytes_to_str(m__io->read_bytes(5), "ASCII"); + m_seq_int = m__io->read_u1(); +} + +expr_fstring_0_t::~expr_fstring_0_t() { + _clean_up(); +} + +void expr_fstring_0_t::_clean_up() { +} + +std::string expr_fstring_0_t::empty() { + if (f_empty) + return m_empty; + m_empty = std::string(""); + f_empty = true; + return m_empty; +} + +std::string expr_fstring_0_t::head_and_int() { + if (f_head_and_int) + return m_head_and_int; + m_head_and_int = std::string("abc=") + kaitai::kstream::to_string(seq_int()); + f_head_and_int = true; + return m_head_and_int; +} + +std::string expr_fstring_0_t::head_and_int_literal() { + if (f_head_and_int_literal) + return m_head_and_int_literal; + m_head_and_int_literal = std::string("abc=") + kaitai::kstream::to_string(123); + f_head_and_int_literal = true; + return m_head_and_int_literal; +} + +std::string expr_fstring_0_t::head_and_str() { + if (f_head_and_str) + return m_head_and_str; + m_head_and_str = std::string("abc=") + seq_str(); + f_head_and_str = true; + return m_head_and_str; +} + +std::string expr_fstring_0_t::head_and_str_literal() { + if (f_head_and_str_literal) + return m_head_and_str_literal; + m_head_and_str_literal = std::string("abc=") + std::string("foo"); + f_head_and_str_literal = true; + return m_head_and_str_literal; +} + +std::string expr_fstring_0_t::literal() { + if (f_literal) + return m_literal; + m_literal = std::string("abc"); + f_literal = true; + return m_literal; +} + +std::string expr_fstring_0_t::literal_with_escapes() { + if (f_literal_with_escapes) + return m_literal_with_escapes; + m_literal_with_escapes = std::string("abc\n\tt"); + f_literal_with_escapes = true; + return m_literal_with_escapes; +} diff --git a/compiled/cpp_stl_11/expr_fstring_0.h b/compiled/cpp_stl_11/expr_fstring_0.h new file mode 100644 index 00000000..dbc3fa07 --- /dev/null +++ b/compiled/cpp_stl_11/expr_fstring_0.h @@ -0,0 +1,86 @@ +#pragma once + +// This is a generated file! Please edit source .ksy file and use kaitai-struct-compiler to rebuild + +#include "kaitai/kaitaistruct.h" +#include +#include + +#if KAITAI_STRUCT_VERSION < 11000L +#error "Incompatible Kaitai Struct C++/STL API: version 0.11 or later is required" +#endif + +class expr_fstring_0_t : public kaitai::kstruct { + +public: + + expr_fstring_0_t(kaitai::kstream* p__io, kaitai::kstruct* p__parent = nullptr, expr_fstring_0_t* p__root = nullptr); + +private: + void _read(); + void _clean_up(); + +public: + ~expr_fstring_0_t(); + +private: + bool f_empty; + std::string m_empty; + +public: + std::string empty(); + +private: + bool f_head_and_int; + std::string m_head_and_int; + +public: + std::string head_and_int(); + +private: + bool f_head_and_int_literal; + std::string m_head_and_int_literal; + +public: + std::string head_and_int_literal(); + +private: + bool f_head_and_str; + std::string m_head_and_str; + +public: + std::string head_and_str(); + +private: + bool f_head_and_str_literal; + std::string m_head_and_str_literal; + +public: + std::string head_and_str_literal(); + +private: + bool f_literal; + std::string m_literal; + +public: + std::string literal(); + +private: + bool f_literal_with_escapes; + std::string m_literal_with_escapes; + +public: + std::string literal_with_escapes(); + +private: + std::string m_seq_str; + uint8_t m_seq_int; + expr_fstring_0_t* m__root; + kaitai::kstruct* m__parent; + +public: + std::string seq_str() const { return m_seq_str; } + uint8_t seq_int() const { return m_seq_int; } + expr_fstring_0_t* _root() const { return m__root; } + kaitai::kstruct* _parent() const { return m__parent; } +}; diff --git a/compiled/cpp_stl_98/expr_fstring_0.cpp b/compiled/cpp_stl_98/expr_fstring_0.cpp new file mode 100644 index 00000000..c1b5db89 --- /dev/null +++ b/compiled/cpp_stl_98/expr_fstring_0.cpp @@ -0,0 +1,90 @@ +// This is a generated file! Please edit source .ksy file and use kaitai-struct-compiler to rebuild + +#include "expr_fstring_0.h" + +expr_fstring_0_t::expr_fstring_0_t(kaitai::kstream* p__io, kaitai::kstruct* p__parent, expr_fstring_0_t* p__root) : kaitai::kstruct(p__io) { + m__parent = p__parent; + m__root = this; + f_empty = false; + f_head_and_int = false; + f_head_and_int_literal = false; + f_head_and_str = false; + f_head_and_str_literal = false; + f_literal = false; + f_literal_with_escapes = false; + + try { + _read(); + } catch(...) { + _clean_up(); + throw; + } +} + +void expr_fstring_0_t::_read() { + m_seq_str = kaitai::kstream::bytes_to_str(m__io->read_bytes(5), "ASCII"); + m_seq_int = m__io->read_u1(); +} + +expr_fstring_0_t::~expr_fstring_0_t() { + _clean_up(); +} + +void expr_fstring_0_t::_clean_up() { +} + +std::string expr_fstring_0_t::empty() { + if (f_empty) + return m_empty; + m_empty = std::string(""); + f_empty = true; + return m_empty; +} + +std::string expr_fstring_0_t::head_and_int() { + if (f_head_and_int) + return m_head_and_int; + m_head_and_int = std::string("abc=") + kaitai::kstream::to_string(seq_int()); + f_head_and_int = true; + return m_head_and_int; +} + +std::string expr_fstring_0_t::head_and_int_literal() { + if (f_head_and_int_literal) + return m_head_and_int_literal; + m_head_and_int_literal = std::string("abc=") + kaitai::kstream::to_string(123); + f_head_and_int_literal = true; + return m_head_and_int_literal; +} + +std::string expr_fstring_0_t::head_and_str() { + if (f_head_and_str) + return m_head_and_str; + m_head_and_str = std::string("abc=") + seq_str(); + f_head_and_str = true; + return m_head_and_str; +} + +std::string expr_fstring_0_t::head_and_str_literal() { + if (f_head_and_str_literal) + return m_head_and_str_literal; + m_head_and_str_literal = std::string("abc=") + std::string("foo"); + f_head_and_str_literal = true; + return m_head_and_str_literal; +} + +std::string expr_fstring_0_t::literal() { + if (f_literal) + return m_literal; + m_literal = std::string("abc"); + f_literal = true; + return m_literal; +} + +std::string expr_fstring_0_t::literal_with_escapes() { + if (f_literal_with_escapes) + return m_literal_with_escapes; + m_literal_with_escapes = std::string("abc\n\tt"); + f_literal_with_escapes = true; + return m_literal_with_escapes; +} diff --git a/compiled/cpp_stl_98/expr_fstring_0.h b/compiled/cpp_stl_98/expr_fstring_0.h new file mode 100644 index 00000000..2cfd2f8a --- /dev/null +++ b/compiled/cpp_stl_98/expr_fstring_0.h @@ -0,0 +1,88 @@ +#ifndef EXPR_FSTRING_0_H_ +#define EXPR_FSTRING_0_H_ + +// This is a generated file! Please edit source .ksy file and use kaitai-struct-compiler to rebuild + +#include "kaitai/kaitaistruct.h" +#include + +#if KAITAI_STRUCT_VERSION < 11000L +#error "Incompatible Kaitai Struct C++/STL API: version 0.11 or later is required" +#endif + +class expr_fstring_0_t : public kaitai::kstruct { + +public: + + expr_fstring_0_t(kaitai::kstream* p__io, kaitai::kstruct* p__parent = 0, expr_fstring_0_t* p__root = 0); + +private: + void _read(); + void _clean_up(); + +public: + ~expr_fstring_0_t(); + +private: + bool f_empty; + std::string m_empty; + +public: + std::string empty(); + +private: + bool f_head_and_int; + std::string m_head_and_int; + +public: + std::string head_and_int(); + +private: + bool f_head_and_int_literal; + std::string m_head_and_int_literal; + +public: + std::string head_and_int_literal(); + +private: + bool f_head_and_str; + std::string m_head_and_str; + +public: + std::string head_and_str(); + +private: + bool f_head_and_str_literal; + std::string m_head_and_str_literal; + +public: + std::string head_and_str_literal(); + +private: + bool f_literal; + std::string m_literal; + +public: + std::string literal(); + +private: + bool f_literal_with_escapes; + std::string m_literal_with_escapes; + +public: + std::string literal_with_escapes(); + +private: + std::string m_seq_str; + uint8_t m_seq_int; + expr_fstring_0_t* m__root; + kaitai::kstruct* m__parent; + +public: + std::string seq_str() const { return m_seq_str; } + uint8_t seq_int() const { return m_seq_int; } + expr_fstring_0_t* _root() const { return m__root; } + kaitai::kstruct* _parent() const { return m__parent; } +}; + +#endif // EXPR_FSTRING_0_H_ diff --git a/compiled/csharp/ExprFstring0.cs b/compiled/csharp/ExprFstring0.cs new file mode 100644 index 00000000..fe4ec1ad --- /dev/null +++ b/compiled/csharp/ExprFstring0.cs @@ -0,0 +1,132 @@ +// This is a generated file! Please edit source .ksy file and use kaitai-struct-compiler to rebuild + +using System; + +namespace Kaitai +{ + public partial class ExprFstring0 : KaitaiStruct + { + public static ExprFstring0 FromFile(string fileName) + { + return new ExprFstring0(new KaitaiStream(fileName)); + } + + public ExprFstring0(KaitaiStream p__io, KaitaiStruct p__parent = null, ExprFstring0 p__root = null) : base(p__io) + { + m_parent = p__parent; + m_root = p__root ?? this; + f_empty = false; + f_headAndInt = false; + f_headAndIntLiteral = false; + f_headAndStr = false; + f_headAndStrLiteral = false; + f_literal = false; + f_literalWithEscapes = false; + _read(); + } + private void _read() + { + _seqStr = System.Text.Encoding.GetEncoding("ASCII").GetString(m_io.ReadBytes(5)); + _seqInt = m_io.ReadU1(); + } + private bool f_empty; + private string _empty; + public string Empty + { + get + { + if (f_empty) + return _empty; + _empty = (string) (""); + f_empty = true; + return _empty; + } + } + private bool f_headAndInt; + private string _headAndInt; + public string HeadAndInt + { + get + { + if (f_headAndInt) + return _headAndInt; + _headAndInt = (string) ("abc=" + Convert.ToString((long) (SeqInt), 10)); + f_headAndInt = true; + return _headAndInt; + } + } + private bool f_headAndIntLiteral; + private string _headAndIntLiteral; + public string HeadAndIntLiteral + { + get + { + if (f_headAndIntLiteral) + return _headAndIntLiteral; + _headAndIntLiteral = (string) ("abc=" + Convert.ToString((long) (123), 10)); + f_headAndIntLiteral = true; + return _headAndIntLiteral; + } + } + private bool f_headAndStr; + private string _headAndStr; + public string HeadAndStr + { + get + { + if (f_headAndStr) + return _headAndStr; + _headAndStr = (string) ("abc=" + SeqStr); + f_headAndStr = true; + return _headAndStr; + } + } + private bool f_headAndStrLiteral; + private string _headAndStrLiteral; + public string HeadAndStrLiteral + { + get + { + if (f_headAndStrLiteral) + return _headAndStrLiteral; + _headAndStrLiteral = (string) ("abc=" + "foo"); + f_headAndStrLiteral = true; + return _headAndStrLiteral; + } + } + private bool f_literal; + private string _literal; + public string Literal + { + get + { + if (f_literal) + return _literal; + _literal = (string) ("abc"); + f_literal = true; + return _literal; + } + } + private bool f_literalWithEscapes; + private string _literalWithEscapes; + public string LiteralWithEscapes + { + get + { + if (f_literalWithEscapes) + return _literalWithEscapes; + _literalWithEscapes = (string) ("abc\n\tt"); + f_literalWithEscapes = true; + return _literalWithEscapes; + } + } + private string _seqStr; + private byte _seqInt; + private ExprFstring0 m_root; + private KaitaiStruct m_parent; + public string SeqStr { get { return _seqStr; } } + public byte SeqInt { get { return _seqInt; } } + public ExprFstring0 M_Root { get { return m_root; } } + public KaitaiStruct M_Parent { get { return m_parent; } } + } +} diff --git a/compiled/go/src/test_formats/expr_fstring_0.go b/compiled/go/src/test_formats/expr_fstring_0.go new file mode 100644 index 00000000..6d2b30cc --- /dev/null +++ b/compiled/go/src/test_formats/expr_fstring_0.go @@ -0,0 +1,109 @@ +// Code generated by kaitai-struct-compiler from a .ksy source file. DO NOT EDIT. + +package test_formats + +import ( + "github.com/kaitai-io/kaitai_struct_go_runtime/kaitai" + "fmt" +) + +type ExprFstring0 struct { + SeqStr string + SeqInt uint8 + _io *kaitai.Stream + _root *ExprFstring0 + _parent interface{} + _f_empty bool + empty string + _f_headAndInt bool + headAndInt string + _f_headAndIntLiteral bool + headAndIntLiteral string + _f_headAndStr bool + headAndStr string + _f_headAndStrLiteral bool + headAndStrLiteral string + _f_literal bool + literal string + _f_literalWithEscapes bool + literalWithEscapes string +} +func NewExprFstring0() *ExprFstring0 { + return &ExprFstring0{ + } +} + +func (this *ExprFstring0) Read(io *kaitai.Stream, parent interface{}, root *ExprFstring0) (err error) { + this._io = io + this._parent = parent + this._root = root + + tmp1, err := this._io.ReadBytes(int(5)) + if err != nil { + return err + } + tmp1 = tmp1 + this.SeqStr = string(tmp1) + tmp2, err := this._io.ReadU1() + if err != nil { + return err + } + this.SeqInt = tmp2 + return err +} +func (this *ExprFstring0) Empty() (v string, err error) { + if (this._f_empty) { + return this.empty, nil + } + this.empty = string(fmt.Sprintf("", )) + this._f_empty = true + return this.empty, nil +} +func (this *ExprFstring0) HeadAndInt() (v string, err error) { + if (this._f_headAndInt) { + return this.headAndInt, nil + } + this.headAndInt = string(fmt.Sprintf("abc=%v", this.SeqInt)) + this._f_headAndInt = true + return this.headAndInt, nil +} +func (this *ExprFstring0) HeadAndIntLiteral() (v string, err error) { + if (this._f_headAndIntLiteral) { + return this.headAndIntLiteral, nil + } + this.headAndIntLiteral = string(fmt.Sprintf("abc=%v", 123)) + this._f_headAndIntLiteral = true + return this.headAndIntLiteral, nil +} +func (this *ExprFstring0) HeadAndStr() (v string, err error) { + if (this._f_headAndStr) { + return this.headAndStr, nil + } + this.headAndStr = string(fmt.Sprintf("abc=%v", this.SeqStr)) + this._f_headAndStr = true + return this.headAndStr, nil +} +func (this *ExprFstring0) HeadAndStrLiteral() (v string, err error) { + if (this._f_headAndStrLiteral) { + return this.headAndStrLiteral, nil + } + this.headAndStrLiteral = string(fmt.Sprintf("abc=foo", )) + this._f_headAndStrLiteral = true + return this.headAndStrLiteral, nil +} +func (this *ExprFstring0) Literal() (v string, err error) { + if (this._f_literal) { + return this.literal, nil + } + this.literal = string("abc") + this._f_literal = true + return this.literal, nil +} +func (this *ExprFstring0) LiteralWithEscapes() (v string, err error) { + if (this._f_literalWithEscapes) { + return this.literalWithEscapes, nil + } + this.literalWithEscapes = string("abc\n\tt") + this._f_literalWithEscapes = true + return this.literalWithEscapes, nil +} diff --git a/compiled/html/expr_fstring_0.html b/compiled/html/expr_fstring_0.html new file mode 100644 index 00000000..9366d6b9 --- /dev/null +++ b/compiled/html/expr_fstring_0.html @@ -0,0 +1,56 @@ + + + + + + + + + + + + ExprFstring0 format specification + + +
+

ExprFstring0 format specification

+ + + +

Type: ExprFstring0

+ + + + + + + + + + + + + + + + + +
OffsetSizeIDTypeNote
0...seq_strstr(ASCII)
5...seq_intu1
+value instance: ValueInstanceSpec(InstanceIdentifier(empty),List(instances, empty),DocSpec(None,List()),InterpolatedStr(List()),None,Some(CalcStrType)) +value instance: ValueInstanceSpec(InstanceIdentifier(head_and_int),List(instances, head_and_int),DocSpec(None,List()),InterpolatedStr(List(Str(abc=), Name(identifier(seq_int)))),None,Some(CalcStrType)) +value instance: ValueInstanceSpec(InstanceIdentifier(head_and_int_literal),List(instances, head_and_int_literal),DocSpec(None,List()),InterpolatedStr(List(Str(abc=), IntNum(123))),None,Some(CalcStrType)) +value instance: ValueInstanceSpec(InstanceIdentifier(head_and_str),List(instances, head_and_str),DocSpec(None,List()),InterpolatedStr(List(Str(abc=), Name(identifier(seq_str)))),None,Some(CalcStrType)) +value instance: ValueInstanceSpec(InstanceIdentifier(head_and_str_literal),List(instances, head_and_str_literal),DocSpec(None,List()),InterpolatedStr(List(Str(abc=), Str(foo))),None,Some(CalcStrType)) +value instance: ValueInstanceSpec(InstanceIdentifier(literal),List(instances, literal),DocSpec(None,List()),InterpolatedStr(List(Str(abc))),None,Some(CalcStrType)) +value instance: ValueInstanceSpec(InstanceIdentifier(literal_with_escapes),List(instances, literal_with_escapes),DocSpec(None,List()),InterpolatedStr(List(Str(abc + t))),None,Some(CalcStrType)) + +
+ + + + + + + + diff --git a/compiled/java/src/io/kaitai/struct/testformats/ExprFstring0.java b/compiled/java/src/io/kaitai/struct/testformats/ExprFstring0.java new file mode 100644 index 00000000..ac3d8de6 --- /dev/null +++ b/compiled/java/src/io/kaitai/struct/testformats/ExprFstring0.java @@ -0,0 +1,91 @@ +// This is a generated file! Please edit source .ksy file and use kaitai-struct-compiler to rebuild + +package io.kaitai.struct.testformats; + +import io.kaitai.struct.ByteBufferKaitaiStream; +import io.kaitai.struct.KaitaiStruct; +import io.kaitai.struct.KaitaiStream; +import java.io.IOException; +import java.nio.charset.StandardCharsets; + +public class ExprFstring0 extends KaitaiStruct { + public static ExprFstring0 fromFile(String fileName) throws IOException { + return new ExprFstring0(new ByteBufferKaitaiStream(fileName)); + } + + public ExprFstring0(KaitaiStream _io) { + this(_io, null, null); + } + + public ExprFstring0(KaitaiStream _io, KaitaiStruct _parent) { + this(_io, _parent, null); + } + + public ExprFstring0(KaitaiStream _io, KaitaiStruct _parent, ExprFstring0 _root) { + super(_io); + this._parent = _parent; + this._root = _root == null ? this : _root; + _read(); + } + private void _read() { + this.seqStr = new String(this._io.readBytes(5), StandardCharsets.US_ASCII); + this.seqInt = this._io.readU1(); + } + private String empty; + public String empty() { + if (this.empty != null) + return this.empty; + this.empty = ""; + return this.empty; + } + private String headAndInt; + public String headAndInt() { + if (this.headAndInt != null) + return this.headAndInt; + this.headAndInt = "abc=" + Long.toString(seqInt(), 10); + return this.headAndInt; + } + private String headAndIntLiteral; + public String headAndIntLiteral() { + if (this.headAndIntLiteral != null) + return this.headAndIntLiteral; + this.headAndIntLiteral = "abc=" + Long.toString(123, 10); + return this.headAndIntLiteral; + } + private String headAndStr; + public String headAndStr() { + if (this.headAndStr != null) + return this.headAndStr; + this.headAndStr = "abc=" + seqStr(); + return this.headAndStr; + } + private String headAndStrLiteral; + public String headAndStrLiteral() { + if (this.headAndStrLiteral != null) + return this.headAndStrLiteral; + this.headAndStrLiteral = "abc=" + "foo"; + return this.headAndStrLiteral; + } + private String literal; + public String literal() { + if (this.literal != null) + return this.literal; + this.literal = "abc"; + return this.literal; + } + private String literalWithEscapes; + public String literalWithEscapes() { + if (this.literalWithEscapes != null) + return this.literalWithEscapes; + this.literalWithEscapes = "abc\n\tt"; + return this.literalWithEscapes; + } + private String seqStr; + private int seqInt; + private ExprFstring0 _root; + private KaitaiStruct _parent; + public String seqStr() { return seqStr; } + public int seqInt() { return seqInt; } + public ExprFstring0 _root() { return _root; } + public KaitaiStruct _parent() { return _parent; } +} diff --git a/compiled/javascript/ExprFstring0.js b/compiled/javascript/ExprFstring0.js new file mode 100644 index 00000000..93f52ad5 --- /dev/null +++ b/compiled/javascript/ExprFstring0.js @@ -0,0 +1,84 @@ +// This is a generated file! Please edit source .ksy file and use kaitai-struct-compiler to rebuild + +(function (root, factory) { + if (typeof define === 'function' && define.amd) { + define(['exports', 'kaitai-struct/KaitaiStream'], factory); + } else if (typeof exports === 'object' && exports !== null && typeof exports.nodeType !== 'number') { + factory(exports, require('kaitai-struct/KaitaiStream')); + } else { + factory(root.ExprFstring0 || (root.ExprFstring0 = {}), root.KaitaiStream); + } +})(typeof self !== 'undefined' ? self : this, function (ExprFstring0_, KaitaiStream) { +var ExprFstring0 = (function() { + function ExprFstring0(_io, _parent, _root) { + this._io = _io; + this._parent = _parent; + this._root = _root || this; + + this._read(); + } + ExprFstring0.prototype._read = function() { + this.seqStr = KaitaiStream.bytesToStr(this._io.readBytes(5), "ASCII"); + this.seqInt = this._io.readU1(); + } + Object.defineProperty(ExprFstring0.prototype, 'empty', { + get: function() { + if (this._m_empty !== undefined) + return this._m_empty; + this._m_empty = ""; + return this._m_empty; + } + }); + Object.defineProperty(ExprFstring0.prototype, 'headAndInt', { + get: function() { + if (this._m_headAndInt !== undefined) + return this._m_headAndInt; + this._m_headAndInt = "abc=" + (this.seqInt).toString(10); + return this._m_headAndInt; + } + }); + Object.defineProperty(ExprFstring0.prototype, 'headAndIntLiteral', { + get: function() { + if (this._m_headAndIntLiteral !== undefined) + return this._m_headAndIntLiteral; + this._m_headAndIntLiteral = "abc=" + (123).toString(10); + return this._m_headAndIntLiteral; + } + }); + Object.defineProperty(ExprFstring0.prototype, 'headAndStr', { + get: function() { + if (this._m_headAndStr !== undefined) + return this._m_headAndStr; + this._m_headAndStr = "abc=" + this.seqStr; + return this._m_headAndStr; + } + }); + Object.defineProperty(ExprFstring0.prototype, 'headAndStrLiteral', { + get: function() { + if (this._m_headAndStrLiteral !== undefined) + return this._m_headAndStrLiteral; + this._m_headAndStrLiteral = "abc=" + "foo"; + return this._m_headAndStrLiteral; + } + }); + Object.defineProperty(ExprFstring0.prototype, 'literal', { + get: function() { + if (this._m_literal !== undefined) + return this._m_literal; + this._m_literal = "abc"; + return this._m_literal; + } + }); + Object.defineProperty(ExprFstring0.prototype, 'literalWithEscapes', { + get: function() { + if (this._m_literalWithEscapes !== undefined) + return this._m_literalWithEscapes; + this._m_literalWithEscapes = "abc\n\tt"; + return this._m_literalWithEscapes; + } + }); + + return ExprFstring0; +})(); +ExprFstring0_.ExprFstring0 = ExprFstring0; +}); diff --git a/compiled/lua/expr_fstring_0.lua b/compiled/lua/expr_fstring_0.lua new file mode 100644 index 00000000..21134b32 --- /dev/null +++ b/compiled/lua/expr_fstring_0.lua @@ -0,0 +1,93 @@ +-- This is a generated file! Please edit source .ksy file and use kaitai-struct-compiler to rebuild +-- +-- This file is compatible with Lua 5.3 + +local class = require("class") +require("kaitaistruct") +local str_decode = require("string_decode") + +ExprFstring0 = class.class(KaitaiStruct) + +function ExprFstring0:_init(io, parent, root) + KaitaiStruct._init(self, io) + self._parent = parent + self._root = root or self + self:_read() +end + +function ExprFstring0:_read() + self.seq_str = str_decode.decode(self._io:read_bytes(5), "ASCII") + self.seq_int = self._io:read_u1() +end + +ExprFstring0.property.empty = {} +function ExprFstring0.property.empty:get() + if self._m_empty ~= nil then + return self._m_empty + end + + self._m_empty = "" + return self._m_empty +end + +ExprFstring0.property.head_and_int = {} +function ExprFstring0.property.head_and_int:get() + if self._m_head_and_int ~= nil then + return self._m_head_and_int + end + + self._m_head_and_int = "abc=" + tostring(self.seq_int) + return self._m_head_and_int +end + +ExprFstring0.property.head_and_int_literal = {} +function ExprFstring0.property.head_and_int_literal:get() + if self._m_head_and_int_literal ~= nil then + return self._m_head_and_int_literal + end + + self._m_head_and_int_literal = "abc=" + tostring(123) + return self._m_head_and_int_literal +end + +ExprFstring0.property.head_and_str = {} +function ExprFstring0.property.head_and_str:get() + if self._m_head_and_str ~= nil then + return self._m_head_and_str + end + + self._m_head_and_str = "abc=" + self.seq_str + return self._m_head_and_str +end + +ExprFstring0.property.head_and_str_literal = {} +function ExprFstring0.property.head_and_str_literal:get() + if self._m_head_and_str_literal ~= nil then + return self._m_head_and_str_literal + end + + self._m_head_and_str_literal = "abc=" + "foo" + return self._m_head_and_str_literal +end + +ExprFstring0.property.literal = {} +function ExprFstring0.property.literal:get() + if self._m_literal ~= nil then + return self._m_literal + end + + self._m_literal = "abc" + return self._m_literal +end + +ExprFstring0.property.literal_with_escapes = {} +function ExprFstring0.property.literal_with_escapes:get() + if self._m_literal_with_escapes ~= nil then + return self._m_literal_with_escapes + end + + self._m_literal_with_escapes = "abc\n\tt" + return self._m_literal_with_escapes +end + + diff --git a/compiled/nim/expr_fstring_0.nim b/compiled/nim/expr_fstring_0.nim new file mode 100644 index 00000000..71cf90a2 --- /dev/null +++ b/compiled/nim/expr_fstring_0.nim @@ -0,0 +1,106 @@ +import kaitai_struct_nim_runtime +import options +import strutils + +type + ExprFstring0* = ref object of KaitaiStruct + `seqStr`*: string + `seqInt`*: uint8 + `parent`*: KaitaiStruct + `emptyInst`: string + `emptyInstFlag`: bool + `headAndIntInst`: string + `headAndIntInstFlag`: bool + `headAndIntLiteralInst`: string + `headAndIntLiteralInstFlag`: bool + `headAndStrInst`: string + `headAndStrInstFlag`: bool + `headAndStrLiteralInst`: string + `headAndStrLiteralInstFlag`: bool + `literalInst`: string + `literalInstFlag`: bool + `literalWithEscapesInst`: string + `literalWithEscapesInstFlag`: bool + +proc read*(_: typedesc[ExprFstring0], io: KaitaiStream, root: KaitaiStruct, parent: KaitaiStruct): ExprFstring0 + +proc empty*(this: ExprFstring0): string +proc headAndInt*(this: ExprFstring0): string +proc headAndIntLiteral*(this: ExprFstring0): string +proc headAndStr*(this: ExprFstring0): string +proc headAndStrLiteral*(this: ExprFstring0): string +proc literal*(this: ExprFstring0): string +proc literalWithEscapes*(this: ExprFstring0): string + +proc read*(_: typedesc[ExprFstring0], io: KaitaiStream, root: KaitaiStruct, parent: KaitaiStruct): ExprFstring0 = + template this: untyped = result + this = new(ExprFstring0) + let root = if root == nil: cast[ExprFstring0](this) else: cast[ExprFstring0](root) + this.io = io + this.root = root + this.parent = parent + + let seqStrExpr = encode(this.io.readBytes(int(5)), "ASCII") + this.seqStr = seqStrExpr + let seqIntExpr = this.io.readU1() + this.seqInt = seqIntExpr + +proc empty(this: ExprFstring0): string = + if this.emptyInstFlag: + return this.emptyInst + let emptyInstExpr = string("") + this.emptyInst = emptyInstExpr + this.emptyInstFlag = true + return this.emptyInst + +proc headAndInt(this: ExprFstring0): string = + if this.headAndIntInstFlag: + return this.headAndIntInst + let headAndIntInstExpr = string("abc=" + intToStr(int(this.seqInt))) + this.headAndIntInst = headAndIntInstExpr + this.headAndIntInstFlag = true + return this.headAndIntInst + +proc headAndIntLiteral(this: ExprFstring0): string = + if this.headAndIntLiteralInstFlag: + return this.headAndIntLiteralInst + let headAndIntLiteralInstExpr = string("abc=" + intToStr(int(123))) + this.headAndIntLiteralInst = headAndIntLiteralInstExpr + this.headAndIntLiteralInstFlag = true + return this.headAndIntLiteralInst + +proc headAndStr(this: ExprFstring0): string = + if this.headAndStrInstFlag: + return this.headAndStrInst + let headAndStrInstExpr = string("abc=" + this.seqStr) + this.headAndStrInst = headAndStrInstExpr + this.headAndStrInstFlag = true + return this.headAndStrInst + +proc headAndStrLiteral(this: ExprFstring0): string = + if this.headAndStrLiteralInstFlag: + return this.headAndStrLiteralInst + let headAndStrLiteralInstExpr = string("abc=" + "foo") + this.headAndStrLiteralInst = headAndStrLiteralInstExpr + this.headAndStrLiteralInstFlag = true + return this.headAndStrLiteralInst + +proc literal(this: ExprFstring0): string = + if this.literalInstFlag: + return this.literalInst + let literalInstExpr = string("abc") + this.literalInst = literalInstExpr + this.literalInstFlag = true + return this.literalInst + +proc literalWithEscapes(this: ExprFstring0): string = + if this.literalWithEscapesInstFlag: + return this.literalWithEscapesInst + let literalWithEscapesInstExpr = string("abc\n\tt") + this.literalWithEscapesInst = literalWithEscapesInstExpr + this.literalWithEscapesInstFlag = true + return this.literalWithEscapesInst + +proc fromFile*(_: typedesc[ExprFstring0], filename: string): ExprFstring0 = + ExprFstring0.read(newKaitaiFileStream(filename), nil, nil) + diff --git a/compiled/perl/ExprFstring0.pm b/compiled/perl/ExprFstring0.pm new file mode 100644 index 00000000..b252ba7a --- /dev/null +++ b/compiled/perl/ExprFstring0.pm @@ -0,0 +1,101 @@ +# This is a generated file! Please edit source .ksy file and use kaitai-struct-compiler to rebuild + +use strict; +use warnings; +use IO::KaitaiStruct 0.011_000; +use Encode; + +######################################################################## +package ExprFstring0; + +our @ISA = 'IO::KaitaiStruct::Struct'; + +sub from_file { + my ($class, $filename) = @_; + my $fd; + + open($fd, '<', $filename) or return undef; + binmode($fd); + return new($class, IO::KaitaiStruct::Stream->new($fd)); +} + +sub new { + my ($class, $_io, $_parent, $_root) = @_; + my $self = IO::KaitaiStruct::Struct->new($_io); + + bless $self, $class; + $self->{_parent} = $_parent; + $self->{_root} = $_root || $self;; + + $self->_read(); + + return $self; +} + +sub _read { + my ($self) = @_; + + $self->{seq_str} = Encode::decode("ASCII", $self->{_io}->read_bytes(5)); + $self->{seq_int} = $self->{_io}->read_u1(); +} + +sub empty { + my ($self) = @_; + return $self->{empty} if ($self->{empty}); + $self->{empty} = ""; + return $self->{empty}; +} + +sub head_and_int { + my ($self) = @_; + return $self->{head_and_int} if ($self->{head_and_int}); + $self->{head_and_int} = "abc=" . sprintf('%d', $self->seq_int()); + return $self->{head_and_int}; +} + +sub head_and_int_literal { + my ($self) = @_; + return $self->{head_and_int_literal} if ($self->{head_and_int_literal}); + $self->{head_and_int_literal} = "abc=" . sprintf('%d', 123); + return $self->{head_and_int_literal}; +} + +sub head_and_str { + my ($self) = @_; + return $self->{head_and_str} if ($self->{head_and_str}); + $self->{head_and_str} = "abc=" . $self->seq_str(); + return $self->{head_and_str}; +} + +sub head_and_str_literal { + my ($self) = @_; + return $self->{head_and_str_literal} if ($self->{head_and_str_literal}); + $self->{head_and_str_literal} = "abc=" . "foo"; + return $self->{head_and_str_literal}; +} + +sub literal { + my ($self) = @_; + return $self->{literal} if ($self->{literal}); + $self->{literal} = "abc"; + return $self->{literal}; +} + +sub literal_with_escapes { + my ($self) = @_; + return $self->{literal_with_escapes} if ($self->{literal_with_escapes}); + $self->{literal_with_escapes} = "abc\n\tt"; + return $self->{literal_with_escapes}; +} + +sub seq_str { + my ($self) = @_; + return $self->{seq_str}; +} + +sub seq_int { + my ($self) = @_; + return $self->{seq_int}; +} + +1; diff --git a/compiled/php/ExprFstring0.php b/compiled/php/ExprFstring0.php new file mode 100644 index 00000000..2628141f --- /dev/null +++ b/compiled/php/ExprFstring0.php @@ -0,0 +1,69 @@ +_read(); + } + + private function _read() { + $this->_m_seqStr = \Kaitai\Struct\Stream::bytesToStr($this->_io->readBytes(5), "ASCII"); + $this->_m_seqInt = $this->_io->readU1(); + } + protected $_m_empty; + public function empty() { + if ($this->_m_empty !== null) + return $this->_m_empty; + $this->_m_empty = ""; + return $this->_m_empty; + } + protected $_m_headAndInt; + public function headAndInt() { + if ($this->_m_headAndInt !== null) + return $this->_m_headAndInt; + $this->_m_headAndInt = "abc=" . strval($this->seqInt()); + return $this->_m_headAndInt; + } + protected $_m_headAndIntLiteral; + public function headAndIntLiteral() { + if ($this->_m_headAndIntLiteral !== null) + return $this->_m_headAndIntLiteral; + $this->_m_headAndIntLiteral = "abc=" . strval(123); + return $this->_m_headAndIntLiteral; + } + protected $_m_headAndStr; + public function headAndStr() { + if ($this->_m_headAndStr !== null) + return $this->_m_headAndStr; + $this->_m_headAndStr = "abc=" . $this->seqStr(); + return $this->_m_headAndStr; + } + protected $_m_headAndStrLiteral; + public function headAndStrLiteral() { + if ($this->_m_headAndStrLiteral !== null) + return $this->_m_headAndStrLiteral; + $this->_m_headAndStrLiteral = "abc=" . "foo"; + return $this->_m_headAndStrLiteral; + } + protected $_m_literal; + public function literal() { + if ($this->_m_literal !== null) + return $this->_m_literal; + $this->_m_literal = "abc"; + return $this->_m_literal; + } + protected $_m_literalWithEscapes; + public function literalWithEscapes() { + if ($this->_m_literalWithEscapes !== null) + return $this->_m_literalWithEscapes; + $this->_m_literalWithEscapes = "abc\n\tt"; + return $this->_m_literalWithEscapes; + } + protected $_m_seqStr; + protected $_m_seqInt; + public function seqStr() { return $this->_m_seqStr; } + public function seqInt() { return $this->_m_seqInt; } + } +} diff --git a/compiled/python/expr_fstring_0.py b/compiled/python/expr_fstring_0.py new file mode 100644 index 00000000..de620b96 --- /dev/null +++ b/compiled/python/expr_fstring_0.py @@ -0,0 +1,78 @@ +# This is a generated file! Please edit source .ksy file and use kaitai-struct-compiler to rebuild +# type: ignore + +import kaitaistruct +from kaitaistruct import KaitaiStruct, KaitaiStream, BytesIO + + +if getattr(kaitaistruct, 'API_VERSION', (0, 9)) < (0, 11): + raise Exception("Incompatible Kaitai Struct Python API: 0.11 or later is required, but you have %s" % (kaitaistruct.__version__)) + +class ExprFstring0(KaitaiStruct): + def __init__(self, _io, _parent=None, _root=None): + self._io = _io + self._parent = _parent + self._root = _root if _root else self + self._read() + + def _read(self): + self.seq_str = (self._io.read_bytes(5)).decode("ASCII") + self.seq_int = self._io.read_u1() + + @property + def empty(self): + if hasattr(self, '_m_empty'): + return self._m_empty + + self._m_empty = u"" + return getattr(self, '_m_empty', None) + + @property + def head_and_int(self): + if hasattr(self, '_m_head_and_int'): + return self._m_head_and_int + + self._m_head_and_int = u"abc=" + str(self.seq_int) + return getattr(self, '_m_head_and_int', None) + + @property + def head_and_int_literal(self): + if hasattr(self, '_m_head_and_int_literal'): + return self._m_head_and_int_literal + + self._m_head_and_int_literal = u"abc=" + str(123) + return getattr(self, '_m_head_and_int_literal', None) + + @property + def head_and_str(self): + if hasattr(self, '_m_head_and_str'): + return self._m_head_and_str + + self._m_head_and_str = u"abc=" + self.seq_str + return getattr(self, '_m_head_and_str', None) + + @property + def head_and_str_literal(self): + if hasattr(self, '_m_head_and_str_literal'): + return self._m_head_and_str_literal + + self._m_head_and_str_literal = u"abc=" + u"foo" + return getattr(self, '_m_head_and_str_literal', None) + + @property + def literal(self): + if hasattr(self, '_m_literal'): + return self._m_literal + + self._m_literal = u"abc" + return getattr(self, '_m_literal', None) + + @property + def literal_with_escapes(self): + if hasattr(self, '_m_literal_with_escapes'): + return self._m_literal_with_escapes + + self._m_literal_with_escapes = u"abc\n\tt" + return getattr(self, '_m_literal_with_escapes', None) + + diff --git a/compiled/ruby/expr_fstring_0.rb b/compiled/ruby/expr_fstring_0.rb new file mode 100644 index 00000000..53710020 --- /dev/null +++ b/compiled/ruby/expr_fstring_0.rb @@ -0,0 +1,57 @@ +# This is a generated file! Please edit source .ksy file and use kaitai-struct-compiler to rebuild + +require 'kaitai/struct/struct' + +unless Gem::Version.new(Kaitai::Struct::VERSION) >= Gem::Version.new('0.11') + raise "Incompatible Kaitai Struct Ruby API: 0.11 or later is required, but you have #{Kaitai::Struct::VERSION}" +end + +class ExprFstring0 < Kaitai::Struct::Struct + def initialize(_io, _parent = nil, _root = self) + super(_io, _parent, _root) + _read + end + + def _read + @seq_str = (@_io.read_bytes(5)).force_encoding("ASCII").encode('UTF-8') + @seq_int = @_io.read_u1 + self + end + def empty + return @empty unless @empty.nil? + @empty = "" + @empty + end + def head_and_int + return @head_and_int unless @head_and_int.nil? + @head_and_int = "abc=" + seq_int.to_s(10) + @head_and_int + end + def head_and_int_literal + return @head_and_int_literal unless @head_and_int_literal.nil? + @head_and_int_literal = "abc=" + 123.to_s(10) + @head_and_int_literal + end + def head_and_str + return @head_and_str unless @head_and_str.nil? + @head_and_str = "abc=" + seq_str + @head_and_str + end + def head_and_str_literal + return @head_and_str_literal unless @head_and_str_literal.nil? + @head_and_str_literal = "abc=" + "foo" + @head_and_str_literal + end + def literal + return @literal unless @literal.nil? + @literal = "abc" + @literal + end + def literal_with_escapes + return @literal_with_escapes unless @literal_with_escapes.nil? + @literal_with_escapes = "abc\n\tt" + @literal_with_escapes + end + attr_reader :seq_str + attr_reader :seq_int +end diff --git a/compiled/rust/expr_fstring_0.rs b/compiled/rust/expr_fstring_0.rs new file mode 100644 index 00000000..c15ffe09 --- /dev/null +++ b/compiled/rust/expr_fstring_0.rs @@ -0,0 +1,108 @@ +// This is a generated file! Please edit source .ksy file and use kaitai-struct-compiler to rebuild + +use std::option::Option; +use std::boxed::Box; +use std::io::Result; +use std::io::Cursor; +use std::vec::Vec; +use std::default::Default; +use kaitai_struct::KaitaiStream; +use kaitai_struct::KaitaiStruct; + +#[derive(Default)] +pub struct ExprFstring0 { + pub seqStr: String, + pub seqInt: u8, + pub empty: Option, + pub headAndInt: Option, + pub headAndIntLiteral: Option, + pub headAndStr: Option, + pub headAndStrLiteral: Option, + pub literal: Option, + pub literalWithEscapes: Option, +} + +impl KaitaiStruct for ExprFstring0 { + fn new(stream: &mut S, + _parent: &Option>, + _root: &Option>) + -> Result + where Self: Sized { + let mut s: Self = Default::default(); + + s.stream = stream; + s.read(stream, _parent, _root)?; + + Ok(s) + } + + + fn read(&mut self, + stream: &mut S, + _parent: &Option>, + _root: &Option>) + -> Result<()> + where Self: Sized { + self.seqStr = String::from_utf8_lossy(self.stream.read_bytes(5)?); + self.seqInt = self.stream.read_u1()?; + } +} + +impl ExprFstring0 { + fn empty(&mut self) -> String { + if let Some(x) = self.empty { + return x; + } + + self.empty = ""; + return self.empty; + } + fn headAndInt(&mut self) -> String { + if let Some(x) = self.headAndInt { + return x; + } + + self.headAndInt = "abc=" + self.seq_int.to_string(); + return self.headAndInt; + } + fn headAndIntLiteral(&mut self) -> String { + if let Some(x) = self.headAndIntLiteral { + return x; + } + + self.headAndIntLiteral = "abc=" + 123.to_string(); + return self.headAndIntLiteral; + } + fn headAndStr(&mut self) -> String { + if let Some(x) = self.headAndStr { + return x; + } + + self.headAndStr = "abc=" + self.seq_str; + return self.headAndStr; + } + fn headAndStrLiteral(&mut self) -> String { + if let Some(x) = self.headAndStrLiteral { + return x; + } + + self.headAndStrLiteral = "abc=" + "foo"; + return self.headAndStrLiteral; + } + fn literal(&mut self) -> String { + if let Some(x) = self.literal { + return x; + } + + self.literal = "abc"; + return self.literal; + } + fn literalWithEscapes(&mut self) -> String { + if let Some(x) = self.literalWithEscapes { + return x; + } + + self.literalWithEscapes = "abc\n\tt"; + return self.literalWithEscapes; + } +}