Compare five real examples across four targets on three measured platforms, preserving raw samples, independent output verification and artifact provenance. Complete the WebAssembly support needed by the examples, inspect ZX bundles, prune generated C dependencies while preserving C++ linkage, and validate native script execution. Optimize only the temporary bootstrap seed and retain fresh-build measurements and historical benchmark records under bench/results. Local tests: all 522 cases passed across the full run and corrected header-test rerun; all 16 bootstrap modules match. Playground runtime, bundle runtime, private browser layouts and matrix controls, published artifacts and local site links passed.
95 lines
3.2 KiB
C
95 lines
3.2 KiB
C
/* Generated by zi2c from compiler_expression.zi. */
|
|
#ifndef ZIRAN_COMPILER_EXPRESSION_H
|
|
#define ZIRAN_COMPILER_EXPRESSION_H
|
|
|
|
#include <stdbool.h>
|
|
#include "zir_string_types.h"
|
|
#include "zir_bounds.h"
|
|
#include "compiler_scan.h"
|
|
#include "compiler_source.h"
|
|
#include "compiler_text.h"
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
typedef int32_t StatementExpressionError;
|
|
typedef struct StatementExpression StatementExpression;
|
|
|
|
enum {
|
|
StatementExpressionError_None = 0,
|
|
StatementExpressionError_Modifier = 1,
|
|
StatementExpressionError_ArrayLiteral = 2,
|
|
};
|
|
|
|
struct StatementExpression {
|
|
String name;
|
|
String type;
|
|
String value;
|
|
String lhs;
|
|
String assignment;
|
|
String modifier;
|
|
bool has_declaration;
|
|
bool has_value;
|
|
bool is_else;
|
|
StatementExpressionError error;
|
|
};
|
|
int32_t compiler_expression_BinaryPrecedence(String operator);
|
|
int32_t compiler_expression_CharacterByte(String literal);
|
|
StatementExpression compiler_expression_StatementParts(String source, StatementKind kind);
|
|
|
|
/* Small procedures other modules inline; compiler_expression.c defines them. */
|
|
#if !defined(__cplusplus) && !defined(ZIRAN_COMPILER_EXPRESSION_H_SOURCE) && !defined(ZIRAN_NO_HEADER_INLINE)
|
|
#include <stdbool.h>
|
|
#include "zir_string_types.h"
|
|
#include "zir_bounds.h"
|
|
static inline int32_t compiler_expression_CharacterByte_ziran_inline(String literal);
|
|
#define compiler_expression_CharacterByte(...) compiler_expression_CharacterByte_ziran_inline(__VA_ARGS__)
|
|
|
|
static inline int32_t
|
|
compiler_expression_CharacterByte_ziran_inline(String literal)
|
|
{
|
|
bool value_0 = (int64_t)(literal).length == 3LL && (uint8_t)ZIRAN_INDEX(literal.data, literal.length, 0) == 34 && (uint8_t)ZIRAN_INDEX(literal.data, literal.length, 2) == 34;
|
|
if (value_0 && (uint8_t)ZIRAN_INDEX(literal.data, literal.length, 1) < 128) {
|
|
return (int32_t)((uint8_t)literal.data[1]);
|
|
}
|
|
bool value_1 = (int64_t)(literal).length == 4LL && (uint8_t)ZIRAN_INDEX(literal.data, literal.length, 0) == 34 && (uint8_t)ZIRAN_INDEX(literal.data, literal.length, 1) == 92;
|
|
if (value_1 && (uint8_t)ZIRAN_INDEX(literal.data, literal.length, 3) == 34) {
|
|
uint8_t escape = (uint8_t)literal.data[2];
|
|
if (escape == 48) {
|
|
return 0;
|
|
}
|
|
if (escape == 110) {
|
|
return 10;
|
|
}
|
|
if (escape == 114) {
|
|
return 13;
|
|
}
|
|
if (escape == 116) {
|
|
return 9;
|
|
}
|
|
if (escape == 34) {
|
|
return 34;
|
|
}
|
|
if (escape == 92) {
|
|
return 92;
|
|
}
|
|
return -1;
|
|
}
|
|
bool value_2 = (int64_t)(literal).length == 6LL && (uint8_t)ZIRAN_INDEX(literal.data, literal.length, 0) == 34 && (uint8_t)ZIRAN_INDEX(literal.data, literal.length, 1) == 92;
|
|
if (value_2 && (uint8_t)ZIRAN_INDEX(literal.data, literal.length, 2) == 120 && (uint8_t)ZIRAN_INDEX(literal.data, literal.length, 5) == 34) {
|
|
int32_t high = compiler_text_HexDigit((uint8_t)literal.data[3]);
|
|
int32_t low = compiler_text_HexDigit((uint8_t)literal.data[4]);
|
|
if (high >= 0 && low >= 0) {
|
|
return (int32_t)(((uint32_t)high * 16u) + (uint32_t)low);
|
|
}
|
|
}
|
|
return -1;
|
|
}
|
|
#endif
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif /* ZIRAN_COMPILER_EXPRESSION_H */
|