├── tests ├── Scripts │ ├── .empty │ ├── have-jit │ ├── printf │ ├── cxx-common.sh │ ├── using-build-directory │ ├── cxx-link │ └── cxx-compile ├── Baseline │ ├── spicy.types.unit.offset │ │ └── .stderr │ ├── hilti.types.real.add-2 │ │ └── output │ ├── spicy.rt.time │ │ └── output │ ├── hilti.hiltic.cc.empty │ │ └── output │ ├── hilti.hiltic.jit.empty │ │ └── output │ ├── hilti.statements.try │ │ └── output │ ├── hilti.types.bytes.ops │ │ └── output │ ├── hilti.expressions.ternary │ │ └── output │ ├── hilti.types.address.unpack │ │ └── output │ ├── hilti.types.bitfield.unpack │ │ └── output │ ├── hilti.types.bytes.iterator │ │ └── output │ ├── hilti.types.bytes.match │ │ └── output │ ├── hilti.types.bytes.to-int │ │ └── output │ ├── hilti.types.bytes.to-real │ │ └── output │ ├── hilti.types.bytes.to-time │ │ └── output │ ├── hilti.types.enum.equal-ops │ │ └── output │ ├── hilti.types.integer.cast │ │ └── output │ ├── hilti.types.optional.ops │ │ └── output │ ├── hilti.types.real.limits │ │ └── output │ ├── hilti.types.real.unpack │ │ └── output │ ├── hilti.types.stream.iterator │ │ └── output │ ├── hilti.types.stream.view │ │ └── output │ ├── hilti.types.struct.params │ │ └── output │ ├── hilti.types.time.functions │ │ └── output │ ├── spicy.types.unit.params │ │ ├── .stderr │ │ └── output │ ├── spicy.types.unit.stream-2 │ │ └── output │ ├── spicy.types.unit.stream │ │ └── output │ ├── hilti.ast.coercion-type-changes │ │ └── output │ ├── hilti.ast.import-from │ │ └── output │ ├── hilti.types.bitfield.convert │ │ └── output │ ├── hilti.types.integer.exceptions │ │ └── output │ ├── hilti.types.regexp.match-repeats │ │ └── output │ ├── hilti.types.struct.auto-result │ │ └── output │ ├── spicy.attributes.spicy-version-2 │ │ └── output │ ├── spicy.attributes.spicy-version │ │ └── output │ ├── spicy.rt.crc32 │ │ └── output │ ├── spicy.types.bytes.join │ │ └── output │ ├── spicy.types.regexp.operators │ │ └── output │ ├── spicy.types.struct.const-param │ │ └── output │ ├── spicy.types.unit.params-atomic │ │ ├── .stderr │ │ └── output │ ├── spicy.types.unit.params-modify │ │ ├── .stderr │ │ └── output │ ├── spicy.types.unit.sync-advance-3 │ │ └── output │ ├── hilti.codegen.ctor │ │ └── output │ ├── hilti.codegen.reserved │ │ └── output │ ├── hilti.expressions.global-scope-id │ │ └── output │ ├── hilti.statements.break │ │ └── output │ ├── hilti.statements.if-empty │ │ └── output │ ├── hilti.types.integer.operators-signed │ │ └── output │ ├── hilti.types.real.coercion │ │ └── output │ ├── hilti.types.real.mul │ │ └── output │ ├── hilti.types.real.sub │ │ └── output │ ├── spicy.doc.hello │ │ └── output │ ├── spicy.types.sink.reassembler.policy │ │ └── output │ ├── spicy.types.unit.params-recursive │ │ └── .stderr │ ├── spicy.types.unit.unit-max-size-coerce │ │ └── output │ ├── hilti.hiltic.jit.globals │ │ └── output │ ├── hilti.types.bitfield.ops │ │ └── output │ ├── hilti.types.function.auto-params │ │ └── output │ ├── hilti.types.integer.operators-unsigned │ │ └── output │ ├── hilti.types.real.add │ │ └── output │ ├── hilti.types.struct.static-method │ │ └── output │ ├── spicy.doc.debug-hooks │ │ └── output │ ├── spicy.types.map.default-coerce │ │ └── output │ ├── spicy.types.reference.operators │ │ └── output │ ├── spicy.types.unit.convert-regexp │ │ └── output │ ├── spicy.types.unit.find │ │ └── output │ ├── spicy.types.unit.switch-bytes │ │ └── output │ ├── hilti.hiltic.cc.hello-world │ │ └── output │ ├── hilti.hiltic.jit.hello-world │ │ └── output │ ├── hilti.hiltic.jit.hilti-cxx │ │ ├── output │ │ ├── wrapper.output │ │ └── error │ ├── hilti.tools.hilti-driver-hilti-path │ │ └── output │ ├── hilti.types.enum.import │ │ └── output │ ├── hilti.types.function.extern-no-suspend │ │ └── output │ ├── hilti.types.integer.on-heap │ │ └── output │ ├── hilti.types.struct.method │ │ └── output │ ├── hilti.types.tuple.index │ │ └── output │ ├── spicy.codegen.default-arg-across-import │ │ └── output │ ├── spicy.doc.my_http │ │ └── output │ ├── spicy.types.bytes.iterator │ │ └── output │ ├── spicy.types.sink.filter-it │ │ └── output │ ├── spicy.types.unit.context-inout │ │ └── output │ ├── spicy.types.unit.filter-in-vector-of-sub │ │ └── output │ ├── spicy.types.unit.params-inout-sink │ │ └── output │ ├── spicy.types.unit.print-hook-2 │ │ └── output │ ├── spicy.types.unit.print-hook │ │ └── output │ ├── spicy.types.unit.switch-scope │ │ └── output │ ├── hilti.codegen.cxx-any-as-ptr │ │ └── output │ ├── hilti.expressions.list-comprehension │ │ └── output │ ├── hilti.types.bytes.iterator-sign │ │ └── output │ ├── hilti.types.interval.ops │ │ └── output │ ├── hilti.types.result.error │ │ └── output │ ├── hilti.types.string.fmt │ │ └── output │ ├── hilti.types.union.same-type │ │ └── output │ ├── spicy.codegen.cxx-any-as-ptr │ │ └── output │ ├── spicy.expressions.list-comprehension-unit │ │ └── output │ ├── spicy.expressions.list-comprehension │ │ └── output │ ├── spicy.rt.base64 │ │ └── output │ ├── spicy.rt.zlib │ │ └── output │ ├── spicy.types.bitfield.anonymous-field-const │ │ └── output │ ├── spicy.types.interval.ops │ │ └── output │ ├── spicy.types.set.ops │ │ └── output │ ├── spicy.types.struct.ctor-same-fields │ │ └── output │ ├── spicy.types.unit.debug-hook │ │ └── output │ ├── spicy.types.unit.struct-ctor-init │ │ └── output │ ├── spicy.types.vector.iterator │ │ └── output │ ├── spicy.types.vector.parse-const │ │ └── output │ ├── hilti.hiltic.jit.precompiled-globals │ │ └── output │ ├── hilti.rt.debug │ │ └── output │ ├── hilti.statements.for │ │ └── output │ ├── hilti.types.function.hook-functions-empty │ │ └── output │ ├── hilti.types.function.hook-methods-empty │ │ └── output │ ├── hilti.types.integer.coercion │ │ └── output │ ├── hilti.types.optional.coercion │ │ └── output │ ├── hilti.types.real.inf_NaN │ │ └── output │ ├── hilti.types.union.ops │ │ └── output │ ├── hilti.types.vector.default-values │ │ └── output │ ├── spicy.doc.my_http-host-parse1 │ │ └── output │ ├── spicy.types.bytes.parse-ctor │ │ └── output │ ├── spicy.types.bytes.parse-eod │ │ └── output │ ├── spicy.types.optional.ops │ │ └── output │ ├── spicy.types.port.ops │ │ └── output │ ├── spicy.types.time.ops │ │ └── output │ ├── spicy.types.unit.params-inout-unit │ │ └── output │ ├── spicy.types.unit.unit-ref-deref │ │ └── output │ ├── spicy.types.vector.parse-lahead-eod │ │ └── output │ ├── hilti.hiltic.jit.precompiled-hello-world │ │ └── output │ ├── hilti.rt.print │ │ └── output │ ├── hilti.statements.continue │ │ └── output │ ├── hilti.types.function.hook-redecl │ │ └── stdout │ ├── hilti.types.regexp.span │ │ └── output │ ├── hilti.types.struct.method-auto-param │ │ └── output │ ├── hilti.types.struct.overloading │ │ └── output │ ├── hilti.types.struct.static-method-extern │ │ └── output │ ├── spicy.rt.print-escaping │ │ └── output │ ├── spicy.types.bytes.parse-length-coercion │ │ └── output │ ├── spicy.types.function.overloading │ │ └── output │ ├── spicy.types.sink.no-data-for-lahead │ │ └── output │ ├── spicy.types.string.operators │ │ └── output │ ├── spicy.types.unit.convert-integer-signed │ │ └── output │ ├── spicy.types.unit.offset-in-attribute │ │ └── output │ ├── spicy.types.unit.offset-parse-from │ │ └── output │ ├── spicy.types.unit.set_input-beyond-current │ │ └── output │ ├── spicy.types.unit.skip-field-literal-conditional │ │ └── output │ ├── spicy.types.unit.skip-sized │ │ └── output │ ├── hilti.ast.local-use-before-decl │ │ └── output │ ├── hilti.types.regexp.incremental │ │ └── output │ ├── hilti.types.tuple.bytes-iter-deref │ │ └── output │ ├── spicy.tools.spicyc-hello-world │ │ └── output │ ├── spicy.types.bitfield.anonymous-field-with-enum-param │ │ └── output │ ├── spicy.types.bitfield.parse-enum │ │ └── output │ ├── spicy.types.bytes.parse-length-eod │ │ └── output │ ├── spicy.types.regexp.parse-captures-requires │ │ └── output │ ├── spicy.types.unit.offset-with-expr │ │ └── output │ ├── spicy.types.unit.params-for-vars │ │ └── output │ ├── spicy.types.unit.unit-size │ │ └── output │ ├── spicy.types.vector.parse-eod │ │ └── output │ ├── hilti.hiltic.cc.separate-units │ │ └── output │ ├── hilti.types.bytes.decode │ │ └── output │ ├── hilti.types.function.overloading │ │ └── output │ ├── hilti.types.string.encode │ │ └── output │ ├── hilti.types.struct.params-init-ambiguity │ │ └── output │ ├── spicy.rt.load-hlto │ │ └── output │ ├── spicy.tools.spicy-build-hello-world │ │ └── output │ ├── spicy.types.bitfield.parse-bitorder │ │ └── output │ ├── spicy.types.null.coercion │ │ └── output │ ├── spicy.types.sink.reassembler.custom-length │ │ └── output │ ├── spicy.types.unit.input-save-and-restore │ │ └── output │ ├── spicy.types.unit.sub-unit │ │ └── output │ ├── spicy.types.unit.unit-max-size-as-field │ │ └── output │ ├── spicy.types.vector.parse-lahead-parse-from │ │ └── output │ ├── spicy.types.vector.parse-while │ │ └── output │ ├── hilti.types.function.coercion-order │ │ └── output │ ├── hilti.types.function.hook-functions │ │ └── output │ ├── hilti.types.optional.consts │ │ └── output │ ├── hilti.types.port.ops │ │ └── output │ ├── hilti.types.reference.strong-from-weak-ref │ │ └── output │ ├── hilti.types.struct.string-conversion │ │ └── output │ ├── spicy.statements.for-resolve │ │ └── output │ ├── spicy.types.address.ops │ │ └── output │ ├── spicy.types.bitfield.parse │ │ └── output │ ├── spicy.types.bytes.parse-length │ │ └── output │ ├── spicy.types.real.parse │ │ └── output │ ├── spicy.types.unit.switch-void │ │ └── output │ ├── spicy.types.unit.unit-max-size-as-field-3 │ │ └── output │ ├── hilti.expressions.default-ctor │ │ └── output │ ├── hilti.types.function.hook-methods-across-units │ │ └── output │ ├── hilti.types.integer.unpack │ │ └── output │ ├── hilti.types.struct.static-field │ │ └── output │ ├── spicy.rt.base64-filter-eod │ │ └── output │ ├── spicy.rt.print-binary │ │ └── output │ ├── spicy.statements.print │ │ └── output │ ├── spicy.types.bitfield.ctor-look-ahead │ │ └── output │ ├── spicy.types.bitfield.typedef │ │ └── output │ ├── spicy.types.bytes.parse-until │ │ └── output │ ├── spicy.types.network.ops │ │ └── output │ ├── spicy.types.unit.attr-parse-at │ │ └── output │ ├── spicy.types.unit.attr-parse-from-expr │ │ └── output │ ├── spicy.types.unit.convert-field-self │ │ └── output │ ├── spicy.types.unit.external-global-vars │ │ └── output │ ├── spicy.types.unit.offset-indirect │ │ └── output │ ├── spicy.types.unit.params-forward │ │ └── output │ ├── spicy.types.unit.params-reference │ │ └── output │ ├── spicy.types.unit.set_input │ │ └── output │ ├── spicy.types.unit.unit-convert-two │ │ └── output │ ├── spicy.types.vector.ctor-vector │ │ └── output │ ├── spicy.types.vector.parse-length │ │ └── output │ ├── hilti.statements.try-across-hooks │ │ └── output │ ├── hilti.types.function.hook-functions-across-units │ │ └── output │ ├── hilti.types.reference.strong-ref │ │ └── output │ ├── hilti.types.regexp.groups │ │ └── output │ ├── hilti.use-cases.parse-bytes │ │ └── output │ ├── spicy.cfg.unit-parameter │ │ └── output │ ├── spicy.statements.for │ │ └── output │ ├── spicy.tools.spicy-driver-file │ │ └── output │ ├── spicy.types.sink.reassembler.basic │ │ └── output │ ├── spicy.types.type.type-info │ │ └── output │ ├── spicy.types.unit.all-default-parameters │ │ └── output │ ├── spicy.types.unit.convert-enum │ │ └── output │ ├── spicy.types.unit.external-hooks-unit-arg │ │ └── output │ ├── spicy.types.unit.size-side-effects-3 │ │ └── output │ ├── spicy.types.unit.size-with-offset │ │ └── output │ ├── spicy.types.unit.unit-max-size-as-field-2 │ │ └── output │ ├── spicy.types.vector.parse-unbounded-stop │ │ └── output │ ├── hilti.hiltic.jit.precompiled-globals-twice │ │ └── output │ ├── hilti.types.regexp.match-state │ │ └── output │ ├── spicy.types.address.parse │ │ └── output │ ├── spicy.types.bytes.parse-inc │ │ └── output │ ├── spicy.types.regexp.regression-incremental │ │ └── output │ ├── spicy.types.sink.reassembler.init-seq │ │ └── output │ ├── spicy.types.unit.attr-parse-from │ │ └── output │ ├── spicy.types.unit.external-hooks-same-module │ │ └── output │ ├── spicy.types.unit.size-side-effects │ │ └── output │ ├── spicy.types.unit.skip-field-literals │ │ └── output │ ├── spicy.types.unit.switch-blocks │ │ └── output │ ├── spicy.types.vector.parse-until-including │ │ └── output │ ├── hilti.hiltic.cc.import │ │ └── output │ ├── hilti.types.enum.cast │ │ └── output │ ├── hilti.types.reference.weak-from-value-ref-int │ │ └── output │ ├── hilti.types.regexp.big-regexp │ │ └── output │ ├── hilti.types.set.ctor │ │ └── output │ ├── spicy.doc.my_http-host-callback │ │ └── output │ ├── spicy.tools.spicyc-cxx-link │ │ └── output │ ├── spicy.tools.spicyc-precompiled │ │ └── output │ ├── spicy.types.bytes.parse-length-eod-chunked │ │ └── output │ ├── spicy.types.bytes.parse-until-eod │ │ └── output │ ├── spicy.types.unit.basic │ │ ├── .stderr │ │ └── output │ ├── spicy.types.unit.conditional-parse-at │ │ └── output │ ├── spicy.types.unit.error-hook │ │ └── output │ ├── spicy.types.unit.size-side-effects-2 │ │ └── output │ ├── spicy.types.unit.skip-lahead │ │ └── output │ ├── spicy.types.unit.transient │ │ └── output │ ├── spicy.types.unit.variables-optional │ │ └── output │ ├── spicy.types.vector.parse-lahead-int-variable │ │ └── output │ ├── spicy.types.vector.repeat-side-effect │ │ └── output │ ├── hilti.hiltic.jit.precompiled-globals-twice-dynamic │ │ └── output │ ├── hilti.types.reference.weak-from-value-ref-int-on-heap │ │ └── output │ ├── hilti.types.struct.on-heap-cyclic │ │ └── output │ ├── spicy.statements.switch │ │ └── output │ ├── spicy.types.bitfield.anonymous-field │ │ └── output │ ├── spicy.types.sink.reassembler.auto-trim │ │ └── output │ ├── spicy.types.unit.context-unit-parameters │ │ └── output │ ├── spicy.types.unit.var-struct-init │ │ └── output │ ├── spicy.types.vector.parse-enum │ │ └── output │ ├── spicy.types.vector.parse-lahead-int-longest-match │ │ └── output │ ├── hilti.types.bitfield.ctor │ │ └── output │ ├── hilti.types.stream.ops │ │ └── output │ ├── hilti.types.vector.iterator │ │ └── output │ ├── hilti.types.vector.ops │ │ └── output │ ├── spicy.tools.spicy-build-driver │ │ ├── output │ │ └── no-main.output │ ├── spicy.types.unit.basic-incremental │ │ ├── debug.log │ │ └── output │ ├── spicy.types.unit.switch-lahead-literal │ │ └── output │ ├── spicy.types.unit.void-eod │ │ └── output │ ├── spicy.types.vector.parse-type │ │ └── output │ ├── hilti.hiltic.jit.umask │ │ └── output │ ├── hilti.types.bytes.join │ │ └── output │ ├── hilti.types.function.hook-methods │ │ └── output │ ├── hilti.types.set.ops │ │ └── output │ ├── spicy.types.map.ops │ │ └── output │ ├── spicy.types.unit.convert │ │ └── output │ ├── spicy.types.unit.synchronize-failure-in-trial-mode-2 │ │ └── output │ ├── spicy.types.unit.synchronize-failure-in-trial-mode │ │ └── output │ ├── spicy.types.unit.variables │ │ └── output │ ├── spicy.types.vector.parse-subitem-attrs │ │ └── output │ ├── spicy.types.vector.parse-subitem │ │ └── output │ ├── hilti.hiltic.cc.exception │ │ └── output │ ├── hilti.hiltic.jit.exception │ │ └── output │ ├── hilti.hiltic.jit.import │ │ └── output │ ├── spicy.doc.my_http-host-parse2 │ │ └── output │ ├── spicy.types.integer.parse-lahead │ │ └── output │ ├── spicy.types.sink.reassembler.skip │ │ └── output │ ├── spicy.types.unit.context-unit-refs │ │ └── output │ ├── spicy.types.unit.external-hooks-import │ │ └── output │ ├── spicy.types.unit.switch-if-expr │ │ └── output │ ├── spicy.types.unit.synchronize-failure-after-trim │ │ └── output │ ├── spicy.types.unit.unit-convert │ │ └── output │ ├── hilti.optimization.peephole-default-void │ │ └── opt.hlt │ ├── hilti.rt.print-escapes │ │ └── output │ ├── hilti.validation.duplicate-4 │ │ └── output │ ├── spicy.types.sink.reassembler.sequence │ │ └── output │ ├── spicy.types.unit.context-conns │ │ └── output │ ├── spicy.types.unit.convert-integer │ │ └── output │ ├── spicy.types.unit.filter-chained │ │ └── output │ ├── spicy.types.unit.stream-statistics │ │ └── output │ ├── hilti.types.function.hook-priorities │ │ └── output │ ├── hilti.types.reference.weak-from-value-ref-struct │ │ └── output │ ├── hilti.types.result.exceptions-2 │ │ └── output │ ├── hilti.types.result.exceptions │ │ └── output │ ├── hilti.types.time.ops │ │ └── output │ ├── spicy.expressions.operator-precedence │ │ └── output │ ├── spicy.types.enum.type │ │ └── output │ ├── spicy.types.unit.filter │ │ └── output │ ├── spicy.types.unit.skip-field │ │ └── output │ ├── spicy.types.vector.offset │ │ └── output │ ├── hilti.statements.block │ │ └── output │ ├── hilti.statements.switch │ │ └── output │ ├── hilti.types.integer.overflow-diag │ │ └── output │ ├── hilti.types.result.condition-test │ │ └── output │ ├── spicy.statements.block │ │ └── output │ ├── spicy.types.unit.switch-if-lahead │ │ └── output │ ├── spicy.types.vector.parse-lahead-int-regexp │ │ └── output │ ├── hilti.rt.profiler │ │ └── output │ ├── hilti.types.address.ops │ │ └── output │ ├── hilti.types.integer.ctor-fail-8 │ │ └── output │ ├── hilti.types.struct.errors-2 │ │ └── output │ ├── hilti.types.tuple.assignment-coerce │ │ └── output │ ├── spicy.rt.accept-decline │ │ └── output │ ├── spicy.statements.confirm-fail │ │ └── output │ ├── spicy.statements.reject-fail │ │ └── output │ ├── spicy.tools.spicy-driver-properties │ │ └── output │ ├── spicy.types.integer.ctor-fail-7 │ │ └── output │ ├── spicy.types.sink.write │ │ └── output │ ├── spicy.types.unit.sub-unit-fail │ │ └── output │ ├── spicy.types.unit.switch-lahead-regexp-incremental │ │ └── output │ ├── hilti.types.integer.ctor-fail │ │ └── output │ ├── hilti.types.integer.shifting-too-much-2 │ │ └── output │ ├── hilti.types.integer.shifting-too-much-3 │ │ └── output │ ├── hilti.types.map.ctor-fail │ │ └── output │ ├── hilti.types.map.ops │ │ └── output │ ├── hilti.types.struct.ctor │ │ └── output │ ├── hilti.types.struct.errors-method-2 │ │ └── output │ ├── hilti.types.tuple.index-fail │ │ └── output │ ├── spicy.statements.while │ │ └── output │ ├── spicy.types.unit.switch-convert-mixed │ │ └── output │ ├── hilti.optimization.peephole-try-catch │ │ └── opt.hlt │ ├── hilti.types.integer.ctor-fail-2 │ │ └── output │ ├── hilti.types.integer.ctor-fail-3 │ │ └── output │ ├── hilti.types.integer.ctor-fail-5 │ │ └── output │ ├── hilti.types.integer.ctor-fail-6 │ │ └── output │ ├── hilti.types.real.series │ │ └── output │ ├── hilti.types.set.ctor-fail │ │ └── output │ ├── hilti.types.struct.errors-no-self │ │ └── output │ ├── hilti.types.struct.finally-fail │ │ └── output │ ├── spicy.tools.spicy-dump │ │ ├── output-text2 │ │ └── output-text3 │ ├── spicy.types.integer.ctor-fail-3 │ │ └── output │ ├── spicy.types.integer.ctor-fail-4 │ │ └── output │ ├── spicy.types.integer.ctor-fail-5 │ │ └── output │ ├── spicy.types.integer.ctor-fail-6 │ │ └── output │ ├── spicy.types.integer.ctor-fail-8 │ │ └── output │ ├── spicy.types.integer.ctor-fail-9 │ │ └── output │ ├── spicy.types.struct.parse-fail │ │ └── output │ ├── spicy.types.unit.hook-id-fail-3 │ │ └── output │ ├── spicy.types.unit.params-inout-forward │ │ └── output │ ├── spicy.types.unit.void-fail-2 │ │ └── output │ ├── hilti.codegen.init │ │ └── output │ ├── hilti.rt.exception-location │ │ └── output │ ├── hilti.types.integer.ctor-fail-4 │ │ └── output │ ├── hilti.types.integer.ctor-fail-7 │ │ └── output │ ├── hilti.types.list.ctor-fail │ │ └── output │ ├── hilti.types.struct.errors │ │ └── output │ ├── hilti.types.vector.ctor-fail │ │ └── output │ ├── spicy.types.unit.block-fail │ │ └── output │ ├── spicy.types.unit.conditional-bytes │ │ └── output │ ├── spicy.types.unit.conditional │ │ └── output │ ├── spicy.types.unit.switch-parse-from │ │ └── output │ ├── spicy.types.vector.parse-lahead-int-regexp-longest-match │ │ └── output │ ├── hilti.types.reference.weak-from-strong-ref │ │ └── output │ ├── hilti.types.struct.finally-fail-2 │ │ └── output │ ├── hilti.types.struct.finally-fail-3 │ │ └── output │ ├── spicy.rt.stack-check-init │ │ └── output │ ├── spicy.types.bitfield.parse-debug-output │ │ └── output │ ├── spicy.types.enum.from-int │ │ └── output │ ├── spicy.types.id.validation-2 │ │ └── output │ ├── spicy.types.reference.function-parameters │ │ └── output │ ├── spicy.types.sink.connect-mime │ │ └── output │ ├── spicy.types.sink.connect │ │ └── output │ ├── spicy.types.unit.block-fail-2 │ │ └── output │ ├── spicy.types.unit.filter-offset │ │ └── output │ ├── spicy.types.unit.switch-duplicate-case │ │ └── output │ ├── spicy.types.unit.unknown-field-2 │ │ └── output │ ├── spicy.types.unit.unknown-field │ │ └── output │ ├── hilti.types.enum.duplicate-value-fail │ │ └── output │ ├── hilti.types.result.conversion │ │ └── output │ ├── spicy.types.integer.ops-fail │ │ └── output │ ├── spicy.types.unit.parseable-fail │ │ └── output │ └── spicy.types.unit.size-overflow │ │ └── output ├── .gitignore ├── .clang-format ├── codebase │ └── visitors.sh ├── hilti │ ├── hiltic │ │ ├── jit │ │ │ ├── empty.hlt │ │ │ ├── hello-world.hlt │ │ │ ├── globals.hlt │ │ │ ├── keep-temps.hlt │ │ │ └── precompiled-hello-world.hlt │ │ └── print │ │ │ └── empty.hlt │ ├── types │ │ ├── set │ │ │ ├── ctor-fail.hlt │ │ │ └── ops-fail.hlt │ │ ├── vector │ │ │ └── ctor-fail.hlt │ │ ├── map │ │ │ ├── ctor-fail.hlt │ │ │ └── ops-fail.hlt │ │ ├── integer │ │ │ ├── mixed-operands-overflow.hlt │ │ │ └── signed-out-of-range.hlt │ │ ├── list │ │ │ └── ctor-fail.hlt │ │ ├── tuple │ │ │ └── index.hlt │ │ ├── function │ │ │ └── hook-functions-empty.hlt │ │ ├── real │ │ │ └── mul.hlt │ │ ├── result │ │ │ └── void-error.hlt │ │ └── string │ │ │ └── fmt.hlt │ ├── validation │ │ ├── declaration-cycle.hlt │ │ ├── self-decl-fail.hlt │ │ ├── wildcard-types.hlt │ │ ├── local-variables.hlt │ │ └── function-proto-fail.hlt │ ├── cfg │ │ ├── empty.hlt │ │ └── for.hlt │ ├── ast │ │ └── types.hlt │ ├── statements │ │ └── if-empty.hlt │ ├── codegen │ │ ├── globals-deps.hlt │ │ └── ctor.hlt │ └── tools │ │ └── print-settings.hlt ├── spicy │ ├── doc │ │ └── hello.spicy │ ├── types │ │ ├── integer │ │ │ ├── plus-zero.spicy │ │ │ ├── wrong-cast.spicy │ │ │ ├── wrong-int-mix.spicy │ │ │ └── wrong-assign.spicy │ │ ├── bytes │ │ │ ├── join.spicy │ │ │ ├── chunked-convert-deprecation.spicy │ │ │ ├── parse-ctor.spicy │ │ │ └── parse-eod.spicy │ │ ├── unit │ │ │ ├── field-default-value.spicy │ │ │ ├── sub-unit-fail.spicy │ │ │ ├── params-reference-fail.spicy │ │ │ ├── coercion.spicy │ │ │ ├── convert-field-self.spicy │ │ │ ├── synchronize-try-with-size.spicy │ │ │ ├── stream-fail.spicy │ │ │ ├── unit-max-size-coerce.spicy │ │ │ ├── variables-fail.spicy │ │ │ ├── field-hook-fail.spicy │ │ │ └── parseable-fail.spicy │ │ ├── vector │ │ │ └── parse-subitem-attrs-fail.spicy │ │ ├── optional │ │ │ └── ops.spicy │ │ ├── regexp │ │ │ └── invalid-field.spicy │ │ ├── bitfield │ │ │ └── typedef.spicy │ │ ├── set │ │ │ └── const-set.spicy │ │ └── function │ │ │ └── overloading.spicy │ ├── expressions │ │ ├── ternary.spicy │ │ └── new-fail.spicy │ ├── statements │ │ ├── confirm-fail.spicy │ │ ├── reject-fail.spicy │ │ └── throw-fail.spicy │ ├── rt │ │ ├── load-hlto.spicy │ │ ├── time.spicy │ │ ├── getenv.spicy │ │ └── print-binary.spicy │ ├── attributes │ │ └── byte-order.spicy │ ├── lib │ │ ├── bytes_to_hexstring.spicy │ │ └── bytes_to_mac.spicy │ └── tools │ │ ├── spicy-build-hello-world.spicy │ │ └── spicyc-hello-world.spicy └── ctest │ └── all.sh ├── VERSION ├── hilti ├── runtime │ ├── include │ │ ├── hilti │ │ │ └── rt │ │ ├── 3rdparty │ │ │ ├── any │ │ │ ├── SafeInt │ │ │ ├── tinyformat │ │ │ ├── .clang-tidy │ │ │ ├── ghc │ │ │ ├── ArticleEnumClass-v2 │ │ │ └── nlohmann │ │ │ │ ├── json.hpp │ │ │ │ └── json_fwd.hpp │ │ ├── unpack.h │ │ ├── types │ │ │ └── set_fwd.h │ │ └── linker.h │ └── src │ │ ├── tests │ │ └── .clang-tidy │ │ └── version.cc ├── toolchain │ ├── include │ │ ├── hilti │ │ ├── ast │ │ │ └── builder │ │ │ │ └── all.h │ │ └── compiler │ │ │ └── init.h │ ├── .clang-tidy │ └── src │ │ └── ast │ │ ├── declarations │ │ └── imported-module.cc │ │ ├── meta.cc │ │ ├── ctors │ │ ├── struct.cc │ │ └── bitfield.cc │ │ ├── statements │ │ └── try.cc │ │ ├── function.cc │ │ └── statement.cc └── lib │ └── CMakeLists.txt ├── spicy ├── runtime │ ├── include │ │ ├── spicy │ │ │ └── rt │ │ ├── parser-fwd.h │ │ ├── config.h.in │ │ └── spicy.h │ └── src │ │ ├── tests │ │ └── .clang-tidy │ │ └── mime.cc ├── toolchain │ ├── include │ │ ├── spicy │ │ ├── ast │ │ │ ├── ctors │ │ │ │ └── all.h │ │ │ ├── declarations │ │ │ │ └── all.h │ │ │ └── operators │ │ │ │ └── all.h │ │ ├── compiler │ │ │ └── init.h │ │ └── spicy.h │ ├── .clang-tidy │ └── bin │ │ └── spicy-dump │ │ └── options.h └── lib │ └── CMakeLists.txt ├── doc ├── examples │ ├── hello.spicy │ ├── my_http.spicy │ ├── my_http-host-callback.cc │ ├── my_http-host-driver.cc │ ├── my_http-host-parse1.cc │ ├── my_http-host-parse2.cc │ ├── my_http-host-driver-hlto.cc │ ├── request-line.pcap │ ├── _skip.spicy │ └── my_http.evt ├── tutorial │ └── examples │ │ ├── tftp.evt │ │ ├── tftp.spicy │ │ ├── udp-contents.resp.1367411052.081790.dat │ │ ├── udp-contents.orig.1367411051.972852.dat │ │ ├── tftp_rrq.pcap │ │ ├── _tftp-1.spicy │ │ ├── tftp-single-request.evt │ │ └── tftp-single-request-more-args.evt ├── _static │ ├── hilti-logo.png │ ├── spicy-logo.png │ ├── hilti-favicon.ico │ ├── spicy-favicon.ico │ ├── spicy-logo-small.png │ ├── spicy-logo-square.png │ ├── spicy-logo-with-border.png │ ├── spicy-logo-wth-border.png │ └── README.t2d ├── .gitignore ├── programming │ ├── examples │ │ ├── _basic-unit-module.spicy.output │ │ ├── mylibrary.spicy │ │ ├── _basic-unit-module-with-default.spicy.output │ │ ├── _regexp.spicy │ │ ├── _context-empty.spicy.output │ │ ├── _parse-vector.spicy │ │ ├── _constant-field.spicy │ │ ├── _parse-vector-foreach.spicy │ │ ├── _constant-field.spicy.output_1 │ │ ├── _context-empty.spicy │ │ ├── _empty-context.spicy │ │ ├── _max-size.spicy │ │ ├── _parse-convert.spicy.output │ │ ├── _parse-filter.spicy.output │ │ ├── _parse-requires.spicy.output_1 │ │ ├── _size.spicy │ │ ├── _unit-vars-init.spicy.output │ │ ├── _unit-vars-init.spicy │ │ ├── _parse-bitfield-enum.spicy.output │ │ ├── _parse-requires-property.spicy.output_1 │ │ ├── _parse-void-size.spicy │ │ ├── _unit-params-string.spicy.output │ │ ├── _basic-unit-module.spicy │ │ ├── _debug-hooks.spicy.output │ │ ├── _debug-hooks.spicy.output_2 │ │ ├── _parse-void-size.spicy.output │ │ ├── _skip.spicy │ │ ├── _unit-params.spicy.output │ │ ├── _parse-convert-unit.spicy.output │ │ ├── _parse-requires.spicy │ │ ├── _parse-convert.spicy │ │ ├── _parse-switch-lhead.spicy.output │ │ ├── _parse-unit-params.spicy.output │ │ ├── _regexp.spicy.output │ │ ├── _anonymous-field.spicy.output │ │ ├── _basic-unit-parse.spicy.output │ │ ├── _parse-reassembly.spicy.output │ │ ├── _parse-requires-property.spicy │ │ ├── _unit-params-vector.spicy.output │ │ ├── _unit-vars.spicy.output │ │ ├── _basic-unit-parse-byte-order.spicy.output │ │ ├── _basic-unit-parse.spicy │ │ ├── _debug-hooks.spicy.output_1 │ │ ├── _parse-look-ahead.spicy │ │ ├── _anonymous-field.spicy │ │ ├── _parse-address.spicy │ │ ├── _parse-bitfield.spicy.output │ │ ├── _parse-vector.spicy.output │ │ ├── _skip.spicy.output │ │ ├── _parse-look-ahead.spicy.output │ │ ├── _unit-vars-optional.spicy.output │ │ ├── _basic-unit-module-with-default.spicy │ │ ├── _parse-parse.spicy │ │ └── _parse-parse.spicy.output │ └── language │ │ └── examples │ │ ├── _function-inout.spicy.output │ │ ├── _module-hello-world.spicy │ │ ├── _module-hello-world.spicy.output │ │ ├── _statement-interpolation.spicy │ │ ├── _statement-interpolation.spicy.output │ │ ├── _statement-for.spicy.output │ │ └── _function-inout.spicy ├── autogen │ └── types │ │ ├── generic-end.rst │ │ ├── generic-begin.rst │ │ ├── generic-pack.rst │ │ ├── generic-unpack.rst │ │ └── optional.rst ├── development │ ├── doxygen.rst │ └── index.rst └── requirements.txt ├── .dockerignore ├── CPPLINT.cfg ├── scripts ├── CMakeLists.txt └── cxx-installed-dir ├── .gitignore └── ruff.toml /tests/Scripts/.empty: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /VERSION: -------------------------------------------------------------------------------- 1 | 1.15.0-dev.186 2 | -------------------------------------------------------------------------------- /hilti/runtime/include/hilti/rt: -------------------------------------------------------------------------------- 1 | .. -------------------------------------------------------------------------------- /spicy/runtime/include/spicy/rt: -------------------------------------------------------------------------------- 1 | .. -------------------------------------------------------------------------------- /hilti/toolchain/include/hilti: -------------------------------------------------------------------------------- 1 | ../include -------------------------------------------------------------------------------- /spicy/toolchain/include/spicy: -------------------------------------------------------------------------------- 1 | ../include -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.unit.offset/.stderr: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.types.real.add-2/output: -------------------------------------------------------------------------------- 1 | 4.21 2 | -------------------------------------------------------------------------------- /doc/examples/hello.spicy: -------------------------------------------------------------------------------- 1 | ../../tests/spicy/doc/hello.spicy -------------------------------------------------------------------------------- /doc/tutorial/examples/tftp.evt: -------------------------------------------------------------------------------- 1 | ../../autogen/zeek/tftp.evt -------------------------------------------------------------------------------- /hilti/runtime/include/3rdparty/any: -------------------------------------------------------------------------------- 1 | ../../../../3rdparty/any -------------------------------------------------------------------------------- /hilti/toolchain/.clang-tidy: -------------------------------------------------------------------------------- 1 | ../../.clang-tidy.toolchain -------------------------------------------------------------------------------- /spicy/toolchain/.clang-tidy: -------------------------------------------------------------------------------- 1 | ../../.clang-tidy.toolchain -------------------------------------------------------------------------------- /doc/examples/my_http.spicy: -------------------------------------------------------------------------------- 1 | ../../tests/spicy/doc/my_http.spicy -------------------------------------------------------------------------------- /doc/tutorial/examples/tftp.spicy: -------------------------------------------------------------------------------- 1 | ../../autogen/zeek/tftp.spicy -------------------------------------------------------------------------------- /tests/.gitignore: -------------------------------------------------------------------------------- 1 | diag.log 2 | .tmp 3 | .btest.failed.dat 4 | -------------------------------------------------------------------------------- /doc/tutorial/examples/udp-contents.resp.1367411052.081790.dat: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /hilti/runtime/include/3rdparty/SafeInt: -------------------------------------------------------------------------------- 1 | ../../../../3rdparty/SafeInt -------------------------------------------------------------------------------- /tests/.clang-format: -------------------------------------------------------------------------------- 1 | DisableFormat: true 2 | SortIncludes: false 3 | -------------------------------------------------------------------------------- /hilti/runtime/include/3rdparty/tinyformat: -------------------------------------------------------------------------------- 1 | ../../../../3rdparty/tinyformat -------------------------------------------------------------------------------- /hilti/runtime/include/3rdparty/.clang-tidy: -------------------------------------------------------------------------------- 1 | ../../../../3rdparty/.clang-tidy -------------------------------------------------------------------------------- /hilti/runtime/include/3rdparty/ghc: -------------------------------------------------------------------------------- 1 | ../../../../3rdparty/filesystem/include/ghc -------------------------------------------------------------------------------- /doc/examples/my_http-host-callback.cc: -------------------------------------------------------------------------------- 1 | ../../tests/spicy/doc/my_http-host-callback.cc -------------------------------------------------------------------------------- /doc/examples/my_http-host-driver.cc: -------------------------------------------------------------------------------- 1 | ../../tests/spicy/doc/my_http-host-driver.cc -------------------------------------------------------------------------------- /doc/examples/my_http-host-parse1.cc: -------------------------------------------------------------------------------- 1 | ../../tests/spicy/doc/my_http-host-parse1.cc -------------------------------------------------------------------------------- /doc/examples/my_http-host-parse2.cc: -------------------------------------------------------------------------------- 1 | ../../tests/spicy/doc/my_http-host-parse2.cc -------------------------------------------------------------------------------- /doc/tutorial/examples/udp-contents.orig.1367411051.972852.dat: -------------------------------------------------------------------------------- 1 | rfc1350.txtoctet -------------------------------------------------------------------------------- /tests/codebase/visitors.sh: -------------------------------------------------------------------------------- 1 | # @TEST-EXEC: ${SCRIPTS}/check-node-methods ${DIST} 2 | -------------------------------------------------------------------------------- /doc/examples/my_http-host-driver-hlto.cc: -------------------------------------------------------------------------------- 1 | ../../tests/spicy/doc/my_http-host-driver-hlto.cc -------------------------------------------------------------------------------- /hilti/runtime/include/3rdparty/ArticleEnumClass-v2: -------------------------------------------------------------------------------- 1 | ../../../../3rdparty/ArticleEnumClass-v2 -------------------------------------------------------------------------------- /doc/_static/hilti-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zeek/spicy/HEAD/doc/_static/hilti-logo.png -------------------------------------------------------------------------------- /doc/_static/spicy-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zeek/spicy/HEAD/doc/_static/spicy-logo.png -------------------------------------------------------------------------------- /.dockerignore: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2020-now by the Zeek Project. See LICENSE for details. 2 | 3 | build* 4 | -------------------------------------------------------------------------------- /doc/_static/hilti-favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zeek/spicy/HEAD/doc/_static/hilti-favicon.ico -------------------------------------------------------------------------------- /doc/_static/spicy-favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zeek/spicy/HEAD/doc/_static/spicy-favicon.ico -------------------------------------------------------------------------------- /doc/examples/request-line.pcap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zeek/spicy/HEAD/doc/examples/request-line.pcap -------------------------------------------------------------------------------- /doc/_static/spicy-logo-small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zeek/spicy/HEAD/doc/_static/spicy-logo-small.png -------------------------------------------------------------------------------- /doc/_static/spicy-logo-square.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zeek/spicy/HEAD/doc/_static/spicy-logo-square.png -------------------------------------------------------------------------------- /hilti/runtime/include/3rdparty/nlohmann/json.hpp: -------------------------------------------------------------------------------- 1 | ../../../../../3rdparty/json/single_include/nlohmann/json.hpp -------------------------------------------------------------------------------- /hilti/runtime/include/3rdparty/nlohmann/json_fwd.hpp: -------------------------------------------------------------------------------- 1 | ../../../../../3rdparty/json/include/nlohmann/json_fwd.hpp -------------------------------------------------------------------------------- /doc/tutorial/examples/tftp_rrq.pcap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zeek/spicy/HEAD/doc/tutorial/examples/tftp_rrq.pcap -------------------------------------------------------------------------------- /CPPLINT.cfg: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2020-now by the Zeek Project. See LICENSE for details. 2 | filter=-,+readability/casting 3 | -------------------------------------------------------------------------------- /doc/_static/spicy-logo-with-border.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zeek/spicy/HEAD/doc/_static/spicy-logo-with-border.png -------------------------------------------------------------------------------- /doc/_static/spicy-logo-wth-border.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zeek/spicy/HEAD/doc/_static/spicy-logo-wth-border.png -------------------------------------------------------------------------------- /doc/.gitignore: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2020-now by the Zeek Project. See LICENSE for details. 2 | 3 | !Makefile 4 | doxygen-output 5 | -------------------------------------------------------------------------------- /doc/programming/examples/_basic-unit-module.spicy.output: -------------------------------------------------------------------------------- 1 | # Automatically generated; do not edit. -- spicyc -j %INPUT//False 2 | [$version=42] 3 | -------------------------------------------------------------------------------- /doc/programming/language/examples/_function-inout.spicy.output: -------------------------------------------------------------------------------- 1 | # Automatically generated; do not edit. -- spicyc -j %INPUT//False 2 | 1 3 | 2 4 | -------------------------------------------------------------------------------- /tests/Scripts/have-jit: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | # 3 | # Returns success if we have JIT support available. 4 | 5 | test $(spicy-config --jit-support) = "yes" 6 | -------------------------------------------------------------------------------- /tests/Scripts/printf: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Exposes a `printf` with bash extensions. 4 | 5 | # shellcheck disable=SC2059 6 | printf "$@" 7 | -------------------------------------------------------------------------------- /tests/hilti/hiltic/jit/empty.hlt: -------------------------------------------------------------------------------- 1 | # @TEST-EXEC: ${HILTIC} -j -D compiler,jit %INPUT >output 2 | # @TEST-EXEC: btest-diff output 3 | 4 | module Foo {} 5 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.rt.time/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | -------------------------------------------------------------------------------- /tests/Scripts/cxx-common.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | if [ "$1" = "--release" ]; then 4 | debug="" 5 | shift 6 | else 7 | debug="--debug" 8 | fi 9 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.hiltic.cc.empty/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.hiltic.jit.empty/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.statements.try/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.types.bytes.ops/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | -------------------------------------------------------------------------------- /tests/spicy/doc/hello.spicy: -------------------------------------------------------------------------------- 1 | # @TEST-EXEC: spicyc -j %INPUT >output 2 | # @TEST-EXEC: btest-diff output 3 | 4 | module Test; 5 | 6 | print "Hello, world!"; 7 | -------------------------------------------------------------------------------- /tests/spicy/types/integer/plus-zero.spicy: -------------------------------------------------------------------------------- 1 | # @TEST-EXEC: ${SPICYC} -j %INPUT 2 | 3 | module Test; 4 | 5 | global x: int64 = int64(6) - +3; 6 | assert x == 3; 7 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.expressions.ternary/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.types.address.unpack/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.types.bitfield.unpack/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.types.bytes.iterator/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.types.bytes.match/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.types.bytes.to-int/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.types.bytes.to-real/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.types.bytes.to-time/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.types.enum.equal-ops/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.types.integer.cast/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.types.optional.ops/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.types.real.limits/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.types.real.unpack/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.types.stream.iterator/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.types.stream.view/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.types.struct.params/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.types.time.functions/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.unit.params/.stderr: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.unit.stream-2/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.unit.stream/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | -------------------------------------------------------------------------------- /tests/ctest/all.sh: -------------------------------------------------------------------------------- 1 | # @TEST-GROUP: no-jit 2 | # @TEST-REQUIRES: using-build-directory 3 | # @TEST-EXEC: cmake --build "${SPICY_BUILD_DIRECTORY}" --target check 1>&2 4 | -------------------------------------------------------------------------------- /tests/spicy/expressions/ternary.spicy: -------------------------------------------------------------------------------- 1 | # @TEST-EXEC: ${SPICYC} -j %INPUT 2 | 3 | module Foo; 4 | 5 | assert 1 == (True ? 1 : 2); 6 | assert 2 == (False ? 1 : 2); 7 | -------------------------------------------------------------------------------- /doc/programming/language/examples/_module-hello-world.spicy: -------------------------------------------------------------------------------- 1 | # Automatically generated; edit in Sphinx source code, not here. 2 | module Test; 3 | 4 | print "Hello, world!"; -------------------------------------------------------------------------------- /tests/Baseline/hilti.ast.coercion-type-changes/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.ast.import-from/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | foo 3 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.types.bitfield.convert/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.types.integer.exceptions/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.types.regexp.match-repeats/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.types.struct.auto-result/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.attributes.spicy-version-2/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.attributes.spicy-version/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.rt.crc32/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | 0xc96b9640 3 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.bytes.join/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | a.b.c 3 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.regexp.operators/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.struct.const-param/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.unit.params-atomic/.stderr: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.unit.params-modify/.stderr: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.unit.sync-advance-3/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | -------------------------------------------------------------------------------- /tests/spicy/statements/confirm-fail.spicy: -------------------------------------------------------------------------------- 1 | # @TEST-EXEC-FAIL: spicyc -p %INPUT >>output 2>&1 2 | # @TEST-EXEC: btest-diff output 3 | 4 | module test; 5 | 6 | confirm; 7 | -------------------------------------------------------------------------------- /tests/spicy/statements/reject-fail.spicy: -------------------------------------------------------------------------------- 1 | # @TEST-EXEC-FAIL: spicyc -p %INPUT >>output 2>&1 2 | # @TEST-EXEC: btest-diff output 3 | 4 | module test; 5 | 6 | reject; 7 | -------------------------------------------------------------------------------- /doc/autogen/types/generic-end.rst: -------------------------------------------------------------------------------- 1 | .. spicy:operator:: generic::End end() 2 | 3 | Returns an iterator to the end of the container's content. 4 | 5 | -------------------------------------------------------------------------------- /spicy/runtime/src/tests/.clang-tidy: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2020-now by the Zeek Project. See LICENSE for details. 2 | 3 | --- 4 | Checks: ' 5 | -modernize-type-traits, 6 | ' 7 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.codegen.ctor/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | /abc/ 3 | 42 4 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.codegen.reserved/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | 42 3 | 42 4 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.expressions.global-scope-id/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.statements.break/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | 1 3 | 1 4 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.statements.if-empty/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | done 3 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.types.integer.operators-signed/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.types.real.coercion/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | 3.14159 3 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.types.real.mul/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | 4284 3 | 100 4 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.types.real.sub/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | 10 3 | 7.5 4 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.doc.hello/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | Hello, world! 3 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.sink.reassembler.policy/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.unit.params-recursive/.stderr: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.unit.unit-max-size-coerce/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | -------------------------------------------------------------------------------- /hilti/runtime/include/unpack.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2020-now by the Zeek Project. See LICENSE for details. 2 | 3 | #pragma once 4 | 5 | namespace hilti::rt {} // namespace hilti::rt 6 | -------------------------------------------------------------------------------- /spicy/toolchain/include/ast/ctors/all.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2020-now by the Zeek Project. See LICENSE for details. 2 | 3 | #pragma once 4 | 5 | #include 6 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.hiltic.jit.globals/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | Hello, world! 3 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.types.bitfield.ops/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | (a: 31, b: 3) 3 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.types.function.auto-params/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | 42 3 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.types.integer.operators-unsigned/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.types.real.add/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | 12.63 3 | 4.21 4 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.types.struct.static-method/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | 12 3 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.doc.debug-hooks/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | 1234 3 | 567890 4 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.map.default-coerce/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | {0: 1} 3 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.reference.operators/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | Null 3 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.unit.convert-regexp/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | 12346 3 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.unit.find/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [$data=b"23456"] 3 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.unit.switch-bytes/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | 1 3 | 2 4 | -------------------------------------------------------------------------------- /tests/Scripts/using-build-directory: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | # 3 | # Returns success if the tests are running from inside the build directory. 4 | 5 | test ${USING_BUILD_DIRECTORY} = 1 6 | -------------------------------------------------------------------------------- /tests/hilti/types/set/ctor-fail.hlt: -------------------------------------------------------------------------------- 1 | # @TEST-EXEC-FAIL: ${HILTIC} -j %INPUT >output 2>&1 2 | # @TEST-EXEC: btest-diff output 3 | 4 | module X { 5 | 6 | set(1, "B", 3); 7 | 8 | } 9 | -------------------------------------------------------------------------------- /tests/spicy/types/bytes/join.spicy: -------------------------------------------------------------------------------- 1 | # @TEST-EXEC: ${SPICYC} -j %INPUT >output 2 | # @TEST-EXEC: btest-diff output 3 | 4 | module Test; 5 | print b".".join(vector("a", "b", "c")); 6 | -------------------------------------------------------------------------------- /doc/autogen/types/generic-begin.rst: -------------------------------------------------------------------------------- 1 | .. spicy:operator:: generic::Begin begin() 2 | 3 | Returns an iterator to the beginning of the container's content. 4 | 5 | -------------------------------------------------------------------------------- /doc/programming/examples/mylibrary.spicy: -------------------------------------------------------------------------------- 1 | module MyLibrary; 2 | 3 | ## Rotate each letter by 13 characters. 4 | public function rot13(s: string) : string &cxxname="MyLibrary::rot13"; 5 | -------------------------------------------------------------------------------- /scripts/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2020-now by the Zeek Project. See LICENSE for details. 2 | 3 | install(PROGRAMS precompile-headers.sh RENAME spicy-precompile-headers TYPE BIN) 4 | -------------------------------------------------------------------------------- /spicy/runtime/include/parser-fwd.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2020-now by the Zeek Project. See LICENSE for details. 2 | 3 | #pragma once 4 | 5 | namespace spicy::rt { 6 | struct Parser; 7 | } 8 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.hiltic.cc.hello-world/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | Hello, world! 3 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.hiltic.jit.hello-world/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | Hello, world! 3 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.hiltic.jit.hilti-cxx/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | Hello, world! 3 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.tools.hilti-driver-hilti-path/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | foo 3 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.types.enum.import/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | X::A1 3 | X::A2 4 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.types.function.extern-no-suspend/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | foo 3 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.types.integer.on-heap/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | 256 3 | 128 4 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.types.struct.method/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | 42 3 | 43 4 | 44 5 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.types.tuple.index/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | Hello! 3 | True 4 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.codegen.default-arg-across-import/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | TCP 3 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.doc.my_http/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | GET, /index.html, 1.0 3 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.bytes.iterator/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | 49 3 | 50 4 | 51 5 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.sink.filter-it/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | Hello, Spicy! 3 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.unit.context-inout/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [$x=100] 3 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.unit.filter-in-vector-of-sub/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | S 3 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.unit.params-inout-sink/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | 1234 3 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.unit.print-hook-2/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | -|- 3 | 1|2 4 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.unit.print-hook/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | -|- 3 | 1|2 4 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.unit.switch-scope/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | 1 3 | b, 2 4 | -------------------------------------------------------------------------------- /tests/hilti/validation/declaration-cycle.hlt: -------------------------------------------------------------------------------- 1 | # @TEST-EXEC-FAIL: hiltic -j %INPUT >output 2>&1 2 | # @TEST-EXEC: btest-diff output 3 | 4 | module Test { 5 | local x = 2 * x; 6 | } 7 | -------------------------------------------------------------------------------- /doc/programming/examples/_basic-unit-module-with-default.spicy.output: -------------------------------------------------------------------------------- 1 | # Automatically generated; do not edit. -- spicyc -j %INPUT//False 2 | [$version=(not set)] 3 | version is 42 4 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.codegen.cxx-any-as-ptr/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | uint64 3 | string 4 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.expressions.list-comprehension/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [2, 4, 6] 3 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.types.bytes.iterator-sign/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | 80 3 | 79 4 | 80 5 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.types.interval.ops/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | 2.500000s 3 | 1.500000s 4 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.types.result.error/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | 3 | test 4 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.types.string.fmt/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | foo 3 | 42 4 | foo 32 ff 5 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.types.union.same-type/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | $a="A" 3 | $b="B" 4 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.codegen.cxx-any-as-ptr/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | uint64 3 | string 4 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.expressions.list-comprehension-unit/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [] 3 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.expressions.list-comprehension/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [2, 4, 6] 3 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.rt.base64/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | MTIzNDU2Nzg5MA== 3 | 1234567890 4 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.rt.zlib/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | Hello, Spicy! 3 | 1111111111\x0a 4 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.bitfield.anonymous-field-const/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | 255 3 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.interval.ops/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | 2.500000s 3 | 1.500000s 4 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.set.ops/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | {"A", "B"} 3 | {1, 2, 3} 4 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.struct.ctor-same-fields/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [$t=b"foo"] 3 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.unit.debug-hook/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | DONE with %debug 3 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.unit.struct-ctor-init/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [$a=1, $b=2] 3 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.vector.iterator/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | 49 3 | 50 4 | 51 5 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.vector.parse-const/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [$x=[1, 1, 1]] 3 | -------------------------------------------------------------------------------- /tests/Scripts/cxx-link: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | . $(dirname $0)/cxx-common.sh 4 | 5 | cxx=$(spicy-config --cxx) 6 | ldflags=$(spicy-config --ldflags ${debug}) 7 | 8 | exec ${cxx} $@ ${ldflags} 9 | -------------------------------------------------------------------------------- /tests/hilti/cfg/empty.hlt: -------------------------------------------------------------------------------- 1 | # @TEST-EXEC: hiltic -p -o /dev/null -D cfg-initial %INPUT >output 2>&1 2 | # @TEST-EXEC: btest-diff output 3 | 4 | module foo { 5 | function void fn() {} 6 | } 7 | -------------------------------------------------------------------------------- /tests/hilti/types/vector/ctor-fail.hlt: -------------------------------------------------------------------------------- 1 | # @TEST-EXEC-FAIL: ${HILTIC} -j %INPUT >output 2>&1 2 | # @TEST-EXEC: btest-diff output 3 | 4 | module X { 5 | 6 | vector(1, "B", 3); 7 | 8 | } 9 | -------------------------------------------------------------------------------- /doc/autogen/types/generic-pack.rst: -------------------------------------------------------------------------------- 1 | .. spicy:operator:: generic::Pack bytes pack t:tuple 2 | 3 | Packs a value into a binary representation. See :ref:`packing` for 4 | details. 5 | 6 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.hiltic.jit.hilti-cxx/wrapper.output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | our wrapper ran! 3 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.hiltic.jit.precompiled-globals/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | Hello, world! 3 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.rt.debug/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [test-debug] 12 3 | [test-debug] 12 4 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.statements.for/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | 1 3 | 2 4 | 3 5 | 1 6 | 2 7 | 3 8 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.types.function.hook-functions-empty/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | (not set) 3 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.types.function.hook-methods-empty/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | (not set) 3 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.types.integer.coercion/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | -9223372036854775808 3 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.types.optional.coercion/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | ((not set)) 3 | (("x")) 4 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.types.real.inf_NaN/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | 0 3 | -0 4 | inf 5 | -inf 6 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.types.union.ops/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | 3 | $i=42 4 | $test="X" 5 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.types.vector.default-values/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | X::Undef 3 | X::A1 4 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.doc.my_http-host-parse1/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | GET, /index.html, 1.0 3 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.bytes.parse-ctor/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [$b1=b"abc", $b2=b"def"] 3 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.bytes.parse-eod/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [$b1=b"abc", $b2=b"def"] 3 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.optional.ops/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | (not set) 3 | 123 4 | 456 5 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.port.ops/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | 80/tcp 3 | 123/udp 4 | 1/tcp 5 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.time.ops/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | 2011-01-19T05:31:50.500000000Z 3 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.unit.params-inout-unit/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [$x=2, $s=] 3 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.unit.unit-ref-deref/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | my_fn 3 | my_inout_fn 4 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.vector.parse-lahead-eod/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | 12 3 | 34 4 | 56 5 | -------------------------------------------------------------------------------- /tests/hilti/types/map/ctor-fail.hlt: -------------------------------------------------------------------------------- 1 | # @TEST-EXEC-FAIL: ${HILTIC} -j %INPUT >output 2>&1 2 | # @TEST-EXEC: btest-diff output 3 | 4 | module X { 5 | 6 | map(1: "A", 2: "B", "X": "C"); 7 | 8 | } 9 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2020-now by the Zeek Project. See LICENSE for details. 2 | 3 | /build* 4 | tmp 5 | *.pyc 6 | .##* 7 | compile_commands.json 8 | .clangd 9 | .cache 10 | *.swp 11 | -------------------------------------------------------------------------------- /doc/development/doxygen.rst: -------------------------------------------------------------------------------- 1 | .. _doxygen: 2 | 3 | C++ API documentation 4 | ===================== 5 | 6 | The generated C++ API documentation can be found `here <../_static/doxygen/index.html>`__. 7 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.hiltic.jit.precompiled-hello-world/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | Hello, world! 3 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.rt.print/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | abc 3 | a"bc 4 | [$s1="Foo!", $s2="a\"b\n"] 5 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.statements.continue/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | 1 3 | 2 4 | 3 5 | 1 6 | 2 7 | 3 8 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.types.function.hook-redecl/stdout: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | Hi!! 3 | Hi!! 4 | Hi!! 5 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.types.regexp.span/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | (1, b"234X5678Y09") 3 | (-1, b"") 4 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.types.struct.method-auto-param/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | foo 3 | [$s="bar"] 4 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.types.struct.overloading/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | void 3 | bool 4 | string 5 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.types.struct.static-method-extern/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | Done, result: 22 3 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.rt.print-escaping/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | \", \" 3 | \", \" 4 | 5C22, 5C22 5 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.bytes.parse-length-coercion/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | abc, 12345, def 3 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.function.overloading/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | int64, 42 3 | string, foo 4 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.sink.no-data-for-lahead/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | TESTING::Message {} 3 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.string.operators/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | ("Spicy", "Spïcy", "Spicy") 3 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.unit.convert-integer-signed/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [$s1=-60, $s2=196] 3 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.unit.offset-in-attribute/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [$a=b"12", $z=b"56"] 3 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.unit.offset-parse-from/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | element 1 3 | element 2 4 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.unit.params-atomic/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [$f=[$x="String", $y=True]] 3 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.unit.set_input-beyond-current/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [$a=1, $b=9] 3 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.unit.skip-field-literal-conditional/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | 1 3 | 4 4 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.unit.skip-sized/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [$a=b"\x01\x02", $c=b"\x04"] 3 | -------------------------------------------------------------------------------- /tests/Scripts/cxx-compile: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | . $(dirname $0)/cxx-common.sh 4 | 5 | cxx=$(spicy-config --cxx) 6 | cxxflags=$(spicy-config --cxxflags ${debug}) 7 | 8 | exec ${cxx} ${cxxflags} $@ 9 | -------------------------------------------------------------------------------- /tests/spicy/types/unit/field-default-value.spicy: -------------------------------------------------------------------------------- 1 | # @TEST-EXEC: ${SPICYC} -p %INPUT 2 | 3 | module Foo; 4 | 5 | type Bar = unit { 6 | a: uint8 &default=0; 7 | var b: bytes = b"" + b""; 8 | }; 9 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.ast.local-use-before-decl/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | ("local", 5) 3 | ("global", 1) 4 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.types.regexp.incremental/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | (-1, 4) 3 | (-1, 2) 4 | (1, 6) 5 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.types.tuple.bytes-iter-deref/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [(49), (50), (51), (255)] 3 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.tools.spicyc-hello-world/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | Hello, world! 3 | Hello, world! 4 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.bitfield.anonymous-field-with-enum-param/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | Boolean! 3 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.bitfield.parse-enum/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | Foo::A 3 | Foo:: 4 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.bytes.parse-length-eod/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [$b1=b"abc", $b2=b"123"] 3 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.regexp.parse-captures-requires/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [$a=b"b", $b=b"abc"] 3 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.unit.offset-with-expr/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [$length=3, $la=[$la=b"123"]] 3 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.unit.params-for-vars/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [$i=7, $bar="bar", $foo="foo"] 3 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.unit.params/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [$f=(not set)] 3 | [$f=[$x=b"xxx"]] 4 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.unit.unit-size/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [$a=[$x=b"12345"], $b=[$x=b"67890"]] 3 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.vector.parse-eod/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [$a=[49, 50, 51, 52, 53], $b=[]] 3 | -------------------------------------------------------------------------------- /tests/spicy/types/unit/sub-unit-fail.spicy: -------------------------------------------------------------------------------- 1 | # @TEST-EXEC-FAIL: spicyc -c %INPUT >output 2>&1 2 | # @TEST-EXEC: btest-diff output 3 | 4 | module T; 5 | 6 | public type A = unit { 7 | : B; 8 | }; 9 | -------------------------------------------------------------------------------- /doc/programming/language/examples/_module-hello-world.spicy.output: -------------------------------------------------------------------------------- 1 | # Automatically generated; do not edit. -- spicyc -j %INPUT/spicyc -j %INPUT/False 2 | # spicyc -j hello-world.spicy 3 | Hello, world! 4 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.hiltic.cc.separate-units/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | Hello, world 1! 3 | Hello, world 2! 4 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.types.bytes.decode/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | testing 3 | test??ng? 4 | testüng 5 | 123? 6 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.types.function.overloading/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | ("int64", 42) 3 | ("string", "foo") 4 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.types.string.encode/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | testing 3 | test??ng? 4 | test\xc3\xbcng 5 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.types.struct.params-init-ambiguity/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [$s="foo"] 3 | [$s="bar"] 4 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.rt.load-hlto/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | Hello, world! 3 | [error] no parsers available 4 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.tools.spicy-build-hello-world/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | Hello, world! 3 | Hello, world! 4 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.bitfield.parse-bitorder/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | 0, 2 3 | 1, 0 4 | 1, 0 5 | 0, 2 6 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.null.coercion/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | False 3 | Null 4 | (not set) 5 | (not set) 6 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.sink.reassembler.custom-length/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | 0000011111222223333344444 3 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.unit.input-save-and-restore/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | 12345, 67890, 67890, 67890 3 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.unit.sub-unit/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [$f=(not set)] 3 | [$f=[$x=258, $y=3]] 4 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.unit.unit-max-size-as-field/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [$dat=[$b=b"1"], $b=b"23"] 3 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.vector.parse-lahead-parse-from/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [$x=[97, 98, 99], $y=120] 3 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.vector.parse-while/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | 1 3 | 2 4 | [$ints=[1, 2], $last=4] 5 | -------------------------------------------------------------------------------- /doc/autogen/types/generic-unpack.rst: -------------------------------------------------------------------------------- 1 | .. spicy:operator:: generic::Unpack unpack t:type 2 | 3 | Unpacks a value from a binary representation. See :ref:`packing` for 4 | details. 5 | 6 | -------------------------------------------------------------------------------- /doc/programming/examples/_regexp.spicy: -------------------------------------------------------------------------------- 1 | # Automatically generated; edit in Sphinx source code, not here. 2 | module Test; 3 | 4 | public type Foo = unit { 5 | x: /Foo.*Bar/; 6 | on %done { print self; } 7 | }; -------------------------------------------------------------------------------- /doc/programming/language/examples/_statement-interpolation.spicy: -------------------------------------------------------------------------------- 1 | # Automatically generated; edit in Sphinx source code, not here. 2 | module Test; 3 | 4 | print "Hello, %s!" % "World"; 5 | print "%s=%d" % ("x", 1); -------------------------------------------------------------------------------- /tests/Baseline/hilti.types.function.coercion-order/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | 8 3 | 8/64 4 | 8/64/64 5 | 8/8/64/64 6 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.types.function.hook-functions/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | 42 3 | f1.a X 4 | f1.b X 5 | f1.c X 6 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.types.optional.consts/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | 1 3 | b"ABC" 4 | b"ABC" 5 | b"" 6 | (not set) 7 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.types.port.ops/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | 80/tcp 3 | 123/udp 4 | 1/tcp 5 | TCP 6 | UDP 7 | TCP 8 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.types.reference.strong-from-weak-ref/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | xyz 3 | xyz 4 | xyz 5 | xyz 6 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.types.struct.string-conversion/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | xxx|yyy 3 | [$x="xxx", $y="yyy"] 4 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.statements.for-resolve/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | 31 3 | 32 4 | 33 5 | 34 6 | 35 7 | 36 8 | 37 9 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.address.ops/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | 1.2.3.4 3 | 2001:db8:85a3:8d3:1319:8a2e:370:7348 4 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.bitfield.parse/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | 1 3 | 3 4 | 3 5 | [$f=(x1: 1, x2: 3, x3: 3)] 6 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.bytes.parse-length/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [$b1=b"abc", $b2=b"12345", $b3=b"def"] 3 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.real.parse/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [$f1=12.3457, $f2=12.3457, $f3=3.14, $f4=3.14] 3 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.unit.switch-void/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | 1 3 | 2 or 3 4 | 2 or 3 5 | something else 6 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.unit.unit-max-size-as-field-3/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [$dat=[[$b=b"1"]], $x=b"3"] 3 | -------------------------------------------------------------------------------- /tests/hilti/hiltic/print/empty.hlt: -------------------------------------------------------------------------------- 1 | # @TEST-GROUP: no-jit 2 | # @TEST-EXEC: ${HILTIC} -g -c %INPUT >output 3 | # @TEST-EXEC: ${HILTIC} -l %INPUT >>output 4 | # @TEST-EXEC: btest-diff output 5 | 6 | module Foo {} 7 | -------------------------------------------------------------------------------- /tests/spicy/types/integer/wrong-cast.spicy: -------------------------------------------------------------------------------- 1 | # @TEST-EXEC-FAIL: ${SPICYC} -j %INPUT >output 2>&1 2 | # @TEST-EXEC: btest-diff output 3 | 4 | module Test; 5 | 6 | global a: int32 = 1; 7 | 8 | print cast(a); 9 | -------------------------------------------------------------------------------- /doc/autogen/types/optional.rst: -------------------------------------------------------------------------------- 1 | .. rubric:: Operators 2 | 3 | .. spicy:operator:: optional::Deref op:* t:optional op: 4 | 5 | Returns the element stored, or throws an exception if none. 6 | 7 | -------------------------------------------------------------------------------- /doc/programming/examples/_context-empty.spicy.output: -------------------------------------------------------------------------------- 1 | # Automatically generated; do not edit. -- spicy-driver %INPUT spicyc -j %INPUT/spicyc -j %INPUT/False 2 | # spicyc -j print.spicy 3 | Hello, World! 4 | x=1 5 | -------------------------------------------------------------------------------- /doc/tutorial/examples/_tftp-1.spicy: -------------------------------------------------------------------------------- 1 | # Automatically generated; edit in Sphinx source code, not here. 2 | module TFTP; 3 | 4 | public type Packet = unit { 5 | opcode: uint16; 6 | 7 | on %done { print self; } 8 | }; -------------------------------------------------------------------------------- /doc/tutorial/examples/tftp-single-request.evt: -------------------------------------------------------------------------------- 1 | protocol analyzer spicy::TFTP over UDP: 2 | parse with TFTP::Packet, 3 | port 69/udp; 4 | 5 | import TFTP; 6 | 7 | on TFTP::Request -> event tftp::request($conn); 8 | -------------------------------------------------------------------------------- /spicy/runtime/include/config.h.in: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2020-now by the Zeek Project. See LICENSE for details. 2 | 3 | #pragma once 4 | 5 | namespace spicy::rt::configuration { 6 | } // namespace spicy::rt::configuration 7 | -------------------------------------------------------------------------------- /spicy/runtime/src/mime.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2020-now by the Zeek Project. See LICENSE for details. 2 | 3 | #include 4 | 5 | using namespace spicy::rt; 6 | 7 | HILTI_EXCEPTION_IMPL(InvalidMIMEType) 8 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.expressions.default-ctor/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [$a="", $b=(not set)] 3 | [$a="", $b=(not set)] 4 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.types.function.hook-methods-across-units/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | Bar: f1 3 | Bar: f2 4 | Foo: f1 5 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.types.integer.unpack/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | L 0x0100 3 | B 0x0001 4 | L 0x0100 5 | B 0x0001 6 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.types.struct.static-field/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [$a=""] 3 | 4 | [$a="not static"] 5 | static 6 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.rt.base64-filter-eod/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | Hello, Spicy!\x0a 3 | [$x=b"Hello, Spicy!\x0a"] 4 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.rt.print-binary/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | H\xc3\xbcrz 3 | X\x0d\x0aY 4 | H\xc3\xbcrz, X\x0d\x0aY 5 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.statements.print/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | True 3 | True, 32 4 | 5 | Xyz 6 | (1, 2, True, b"XX") 7 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.bitfield.ctor-look-ahead/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [$x=[1, 2, 3], $y=(a: 4, b: 8), $z=5] 3 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.bitfield.typedef/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | foo::Y { 3 | x: { 4 | a: 31 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.bytes.parse-until/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [$b1=b"abc", $b2=b"12345", $b3=b"12345ddef"] 3 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.network.ops/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | 2001:db8::/48 3 | 192.168.1.0/24 4 | 192.168.1.0/24 5 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.unit.attr-parse-at/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | get_input 3 | 1234, 5678, 1234567890, 12345, 90 4 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.unit.attr-parse-from-expr/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [$x=b"\x01\x02", $y=258, $z=b"\x03\x04"] 3 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.unit.convert-field-self/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | foo::X { 3 | len: 5 4 | x: 5 5 | } 6 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.unit.external-global-vars/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [$a=b"0", $b=[$a=b"1234", $b=b"567890"]] 3 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.unit.offset-indirect/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [$x1=[$x=258, $y=3], $x2=[$x=1029, $y=6]] 3 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.unit.params-forward/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [$t1=b"yyy"] 3 | [$x=[$t2=b"xxx", $x=]] 4 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.unit.params-reference/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | X, old 3 | Y, new 4 | struct_, [$x="xxx"] 5 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.unit.set_input/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [$x=[[$x=1, $y=2], [$x=772, $y=5], [$x=772, $y=5]]] 3 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.unit.unit-convert-two/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | Test::X { 3 | a: 254 4 | b: 255 5 | } 6 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.vector.ctor-vector/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [$x1=[0, 0], $x2=[1, 1], $x3=[b"abc", b"abc"]] 3 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.vector.parse-length/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [$a=[[$x=1, $y=2], [$x=3, $y=4]], $b=b"XXXX"] 3 | -------------------------------------------------------------------------------- /doc/programming/examples/_constant-field.spicy: -------------------------------------------------------------------------------- 1 | # Automatically generated; edit in Sphinx source code, not here. 2 | module Test; 3 | 4 | public type Foo = unit { 5 | bar: b"bar"; 6 | on %done { print self.bar; } 7 | }; -------------------------------------------------------------------------------- /doc/programming/examples/_parse-vector-foreach.spicy: -------------------------------------------------------------------------------- 1 | # Automatically generated; edit in Sphinx source code, not here. 2 | module Test; 3 | 4 | public type Foo = unit { 5 | x: uint8[5] foreach { print $$, self.x; } 6 | }; -------------------------------------------------------------------------------- /hilti/runtime/src/tests/.clang-tidy: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2020-now by the Zeek Project. See LICENSE for details. 2 | 3 | --- 4 | Checks: ' 5 | -clang-analyzer-optin.core.EnumCastOutOfRange, 6 | -modernize-type-traits, 7 | ' 8 | -------------------------------------------------------------------------------- /hilti/toolchain/src/ast/declarations/imported-module.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2020-now by the Zeek Project. See LICENSE for details. 2 | 3 | #include 4 | 5 | using namespace hilti; 6 | -------------------------------------------------------------------------------- /hilti/toolchain/src/ast/meta.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2020-now by the Zeek Project. See LICENSE for details. 2 | 3 | #include 4 | 5 | using namespace hilti; 6 | 7 | std::unordered_set Meta::_cache; 8 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.statements.try-across-hooks/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | Foo: f1 3 | Bar: f1 4 | ("Caught: ", "Bar::f1") 5 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.types.function.hook-functions-across-units/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | Bar: f1 3 | Bar: f2 4 | Foo: f1 5 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.types.reference.strong-ref/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | xyz123 3 | xyz123 4 | xyz123 5 | xyz123 6 | Null 7 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.types.regexp.groups/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [b"xxA1234X5678Y9012B", b"1234", b"5678", b"9012"] 3 | [] 4 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.use-cases.parse-bytes/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | Parsed: [$a=1, $b=2, $c=1027] 3 | Data left: 4 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.cfg.unit-parameter/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | foo::X { 3 | y: foo::Y { 4 | data: foo 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.statements.for/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | 1 3 | 2 4 | 3 5 | 1 6 | 2 7 | 3 8 | 1 9 | 3 10 | 4 11 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.tools.spicy-driver-file/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [$x=b"1\x0a2\x0a3\x0a"] 3 | [$x=b"1\x0a2\x0a3\x0a"] 4 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.sink.reassembler.basic/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | 0123 3 | 01234567 4 | 0123456789 5 | 0123456789 6 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.type.type-info/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | X::S, X::S, bool, real, bool 3 | bool 4 | in f:, X::S 5 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.unit.all-default-parameters/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | foo::X { 3 | v: False 4 | x: 7 5 | } 6 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.unit.convert-enum/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | ExampleEnum::A 3 | ExampleEnum::B 4 | ExampleEnum::C 5 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.unit.external-hooks-unit-arg/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | 2, [$a=b"12", $f=[$a=b"345", $b=b"67890"]] 3 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.unit.size-side-effects-3/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [$len=2, $one=b"1", $two=b"2", $three=b"3"] 3 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.unit.size-with-offset/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | x, 3 3 | x, \x01\x02\x03 4 | z, 4 5 | z, 1234 6 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.unit.unit-max-size-as-field-2/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [$dat=[[$b=b"1"], [$b=b"2"], [$b=b"3"]]] 3 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.vector.parse-unbounded-stop/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [], 1 3 | [1], 2 4 | [1, 2], 0 5 | Stopping 6 | -------------------------------------------------------------------------------- /tests/spicy/types/unit/params-reference-fail.spicy: -------------------------------------------------------------------------------- 1 | # @TEST-EXEC-FAIL: spicyc -p %INPUT >output 2>&1 2 | # @TEST-EXEC: btest-diff output 3 | 4 | module Test; 5 | 6 | function f(s: string&) { 7 | *s = new "xxx"; 8 | } 9 | -------------------------------------------------------------------------------- /doc/_static/README.t2d: -------------------------------------------------------------------------------- 1 | *.t2d files were created with "TouchDraw", which is available for iOS, 2 | macOS, and Android; see https://www.elevenworks.com/touchdraw. 3 | 4 | The corresponding *.svg files are exported from TouchDraw. 5 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.hiltic.jit.precompiled-globals-twice/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | Hello, world! 3 | 2 4 | Hello, world! 5 | 2 6 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.types.regexp.match-state/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | (-1, 4) 3 | (-1, 2) 4 | (1, 6) 5 | (-1, 6) 6 | (1, 0) 7 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.address.parse/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | 1.2.3.4 3 | 4.3.2.1 4 | 102:304:506:708:910:1112:1314:1516 5 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.bytes.parse-inc/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [$a=b"lllll", $b=b"aa", $uuu=b"1234", $remaining=b"rrrrrrr"] 3 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.regexp.regression-incremental/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [$x=b"aa", $y=b"ab"] 3 | [$x=b"", $y=b"ab"] 4 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.sink.reassembler.init-seq/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | 0123 3 | 01234567 4 | 0123456789 5 | 0123456789 6 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.unit.attr-parse-from/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [$a=b"12345", $B=b"ABCDE", $C=b"FGHI", $d=b"67890"] 3 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.unit.external-hooks-same-module/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | FOO init 3 | FOO a, 1234 4 | FOO b, 567890 5 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.unit.size-side-effects/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [$len=2, $len_bytes=b"1", $len_plus_one_bytes=b"23"] 3 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.unit.skip-field-literals/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [$rest_of_data=b"Zeek"] 3 | [$rest_of_data=b"Zeek"] 4 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.unit.switch-blocks/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [$a=b"1", $b=b"2", $c=b"345", $d=(not set)] 3 | 2 4 | 345 5 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.vector.parse-until-including/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | 1 3 | 2 4 | 3 5 | [$ints=[1, 2, 3], $last=4] 6 | -------------------------------------------------------------------------------- /tests/spicy/types/vector/parse-subitem-attrs-fail.spicy: -------------------------------------------------------------------------------- 1 | # @TEST-EXEC-FAIL: spicyc -j %INPUT >output 2>&1 2 | # @TEST-EXEC: btest-diff output 3 | 4 | module Test; 5 | 6 | public type Foo = unit { 7 | x: (bytes)[3]; 8 | }; 9 | -------------------------------------------------------------------------------- /doc/programming/examples/_constant-field.spicy.output_1: -------------------------------------------------------------------------------- 1 | # Automatically generated; do not edit. -- printf 'bar' | spicy-driver %INPUT/printf 'bar' | spicy-driver %INPUT/False 2 | # printf 'bar' | spicy-driver foo.spicy 3 | bar 4 | -------------------------------------------------------------------------------- /hilti/runtime/include/types/set_fwd.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2020-now by the Zeek Project. See LICENSE for details. 2 | 3 | #pragma once 4 | 5 | namespace hilti::rt { 6 | template 7 | class Set; 8 | } // namespace hilti::rt 9 | -------------------------------------------------------------------------------- /hilti/runtime/src/version.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2020-now by the Zeek Project. See LICENSE for details. 2 | 3 | #include 4 | 5 | const char* HILTI_VERSION_FUNCTION() { return PROJECT_VERSION_STRING_LONG; } 6 | -------------------------------------------------------------------------------- /hilti/toolchain/include/ast/builder/all.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2020-now by the Zeek Project. See LICENSE for details. 2 | 3 | #pragma once 4 | 5 | #include 6 | #include 7 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.hiltic.cc.import/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | Hello, world! 3 | Foo! 4 | Bar! 5 | Hello, world! 6 | Foo! 7 | Bar! 8 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.types.enum.cast/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | X::Undef 3 | X::A1 4 | X::A2 5 | X:: 6 | X:: 7 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.types.reference.weak-from-value-ref-int/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | ("init", 32, 32) 3 | ("main", ) 4 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.types.regexp.big-regexp/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | 1 3 | (1, b"<...>/passwd") 4 | [b"<...>/passwd", b"passwd"] 5 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.types.set.ctor/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19} 3 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.doc.my_http-host-callback/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | GET, /index.html, 1.0 3 | In C++ land: GET, /index.html, 1.0 4 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.tools.spicyc-cxx-link/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | Hello, world! 3 | Hi, world! 4 | Hello, world! 5 | Hi, world! 6 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.tools.spicyc-precompiled/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [$f1=(not set), $f2=(not set)] 3 | 1 4 | 2 5 | [$f1=1, $f2=2] 6 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.bytes.parse-length-eod-chunked/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | 123 3 | 456 4 | 78 5 | [$b1=b"abc", $b2=b"78"] 6 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.bytes.parse-until-eod/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | Test::X { 3 | x: 0 4 | } 5 | Test::Y { 6 | x: 0 7 | } 8 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.unit.basic/.stderr: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [spicy] Mini::Test 3 | [spicy] f1 = 10000 4 | [spicy] f2 = 42 5 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.unit.conditional-parse-at/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [$b1=[$y=120], $b2=(not set), $x=] 3 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.unit.error-hook/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [$a=b"1234", $b=(not set)] 3 | Error, [$a=b"1234", $b=(not set)] 4 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.unit.size-side-effects-2/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [$len=2, $len_bytes=[49], $len_plus_one_bytes=[50, 51]] 3 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.unit.skip-lahead/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | foo::X { 3 | xs: [ 4 | 1 5 | 2 6 | 3 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.unit.transient/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [$y=b"6"] 3 | |, 57 4 | |, 48 5 | [$b=b"34", $c=b"78", $d=b"ab"] 6 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.unit.variables-optional/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [$f=(not set), $x=(not set)] 3 | [$f=b"xxx", $x=b"xxx"] 4 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.vector.parse-lahead-int-variable/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [$a=[[$x=1, $y=2571], [$x=1, $y=3085]], $b=2] 3 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.vector.repeat-side-effect/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [$len=2, $len_bytes=[49], $len_plus_one_bytes=[50, 51]] 3 | -------------------------------------------------------------------------------- /tests/spicy/types/unit/coercion.spicy: -------------------------------------------------------------------------------- 1 | # @TEST-EXEC: spicyc -p %INPUT 2 | # @TEST-DOC: Check that unit T coerces to T&. 3 | 4 | module testing; 5 | 6 | public type U = unit {}; 7 | 8 | global x: U; 9 | global y: U& = x; 10 | -------------------------------------------------------------------------------- /doc/programming/examples/_context-empty.spicy: -------------------------------------------------------------------------------- 1 | # Automatically generated; edit in Sphinx source code, not here. 2 | module Test; 3 | 4 | public type Foo = unit { 5 | %context = int64; 6 | 7 | on %init { print self.context(); } 8 | }; -------------------------------------------------------------------------------- /doc/programming/examples/_empty-context.spicy: -------------------------------------------------------------------------------- 1 | # Automatically generated; edit in Sphinx source code, not here. 2 | module Test; 3 | 4 | public type Foo = unit { 5 | %context = bytes; 6 | 7 | on %init { print self.context(); } 8 | }; -------------------------------------------------------------------------------- /doc/programming/examples/_max-size.spicy: -------------------------------------------------------------------------------- 1 | # Automatically generated; edit in Sphinx source code, not here. 2 | module Test; 3 | 4 | public type Foo = unit { 5 | x: bytes &until=b"\x00" &max-size=1024; 6 | on %done { print self; } 7 | }; -------------------------------------------------------------------------------- /doc/programming/examples/_parse-convert.spicy.output: -------------------------------------------------------------------------------- 1 | # Automatically generated; do not edit. -- printf 12345 | spicy-driver %INPUT/printf 12345 | spicy-driver %INPUT/False 2 | # printf 12345 | spicy-driver foo.spicy 3 | [$x=12345] 4 | -------------------------------------------------------------------------------- /doc/programming/examples/_parse-filter.spicy.output: -------------------------------------------------------------------------------- 1 | # Automatically generated; do not edit. -- printf 'aBcDe' | spicy-driver %INPUT/printf 'aBcDe' | spicy-driver %INPUT/False 2 | # printf 'aBcDe' | spicy-driver foo.spicy 3 | ABCDE 4 | -------------------------------------------------------------------------------- /doc/programming/examples/_parse-requires.spicy.output_1: -------------------------------------------------------------------------------- 1 | # Automatically generated; do not edit. -- printf '\001' | spicy-driver %INPUT/printf '\001' | spicy-driver %INPUT/False 2 | # printf '\001' | spicy-driver foo.spicy 3 | [$x=1] 4 | -------------------------------------------------------------------------------- /doc/programming/examples/_size.spicy: -------------------------------------------------------------------------------- 1 | # Automatically generated; edit in Sphinx source code, not here. 2 | module Test; 3 | 4 | public type Foo = unit { 5 | x: int16[] &size=6; 6 | y: bytes &eod; 7 | on %done { print self; } 8 | }; -------------------------------------------------------------------------------- /doc/programming/examples/_unit-vars-init.spicy.output: -------------------------------------------------------------------------------- 1 | # Automatically generated; do not edit. -- printf \05 | spicy-driver %INPUT/printf \05 | spicy-driver %INPUT/False 2 | # printf \05 | spicy-driver foo.spicy 3 | [$x=48, $a=123] 4 | -------------------------------------------------------------------------------- /hilti/toolchain/src/ast/ctors/struct.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2020-now by the Zeek Project. See LICENSE for details. 2 | 3 | #include 4 | 5 | using namespace hilti; 6 | 7 | ctor::struct_::Field::~Field() = default; 8 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.hiltic.jit.precompiled-globals-twice-dynamic/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | Hello, world! 3 | 2 4 | Hello, world! 5 | 2 6 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.types.reference.weak-from-value-ref-int-on-heap/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | ("init", 32, 32) 3 | ("main", ) 4 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.types.struct.on-heap-cyclic/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [$s="X2", $y=(not set)] 3 | [$s="Y", $x=[$s="X", $y=(not set)]] 4 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.statements.switch/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | uncaught exception hilti::rt::UnhandledSwitchCase: 3 (fail.spicy:5:1-8:1) 3 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.bitfield.anonymous-field/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | 15, 15 3 | [] 4 | Test::Foo { 5 | x: 15 6 | y: 15 7 | } 8 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.sink.reassembler.auto-trim/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | Overlap at 1: 2 vs X 3 | Overlap at 1: 2 vs Y 4 | 123456 5 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.unit.basic/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [$f1=(not set), $f2=(not set)] 3 | 10000 4 | 42 5 | [$f1=10000, $f2=42] 6 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.unit.context-unit-parameters/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | test::X { 3 | p: test::P { 4 | x: 42 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.unit.var-struct-init/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | foo::Y { 3 | x: foo::X { 4 | x: 4 5 | } 6 | y: 2 7 | } 8 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.vector.parse-enum/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [$x1=[1, 2], $x2=[X::Red, X::Blue], $x3=[X::Red, X::Blue], $x4=3] 3 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.vector.parse-lahead-int-longest-match/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [$a=[[$x=1, $y=2571], [$x=1, $y=3085]], $b=258] 3 | -------------------------------------------------------------------------------- /tests/hilti/hiltic/jit/hello-world.hlt: -------------------------------------------------------------------------------- 1 | # @TEST-EXEC: ${HILTIC} -j -D compiler,jit %INPUT >output 2 | # @TEST-EXEC: btest-diff output 3 | 4 | module Foo { 5 | 6 | import hilti; 7 | 8 | hilti::print("Hello, world!"); 9 | 10 | } 11 | -------------------------------------------------------------------------------- /tests/spicy/types/integer/wrong-int-mix.spicy: -------------------------------------------------------------------------------- 1 | # @TEST-EXEC-FAIL: ${SPICYC} -j %INPUT >output 2>&1 2 | # @TEST-EXEC: btest-diff output 3 | 4 | module Test; 5 | 6 | global a: int32 = 1; 7 | global b: uint32; 8 | 9 | print a + b; 10 | -------------------------------------------------------------------------------- /doc/examples/_skip.spicy: -------------------------------------------------------------------------------- 1 | # Automatically generated; edit in Sphinx source code, not here. 2 | module Test; 3 | 4 | public type Foo = unit { 5 | x: int8; 6 | : skip bytes &size=5; 7 | y: int8; 8 | on %done { print self; } 9 | }; -------------------------------------------------------------------------------- /doc/programming/examples/_unit-vars-init.spicy: -------------------------------------------------------------------------------- 1 | # Automatically generated; edit in Sphinx source code, not here. 2 | module Test; 3 | 4 | public type Foo = unit { 5 | x: int8; 6 | var a: int8 = 123; 7 | on %done { print self; } 8 | }; -------------------------------------------------------------------------------- /hilti/lib/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2020-now by the Zeek Project. See LICENSE for details. 2 | 3 | install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${CMAKE_INSTALL_DATADIR}/hilti 4 | PATTERN "CMakeLists.txt" EXCLUDE) 5 | -------------------------------------------------------------------------------- /spicy/lib/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2020-now by the Zeek Project. See LICENSE for details. 2 | 3 | install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${CMAKE_INSTALL_DATADIR}/spicy 4 | PATTERN "CMakeLists.txt" EXCLUDE) 5 | -------------------------------------------------------------------------------- /spicy/toolchain/include/ast/declarations/all.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2020-now by the Zeek Project. See LICENSE for details. 2 | 3 | #pragma once 4 | 5 | #include 6 | #include 7 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.types.bitfield.ctor/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | (a: (not set), b: (not set), c: (not set)) 3 | (a: 1, b: (not set), c: 2) 4 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.types.stream.ops/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [$num_data_bytes=2, $num_data_chunks=2, $num_gap_bytes=0, $num_gap_chunks=0] 3 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.types.vector.iterator/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.types.vector.ops/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | ["a", "b", "c", "", "", "e", "f", "g"] 3 | [0, 0, 42, 0, 1] 4 | [1, 0, 3] 5 | 1 6 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.tools.spicy-build-driver/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [$f1=(not set), $f2=(not set)] 3 | 10000 4 | 42 5 | [$f1=10000, $f2=42] 6 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.unit.basic-incremental/debug.log: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [spicy] Mini::Test 3 | [spicy] f1 = 10000 4 | [spicy] f2 = 42 5 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.unit.switch-lahead-literal/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [$a=(not set), $b=[$b=65535]] 3 | [$a=[$a=b"A"], $b=(not set)] 4 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.unit.void-eod/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | Test::X { 3 | a: a 4 | y: Test::Y { 5 | b: b 6 | } 7 | e: e 8 | } 9 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.vector.parse-type/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [$x=(not set)] 3 | one: 97 4 | one: 98 5 | one: 99 6 | [$x=[97, 98, 99]] 7 | -------------------------------------------------------------------------------- /tests/hilti/types/integer/mixed-operands-overflow.hlt: -------------------------------------------------------------------------------- 1 | # @TEST-EXEC-FAIL: ${HILTIC} -j %INPUT 2>output.log 2 | # @TEST-EXEC: btest-diff output.log 3 | 4 | module Test { 5 | 6 | global uint<8> x3 = 0; 7 | x3 = x3 + 256; 8 | 9 | } 10 | -------------------------------------------------------------------------------- /doc/programming/examples/_parse-bitfield-enum.spicy.output: -------------------------------------------------------------------------------- 1 | # Automatically generated; do not edit. -- printf '\x21' | spicy-driver %INPUT/printf '\x21' | spicy-driver %INPUT/False 2 | # printf '\x21' | spicy-driver foo.spicy 3 | X::A, X::B 4 | -------------------------------------------------------------------------------- /doc/programming/examples/_parse-requires-property.spicy.output_1: -------------------------------------------------------------------------------- 1 | # Automatically generated; do not edit. -- printf '\001' | spicy-driver %INPUT/printf '\001' | spicy-driver %INPUT/False 2 | # printf '\001' | spicy-driver foo.spicy 3 | [$x=1] 4 | -------------------------------------------------------------------------------- /doc/programming/examples/_parse-void-size.spicy: -------------------------------------------------------------------------------- 1 | # Automatically generated; edit in Sphinx source code, not here. 2 | module Test; 3 | 4 | public type Foo = unit { 5 | : void &size=2; 6 | x: uint8; 7 | 8 | on %done { print self; } 9 | }; -------------------------------------------------------------------------------- /doc/programming/examples/_unit-params-string.spicy.output: -------------------------------------------------------------------------------- 1 | # Automatically generated; do not edit. -- printf '\x2a' | spicy-driver %INPUT/printf '\x2a' | spicy-driver %INPUT/False 2 | # printf '\x2a' | spicy-driver foo.spicy 3 | Hello, world! 4 | -------------------------------------------------------------------------------- /doc/programming/language/examples/_statement-for.spicy.output: -------------------------------------------------------------------------------- 1 | # Automatically generated; do not edit. -- spicyc -j %INPUT/spicyc -j %INPUT/False 2 | # spicyc -j for.spicy 3 | 1 4 | 2 5 | 3 6 | 97 7 | 98 8 | 99 9 | a 10 | b 11 | c 12 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.hiltic.jit.umask/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | -rwxrwxrwx 3 | -rwxrwxr-x 4 | -rwxrwx--x 5 | -rwxr-xrwx 6 | -rwxr-xr-x 7 | -rwx--x--x 8 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.types.bytes.join/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | foobarbaz 3 | foo.bar.baz 4 | fooXXXbarXXXbaz 5 | 6 | one.two.three 7 | 1.2.3 8 | 1 9 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.types.function.hook-methods/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | ("in f2:", "sss") 3 | 42 4 | f1 sss Hurz 5 | f2 sss Hurz 6 | f3 sss Hurz 7 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.types.set.ops/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | {"A", "B"} 3 | {1, 2, 3} 4 | {} 5 | {} 6 | 0 7 | 1 8 | 3 9 | 10 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.map.ops/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | {1: b"AAA", 2: b"BBB", 3: b"CCC"} 3 | BBB 4 | 0 5 | 43 6 | 43 7 | [$i=43] 8 | (not set) 9 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.unit.basic-incremental/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [$f1=(not set), $f2=(not set)] 3 | 10000 4 | 42 5 | [$f1=10000, $f2=42] 6 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.unit.convert/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | Mini::Test { 3 | a: aabb 4 | b: 65535 5 | } 6 | Mini::Test2 { 7 | a: 8 8 | } 9 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.unit.synchronize-failure-in-trial-mode-2/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | Confirming with state: [$xs=[]] 3 | [$xs=[[$a=b"A"]]] 4 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.unit.synchronize-failure-in-trial-mode/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | Confirming with state: [$xs=[]] 3 | [$xs=[[$a=b"A"]]] 4 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.unit.variables/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [$f=(not set), $x=b"", $y=b"yyy"] 3 | [$f=b"xxx", $x=b"xxx", $y=b"yyy"] 4 | yyy 5 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.vector.parse-subitem-attrs/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [$x=[b"abc", b"abc", b"abc"], $y=[b"12", b"34", b"56", b"78", b"90"]] 3 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.vector.parse-subitem/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | 97, 98 3 | 97, 99 4 | 97, 100 5 | [$x=97, $y=[[$z=98], [$z=99], [$z=100]]] 6 | -------------------------------------------------------------------------------- /tests/spicy/rt/load-hlto.spicy: -------------------------------------------------------------------------------- 1 | # @TEST-EXEC: ${SPICYC} %INPUT -j -o foo.hlto >> output 2>&1 2 | # @TEST-EXEC: spicy-driver -J foo.hlto >> output 2>&1 || true 3 | # @TEST-EXEC: btest-diff output 4 | 5 | module Test; 6 | 7 | print "Hello, world!"; 8 | -------------------------------------------------------------------------------- /doc/programming/examples/_basic-unit-module.spicy: -------------------------------------------------------------------------------- 1 | # Automatically generated; edit in Sphinx source code, not here. 2 | module Test; 3 | 4 | type Foo = unit { 5 | version: uint32; 6 | }; 7 | 8 | global f: Foo; 9 | f.version = 42; 10 | print f; -------------------------------------------------------------------------------- /doc/programming/examples/_debug-hooks.spicy.output: -------------------------------------------------------------------------------- 1 | # Automatically generated; do not edit. -- printf "1234567890" | spicy-driver %INPUT/printf "1234567890" | spicy-driver %INPUT/False 2 | # printf "1234567890" | spicy-driver debugging.spicy 3 | 4 | -------------------------------------------------------------------------------- /doc/programming/examples/_debug-hooks.spicy.output_2: -------------------------------------------------------------------------------- 1 | # Automatically generated; do not edit. -- printf "1234567890" | spicy-driver %INPUT/printf "1234567890" | spicy-driver %INPUT/False 2 | # printf "1234567890" | spicy-driver debugging.spicy 3 | 4 | -------------------------------------------------------------------------------- /doc/programming/examples/_parse-void-size.spicy.output: -------------------------------------------------------------------------------- 1 | # Automatically generated; do not edit. -- printf '\01\02\03' | spicy-driver %INPUT/printf '\01\02\03' | spicy-driver %INPUT/False 2 | # printf '\01\02\03' | spicy-driver foo.spicy 3 | [$x=3] 4 | -------------------------------------------------------------------------------- /doc/programming/examples/_skip.spicy: -------------------------------------------------------------------------------- 1 | # Automatically generated; edit in Sphinx source code, not here. 2 | module Test; 3 | 4 | public type Foo = unit { 5 | x: int8; 6 | : skip bytes &size=5; 7 | y: int8; 8 | on %done { print self; } 9 | }; -------------------------------------------------------------------------------- /doc/programming/examples/_unit-params.spicy.output: -------------------------------------------------------------------------------- 1 | # Automatically generated; do not edit. -- printf '\05' | spicy-driver %INPUT/printf '\05' | spicy-driver %INPUT/False 2 | # printf '\05' | spicy-driver foo.spicy 3 | My multiplied integer: 25 4 | -------------------------------------------------------------------------------- /hilti/toolchain/src/ast/ctors/bitfield.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2020-now by the Zeek Project. See LICENSE for details. 2 | 3 | #include 4 | 5 | using namespace hilti; 6 | 7 | ctor::bitfield::BitRange::~BitRange() = default; 8 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.hiltic.cc.exception/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | HILTI - Begin 3 | Caught exception: test exception (<...>/exception.hlt:20:5-20:40) 4 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.hiltic.jit.exception/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | HILTI - Begin 3 | Caught exception: test exception (<...>/exception.hlt:13:5-13:40) 4 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.hiltic.jit.import/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | Bar! 3 | Bar! 4 | Foo! 5 | Foo! 6 | Hello, world from Bar! 7 | Hello, world from Foo! 8 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.doc.my_http-host-parse2/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | GET, /index.html, 1.0 3 | method : GET 4 | uri : /index.html 5 | version: 1.0 6 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.integer.parse-lahead/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [$v=1] 3 | [$v=2] 4 | [$v=3] 5 | [$lines=[[$v=1], [$v=2], [$v=3]], $term=65535] 6 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.sink.reassembler.skip/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | Skipped to position 6 3 | 01236789 4 | 5 | Skipped to position 6 6 | 016789 7 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.unit.context-unit-refs/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | replies seen, 3 3 | requests seen, 4 4 | replies seen, 2 5 | requests seen, 2 6 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.unit.external-hooks-import/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | FOO a, 1234 3 | FOO b, 567890 4 | FOO done 1 5 | FOO done 2 6 | FOO init 7 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.unit.switch-if-expr/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | Mini::test { 3 | a: 1 4 | b1: 2345 5 | } 6 | Mini::test { 7 | a: 2 8 | } 9 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.unit.synchronize-failure-after-trim/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | Confirming with state: [$x=[]] 3 | [$x=[[$ab=b"AB", $cd=b"CD"]]] 4 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.unit.unit-convert/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | foo! 3 | 42 4 | 42 5 | [$foo="foo!", $bar1=42, $bar2=42, $numbers=[12, 34, 56]] 6 | -------------------------------------------------------------------------------- /tests/hilti/ast/types.hlt: -------------------------------------------------------------------------------- 1 | # @TEST-GROUP: no-jit 2 | # @TEST-EXEC: ${HILTIC} -p -D compiler,ast-final %INPUT >output 2>&1 3 | # @TEST-EXEC: btest-diff output 4 | 5 | module Foo { 6 | 7 | global x1 = b"abc"; 8 | global x2 = (1, 2); 9 | 10 | } 11 | -------------------------------------------------------------------------------- /tests/hilti/statements/if-empty.hlt: -------------------------------------------------------------------------------- 1 | # @TEST-EXEC: ${HILTIC} -j %INPUT >output 2 | # @TEST-EXEC: btest-diff output 3 | 4 | module Test { 5 | 6 | import hilti; 7 | 8 | if ( True ) { } 9 | else { } 10 | 11 | hilti::print("done"); 12 | 13 | } 14 | -------------------------------------------------------------------------------- /tests/spicy/attributes/byte-order.spicy: -------------------------------------------------------------------------------- 1 | # @TEST-EXEC-FAIL: ${SPICYC} -p %INPUT 2> output 2 | # @TEST-EXEC: btest-diff output 3 | 4 | module Test; 5 | 6 | %byte-order=1; 7 | 8 | public type Type = unit { 9 | foo: uint32 &byte-order; 10 | }; 11 | -------------------------------------------------------------------------------- /tests/spicy/types/integer/wrong-assign.spicy: -------------------------------------------------------------------------------- 1 | # @TEST-EXEC-FAIL: ${SPICYC} -j %INPUT >output 2>&1 2 | # @TEST-EXEC: btest-diff output 3 | 4 | module Test; 5 | 6 | global a: int32 = 1; 7 | global b: uint32; 8 | 9 | b = a; 10 | 11 | print b; 12 | -------------------------------------------------------------------------------- /doc/examples/my_http.evt: -------------------------------------------------------------------------------- 1 | protocol analyzer spicy::MyHTTP over TCP: 2 | parse originator with MyHTTP::RequestLine, 3 | port 12345/tcp; 4 | 5 | on MyHTTP::RequestLine -> event MyHTTP::request_line($conn, self.method, self.uri, self.version.number); 6 | -------------------------------------------------------------------------------- /doc/programming/examples/_parse-convert-unit.spicy.output: -------------------------------------------------------------------------------- 1 | # Automatically generated; do not edit. -- printf 12345678 | spicy-driver %INPUT/printf 12345678 | spicy-driver %INPUT/False 2 | # printf 12345678 | spicy-driver foo.spicy 3 | [12, 34, 56, 78] 4 | -------------------------------------------------------------------------------- /doc/programming/examples/_parse-requires.spicy: -------------------------------------------------------------------------------- 1 | # Automatically generated; edit in Sphinx source code, not here. 2 | module Test; 3 | 4 | import spicy; 5 | 6 | public type Foo = unit { 7 | x: int8 &requires=($$ < 5); 8 | on %done { print self; } 9 | }; -------------------------------------------------------------------------------- /tests/Baseline/hilti.hiltic.jit.hilti-cxx/error: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [error] hiltic: C++ compiler not available or not functioning (looking for "<...>/exist") 3 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.optimization.peephole-default-void/opt.hlt: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | module Test { 3 | 4 | 5 | public function void foo() { 6 | } 7 | 8 | } 9 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.rt.print-escapes/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | Test 3 | 4 | Test\x0a 5 | ["Test\n"] 6 | [b"Test\x0a"] 7 | Test 8 | 9 | Test\x0a 10 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.validation.duplicate-4/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | uncaught exception hilti::rt::AssertionFailure: 3 == 1 (<...>/duplicate.hlt:11:1-11:39) 3 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.sink.reassembler.sequence/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | 2 3 | 2 4 | 2 5 | 2 6 | 4 7 | 4 8 | 4 9 | 4 10 | 10 11 | 0123456789 12 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.unit.context-conns/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | msg -> 100 3 | put -> 200 4 | CAT -> 555 5 | end -> 300 6 | get -> 400 7 | LST -> 666 8 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.unit.convert-integer/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [$sl=30840, $sb=4328719365, $ul=21542142465, $ub=4328719365, $a=299700, $b=299700] 3 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.unit.filter-chained/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [$b1=b"Hello", $b2=b", Spi", $b3=b"cy!"] 3 | [$b1=b"Hello", $b2=b", Spi", $b3=b"cy!"] 4 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.unit.stream-statistics/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [$num_data_bytes=4, $num_data_chunks=2, $num_gap_bytes=1024, $num_gap_chunks=1] 3 | -------------------------------------------------------------------------------- /tests/hilti/types/list/ctor-fail.hlt: -------------------------------------------------------------------------------- 1 | # @TEST-EXEC-FAIL: ${HILTIC} -j %INPUT >output 2>&1 2 | # @TEST-EXEC: btest-diff output 3 | 4 | module X { 5 | 6 | import hilti; 7 | 8 | for ( index in [1, -2, 3] ) 9 | hilti::print(index); 10 | 11 | } 12 | -------------------------------------------------------------------------------- /tests/hilti/types/set/ops-fail.hlt: -------------------------------------------------------------------------------- 1 | # @TEST-EXEC-FAIL: hiltic -d -p %INPUT >output 2>&1 2 | # @TEST-EXEC: btest-diff output 3 | # 4 | # @TEST-DOC: Checks validators for set operators. 5 | 6 | module foo { 7 | 8 | b"" in set(1, 2, 3); 9 | 10 | } 11 | -------------------------------------------------------------------------------- /tests/spicy/expressions/new-fail.spicy: -------------------------------------------------------------------------------- 1 | # @TEST-EXEC-FAIL: spicyc -p %INPUT >output 2>&1 2 | # @TEST-EXEC: btest-diff output 3 | 4 | module Foo; 5 | 6 | function as_ref(xs: bytes): bytes& { return new xs; } # cannot use non-constant expression with "new". 7 | -------------------------------------------------------------------------------- /tests/spicy/rt/time.spicy: -------------------------------------------------------------------------------- 1 | # @TEST-EXEC: ${SPICYC} -j %INPUT >output 2 | # @TEST-EXEC: btest-diff output 3 | 4 | module Test; 5 | 6 | import spicy; 7 | 8 | global t = spicy::current_time(); 9 | assert t > time(1000000000) && t < time(8000000000); 10 | -------------------------------------------------------------------------------- /doc/programming/examples/_parse-convert.spicy: -------------------------------------------------------------------------------- 1 | # Automatically generated; edit in Sphinx source code, not here. 2 | module Test; 3 | 4 | import spicy; 5 | 6 | public type Foo = unit { 7 | x: bytes &eod &convert=$$.to_uint(); 8 | on %done { print self; } 9 | }; -------------------------------------------------------------------------------- /doc/programming/examples/_parse-switch-lhead.spicy.output: -------------------------------------------------------------------------------- 1 | # Automatically generated; do not edit. -- printf 'A' | spicy-driver %INPUT/printf 'A' | spicy-driver %INPUT/False 2 | # printf 'A' | spicy-driver foo.spicy 3 | [$a=b"A", $b=(not set), $c=(not set)] 4 | -------------------------------------------------------------------------------- /doc/programming/examples/_parse-unit-params.spicy.output: -------------------------------------------------------------------------------- 1 | # Automatically generated; do not edit. -- printf '\01\02' | spicy-driver %INPUT/printf '\01\02' | spicy-driver %INPUT/False 2 | # printf '\01\02' | spicy-driver foo.spicy 3 | Spicy: 1 4 | [$y=[$x=1]] 5 | -------------------------------------------------------------------------------- /doc/programming/examples/_regexp.spicy.output: -------------------------------------------------------------------------------- 1 | # Automatically generated; do not edit. -- printf 'Foo12345Bar' | spicy-driver %INPUT/printf 'Foo12345Bar' | spicy-driver %INPUT/False 2 | # printf 'Foo12345Bar' | spicy-driver foo.spicy 3 | [$x=b"Foo12345Bar"] 4 | -------------------------------------------------------------------------------- /doc/tutorial/examples/tftp-single-request-more-args.evt: -------------------------------------------------------------------------------- 1 | protocol analyzer spicy::TFTP over UDP: 2 | parse with TFTP::Packet, 3 | port 69/udp; 4 | 5 | import TFTP; 6 | 7 | on TFTP::Request -> event tftp::request($conn, $is_orig, self.filename, self.mode); 8 | -------------------------------------------------------------------------------- /spicy/runtime/include/spicy.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2020-now by the Zeek Project. See LICENSE for details. 2 | 3 | /** 4 | * This header defines functions that are made available to Spicy grammars 5 | * inside the `spicy::*` namespace. 6 | */ 7 | 8 | #pragma once 9 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.types.function.hook-priorities/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | f with priority 15 3 | f with priority 10 4 | f with priority 0 5 | f with priority -5 6 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.types.reference.weak-from-value-ref-struct/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | ("init", [$s="x", $i=21], [$s="x", $i=21]) 3 | ("main", ) 4 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.types.result.exceptions-2/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | uncaught exception hilti::rt::result::NoError: (<...>/exceptions.hlt:8:9-8:23) 3 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.types.result.exceptions/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | uncaught exception hilti::rt::result::NoResult: trouble... (<...>/exceptions.hlt:12:9-12:35) 3 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.types.time.ops/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | 2011-01-19T05:31:50.500000000Z 3 | 2011-01-19T06:31:50.000000000Z 4 | 2011-01-19T06:31:50.000000000Z 5 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.expressions.operator-precedence/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | 7 3 | 6 4 | 2 5 | 0 6 | 10 7 | True 8 | True 9 | True 10 | True 11 | True 12 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.enum.type/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | X::A1 3 | Y::Undef 4 | X::A1 5 | Y::B2 6 | Y::Undef 7 | [$x1=X::Undef, $x2=(not set), $y1=(not set)] 8 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.unit.filter/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [$a=b"AB", $b=b"CDEFG", $c=b"HIJ", $d=b"KLMNO"] 3 | [$a=b"AB", $b=b"CDEFG", $c=b"HIJ", $d=b"KLMNO"] 4 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.unit.skip-field/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | skip b 3 | skip eos 4 | [$foo=[$f=7], $x=10] 5 | skip b 6 | skip eos 7 | [$foo=[$f=7], $x=10] 8 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.vector.offset/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | x0=0 at 0 3 | xs[i]=0 at 1 4 | xs[i]=1 at 2 5 | xs[i]=2 at 3 6 | xs=[0, 1, 2] at 1 7 | y=3 at 4 8 | -------------------------------------------------------------------------------- /tests/hilti/cfg/for.hlt: -------------------------------------------------------------------------------- 1 | # @TEST-EXEC: hiltic -p -o /dev/null -D cfg-initial %INPUT >output 2>&1 2 | # @TEST-EXEC: btest-diff output 3 | 4 | module foo { 5 | 6 | function void fn() { 7 | for ( i in [1, 2, 3] ) 8 | i++; 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /tests/hilti/codegen/globals-deps.hlt: -------------------------------------------------------------------------------- 1 | # @TEST-EXEC: hiltic -j %INPUT 2 | # 3 | # @TEST-DOC: This is a regression test for https://github.com/zeek/spicy/issues/1030. 4 | 5 | module c { 6 | 7 | public type a = struct {}; 8 | 9 | global a x; 10 | 11 | } 12 | -------------------------------------------------------------------------------- /tests/spicy/types/optional/ops.spicy: -------------------------------------------------------------------------------- 1 | # @TEST-EXEC: ${SPICYC} -j %INPUT >output 2 | # @TEST-EXEC: btest-diff output 3 | 4 | module Test; 5 | 6 | global x: optional; 7 | print x; 8 | x = "123"; 9 | print x; 10 | x = optional("456"); 11 | print x; 12 | -------------------------------------------------------------------------------- /doc/programming/examples/_anonymous-field.spicy.output: -------------------------------------------------------------------------------- 1 | # Automatically generated; do not edit. -- printf '\01\02\03' | spicy-driver %INPUT/printf '\01\02\03' | spicy-driver %INPUT/False 2 | # printf '\01\02\03' | spicy-driver foo.spicy 3 | 2 4 | [$x=1, $y=3] 5 | -------------------------------------------------------------------------------- /doc/programming/examples/_basic-unit-parse.spicy.output: -------------------------------------------------------------------------------- 1 | # Automatically generated; do not edit. -- printf '\01\02\03\04' | spicy-driver %INPUT/printf '\01\02\03\04' | spicy-driver %INPUT/False 2 | # printf '\01\02\03\04' | spicy-driver foo.spicy 3 | 0x1020304 4 | -------------------------------------------------------------------------------- /doc/programming/examples/_parse-reassembly.spicy.output: -------------------------------------------------------------------------------- 1 | # Automatically generated; do not edit. -- spicy-driver -p Test::Foo %INPUT 4 | 5 | using namespace hilti; 6 | 7 | std::string statement::try_::Catch::_dump() const { return ""; } 8 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.statements.block/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | Testing block: 3 | 1 4 | hello :) 5 | 6 | Testing shadowing: 7 | outer 8 | inner 9 | outer 10 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.statements.switch/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | 1A 3 | 1B 4 | 1B 5 | 1C 6 | 1* 7 | 2B 8 | 2B 9 | 2B 10 | 2* 11 | 2* 12 | 3* 13 | 1T 14 | A 15 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.types.integer.overflow-diag/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | uncaught exception hilti::rt::Overflow: integer overflow (<...>/overflow-diag.hlt:11:1-11:19) 3 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.types.result.condition-test/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.statements.block/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | Testing block: 3 | 1 4 | hello :) 5 | 6 | Testing shadowing: 7 | outer 8 | inner 9 | outer 10 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.unit.switch-if-lahead/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | Test::Foo { 3 | x1: Test::X { 4 | a: x1 5 | } 6 | x2: Test::X {} 7 | y: Y 8 | } 9 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.vector.parse-lahead-int-regexp/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [$a=[[$x=1, $y=2571], [$x=1, $y=3085]], $b=b"XXX", $c=5] 3 | [$a=[], $b=b"XXX", $c=5] 4 | -------------------------------------------------------------------------------- /tests/hilti/hiltic/jit/globals.hlt: -------------------------------------------------------------------------------- 1 | # @TEST-EXEC: ${HILTIC} -j -D compiler,jit %INPUT >output 2 | # @TEST-EXEC: btest-diff output 3 | 4 | module Foo { 5 | 6 | global string X = "Hello, world!"; 7 | 8 | import hilti; 9 | 10 | hilti::print(X); 11 | 12 | } 13 | -------------------------------------------------------------------------------- /tests/hilti/tools/print-settings.hlt: -------------------------------------------------------------------------------- 1 | # @TEST-EXEC: HILTI_PRINT_SETTINGS=1 hiltic -L x/x/x/x -L y/y/y/y/y -p %INPUT 2>output 2 | # @TEST-EXEC: btest-diff output 3 | # 4 | # @TEST-DOC: Check behavior of environment variable HILTI_PRINT_SETTINGS 5 | 6 | module Foo {} 7 | -------------------------------------------------------------------------------- /tests/spicy/types/regexp/invalid-field.spicy: -------------------------------------------------------------------------------- 1 | # @TEST-EXEC-FAIL: printf 'abc1234' | spicy-driver %INPUT >output 2>&1 2 | # @TEST-EXEC: btest-diff output 3 | 4 | module Test; 5 | 6 | public type X = unit { 7 | r1: regexp; 8 | r2: /XXX/ &eod; 9 | }; 10 | -------------------------------------------------------------------------------- /doc/development/index.rst: -------------------------------------------------------------------------------- 1 | 2 | .. _development: 3 | 4 | ================== 5 | Developer's Manual 6 | ================== 7 | 8 | .. toctree:: 9 | :maxdepth: 2 10 | 11 | architecture 12 | testing 13 | debugging 14 | coding-style 15 | doxygen 16 | -------------------------------------------------------------------------------- /doc/programming/examples/_unit-params-vector.spicy.output: -------------------------------------------------------------------------------- 1 | # Automatically generated; do not edit. -- printf '\05\01\02\03' | spicy-driver %INPUT/printf '\05\01\02\03' | spicy-driver %INPUT/False 2 | # printf '\05\01\02\03' | spicy-driver foo.spicy 3 | 5 4 | 10 5 | 15 6 | -------------------------------------------------------------------------------- /doc/programming/examples/_unit-vars.spicy.output: -------------------------------------------------------------------------------- 1 | # Automatically generated; do not edit. -- printf \05 | spicy-driver %INPUT/printf \05 | spicy-driver %INPUT/False 2 | # printf \05 | spicy-driver foo.spicy 3 | [$x=(not set), $a=""] 4 | [$x=48, $a="Our integer is 48"] 5 | -------------------------------------------------------------------------------- /spicy/toolchain/include/ast/operators/all.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2020-now by the Zeek Project. See LICENSE for details. 2 | 3 | #pragma once 4 | 5 | #include 6 | 7 | #include 8 | #include 9 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.rt.profiler/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | #name count avg-% total-% 3 | hilti/func/Foo::fibo 192 4 | hilti/func/Foo::y 95 5 | hilti/total 1 100.00 100.00 6 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.types.address.ops/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | 1.2.3.4 3 | 2001:db8:85a3:8d3:1319:8a2e:370:7348 4 | 1.2.3.4 5 | AddressFamily::IPv4 6 | AddressFamily::IPv6 7 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.types.integer.ctor-fail-8/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [error] <...>/ctor-fail.hlt:2:12-2:31: integer constant out of range 3 | [error] hiltic: parse error 4 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.types.struct.errors-2/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [error] <...>/errors.hlt:12:1-12:10: field 's' is not &optional 3 | [error] hiltic: aborting after errors 4 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.types.tuple.assignment-coerce/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | (>, [], (not set)) 3 | ("foo", [], True) 4 | [(1, 1), (2, 2)] 5 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.rt.accept-decline/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | --- 3 | ok 4 | --- 5 | fail 6 | --- 7 | ok 8 | fail 9 | --- 10 | fail 11 | ok 12 | --- 13 | dunno 14 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.statements.confirm-fail/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [error] <...>/confirm-fail.spicy:6:1-6:8: unknown ID 'self' 3 | [error] spicyc: aborting after errors 4 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.statements.reject-fail/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [error] <...>/reject-fail.spicy:6:1-6:7: unknown ID 'self' 3 | [error] spicyc: aborting after errors 4 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.tools.spicy-driver-properties/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | Port, [$x=b"abc"] 3 | Port (orig), [$x=b"abc"] 4 | Port (resp), [$x=b"abc"] 5 | MIME, [$x=b"abc"] 6 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.integer.ctor-fail-7/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [error] <...>/ctor-fail.spicy:1:36-1:55: integer literal range error 3 | [error] spicyc: parse error 4 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.sink.write/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | Sub , [$s1=b"12", $s2=b"34567890"] 3 | Main, [$a=b"12", $b=b"34567", $c=b"890", $d=b"abcde", $data=], 10 4 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.unit.sub-unit-fail/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [error] <...>/sub-unit-fail.spicy:7:4-7:7: unknown ID 'B' 3 | [error] spicyc: aborting after errors 4 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.unit.switch-lahead-regexp-incremental/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | A, xaaa, Foo 3 | B, xaaaX, Bar 4 | A, xaaa, Foo 5 | B, xaaaX, Bar 6 | B, xaaax, Bar 7 | -------------------------------------------------------------------------------- /tests/hilti/codegen/ctor.hlt: -------------------------------------------------------------------------------- 1 | # @TEST-EXEC: ${HILTIC} -j %INPUT >output 2 | # @TEST-EXEC: btest-diff output 3 | 4 | module Foo { 5 | 6 | import hilti; 7 | 8 | const i = 42; 9 | const re1 = /abc/; 10 | 11 | hilti::print(re1); 12 | hilti::print(i); 13 | 14 | } 15 | -------------------------------------------------------------------------------- /tests/hilti/hiltic/jit/keep-temps.hlt: -------------------------------------------------------------------------------- 1 | # @TEST-EXEC: TMPDIR=$PWD hiltic -j -T %INPUT 2 | # @TEST-EXEC: ls Foo*.cc Foo*.o __linker__*.cc __linker__*.o *.hlto 3 | # 4 | # @TEST-DOC: Validates that if instructed the driver leaves temporary files around. 5 | 6 | module Foo {} 7 | -------------------------------------------------------------------------------- /tests/hilti/types/map/ops-fail.hlt: -------------------------------------------------------------------------------- 1 | # @TEST-EXEC-FAIL: hiltic -d -p %INPUT >output 2>&1 2 | # @TEST-EXEC: btest-diff output 3 | # 4 | # @TEST-DOC: Checks validators for map operators. 5 | 6 | module foo { 7 | 8 | b"" in map(1: b"a", 2: b"b", 3: b"c"); 9 | 10 | } 11 | -------------------------------------------------------------------------------- /tests/hilti/validation/self-decl-fail.hlt: -------------------------------------------------------------------------------- 1 | # @TEST-EXEC-FAIL: ${HILTIC} -j %INPUT > output 2>&1 2 | # @TEST-EXEC: btest-diff output 3 | 4 | module Foo { 5 | 6 | global self = 1; 7 | 8 | function void foo(string self) { 9 | local self = 3; 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /tests/hilti/validation/wildcard-types.hlt: -------------------------------------------------------------------------------- 1 | # @TEST-EXEC-FAIL: ${HILTIC} -j %INPUT >output 2>&1 2 | # @TEST-EXEC: btest-diff output 3 | 4 | module Foo { 5 | 6 | global int<*> i; 7 | 8 | function void f(tuple<*> t) { 9 | local int<*> j; 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /tests/spicy/lib/bytes_to_hexstring.spicy: -------------------------------------------------------------------------------- 1 | # @TEST-EXEC: ${SPICYC} -j %INPUT 2 | 3 | module Test; 4 | 5 | import spicy; 6 | 7 | assert spicy::bytes_to_hexstring(b"\x01\x23\x45") == "012345"; 8 | assert spicy::bytes_to_hexstring(b"\x08\x61\xC4\x68\x00") == "0861C46800"; 9 | -------------------------------------------------------------------------------- /tests/spicy/tools/spicy-build-hello-world.spicy: -------------------------------------------------------------------------------- 1 | # @TEST-GROUP: no-jit 2 | # @TEST-EXEC: ${SPICY_BUILD} -S %INPUT 3 | # @TEST-EXEC: ./a.out >output 4 | # @TEST-EXEC: btest-diff output 5 | 6 | module Foo; 7 | 8 | print "Hello, world!"; 9 | print "Hello", "world!"; 10 | -------------------------------------------------------------------------------- /tests/spicy/types/bitfield/typedef.spicy: -------------------------------------------------------------------------------- 1 | # @TEST-EXEC: printf '\377' | spicy-dump %INPUT >output 2 | # @TEST-EXEC: btest-diff output 3 | 4 | module foo; 5 | 6 | type X = bitfield(8) { 7 | a: 0..4; 8 | }; 9 | 10 | public type Y = unit { 11 | x: X; 12 | }; 13 | -------------------------------------------------------------------------------- /tests/spicy/types/bytes/chunked-convert-deprecation.spicy: -------------------------------------------------------------------------------- 1 | # @TEST-EXEC: echo 12345 | spicy-driver -i 1 %INPUT >output 2>&1 2 | # @TEST-EXEC: btest-diff output 3 | 4 | module Test; 5 | 6 | public type X = unit { 7 | x: bytes &chunked &eod &convert="deprecated"; 8 | }; 9 | -------------------------------------------------------------------------------- /tests/spicy/types/set/const-set.spicy: -------------------------------------------------------------------------------- 1 | # @TEST-DOC: Checks that `in` works with `const` sets; regression test for #1605. 2 | # 3 | # @TEST-EXEC: spicyc -dj %INPUT 4 | 5 | module foo; 6 | 7 | const xs = set("a"); 8 | 9 | assert "a" in xs; 10 | assert "b" !in xs; 11 | -------------------------------------------------------------------------------- /tests/spicy/types/unit/convert-field-self.spicy: -------------------------------------------------------------------------------- 1 | # @TEST-EXEC: printf '\005abcde' | spicy-dump -d %INPUT >output 2 | # @TEST-EXEC: btest-diff output 3 | 4 | module foo; 5 | 6 | public type X = unit { 7 | len: uint8; 8 | x: bytes &eod &convert=self.len; 9 | }; 10 | -------------------------------------------------------------------------------- /doc/programming/examples/_basic-unit-parse-byte-order.spicy.output: -------------------------------------------------------------------------------- 1 | # Automatically generated; do not edit. -- printf '\01\02\03\04' | spicy-driver %INPUT/printf '\01\02\03\04' | spicy-driver %INPUT/False 2 | # printf '\01\02\03\04' | spicy-driver foo.spicy 3 | 0x4030201 4 | -------------------------------------------------------------------------------- /doc/programming/examples/_basic-unit-parse.spicy: -------------------------------------------------------------------------------- 1 | # Automatically generated; edit in Sphinx source code, not here. 2 | module Test; 3 | 4 | public type Foo = unit { 5 | version: uint32; 6 | 7 | on %done { 8 | print "0x%x" % self.version; 9 | } 10 | }; -------------------------------------------------------------------------------- /doc/programming/examples/_debug-hooks.spicy.output_1: -------------------------------------------------------------------------------- 1 | # Automatically generated; do not edit. -- printf "1234567890" | spicy-driver -d %INPUT/printf "1234567890" | spicy-driver -d %INPUT/False 2 | # printf "1234567890" | spicy-driver -d debugging.spicy 3 | 1234 4 | 567890 5 | -------------------------------------------------------------------------------- /doc/programming/examples/_parse-look-ahead.spicy: -------------------------------------------------------------------------------- 1 | # Automatically generated; edit in Sphinx source code, not here. 2 | module Test; 3 | 4 | public type Foo = unit { 5 | data: uint8[]; 6 | : /EOD/; 7 | x : int8; 8 | 9 | on %done { print self; } 10 | }; -------------------------------------------------------------------------------- /doc/programming/language/examples/_function-inout.spicy: -------------------------------------------------------------------------------- 1 | # Automatically generated; edit in Sphinx source code, not here. 2 | module Test; 3 | 4 | global s = "1"; 5 | 6 | function foo(inout x: string) { 7 | x = "2"; 8 | } 9 | 10 | print s; 11 | foo(s); 12 | print s; -------------------------------------------------------------------------------- /hilti/toolchain/include/compiler/init.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2020-now by the Zeek Project. See LICENSE for details. 2 | 3 | #pragma once 4 | 5 | namespace hilti { 6 | /** Perform global initializations for compiling HILTI source files. */ 7 | void init(); 8 | } // namespace hilti 9 | -------------------------------------------------------------------------------- /hilti/toolchain/src/ast/function.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2020-now by the Zeek Project. See LICENSE for details. 2 | 3 | #include 4 | #include 5 | 6 | using namespace hilti; 7 | 8 | std::string Function::_dump() const { return ""; } 9 | -------------------------------------------------------------------------------- /hilti/toolchain/src/ast/statement.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2020-now by the Zeek Project. See LICENSE for details. 2 | 3 | #include 4 | #include 5 | 6 | using namespace hilti; 7 | 8 | std::string Statement::_dump() const { return ""; } 9 | -------------------------------------------------------------------------------- /spicy/toolchain/bin/spicy-dump/options.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2020-now by the Zeek Project. See LICENSE for details. 2 | 3 | #pragma once 4 | 5 | /** 6 | * Formatting options for output. 7 | */ 8 | struct OutputOptions { 9 | bool include_offsets = false; 10 | }; 11 | -------------------------------------------------------------------------------- /spicy/toolchain/include/compiler/init.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2020-now by the Zeek Project. See LICENSE for details. 2 | 3 | #pragma once 4 | 5 | namespace spicy { 6 | /** Perform global initializations for compiling Spicy source files. */ 7 | void init(); 8 | } // namespace spicy 9 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.types.integer.ctor-fail/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [error] <...>/ctor-fail.hlt:7:12-7:37: integer value out of range 3 | [error] hiltic: aborting after errors 4 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.types.integer.shifting-too-much-2/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | uncaught exception hilti::rt::Overflow: integer overflow (<...>/shifting-too-much.hlt:5:1-5:12) 3 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.types.integer.shifting-too-much-3/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | uncaught exception hilti::rt::Overflow: integer overflow (<...>/shifting-too-much.hlt:5:1-5:10) 3 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.types.map.ctor-fail/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [error] <...>/ctor-fail.hlt:6:1-6:29: inconsistent key types in map 3 | [error] hiltic: aborting after errors 4 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.types.map.ops/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | {1: b"AAA", 2: b"BBB", 3: b"CCC"} 3 | {} 4 | BBB 5 | (1, b"AAA") 6 | (2, b"XXX") 7 | (3, b"CCC") 8 | 9 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.types.struct.ctor/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [$b=True, $s="Foo!", $i=21] 3 | [$b=True, $s=(not set), $i=(not set)] 4 | [$b=False, $s=(not set), $i=(not set)] 5 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.types.struct.errors-method-2/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [error] <...>/errors-method.hlt:6:34-6:37: unknown ID 'self' 3 | [error] hiltic: aborting after errors 4 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.types.tuple.index-fail/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [error] <...>/index-fail.hlt:12:14-12:17: tuple index out of range 3 | [error] hiltic: aborting after errors 4 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.statements.while/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | -- A 3 | 1 4 | 2 5 | 3 6 | 4 7 | 5 8 | -- B 9 | 3 10 | 4 11 | 5 12 | -- C 13 | 1 14 | 3 15 | 4 16 | -- D 17 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.unit.switch-convert-mixed/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | in x:1, 1 3 | in x:2, 1 4 | [$a=b"\x01", $x=1] 5 | in x:1, 2 6 | in x:2, 2 7 | [$a=b"\x02", $x=2] 8 | -------------------------------------------------------------------------------- /tests/hilti/types/tuple/index.hlt: -------------------------------------------------------------------------------- 1 | # @TEST-EXEC: ${HILTIC} -j %INPUT >output 2 | # @TEST-EXEC: btest-diff output 3 | 4 | module Foo { 5 | 6 | import hilti; 7 | 8 | global auto x = ("Hello!", True); 9 | 10 | hilti::print(x[0]); 11 | hilti::print(x[1]); 12 | 13 | } 14 | -------------------------------------------------------------------------------- /tests/spicy/types/unit/synchronize-try-with-size.spicy: -------------------------------------------------------------------------------- 1 | # @TEST-EXEC: spicyc -j %INPUT 2 | # 3 | # @TEST-DOC: Regression test for #2007, just ensuring that it builds. 4 | 5 | module Test; 6 | 7 | public type Data = unit { 8 | : bytes &eod &max-size=5 &try; 9 | }; 10 | -------------------------------------------------------------------------------- /doc/programming/examples/_anonymous-field.spicy: -------------------------------------------------------------------------------- 1 | # Automatically generated; edit in Sphinx source code, not here. 2 | module Test; 3 | 4 | public type Foo = unit { 5 | x: int8; 6 | : int8 { print $$; } # anonymous field 7 | y: int8; 8 | on %done { print self; } 9 | }; -------------------------------------------------------------------------------- /doc/programming/examples/_parse-address.spicy: -------------------------------------------------------------------------------- 1 | # Automatically generated; edit in Sphinx source code, not here. 2 | module Test; 3 | 4 | import spicy; 5 | 6 | public type Foo = unit { 7 | ip: addr &ipv6 &byte-order=spicy::ByteOrder::Little; 8 | on %done { print self; } 9 | }; -------------------------------------------------------------------------------- /doc/programming/examples/_parse-bitfield.spicy.output: -------------------------------------------------------------------------------- 1 | # Automatically generated; do not edit. -- printf '\01\02\03\04' | spicy-driver %INPUT/printf '\01\02\03\04' | spicy-driver %INPUT/False 2 | # printf '\01\02\03\04' | spicy-driver foo.spicy 3 | 0, 2, 0 4 | [$f=(0, 2, 0)] 5 | -------------------------------------------------------------------------------- /doc/programming/examples/_parse-vector.spicy.output: -------------------------------------------------------------------------------- 1 | # Automatically generated; do not edit. -- printf '\01\02\03\04\05' | spicy-driver %INPUT/printf '\01\02\03\04\05' | spicy-driver %INPUT/False 2 | # printf '\01\02\03\04\05' | spicy-driver foo.spicy 3 | [$x=[1, 2, 3, 4, 5]] 4 | -------------------------------------------------------------------------------- /doc/programming/examples/_skip.spicy.output: -------------------------------------------------------------------------------- 1 | # Automatically generated; do not edit. -- printf '\01\02\03\04\05\06\07' | spicy-driver %INPUT/printf '\01\02\03\04\05\06\07' | spicy-driver %INPUT/False 2 | # printf '\01\02\03\04\05\06\07' | spicy-driver foo.spicy 3 | [$x=1, $y=7] 4 | -------------------------------------------------------------------------------- /ruff.toml: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2020-now by the Zeek Project. See LICENSE for details. 2 | 3 | target-version = "py39" 4 | 5 | exclude = [ 6 | "3rdparty", 7 | ] 8 | 9 | [lint] 10 | select = [ 11 | "C4", 12 | "F", 13 | "I", 14 | "ISC", 15 | "UP", 16 | ] 17 | -------------------------------------------------------------------------------- /spicy/toolchain/include/spicy.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2020-now by the Zeek Project. See LICENSE for details. 2 | 3 | #pragma once 4 | 5 | #include 6 | 7 | #include 8 | #include 9 | #include 10 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.optimization.peephole-try-catch/opt.hlt: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | module Test { 3 | 4 | 5 | public function void foo() { 6 | assert True; 7 | } 8 | 9 | } 10 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.types.integer.ctor-fail-2/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [error] <...>/ctor-fail.hlt:2:18-2:37: integer value out of range 3 | [error] hiltic: aborting after errors 4 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.types.integer.ctor-fail-3/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [error] <...>/ctor-fail.hlt:2:12-2:21: integer value out of range 3 | [error] hiltic: aborting after errors 4 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.types.integer.ctor-fail-5/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [error] <...>/ctor-fail.hlt:2:12-2:22: integer value out of range 3 | [error] hiltic: aborting after errors 4 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.types.integer.ctor-fail-6/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [error] <...>/ctor-fail.hlt:2:12-2:20: integer value out of range 3 | [error] hiltic: aborting after errors 4 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.types.real.series/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | 126.1 3 | 100 4 | 12610 5 | 300.238 6 | True 7 | False 8 | True 9 | False 10 | False 11 | 126100 12 | 127.1 13 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.types.set.ctor-fail/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [error] <...>/ctor-fail.hlt:6:1-6:14: set elements have inconsistent types 3 | [error] hiltic: aborting after errors 4 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.types.struct.errors-no-self/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [error] <...>/errors-no-self.hlt:13:34-13:37: unknown ID 'self' 3 | [error] hiltic: aborting after errors 4 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.types.struct.finally-fail/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [error] <...>/finally-fail.hlt:8:10-10:1: ~finally must be a hook 3 | [error] hiltic: aborting after errors 4 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.tools.spicy-dump/output-text2: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | Mini::Test [0, 3] { 3 | f: Mini::Foo [0, 3] { 4 | x: 258 [0, 2] 5 | y: 3 [2, 3] 6 | } [0, 3] 7 | } 8 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.integer.ctor-fail-3/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [error] <...>/ctor-fail.spicy:1:28-1:36: integer value out of range 3 | [error] spicyc: aborting after errors 4 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.integer.ctor-fail-4/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [error] <...>/ctor-fail.spicy:1:29-1:38: integer value out of range 3 | [error] spicyc: aborting after errors 4 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.integer.ctor-fail-5/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [error] <...>/ctor-fail.spicy:1:27-1:36: integer value out of range 3 | [error] spicyc: aborting after errors 4 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.integer.ctor-fail-6/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [error] <...>/ctor-fail.spicy:1:29-1:38: integer value out of range 3 | [error] spicyc: aborting after errors 4 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.integer.ctor-fail-8/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [error] <...>/ctor-fail.spicy:4:17-4:41: integer value out of range 3 | [error] spicyc: aborting after errors 4 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.integer.ctor-fail-9/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [error] <...>/ctor-fail.spicy:3:23-3:41: integer value out of range 3 | [error] spicyc: aborting after errors 4 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.struct.parse-fail/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [error] <...>/parse-fail.spicy:13:5-13:13: not a parseable type (Foo) 3 | [error] spicyc: aborting after errors 4 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.unit.hook-id-fail-3/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [error] <...>/hook-id-fail.spicy:5:3-7:3: unknown ID 'ASN1Messup' 3 | [error] spicyc: aborting after errors 4 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.unit.params-inout-forward/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | Test::Body { 3 | b: Test::Chunks { 4 | cs: Test::Chunk { 5 | c: 120 6 | } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.unit.void-fail-2/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [error] <...>/void-fail.spicy:6:22-6:27: field 'v' cannot be accessed 3 | [error] spicyc: aborting after errors 4 | -------------------------------------------------------------------------------- /tests/hilti/types/function/hook-functions-empty.hlt: -------------------------------------------------------------------------------- 1 | # @TEST-EXEC: ${HILTIC} -j %INPUT >output 2 | # @TEST-EXEC: btest-diff output 3 | 4 | module Foo { 5 | 6 | import hilti; 7 | 8 | declare hook optional f(string s); 9 | 10 | hilti::print(f("test")); 11 | 12 | } 13 | -------------------------------------------------------------------------------- /tests/spicy/lib/bytes_to_mac.spicy: -------------------------------------------------------------------------------- 1 | # @TEST-EXEC: ${SPICYC} -j %INPUT 2 | 3 | module Test; 4 | 5 | import spicy; 6 | 7 | assert spicy::bytes_to_mac(b"\x01\x23\xff") == "01:23:FF"; 8 | assert spicy::bytes_to_mac(b"\x01") == "01"; 9 | assert spicy::bytes_to_mac(b"") == ""; 10 | -------------------------------------------------------------------------------- /tests/spicy/statements/throw-fail.spicy: -------------------------------------------------------------------------------- 1 | # @TEST-EXEC-FAIL: spicyc -j -d %INPUT >>output 2>&1 2 | # @TEST-EXEC: btest-diff output 3 | # 4 | # @TEST-DOC: Check validation of the throw statement 5 | 6 | module Test; 7 | 8 | throw 1; 9 | throw 8080/tcp; 10 | throw 127.0.0.1; 11 | -------------------------------------------------------------------------------- /doc/programming/examples/_parse-look-ahead.spicy.output: -------------------------------------------------------------------------------- 1 | # Automatically generated; do not edit. -- printf '\01\02\03EOD\04' | spicy-driver %INPUT/printf '\01\02\03EOD\04' | spicy-driver %INPUT/False 2 | # printf '\01\02\03EOD\04' | spicy-driver foo.spicy 3 | [$data=[1, 2, 3], $x=4] 4 | -------------------------------------------------------------------------------- /scripts/cxx-installed-dir: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Copyright (c) 2020-now by the Zeek Project. See LICENSE for details. 4 | 5 | if [ $# != 1 ]; then 6 | echo "usage: $(basename $0) " 7 | exit 1 8 | fi 9 | 10 | $1 -### 2>&1 | grep ^InstalledDir | cut -d ' ' -f 2 11 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.codegen.init/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | preinit 3 | preinit 4 | init 5 | init 6 | module init 7 | 8 | preinit 9 | preinit 10 | init 11 | init 12 | module init 13 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.rt.exception-location/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | uncaught exception hilti::rt::InvalidIterator: underlying object has expired (<...>/exception-location.hlt:11:1-11:17) 3 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.types.integer.ctor-fail-4/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [error] <...>/ctor-fail.hlt:2:12-2:21: integer value out of range for type 3 | [error] hiltic: aborting after errors 4 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.types.integer.ctor-fail-7/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [error] <...>/ctor-fail.hlt:2:12-2:20: integer value out of range for type 3 | [error] hiltic: aborting after errors 4 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.types.list.ctor-fail/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [error] <...>/ctor-fail.hlt:8:16-8:25: list elements have inconsistent types 3 | [error] hiltic: aborting after errors 4 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.types.struct.errors/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [error] <...>/errors.hlt:14:14-14:27: type does not have field 'DoesNotExist' 3 | [error] hiltic: aborting after errors 4 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.types.vector.ctor-fail/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [error] <...>/ctor-fail.hlt:6:1-6:17: vector elements have inconsistent types 3 | [error] hiltic: aborting after errors 4 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.unit.block-fail/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [error] <...>/block-fail.spicy:9:5-11:6: block condition must be of type bool 3 | [error] spicyc: aborting after errors 4 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.unit.conditional-bytes/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [$len=2, $cond=0, $a=2, $x=(not set), $y=(not set), $z=3] 3 | [$len=2, $cond=1, $a=2, $x=b"\x03", $y=4, $z=5] 4 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.unit.conditional/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [$f1=(not set), $f2=(not set)] 3 | [$f1=10000, $f2=42] 4 | [$f1=(not set), $f2=(not set)] 5 | [$f1=0, $f2=(not set)] 6 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.unit.params-modify/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [$f=(not set), $x="original"] 3 | [$x=b"xxx"] 4 | [$f=[$x=b"xxx"], $x="original"] 5 | [$f=[$x=b"xxx"], $x="modified"] 6 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.unit.switch-parse-from/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | Mini::X { 3 | a: \x01 4 | b: \x01 5 | } 6 | Mini::Y { 7 | a: \x01 8 | b: \x01\x02\x03 9 | } 10 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.vector.parse-lahead-int-regexp-longest-match/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [$a=[[$x=65, $y=2571], [$x=65, $y=3085]], $b=b"AAA", $c=5] 3 | [$a=[], $b=b"AAA", $c=5] 4 | -------------------------------------------------------------------------------- /tests/hilti/types/real/mul.hlt: -------------------------------------------------------------------------------- 1 | # @TEST-EXEC: ${HILTIC} -j %INPUT >output 2 | # @TEST-EXEC: btest-diff output 3 | 4 | module Foo { 5 | 6 | import hilti; 7 | 8 | global real d = 42.84 * 100.0; 9 | hilti::print(d); 10 | 11 | d = -10.0 * -10.0; 12 | hilti::print(d); 13 | 14 | } 15 | -------------------------------------------------------------------------------- /tests/hilti/types/result/void-error.hlt: -------------------------------------------------------------------------------- 1 | # @TEST-EXEC-FAIL: hiltic -j %INPUT 2>output 2 | # @TEST-EXEC: btest-diff output 3 | # 4 | # @TEST-DOC: Check that we catch invalid deref of `result`. 5 | 6 | module foo { 7 | 8 | global result x; 9 | *x; 10 | 11 | } 12 | -------------------------------------------------------------------------------- /tests/hilti/validation/local-variables.hlt: -------------------------------------------------------------------------------- 1 | # @TEST-EXEC-FAIL: ${HILTIC} -j %INPUT >output 2>&1 2 | # @TEST-EXEC: btest-diff output 3 | # 4 | # @TEST-DOC: Check that local variables cannot be declared at module scope 5 | 6 | module Foo { 7 | 8 | local auto x = 1; 9 | 10 | } 11 | -------------------------------------------------------------------------------- /tests/spicy/types/unit/stream-fail.spicy: -------------------------------------------------------------------------------- 1 | # @TEST-EXEC: spicyc -j %INPUT 2 | # 3 | # @TEXT-EXEC: Access to `stream()` outside of parsing triggers exception. 4 | 5 | module Test; 6 | 7 | public type X = unit { 8 | }; 9 | 10 | global x: X; 11 | 12 | assert-exception x.stream(); 13 | -------------------------------------------------------------------------------- /tests/spicy/types/unit/unit-max-size-coerce.spicy: -------------------------------------------------------------------------------- 1 | # @TEST-EXEC: spicyc -j -d %INPUT >output 2>&1 2 | # @TEST-EXEC: btest-diff output 3 | # 4 | # @TEST-DOC: Regression test for #1196. 5 | 6 | module foo; 7 | 8 | public type X = unit { 9 | xs: bytes &max-size=1 &eod; 10 | }; 11 | -------------------------------------------------------------------------------- /tests/spicy/types/unit/variables-fail.spicy: -------------------------------------------------------------------------------- 1 | # @TEST-EXEC-FAIL: spicyc -p %INPUT 2>output 2 | # @TEST-EXEC: btest-diff output 3 | 4 | module Mini; 5 | 6 | import spicy; 7 | 8 | public type Test = unit { 9 | if ( True ) { 10 | var x: bytes; 11 | }; 12 | }; 13 | -------------------------------------------------------------------------------- /doc/programming/examples/_unit-vars-optional.spicy.output: -------------------------------------------------------------------------------- 1 | # Automatically generated; do not edit. -- printf \05 | spicy-driver %INPUT/printf \05 | spicy-driver %INPUT/False 2 | # printf \05 | spicy-driver foo.spicy 3 | [$x=(not set), $a=(not set)] 4 | [$x=48, $a="Our integer is 48"] 5 | -------------------------------------------------------------------------------- /doc/requirements.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2020-now by the Zeek Project. See LICENSE for details. 2 | 3 | # Note: beware of https://github.com/readthedocs/sphinx_rtd_theme/issues/1115 4 | # and broken behavior with docutils 0.17. 5 | docutils==0.18.1 6 | sphinx_rtd_theme==1.2.2 7 | Sphinx==6.2.1 8 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.types.reference.weak-from-strong-ref/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | xyz 3 | xyz 4 | xyz 5 | xyz 6 | Null 7 | abc 8 | 9 | Null 10 | Null 11 | 12 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.types.struct.finally-fail-2/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [error] <...>/finally-fail.hlt:4:10-6:1: ~finally must have return type void 3 | [error] hiltic: aborting after errors 4 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.types.struct.finally-fail-3/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [error] <...>/finally-fail.hlt:4:10-6:1: ~finally cannot take any parameters 3 | [error] hiltic: aborting after errors 4 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.rt.stack-check-init/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | uncaught exception hilti::rt::StackSizeExceeded: not enough stack space remaining (<...>/stack-check-init.spicy:12:5-12:10) 3 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.bitfield.parse-debug-output/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [spicy] Mini::test 3 | [spicy] a = 10 4 | [spicy] b = 63 5 | [spicy] x1 = 15 6 | [spicy] x2 = Foo::A 7 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.enum.from-int/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [$code1=ResultCode::SUCCESS, $code2=ResultCode::OPERATIONS_ERROR, $code3=ResultCode::PROTOCOL_ERROR, $code4=ResultCode::OTHER] 3 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.id.validation-2/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [error] <...>/validation.spicy:2:7-2:19: Invalid ID '_private_name': cannot start with '_' 3 | [error] spicyc: parse error 4 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.reference.function-parameters/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | Hello world, Hello world 3 | Hello world once more, Hello world once more 4 | Goodbye, Hello world once more 5 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.sink.connect-mime/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | Sub , [$s1=b"34", $s2=b"567abcde"] 3 | Main, [$a=b"12", $b=b"34567", $c=b"890", $data=] 4 | Sub3 , [$s=b"34567abcde"] 5 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.sink.connect/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | Sub , [$s1=b"34", $s2=b"567abcde"] 3 | Main, [$a=b"12", $b=b"34567", $c=b"890", $data=] 4 | Sub2 , foo, [$s=b"34567abcde"] 5 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.unit.block-fail-2/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [error] <...>/block-fail.spicy:7:7-7:14: syntax error, unexpected attribute, expecting ';' 3 | [error] spicyc: parse error 4 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.unit.filter-offset/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | foo::X { 3 | xs: [ 4 | (0, X) 5 | (0, A) 6 | (1, B) 7 | (2, C) 8 | (3, Z) 9 | ] 10 | } 11 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.unit.switch-duplicate-case/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [error] <...>/switch-duplicate-case.spicy:11:8-15:13: duplicate case 3 | [error] spicyc: aborting after errors 4 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.unit.unknown-field-2/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [error] <...>/unknown-field.spicy:12:16-12:23: unit does not have field 'tss' 3 | [error] spicyc: aborting after errors 4 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.unit.unknown-field/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [error] <...>/unknown-field.spicy:13:14-13:22: unit does not have field 'bar_' 3 | [error] spicyc: aborting after errors 4 | -------------------------------------------------------------------------------- /tests/hilti/hiltic/jit/precompiled-hello-world.hlt: -------------------------------------------------------------------------------- 1 | # @TEST-EXEC: ${HILTIC} -j -o %INPUT.hlto %INPUT 2 | # @TEST-EXEC: ${HILTIC} -j %INPUT.hlto >output 3 | # @TEST-EXEC: btest-diff output 4 | 5 | module Foo { 6 | 7 | import hilti; 8 | 9 | hilti::print("Hello, world!"); 10 | 11 | } 12 | -------------------------------------------------------------------------------- /tests/hilti/types/string/fmt.hlt: -------------------------------------------------------------------------------- 1 | # @TEST-EXEC: ${HILTIC} -j %INPUT >output 2 | # @TEST-EXEC: btest-diff output 3 | 4 | module Foo { 5 | 6 | import hilti; 7 | 8 | hilti::print("%s" % "foo"); 9 | hilti::print("%d" % 42); 10 | hilti::print("%s %d %x" % ("foo", 32, 255)); 11 | 12 | } 13 | -------------------------------------------------------------------------------- /tests/hilti/validation/function-proto-fail.hlt: -------------------------------------------------------------------------------- 1 | # @TEST-EXEC-FAIL: ${HILTIC} -j %INPUT > output 2>&1 2 | # @TEST-EXEC: btest-diff output 3 | # 4 | # @TEST-DOC: Tests that function prototypes without &cxxname are declined 5 | 6 | module Foo { 7 | 8 | declare void fail(); 9 | 10 | } 11 | -------------------------------------------------------------------------------- /tests/spicy/rt/getenv.spicy: -------------------------------------------------------------------------------- 1 | # @TEST-EXEC: SPICY_TEST1=xxx SPICY_TEST2= spicyc -j %INPUT 2 | 3 | module Test; 4 | 5 | import spicy; 6 | 7 | assert *spicy::getenv("SPICY_TEST1") == "xxx"; 8 | assert *spicy::getenv("SPICY_TEST2") == ""; 9 | assert ! spicy::getenv("does-not-exist"); 10 | -------------------------------------------------------------------------------- /tests/spicy/rt/print-binary.spicy: -------------------------------------------------------------------------------- 1 | # @TEST-EXEC: ${SPICYC} -j %INPUT >output 2 | # @TEST-EXEC: btest-diff output 3 | 4 | module Test; 5 | 6 | import spicy; 7 | 8 | global x1: bytes = b"Hürz"; 9 | global x2: bytes = b"X\r\nY"; 10 | 11 | print x1; 12 | print x2; 13 | print x1, x2; 14 | -------------------------------------------------------------------------------- /tests/spicy/types/function/overloading.spicy: -------------------------------------------------------------------------------- 1 | # @TEST-EXEC: spicyc -j %INPUT >output 2 | # @TEST-EXEC: btest-diff output 3 | 4 | module Foo; 5 | 6 | function foo(x: int64) { print "int64", x; } 7 | function foo(x: string) { print "string", x; } 8 | 9 | foo(42); 10 | foo("foo"); 11 | -------------------------------------------------------------------------------- /tests/spicy/types/unit/field-hook-fail.spicy: -------------------------------------------------------------------------------- 1 | # @TEST-EXEC-FAIL: spicyc -j %INPUT >output 2>&1 2 | # @TEST-EXEC: btest-diff output 3 | 4 | module Test; 5 | 6 | type X = unit { 7 | : uint8 foreach { } 8 | : uint8[] &size=1 foreach { } 9 | : bytes &eod foreach { } 10 | }; 11 | -------------------------------------------------------------------------------- /tests/spicy/types/unit/parseable-fail.spicy: -------------------------------------------------------------------------------- 1 | # @TEST-EXEC-FAIL: spicyc -c %INPUT >output 2>&1 2 | # @TEST-EXEC: btest-diff output 3 | 4 | module Test; 5 | 6 | const Marker = "anything"; 7 | 8 | public type Header = unit { 9 | stuff: Marker; # Not a parseable type 10 | }; 11 | -------------------------------------------------------------------------------- /doc/programming/examples/_basic-unit-module-with-default.spicy: -------------------------------------------------------------------------------- 1 | # Automatically generated; edit in Sphinx source code, not here. 2 | module Test; 3 | 4 | type Foo = unit { 5 | version: uint32 &default=42; 6 | }; 7 | 8 | global f: Foo; 9 | print f; 10 | print "version is %s" % f.version; -------------------------------------------------------------------------------- /doc/programming/examples/_parse-parse.spicy: -------------------------------------------------------------------------------- 1 | # Automatically generated; edit in Sphinx source code, not here. 2 | module Test; 3 | 4 | public type Foo = unit { 5 | x: bytes &size=2; 6 | y: uint16 &parse-from=self.x; 7 | z: bytes &size=2; 8 | 9 | on %done { print self; } 10 | }; -------------------------------------------------------------------------------- /tests/Baseline/hilti.types.enum.duplicate-value-fail/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [error] <...>/duplicate-value-fail.hlt:7:10-12:1: enum values are not unique 3 | [error] hiltic: aborting after errors 4 | -------------------------------------------------------------------------------- /tests/Baseline/hilti.types.result.conversion/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | yeah! 3 | 4 | 5 | yeah! 6 | trouble... 7 | yeah! 8 | (not set) 9 | yes 10 | no 11 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.tools.spicy-build-driver/no-main.output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | ./a.out: HILTI runtime environment - executing only global code; no command-line argument handling or other processing 3 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.tools.spicy-dump/output-text3: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [$f=(not set)] 3 | [$f=[$x=258, $y=3]] 4 | Mini::Test { 5 | f: Mini::Foo { 6 | x: 258 7 | y: 3 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.integer.ops-fail/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [error] <...>/ops-fail.spicy:12:15-12:30: unsupported operator: > & > 3 | [error] spicyc: aborting after errors 4 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.unit.parseable-fail/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [error] <...>/parseable-fail.spicy:9:5-9:18: not a parseable constant ("anything") 3 | [error] spicyc: aborting after errors 4 | -------------------------------------------------------------------------------- /tests/Baseline/spicy.types.unit.size-overflow/output: -------------------------------------------------------------------------------- 1 | ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. 2 | [error] processing failed with exception of type hilti::rt::Overflow: integer overflow (<...>/size-overflow.spicy:10:11-10:15) 3 | -------------------------------------------------------------------------------- /tests/hilti/types/integer/signed-out-of-range.hlt: -------------------------------------------------------------------------------- 1 | # @TEST-EXEC-FAIL: ${HILTIC} -j %INPUT >output 2>&1 2 | # @TEST-EXEC: btest-diff output 3 | 4 | ### Failing Coercions #### 5 | 6 | module Foo { 7 | 8 | import hilti; 9 | 10 | global int<64> i64_lo = -0x8000000000000001; 11 | 12 | } 13 | -------------------------------------------------------------------------------- /tests/spicy/tools/spicyc-hello-world.spicy: -------------------------------------------------------------------------------- 1 | # @TEST-EXEC: ${SPICYC} -c %INPUT >test.hlt 2 | # @TEST-EXEC: ${SPICYC} -j %INPUT >output 3 | # @TEST-EXEC: btest-diff test.hlt 4 | # @TEST-EXEC: btest-diff output 5 | 6 | module Foo; 7 | 8 | print "Hello, world!"; 9 | print "Hello", "world!"; 10 | -------------------------------------------------------------------------------- /tests/spicy/types/bytes/parse-ctor.spicy: -------------------------------------------------------------------------------- 1 | # @TEST-EXEC: printf 'abcdef' | spicy-driver %INPUT >output 2>&1 2 | # @TEST-EXEC: btest-diff output 3 | 4 | module Test; 5 | 6 | public type X = unit { 7 | b1 : b"abc"; 8 | b2 : b"def"; 9 | 10 | on %done { print self; } 11 | }; 12 | -------------------------------------------------------------------------------- /tests/spicy/types/bytes/parse-eod.spicy: -------------------------------------------------------------------------------- 1 | # @TEST-EXEC: printf 'abcdef' | spicy-driver %INPUT >output 2>&1 2 | # @TEST-EXEC: btest-diff output 3 | 4 | module Test; 5 | 6 | public type X = unit { 7 | b1 : b"abc"; 8 | b2 : bytes &eod; 9 | 10 | on %done { print self; } 11 | }; 12 | -------------------------------------------------------------------------------- /doc/programming/examples/_parse-parse.spicy.output: -------------------------------------------------------------------------------- 1 | # Automatically generated; do not edit. -- printf '\x01\x02\x03\04' | spicy-driver %INPUT/printf '\x01\x02\x03\04' | spicy-driver %INPUT/False 2 | # printf '\x01\x02\x03\04' | spicy-driver foo.spicy 3 | [$x=b"\x01\x02", $y=258, $z=b"\x03\x04"] 4 | -------------------------------------------------------------------------------- /hilti/runtime/include/linker.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2020-now by the Zeek Project. See LICENSE for details. 2 | 3 | #pragma once 4 | 5 | #define HILTI_EXPORT __attribute__((visibility("default"))) 6 | #define HILTI_HIDDEN __attribute__((visibility("hidden"))) 7 | #define HILTI_WEAK __attribute__((weak)) 8 | --------------------------------------------------------------------------------