diff --git a/benchmark/IOAI/IOAI2025/Individual-Contest/Radar/Solution/Radar_Solution.ipynb b/benchmark/IOAI/IOAI2025/Individual-Contest/Radar/Solution/Radar_Solution.ipynb new file mode 100644 index 0000000000000000000000000000000000000000..f00803c366a77c8c2986f81790a748fcc66553ff --- /dev/null +++ b/benchmark/IOAI/IOAI2025/Individual-Contest/Radar/Solution/Radar_Solution.ipynb @@ -0,0 +1,1056 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "ab23242e-3c5e-4ba6-9cb9-dfc4d8c22321", + "metadata": {}, + "source": [ + "\"IOAI\n", + "\n", + "[IOAI 2025 (Beijing, China), Individual Contest](https://ioai-official.org/china-2025)\n", + "\n", + "[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/IOAI-official/IOAI-2025/blob/main/Individual-Contest/Radar/Solution/Radar_Solution.ipynb)" + ] + }, + { + "cell_type": "markdown", + "id": "f2ea67c2-ec81-4ced-b8a4-a19b591376bb", + "metadata": {}, + "source": [ + "# Radar: Reference Solution" + ] + }, + { + "cell_type": "markdown", + "id": "97ae6685", + "metadata": {}, + "source": [ + "## Configs" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "4243ca5d", + "metadata": { + "jupyter": { + "source_hidden": false + } + }, + "outputs": [], + "source": [ + "radar_configs = {\n", + " 'c': 3e8, \n", + " 'startFreq': 77e9, \n", + " 'Tr': 60e-6, # Sweeping frequency time\n", + " 'Idle_time': 100e-6, # free time\n", + " 'Fs': 10e6, # Sampling frequency\n", + " 'Slope': 29.982e12, # chirp slope\n", + " 'Bandwidth': 60e-6 * 29.982e12, # Transmission signal bandwidth\n", + " 'BandwidthValid': 0.767539200e9,# Effective bandwidth of the transmitted signal\n", + " 'range_size': 256, # range size\n", + " 'azimuth_size': 181, # azimuth size\n", + " 'elevation_size': 181, # elevation size\n", + " 'crop_num': 3, # crop some indices in range domain\n", + " 'n_chirps': 128, # number of chirps in one frame\n", + " 'min_azimuth': -90, # min radar azimuth\n", + " 'max_azimuth': 90, # max radar azimuth\n", + " 'min_elevation': -90, # min radar elevation\n", + " 'max_elevation': 90, # max radar elevation \n", + " 'min_range': 1.0, # min radar range\n", + " 'max_range': 25.0, # max radar range\n", + " 'range_res': 3e8/(2*0.767539200e9), \n", + " 'angle_res': 1\n", + "}\n", + "\n", + "dimssnet_configs = {\n", + " 'n_epoch': 10,\n", + " 'batch_size': 2,\n", + " 'learning_rate': 1e-5,\n", + " 'range_size': 50,\n", + " 'azimuth_size': 181,\n", + " 'elevation_size': 181,\n", + " 'doppler_size': 181, \n", + " 'min_azimuth': -90, # min radar azimuth\n", + " 'max_azimuth': 90, # max radar azimuth\n", + " 'min_elevation': -90, # min radar elevation\n", + " 'max_elevation': 90, # max radar elevation \n", + " 'min_range': 1.0, # min radar range\n", + " 'max_range': 25.0, # max radar range\n", + "}\n", + "\n", + "n_class = 5\n", + "class_table = {\n", + " -1: 'background', \n", + " 0: 'suicase', \n", + " 1: 'chair', \n", + " 2: 'person',\n", + " 3: 'wall'\n", + "}" + ] + }, + { + "cell_type": "markdown", + "id": "c39a54f5", + "metadata": {}, + "source": [ + "## Models" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "10817ce8", + "metadata": { + "jupyter": { + "source_hidden": false + } + }, + "outputs": [], + "source": [ + "import torch\n", + "import torch.nn as nn\n", + "import torch.nn.functional as F\n", + "\n", + "class SRA_Encode(nn.Module):\n", + " def __init__(self):\n", + " super(SRA_Encode, self).__init__()\n", + " self.conv1a = nn.Conv2d(in_channels=1, out_channels=64, \n", + " kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))\n", + " self.conv1b = nn.Conv2d(in_channels=64, out_channels=64, \n", + " kernel_size=(3, 3), stride=(2, 2), padding=(1, 1))\n", + " self.conv2a = nn.Conv2d(in_channels=64, out_channels=128, \n", + " kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))\n", + " self.conv2b = nn.Conv2d(in_channels=128, out_channels=128, \n", + " kernel_size=(3, 3), stride=(2, 2), padding=(1, 1))\n", + " self.conv3a = nn.Conv2d(in_channels=128, out_channels=256, \n", + " kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))\n", + " self.conv3b = nn.Conv2d(in_channels=256, out_channels=256, \n", + " kernel_size=(3, 3), stride=(2, 2), padding=(1, 1))\n", + "\n", + " self.bn1a = nn.BatchNorm2d(num_features=64)\n", + " self.bn1b = nn.BatchNorm2d(num_features=64)\n", + " self.bn2a = nn.BatchNorm2d(num_features=128)\n", + " self.bn2b = nn.BatchNorm2d(num_features=128)\n", + " self.bn3a = nn.BatchNorm2d(num_features=256)\n", + " self.bn3b = nn.BatchNorm2d(num_features=256)\n", + "\n", + " self.relu = nn.ReLU()\n", + " \n", + " def forward(self, x):\n", + " x = self.relu(self.bn1a(self.conv1a(x)))\n", + " x = self.relu(self.bn1b(self.conv1b(x)))\n", + " x = self.relu(self.bn2a(self.conv2a(x)))\n", + " x = self.relu(self.bn2b(self.conv2b(x)))\n", + " x = self.relu(self.bn3a(self.conv3a(x)))\n", + " x = self.relu(self.bn3b(self.conv3b(x)))\n", + " \n", + " return x\n", + "\n", + "class SRA_Decode(nn.Module):\n", + " def __init__(self):\n", + " super(SRA_Decode, self).__init__()\n", + " self.convt1 = nn.ConvTranspose2d(in_channels=256, out_channels=128,\n", + " kernel_size=(3, 3), stride=(2, 2), padding=(1, 1))\n", + " self.convt2 = nn.ConvTranspose2d(in_channels=128, out_channels=64,\n", + " kernel_size=(3, 3), stride=(2, 2), padding=(1, 1))\n", + " self.convt3 = nn.ConvTranspose2d(in_channels=64, out_channels=32,\n", + " kernel_size=(3, 3), stride=(2, 2), padding=(1, 1))\n", + " self.prelu = nn.PReLU()\n", + " self.sigmoid = nn.Sigmoid()\n", + " self.upsample = nn.Upsample(size=(dimssnet_configs['range_size'],\n", + " dimssnet_configs['azimuth_size']), mode='nearest')\n", + "\n", + " def forward(self, x):\n", + " x = self.prelu(self.convt1(x))\n", + " x = self.prelu(self.convt2(x))\n", + " x = self.prelu(self.convt3(x))\n", + "\n", + " return x\n", + "\n", + "class DRA_Encode(nn.Module):\n", + " def __init__(self):\n", + " super(DRA_Encode, self).__init__()\n", + " self.conv1a = nn.Conv2d(in_channels=1, out_channels=64, \n", + " kernel_size=(3, 3), stride=(1, 1), padding=(1, 1)) # (1 50 181)->(64 50 181)\n", + " self.conv1b = nn.Conv2d(in_channels=64, out_channels=64, \n", + " kernel_size=(3, 3), stride=(2, 2), padding=(1, 1)) # (64 50 181)->(64 25 91)\n", + " self.conv2a = nn.Conv2d(in_channels=64, out_channels=128, \n", + " kernel_size=(3, 3), stride=(1, 1), padding=(1, 1)) # (64 25 91)->(128 25 91)\n", + " self.conv2b = nn.Conv2d(in_channels=128, out_channels=128, \n", + " kernel_size=(3, 3), stride=(2, 2), padding=(1, 1)) # (128 25 91)->(128 13 46)\n", + " self.conv3a = nn.Conv2d(in_channels=128, out_channels=256, \n", + " kernel_size=(3, 3), stride=(1, 1), padding=(1, 1)) # (128 13 46)->(256 13 46)\n", + " self.conv3b = nn.Conv2d(in_channels=256, out_channels=256, \n", + " kernel_size=(3, 3), stride=(2, 2), padding=(1, 1)) # (256 13 46)->(256 7 23)\n", + "\n", + " self.bn1a = nn.BatchNorm2d(num_features=64)\n", + " self.bn1b = nn.BatchNorm2d(num_features=64)\n", + " self.bn2a = nn.BatchNorm2d(num_features=128)\n", + " self.bn2b = nn.BatchNorm2d(num_features=128)\n", + " self.bn3a = nn.BatchNorm2d(num_features=256)\n", + " self.bn3b = nn.BatchNorm2d(num_features=256)\n", + "\n", + " self.relu = nn.ReLU()\n", + " \n", + " def forward(self, x):\n", + " x = self.relu(self.bn1a(self.conv1a(x)))\n", + " x = self.relu(self.bn1b(self.conv1b(x)))\n", + " x = self.relu(self.bn2a(self.conv2a(x)))\n", + " x = self.relu(self.bn2b(self.conv2b(x)))\n", + " x = self.relu(self.bn3a(self.conv3a(x)))\n", + " x = self.relu(self.bn3b(self.conv3b(x)))\n", + "\n", + " return x\n", + "\n", + "class DRA_Decode(nn.Module):\n", + " def __init__(self):\n", + " super(DRA_Decode, self).__init__()\n", + " self.convt1 = nn.ConvTranspose2d(in_channels=256, out_channels=128,\n", + " kernel_size=(3, 3), stride=(2, 2), padding=(1, 1)) # (256 7 23)->(128 13 45)\n", + " self.convt2 = nn.ConvTranspose2d(in_channels=128, out_channels=64,\n", + " kernel_size=(3, 3), stride=(2, 2), padding=(1, 1)) # (128 13 45)->(64 25 89)\n", + " self.convt3 = nn.ConvTranspose2d(in_channels=64, out_channels=32,\n", + " kernel_size=(3, 3), stride=(2, 2), padding=(1, 1)) # (64 25 89)->(32 49 177)\n", + " self.prelu = nn.PReLU()\n", + " self.sigmoid = nn.Sigmoid()\n", + " self.upsample = nn.Upsample(size=(dimssnet_configs['range_size'],\n", + " dimssnet_configs['elevation_size']), mode='nearest')\n", + "\n", + " def forward(self, x):\n", + " x = self.prelu(self.convt1(x))\n", + " x = self.prelu(self.convt2(x))\n", + " x = self.prelu(self.convt3(x))\n", + "\n", + " return x\n", + "\n", + "class SRE_Encode(nn.Module):\n", + " def __init__(self):\n", + " super(SRE_Encode, self).__init__()\n", + " self.conv1a = nn.Conv2d(in_channels=1, out_channels=64, \n", + " kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))\n", + " self.conv1b = nn.Conv2d(in_channels=64, out_channels=64, \n", + " kernel_size=(3, 3), stride=(2, 2), padding=(1, 1))\n", + " self.conv2a = nn.Conv2d(in_channels=64, out_channels=128, \n", + " kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))\n", + " self.conv2b = nn.Conv2d(in_channels=128, out_channels=128, \n", + " kernel_size=(3, 3), stride=(2, 2), padding=(1, 1))\n", + " self.conv3a = nn.Conv2d(in_channels=128, out_channels=256, \n", + " kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))\n", + " self.conv3b = nn.Conv2d(in_channels=256, out_channels=256, \n", + " kernel_size=(3, 3), stride=(2, 2), padding=(1, 1))\n", + "\n", + " self.bn1a = nn.BatchNorm2d(num_features=64)\n", + " self.bn1b = nn.BatchNorm2d(num_features=64)\n", + " self.bn2a = nn.BatchNorm2d(num_features=128)\n", + " self.bn2b = nn.BatchNorm2d(num_features=128)\n", + " self.bn3a = nn.BatchNorm2d(num_features=256)\n", + " self.bn3b = nn.BatchNorm2d(num_features=256)\n", + "\n", + " self.relu = nn.ReLU()\n", + " \n", + " def forward(self, x):\n", + " x = self.relu(self.bn1a(self.conv1a(x)))\n", + " x = self.relu(self.bn1b(self.conv1b(x)))\n", + " x = self.relu(self.bn2a(self.conv2a(x)))\n", + " x = self.relu(self.bn2b(self.conv2b(x)))\n", + " x = self.relu(self.bn3a(self.conv3a(x)))\n", + " x = self.relu(self.bn3b(self.conv3b(x)))\n", + "\n", + " return x\n", + "\n", + "class SRE_Decode(nn.Module):\n", + " def __init__(self):\n", + " super(SRE_Decode, self).__init__()\n", + " self.convt1 = nn.ConvTranspose2d(in_channels=256, out_channels=128,\n", + " kernel_size=(3, 3), stride=(2, 2), padding=(1, 1))\n", + " self.convt2 = nn.ConvTranspose2d(in_channels=128, out_channels=64,\n", + " kernel_size=(3, 3), stride=(2, 2), padding=(1, 1))\n", + " self.convt3 = nn.ConvTranspose2d(in_channels=64, out_channels=32,\n", + " kernel_size=(3, 3), stride=(2, 2), padding=(1, 1))\n", + " self.prelu = nn.PReLU()\n", + " self.sigmoid = nn.Sigmoid()\n", + " self.upsample = nn.Upsample(size=(dimssnet_configs['range_size'],\n", + " dimssnet_configs['elevation_size']), mode='nearest')\n", + "\n", + " def forward(self, x):\n", + " x = self.prelu(self.convt1(x))\n", + " x = self.prelu(self.convt2(x))\n", + " x = self.prelu(self.convt3(x))\n", + "\n", + " return x\n", + " \n", + "class DRE_Encode(nn.Module):\n", + " def __init__(self):\n", + " super(DRE_Encode, self).__init__()\n", + " self.conv1a = nn.Conv2d(in_channels=1, out_channels=64, \n", + " kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))\n", + " self.conv1b = nn.Conv2d(in_channels=64, out_channels=64, \n", + " kernel_size=(3, 3), stride=(2, 2), padding=(1, 1))\n", + " self.conv2a = nn.Conv2d(in_channels=64, out_channels=128, \n", + " kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))\n", + " self.conv2b = nn.Conv2d(in_channels=128, out_channels=128, \n", + " kernel_size=(3, 3), stride=(2, 2), padding=(1, 1))\n", + " self.conv3a = nn.Conv2d(in_channels=128, out_channels=256, \n", + " kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))\n", + " self.conv3b = nn.Conv2d(in_channels=256, out_channels=256, \n", + " kernel_size=(3, 3), stride=(2, 2), padding=(1, 1))\n", + "\n", + " self.bn1a = nn.BatchNorm2d(num_features=64)\n", + " self.bn1b = nn.BatchNorm2d(num_features=64)\n", + " self.bn2a = nn.BatchNorm2d(num_features=128)\n", + " self.bn2b = nn.BatchNorm2d(num_features=128)\n", + " self.bn3a = nn.BatchNorm2d(num_features=256)\n", + " self.bn3b = nn.BatchNorm2d(num_features=256)\n", + "\n", + " self.relu = nn.ReLU()\n", + " \n", + " def forward(self, x):\n", + " x = self.relu(self.bn1a(self.conv1a(x)))\n", + " x = self.relu(self.bn1b(self.conv1b(x)))\n", + " x = self.relu(self.bn2a(self.conv2a(x)))\n", + " x = self.relu(self.bn2b(self.conv2b(x)))\n", + " x = self.relu(self.bn3a(self.conv3a(x)))\n", + " x = self.relu(self.bn3b(self.conv3b(x)))\n", + "\n", + " return x\n", + "\n", + "class DRE_Decode(nn.Module):\n", + " def __init__(self):\n", + " super(DRE_Decode, self).__init__()\n", + " self.convt1 = nn.ConvTranspose2d(in_channels=256, out_channels=128,\n", + " kernel_size=(3, 3), stride=(2, 2), padding=(1, 1))\n", + " self.convt2 = nn.ConvTranspose2d(in_channels=128, out_channels=64,\n", + " kernel_size=(3, 3), stride=(2, 2), padding=(1, 1))\n", + " self.convt3 = nn.ConvTranspose2d(in_channels=64, out_channels=32,\n", + " kernel_size=(3, 3), stride=(2, 2), padding=(1, 1))\n", + " self.prelu = nn.PReLU()\n", + " self.sigmoid = nn.Sigmoid()\n", + " self.upsample = nn.Upsample(size=(dimssnet_configs['range_size'],\n", + " dimssnet_configs['elevation_size']), mode='nearest')\n", + "\n", + " def forward(self, x):\n", + " x = self.prelu(self.convt1(x))\n", + " x = self.prelu(self.convt2(x))\n", + " x = self.prelu(self.convt3(x))\n", + "\n", + " return x\n", + " \n", + "class SRD_Encode(nn.Module):\n", + " def __init__(self):\n", + " super(SRD_Encode, self).__init__()\n", + " self.conv1a = nn.Conv2d(in_channels=1, out_channels=64, \n", + " kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))\n", + " self.conv1b = nn.Conv2d(in_channels=64, out_channels=64, \n", + " kernel_size=(3, 3), stride=(2, 2), padding=(1, 1))\n", + " self.conv2a = nn.Conv2d(in_channels=64, out_channels=128, \n", + " kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))\n", + " self.conv2b = nn.Conv2d(in_channels=128, out_channels=128, \n", + " kernel_size=(3, 3), stride=(2, 2), padding=(1, 1))\n", + " self.conv3a = nn.Conv2d(in_channels=128, out_channels=256, \n", + " kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))\n", + " self.conv3b = nn.Conv2d(in_channels=256, out_channels=256, \n", + " kernel_size=(3, 3), stride=(2, 2), padding=(1, 1))\n", + "\n", + " self.bn1a = nn.BatchNorm2d(num_features=64)\n", + " self.bn1b = nn.BatchNorm2d(num_features=64)\n", + " self.bn2a = nn.BatchNorm2d(num_features=128)\n", + " self.bn2b = nn.BatchNorm2d(num_features=128)\n", + " self.bn3a = nn.BatchNorm2d(num_features=256)\n", + " self.bn3b = nn.BatchNorm2d(num_features=256)\n", + "\n", + " self.relu = nn.ReLU()\n", + " \n", + " def forward(self, x):\n", + " x = self.relu(self.bn1a(self.conv1a(x)))\n", + " x = self.relu(self.bn1b(self.conv1b(x)))\n", + " x = self.relu(self.bn2a(self.conv2a(x)))\n", + " x = self.relu(self.bn2b(self.conv2b(x)))\n", + " x = self.relu(self.bn3a(self.conv3a(x)))\n", + " x = self.relu(self.bn3b(self.conv3b(x)))\n", + "\n", + " return x\n", + "\n", + "class SRD_Decode(nn.Module):\n", + " def __init__(self):\n", + " super(SRD_Decode, self).__init__()\n", + " self.convt1 = nn.ConvTranspose2d(in_channels=256, out_channels=128,\n", + " kernel_size=(3, 3), stride=(2, 2), padding=(1, 1))\n", + " self.convt2 = nn.ConvTranspose2d(in_channels=128, out_channels=64,\n", + " kernel_size=(3, 3), stride=(2, 2), padding=(1, 1))\n", + " self.convt3 = nn.ConvTranspose2d(in_channels=64, out_channels=32,\n", + " kernel_size=(3, 3), stride=(2, 2), padding=(1, 1))\n", + " self.prelu = nn.PReLU()\n", + " self.sigmoid = nn.Sigmoid()\n", + " self.upsample = nn.Upsample(size=(dimssnet_configs['range_size'],\n", + " dimssnet_configs['doppler_size']), mode='nearest')\n", + "\n", + " def forward(self, x):\n", + " x = self.prelu(self.convt1(x))\n", + " x = self.prelu(self.convt2(x))\n", + " x = self.prelu(self.convt3(x))\n", + "\n", + " return x\n", + " \n", + "class DRD_Encode(nn.Module):\n", + " def __init__(self):\n", + " super(DRD_Encode, self).__init__()\n", + " self.conv1a = nn.Conv2d(in_channels=1, out_channels=64, \n", + " kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))\n", + " self.conv1b = nn.Conv2d(in_channels=64, out_channels=64, \n", + " kernel_size=(3, 3), stride=(2, 2), padding=(1, 1))\n", + " self.conv2a = nn.Conv2d(in_channels=64, out_channels=128, \n", + " kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))\n", + " self.conv2b = nn.Conv2d(in_channels=128, out_channels=128, \n", + " kernel_size=(3, 3), stride=(2, 2), padding=(1, 1))\n", + " self.conv3a = nn.Conv2d(in_channels=128, out_channels=256, \n", + " kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))\n", + " self.conv3b = nn.Conv2d(in_channels=256, out_channels=256, \n", + " kernel_size=(3, 3), stride=(2, 2), padding=(1, 1))\n", + "\n", + " self.bn1a = nn.BatchNorm2d(num_features=64)\n", + " self.bn1b = nn.BatchNorm2d(num_features=64)\n", + " self.bn2a = nn.BatchNorm2d(num_features=128)\n", + " self.bn2b = nn.BatchNorm2d(num_features=128)\n", + " self.bn3a = nn.BatchNorm2d(num_features=256)\n", + " self.bn3b = nn.BatchNorm2d(num_features=256)\n", + "\n", + " self.relu = nn.ReLU()\n", + " \n", + " def forward(self, x):\n", + " x = self.relu(self.bn1a(self.conv1a(x)))\n", + " x = self.relu(self.bn1b(self.conv1b(x)))\n", + " x = self.relu(self.bn2a(self.conv2a(x)))\n", + " x = self.relu(self.bn2b(self.conv2b(x)))\n", + " x = self.relu(self.bn3a(self.conv3a(x)))\n", + " x = self.relu(self.bn3b(self.conv3b(x)))\n", + "\n", + " return x\n", + "\n", + "class DRD_Decode(nn.Module):\n", + " def __init__(self):\n", + " super(DRD_Decode, self).__init__()\n", + " self.convt1 = nn.ConvTranspose2d(in_channels=256, out_channels=128,\n", + " kernel_size=(3, 3), stride=(2, 2), padding=(1, 1))\n", + " self.convt2 = nn.ConvTranspose2d(in_channels=128, out_channels=64,\n", + " kernel_size=(3, 3), stride=(2, 2), padding=(1, 1))\n", + " self.convt3 = nn.ConvTranspose2d(in_channels=64, out_channels=32,\n", + " kernel_size=(3, 3), stride=(2, 2), padding=(1, 1))\n", + " self.prelu = nn.PReLU()\n", + " self.sigmoid = nn.Sigmoid()\n", + " self.upsample = nn.Upsample(size=(dimssnet_configs['range_size'],\n", + " dimssnet_configs['doppler_size']), mode='nearest')\n", + "\n", + " def forward(self, x):\n", + " x = self.prelu(self.convt1(x))\n", + " x = self.prelu(self.convt2(x))\n", + " x = self.prelu(self.convt3(x))\n", + "\n", + " return x" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "483a5ba6", + "metadata": { + "jupyter": { + "source_hidden": false + } + }, + "outputs": [], + "source": [ + "class DIMSSNet(nn.Module):\n", + " def __init__(self):\n", + " super(DIMSSNet, self).__init__()\n", + " self.encode_sra = SRA_Encode()\n", + " self.decode_sra = SRA_Decode()\n", + " self.encode_dra = DRA_Encode()\n", + " self.decode_dra = DRA_Decode()\n", + " self.encode_sre = SRE_Encode()\n", + " self.decode_sre = SRE_Decode()\n", + " self.encode_dre = DRE_Encode()\n", + " self.decode_dre = DRE_Decode()\n", + " self.encode_srd = SRD_Encode()\n", + " self.decode_srd = SRD_Decode()\n", + " self.encode_drd = DRD_Encode()\n", + " self.decode_drd = DRD_Decode()\n", + " self.fuse_fea = Fuse_fea()\n", + " # self.fuse_fea = Fuse_fea_2D()\n", + " \n", + " def forward(self, x_sra, x_dra, x_sre, x_dre, x_srd, x_drd):\n", + " x_sra = self.encode_sra(x_sra)\n", + " feas_sra = self.decode_sra(x_sra) # (B, 32, 50, 181)\n", + " \n", + " x_dra = self.encode_dra(x_dra)\n", + " feas_dra = self.decode_dra(x_dra) # (B, 32, 50, 181)\n", + " \n", + " x_sre = self.encode_sre(x_sre)\n", + " feas_sre = self.decode_sre(x_sre) # (B, 32, 50, 181)\n", + " \n", + " x_dre = self.encode_dre(x_dre)\n", + " feas_dre = self.decode_dre(x_dre) # (B, 32, 50, 181)\n", + "\n", + " x_srd = self.encode_sre(x_srd)\n", + " feas_srd = self.decode_sre(x_srd) # (B, 32, 50, 181)\n", + " \n", + " x_drd = self.encode_dre(x_drd)\n", + " feas_drd = self.decode_dre(x_drd) # (B, 32, 50, 181) \n", + " \n", + " feas = self.fuse_fea(feas_sra, feas_dra, feas_sre, feas_dre, feas_srd, feas_drd) # (B, 32, 50, 181)\n", + "\n", + " return feas" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "ddb913e6", + "metadata": { + "jupyter": { + "source_hidden": false + } + }, + "outputs": [], + "source": [ + "range_size=radar_configs['range_size']\n", + "azimuth_size=radar_configs['azimuth_size']\n", + "elevation_size=radar_configs['elevation_size']\n", + "\n", + "class Fuse_fea(nn.Module):\n", + " def __init__(self):\n", + " super(Fuse_fea, self).__init__()\n", + " self.convt1 = nn.Conv2d(in_channels=192, out_channels=96,\n", + " kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))\n", + " self.convt2 = nn.Conv2d(in_channels=96, out_channels=48,\n", + " kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))\n", + " self.convt3 = nn.Conv2d(in_channels=48, out_channels=24,\n", + " kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))\n", + " self.convt4 = nn.Conv2d(in_channels=24, out_channels=n_class,\n", + " kernel_size=(3, 3), stride=(1, 1), padding=(1, 1)) \n", + " self.relu = nn.ReLU()\n", + " self.sigmoid = nn.Sigmoid()\n", + "\n", + " def forward(self, feas_sra, feas_dra, feas_sre, feas_dre, feas_srd, feas_drd):\n", + " feas_sre = torch.sum(feas_sre, 3, keepdim=True) # (B, 32, 50, 181) -> (B, 32, 50, 1)\n", + " feas_sre = feas_sre.expand(-1, -1, -1, azimuth_size)\n", + " \n", + " feas_dre = torch.sum(feas_dre, 3, keepdim=True) # (B, 32, 50, 181) -> (B, 32, 50, 1)\n", + " feas_dre = feas_dre.expand(-1, -1, -1, azimuth_size)\n", + "\n", + " feas_srd = torch.sum(feas_srd, 3, keepdim=True) # (B, 32, 50, 181) -> (B, 32, 50, 1)\n", + " feas_srd = feas_srd.expand(-1, -1, -1, azimuth_size)\n", + "\n", + " feas_drd = torch.sum(feas_drd, 3, keepdim=True) # (B, 32, 50, 181) -> (B, 32, 50, 1)\n", + " feas_drd = feas_drd.expand(-1, -1, -1, azimuth_size)\n", + "\n", + " # Resize using bilinear interpolation\n", + " feas_sra = F.interpolate(feas_sra, size=(range_size, azimuth_size), mode='bilinear', align_corners=False)\n", + " feas_dra = F.interpolate(feas_dra, size=(range_size, azimuth_size), mode='bilinear', align_corners=False)\n", + " feas_sre = F.interpolate(feas_sre, size=(range_size, azimuth_size), mode='bilinear', align_corners=False)\n", + " feas_dre = F.interpolate(feas_dre, size=(range_size, azimuth_size), mode='bilinear', align_corners=False)\n", + " feas_srd = F.interpolate(feas_srd, size=(range_size, azimuth_size), mode='bilinear', align_corners=False)\n", + " feas_drd = F.interpolate(feas_drd, size=(range_size, azimuth_size), mode='bilinear', align_corners=False)\n", + " \n", + " feas_ra = torch.cat((feas_sra, feas_dra, feas_sre, feas_dre, feas_srd, feas_drd), 1) # 6*(B, 32, 50, 181) -> (B, 192, 50, 181)\n", + "\n", + " x = self.relu(self.convt1(feas_ra)) # (B, 192, 50, 181) -> (B, 96, 50, 181)\n", + " x = self.relu(self.convt2(x)) # (B, 96, 50, 181) -> (B, 48, 50, 181)\n", + " x = self.relu(self.convt3(x)) # (B, 48, 50, 181) -> (B, 24, 50, 181) \n", + " x = self.sigmoid(self.convt4(x)) # (B, 24, 50, 181) -> (B, 5, 50, 181)\n", + " \n", + " return x\n", + " " + ] + }, + { + "cell_type": "markdown", + "id": "b8d86ece", + "metadata": {}, + "source": [ + "## Utils" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "49705a8f", + "metadata": { + "jupyter": { + "source_hidden": false + } + }, + "outputs": [], + "source": [ + "import scipy.io\n", + "import numpy as np\n", + "\n", + "# Define the target size\n", + "TARGET_HEIGHT = 50\n", + "TARGET_WIDTH = 181\n", + "\n", + "def load_raw_data(file_path):\n", + " data = scipy.io.loadmat(file_path)\n", + "\n", + " # Range-Azimuth Static\n", + " range_az_static = data['range_az_static']\n", + " range_az_static_prob = data['range_az_music_average_static_probability']\n", + " range_az_static_class2_prob = range_az_static_prob[:, :, 1] # 椅子的概率\n", + "\n", + " # Range-Elevation Static\n", + " range_ele_static = data['range_ele_static_all']\n", + "\n", + " # Range-Azimuth Dynamic\n", + " range_az_dynamic = data['range_az_dynamic']\n", + " range_az_dynamic_prob = data['range_az_music_average_dynamic_probability']\n", + " range_az_dynamic_class1_prob = range_az_dynamic_prob[:, :, 0] # 人的概率\n", + "\n", + " # Range-Elevation Dynamic\n", + " range_ele_dynamic = data['range_ele_dynamic_all'] \n", + "\n", + " return [range_az_static, range_az_dynamic, range_ele_static,\n", + " range_ele_dynamic, range_az_dynamic_class1_prob, range_az_static_class2_prob]\n", + "\n", + "def generate_parameter():\n", + " parameter = {\n", + " 'c': 3e8, # the speed of light\n", + " 'start_freq': 77e9, # starting frequency\n", + " 'tr': 60e-6, # Sweeping time, that is, the cycle\n", + " 'samples': 256, # sampling point\n", + " 'fs': 10e6, # Sampling rate\n", + " 'tframe_set': 80e-3, # Frame period\n", + " 'range_bin': 256, # range bin\n", + " 'chirps': 128, # chirp number\n", + " 'doppler_bin': 128, # doppler bin\n", + " 'slope': 29.982e12, # chirp slope\n", + " 'bandwidth': 29.982e12 * 60e-6, # Effective bandwidth of the transmitted signal\n", + " 'bandwidth_valid': 256 / 10e6 * 29.982e12, # Transmission signal bandwidth\n", + " 'center_freq': 77e9 + (29.982e12 * 60e-6) / 2, # center frequency\n", + " 'lambda': 3e8 / (77e9 + (29.982e12 * 60e-6) / 2), # wavelength\n", + " 'tx_antenna': [1, 1, 1], # The number of transmitting antennas\n", + " 'rx_antenna': [1, 1, 1, 1], # Number of receiving antennas\n", + " 'tx_num': 3, # The number of transmitting antennas\n", + " 'rx_num': 4, # The number of receiving antennas\n", + " 'virtual_antenna': 12, # Number of virtual antennas\n", + " 'dz': (3e8 / (77e9 + (29.982e12 * 60e-6) / 2)) / 2, # Pitch spacing of the receiving antenna\n", + " 'dx': (3e8 / (77e9 + (29.982e12 * 60e-6) / 2)) / 2, # Horizontal spacing of receiving antennas\n", + " 'num_cpi': 50, # 帧数\n", + " }\n", + " return parameter\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "id": "c266f24b", + "metadata": {}, + "source": [ + "## Dataloaders" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "892cfb3a", + "metadata": {}, + "outputs": [], + "source": [ + "import os\n", + "from torch.utils.data import Dataset, DataLoader\n", + "from sklearn.model_selection import train_test_split\n", + "\n", + "class CustomDataset(Dataset):\n", + " def __init__(self, file_paths, transform=None):\n", + " self.file_paths = file_paths\n", + " self.transform = transform\n", + " self.file_names = [os.path.basename(path) for path in file_paths]\n", + "\n", + " def __len__(self):\n", + " return len(self.file_paths)\n", + "\n", + " def __getitem__(self, idx):\n", + " data = torch.load(self.file_paths[idx], weights_only=True)\n", + " \n", + " images = data[:6] #first 6 channels are the heatmaps\n", + " labels = data[6] #last channel is the label\n", + " \n", + " images = images.float() \n", + " labels = labels.long() \n", + " labels = labels + 1 #labels are -1 to 3, add 1 to make them 0 to 4\n", + "\n", + " if self.transform:\n", + " images = self.transform(images)\n", + " labels = self.transform(labels)\n", + " \n", + " return images, labels, self.file_names[idx]\n", + "\n", + "class CustomDataset_test(Dataset):\n", + " def __init__(self, file_paths, transform=None):\n", + " self.file_paths = file_paths\n", + " self.transform = transform\n", + " self.file_names = [os.path.basename(path) for path in file_paths]\n", + "\n", + " def __len__(self):\n", + " return len(self.file_paths)\n", + "\n", + " def __getitem__(self, idx):\n", + " data = torch.load(self.file_paths[idx], weights_only=True)\n", + " \n", + " images = data[:6] #only load first 6 channels, labels are not in val_set and test_set\n", + " \n", + " images = images.float() \n", + "\n", + " if self.transform:\n", + " images = self.transform(images)\n", + " \n", + " return images, self.file_names[idx]\n", + "\n", + "# extend base_path to file_path\n", + "def generate_file_paths(base_path):\n", + " file_paths = []\n", + " for frame in os.listdir(base_path):\n", + " frame_path = os.path.join(base_path, frame)\n", + " if frame_path.endswith('.mat.pt'):\n", + " file_paths.append(frame_path)\n", + " return [path for path in file_paths if os.path.exists(path)]\n", + "\n", + "def load_data(base_path, batch_size=4, num_workers=2, test_size=0.2):\n", + " file_paths = generate_file_paths(base_path)\n", + " \n", + " train_paths, test_paths = train_test_split(file_paths, test_size=test_size, random_state=42)\n", + " \n", + " train_dataset = CustomDataset(file_paths=train_paths)\n", + " test_dataset = CustomDataset(file_paths=test_paths)\n", + " \n", + " train_loader = DataLoader(\n", + " train_dataset, \n", + " batch_size=batch_size, \n", + " shuffle=True, \n", + " num_workers=num_workers, \n", + " drop_last=True\n", + " )\n", + " \n", + " test_loader = DataLoader(\n", + " test_dataset, \n", + " batch_size=batch_size, \n", + " shuffle=False, \n", + " num_workers=num_workers, \n", + " drop_last=True\n", + " )\n", + " \n", + " return train_loader, test_loader\n" + ] + }, + { + "cell_type": "markdown", + "id": "67cd6c15", + "metadata": {}, + "source": [ + "## Loss Function" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "4c573803", + "metadata": {}, + "outputs": [], + "source": [ + "#Used to handle the problem of class imbalance\n", + "\n", + "def to_one_hot(tensor, nClasses):\n", + " n, h, w = tensor.size()\n", + " one_hot = torch.zeros(n, nClasses, h, w, device=tensor.device)\n", + " index_tensor = tensor.long().view(n, 1, h, w)\n", + " one_hot = one_hot.scatter_(1, index_tensor, 1)\n", + " return one_hot\n", + "\n", + "def _neg_loss(pred, gt):\n", + " pred = torch.clamp(pred, 1e-5, 1-1e-5)\n", + "\n", + " pos_inds = gt.eq(1).float()\n", + " neg_inds = gt.eq(0).float()\n", + "\n", + " balance_cof = 1.0\n", + " pos_loss = torch.log(pred) * torch.pow(1 - pred, 2) * pos_inds * balance_cof\n", + " neg_loss = torch.log(1 - pred) * torch.pow(pred, 2) * neg_inds\n", + " num_pos = pos_inds.float().sum()\n", + " pos_loss_sum = pos_loss.sum()\n", + " neg_loss_sum = neg_loss.sum()\n", + " if num_pos == 0:\n", + " loss = -neg_loss_sum\n", + " else:\n", + " loss = -(pos_loss_sum + neg_loss_sum) / num_pos\n", + " return loss\n", + "\n", + "class FocalLoss(nn.Module):\n", + " def __init__(self):\n", + " super(FocalLoss, self).__init__()\n", + " self.neg_loss = _neg_loss\n", + "\n", + " def forward(self, out, target):\n", + " return self.neg_loss(out, target)" + ] + }, + { + "cell_type": "markdown", + "id": "dec2b582", + "metadata": {}, + "source": [ + "## Train" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "7c2f0301", + "metadata": {}, + "outputs": [], + "source": [ + "import torch.optim as optim\n", + "import matplotlib.pyplot as plt\n", + "import time\n", + "\n", + "device = torch.device(\"cuda:0\" if torch.cuda.is_available() else \"cpu\")\n", + "\n", + "num_epochs = 20\n", + "\n", + "base_path = '/bohr/train-22pn/v2/training_set'\n", + "train_loader, test_loader = load_data(\n", + " base_path=base_path,\n", + " batch_size=4,\n", + " num_workers=2,\n", + " test_size=0.2\n", + ")\n", + "\n", + "dimssnet = DIMSSNet().to(device)\n", + "criterion = FocalLoss()\n", + "optimizer = optim.Adam(dimssnet.parameters(), lr=0.001)\n", + "start_time = time.time()\n", + "test_loss_record = []\n", + "train_loss_record = []\n", + "\n", + "for epoch in range(num_epochs):\n", + " dimssnet.train()\n", + " running_loss = 0.0\n", + " for images, labels, _ in train_loader:\n", + " images = images.to(device)\n", + " labels = labels.to(device)\n", + " \n", + " images = [image.unsqueeze(1) for image in images]\n", + " images = torch.stack(images, dim=0)\n", + " images = images.float()\n", + " \n", + " outputs = dimssnet(images[:, 0, :, :], images[:, 1, :, :], images[:, 2, :, :],\n", + " images[:, 3, :, :], images[:, 4, :, :], images[:, 5, :, :])\n", + "\n", + " outputs_resized = F.interpolate(outputs, size=(TARGET_HEIGHT, TARGET_WIDTH), mode='bilinear', align_corners=False)\n", + " labels = to_one_hot(labels, n_class)\n", + " \n", + " loss = criterion(outputs_resized, labels.long())\n", + " optimizer.zero_grad()\n", + " loss.backward()\n", + " optimizer.step()\n", + " \n", + " running_loss += loss.item()\n", + "\n", + " test_loss = 0.0\n", + " dimssnet.eval()\n", + " with torch.no_grad():\n", + " for images, labels, _ in test_loader:\n", + " images = images.to(device)\n", + " labels = labels.to(device)\n", + " \n", + " images = [image.unsqueeze(1) for image in images]\n", + " images = torch.stack(images, dim=0)\n", + " images = images.float()\n", + " \n", + " outputs = dimssnet(images[:, 0, :, :], images[:, 1, :, :], images[:, 2, :, :],\n", + " images[:, 3, :, :], images[:, 4, :, :], images[:, 5, :, :])\n", + " \n", + " outputs_resized = F.interpolate(outputs, size=(TARGET_HEIGHT, TARGET_WIDTH), mode='bilinear', align_corners=False)\n", + " labels = to_one_hot(labels, n_class)\n", + " \n", + " loss = criterion(outputs_resized, labels.long())\n", + " test_loss += loss.item()\n", + " \n", + " test_loss_record.append(test_loss/len(test_loader))\n", + " train_loss_record.append(running_loss/len(train_loader))\n", + " print(f\"Epoch {epoch+1}/{num_epochs}, Training Loss: {running_loss/len(train_loader):.4f}, Test Loss: {test_loss/len(test_loader):.4f}\")\n", + "\n", + "# Create a new state_dict and add the \"model\" prefix, in order to match the loading method in metrics\n", + "new_state_dict = {}\n", + "for k, v in dimssnet.state_dict().items():\n", + " new_key = f\"model.{k}\" \n", + " new_state_dict[new_key] = v\n", + "\n", + "print(\"dimssnet successfully saved!\") \n", + "print(\"Training finished.\")\n", + "end_time = time.time()\n", + "total_time = end_time - start_time\n", + "print(f\"Training completed in {total_time} seconds\")" + ] + }, + { + "cell_type": "markdown", + "id": "f001aee8", + "metadata": {}, + "source": [ + "## Inference" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "8b330819", + "metadata": {}, + "outputs": [], + "source": [ + "# Run inference on validation set and testing set\n", + "import pandas as pd\n", + "\n", + "def run_inference(model, data_loader):\n", + " model.eval()\n", + " predictions = []\n", + " filenames = []\n", + " \n", + " with torch.no_grad():\n", + " for images, file_names in data_loader:\n", + " images = images.cuda() if torch.cuda.is_available() else images\n", + " \n", + " x = [image.unsqueeze(1) for image in images]\n", + " x = torch.stack(x, dim=0)\n", + " x = x.float()\n", + " \n", + " # Forward propagation\n", + " outputs = model(x[:, 0, :, :], x[:, 1, :, :], x[:, 2, :, :],\n", + " x[:, 3, :, :], x[:, 4, :, :], x[:, 5, :, :])\n", + " \n", + " # Adjust the output size\n", + " outputs = F.interpolate(outputs, size=(50, 181), mode='bilinear', align_corners=False)\n", + "\n", + " preds = torch.argmax(outputs, dim=1)\n", + " \n", + " preds = preds - 1\n", + " \n", + " for i, pred in enumerate(preds):\n", + " predictions.append(pred.cpu().numpy().flatten())\n", + " filenames.append(file_names[i])\n", + " \n", + " return predictions, filenames\n", + "\n", + "# Load validation set\n", + "if os.environ.get('DATA_PATH'):\n", + " DATA_PATH = os.environ.get(\"DATA_PATH\") + \"/\" \n", + "else:\n", + " DATA_PATH = \"\" # Fallback for local testing\n", + "# Load validation set\n", + "val_paths = generate_file_paths(DATA_PATH + 'validation_set')\n", + "val_dataset = CustomDataset_test(file_paths=val_paths)\n", + "val_loader = DataLoader(\n", + " val_dataset,\n", + " batch_size=1,\n", + " shuffle=False,\n", + " num_workers=0\n", + ")\n", + "\n", + "# Load testing set\n", + "if os.environ.get('DATA_PATH'):\n", + " DATA_PATH = os.environ.get(\"DATA_PATH\") + \"/\" \n", + "else:\n", + " DATA_PATH = \"\" # Fallback for local testing\n", + "# Load testing set\n", + "test_paths = generate_file_paths(DATA_PATH + 'testing_set')\n", + "test_dataset = CustomDataset_test(file_paths=test_paths)\n", + "test_loader = DataLoader(\n", + " test_dataset,\n", + " batch_size=1,\n", + " shuffle=False,\n", + " num_workers=0\n", + ")\n", + "\n", + "# Run inference on validation set\n", + "print(\"Running inference on validation set...\")\n", + "val_predictions, val_filenames = run_inference(dimssnet, val_loader)\n", + "\n", + "# Save validation results to CSV\n", + "val_results = []\n", + "for filename, pred in zip(val_filenames, val_predictions):\n", + " # Create a row with filename and flattened predictions\n", + " row = {'filename': filename}\n", + " for i, p in enumerate(pred):\n", + " row[f'pixel_{i}'] = p\n", + " val_results.append(row)\n", + "\n", + "val_df = pd.DataFrame(val_results)\n", + "val_df.to_csv('submission_val.csv', index=False)\n", + "print(f\"Validation results saved to output_validation.csv with shape: {val_df.shape}\")\n", + "\n", + "# Run inference on testing set\n", + "print(\"Running inference on testing set...\")\n", + "test_predictions, test_filenames = run_inference(dimssnet, test_loader)\n", + "\n", + "# Save testing results to CSV\n", + "test_results = []\n", + "for filename, pred in zip(test_filenames, test_predictions):\n", + " # Create a row with filename and flattened predictions\n", + " row = {'filename': filename}\n", + " for i, p in enumerate(pred):\n", + " row[f'pixel_{i}'] = p\n", + " test_results.append(row)\n", + "\n", + "test_df = pd.DataFrame(test_results)\n", + "test_df.to_csv('submission_test.csv', index=False)\n", + "print(f\"Testing results saved to output_testing.csv with shape: {test_df.shape}\")\n", + "\n", + "print(\"\\nInference completed! Results saved to:\")\n", + "print(\"- submission_val_ref.csv (for validation set leaderboard)\")\n", + "print(\"- submission_test_ref.csv (for testing set leaderboard)\")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "72fde72d", + "metadata": {}, + "outputs": [], + "source": [ + "import zipfile\n", + "import os\n", + "\n", + "# Define the files to zip and the zip file name.\n", + "files_to_zip = ['submission_val.csv', 'submission_test.csv']\n", + "zip_filename = 'submission.zip'\n", + "\n", + "# Create a zip file\n", + "with zipfile.ZipFile(zip_filename, 'w') as zipf:\n", + " for file in files_to_zip:\n", + " # Add the file to the zip fil\n", + " zipf.write(file, os.path.basename(file))\n", + "\n", + "print(f'{zip_filename} Created successfully!')" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.12.9" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/benchmark/IOL/ioling_hf/evals/results/HuggingFaceTB__SmolLM3-3B__diverse5.scores.jsonl b/benchmark/IOL/ioling_hf/evals/results/HuggingFaceTB__SmolLM3-3B__diverse5.scores.jsonl new file mode 100644 index 0000000000000000000000000000000000000000..436ee22545303cca3898ac6816005e06fc24bca7 --- /dev/null +++ b/benchmark/IOL/ioling_hf/evals/results/HuggingFaceTB__SmolLM3-3B__diverse5.scores.jsonl @@ -0,0 +1,5 @@ +{"record_id": "iol-2006-individual-p1-sub-assignment_1", "score": 0.0, "max_score": 4.0, "score_fraction": 0.0, "verdict": "incorrect", "matched_units": [], "missed_units": ["assignment_1.1", "assignment_1.2", "assignment_1.3", "assignment_1.4"], "unit_results": [{"unit_id": "assignment_1.1", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 39.437, "full_output_similarity": 75.0}, {"unit_id": "assignment_1.2", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 39.286, "full_output_similarity": 75.758}, {"unit_id": "assignment_1.3", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 41.667, "full_output_similarity": 56.818}, {"unit_id": "assignment_1.4", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 46.154, "full_output_similarity": 85.714}], "method": "normalized_final_answer_unit_fuzzy_v3", "scoring_scope": "final_answer_only", "scorer_thresholds": {"final_partial_ratio": 92, "full_output_partial_ratio": null}, "needs_human_review": true, "model": "HuggingFaceTB/SmolLM3-3B"} +{"record_id": "iol-2011-individual-p1-sub-a", "score": 0.0, "max_score": 1.0, "score_fraction": 0.0, "verdict": "incorrect", "matched_units": [], "missed_units": ["a.1"], "unit_results": [{"unit_id": "a.1", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 48.5, "full_output_similarity": 48.5}], "method": "normalized_final_answer_unit_fuzzy_v3", "scoring_scope": "final_answer_only", "scorer_thresholds": {"final_partial_ratio": 92, "full_output_partial_ratio": null}, "needs_human_review": true, "model": "HuggingFaceTB/SmolLM3-3B"} +{"record_id": "iol-2015-individual-p5-sub-b", "score": 0.0, "max_score": 9.0, "score_fraction": 0.0, "verdict": "incorrect", "matched_units": [], "missed_units": ["b.1", "b.2", "b.3", "b.4", "b.5", "b.6", "b.7", "b.8", "b.9"], "unit_results": [{"unit_id": "b.1", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 21.739, "full_output_similarity": 77.778}, {"unit_id": "b.2", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 21.053, "full_output_similarity": 82.609}, {"unit_id": "b.3", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 21.739, "full_output_similarity": 77.778}, {"unit_id": "b.4", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 23.256, "full_output_similarity": 75.0}, {"unit_id": "b.5", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 20.513, "full_output_similarity": 75.0}, {"unit_id": "b.6", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 25.0, "full_output_similarity": 75.862}, {"unit_id": "b.7", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 22.727, "full_output_similarity": 80.0}, {"unit_id": "b.8", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 24.561, "full_output_similarity": 70.0}, {"unit_id": "b.9", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 21.739, "full_output_similarity": 77.778}], "method": "normalized_final_answer_unit_fuzzy_v3", "scoring_scope": "final_answer_only", "scorer_thresholds": {"final_partial_ratio": 92, "full_output_partial_ratio": null}, "needs_human_review": true, "model": "HuggingFaceTB/SmolLM3-3B"} +{"record_id": "iol-2021-individual-p2-sub-a", "score": 0.0, "max_score": 9.0, "score_fraction": 0.0, "verdict": "incorrect", "matched_units": [], "missed_units": ["a.1", "a.2", "a.3", "a.4", "a.5", "a.6", "a.7", "a.8", "a.9"], "unit_results": [{"unit_id": "a.1", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 25.197, "full_output_similarity": 48.718}, {"unit_id": "a.2", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 30.0, "full_output_similarity": 66.667}, {"unit_id": "a.3", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 31.25, "full_output_similarity": 70.0}, {"unit_id": "a.4", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 25.0, "full_output_similarity": 89.286}, {"unit_id": "a.5", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 31.579, "full_output_similarity": 60.606}, {"unit_id": "a.6", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 27.586, "full_output_similarity": 73.333}, {"unit_id": "a.7", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 30.769, "full_output_similarity": 77.778}, {"unit_id": "a.8", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 29.032, "full_output_similarity": 67.742}, {"unit_id": "a.9", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 28.571, "full_output_similarity": 77.778}], "method": "normalized_final_answer_unit_fuzzy_v3", "scoring_scope": "final_answer_only", "scorer_thresholds": {"final_partial_ratio": 92, "full_output_partial_ratio": null}, "needs_human_review": true, "model": "HuggingFaceTB/SmolLM3-3B"} +{"record_id": "iol-2025-team-p1-sub-a", "score": 0.0, "max_score": 1.0, "score_fraction": 0.0, "verdict": "incorrect", "matched_units": [], "missed_units": ["a.1"], "unit_results": [{"unit_id": "a.1", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 32.738, "full_output_similarity": 32.738}], "method": "normalized_final_answer_unit_fuzzy_v3", "scoring_scope": "final_answer_only", "scorer_thresholds": {"final_partial_ratio": 92, "full_output_partial_ratio": null}, "needs_human_review": true, "model": "HuggingFaceTB/SmolLM3-3B"} diff --git a/benchmark/IOL/ioling_hf/evals/results/Qwen__Qwen2.5-3B-Instruct__diverse5.scores.jsonl b/benchmark/IOL/ioling_hf/evals/results/Qwen__Qwen2.5-3B-Instruct__diverse5.scores.jsonl new file mode 100644 index 0000000000000000000000000000000000000000..c9ad9822fcb7465cc4b4d8e8cebcb95a3faa935d --- /dev/null +++ b/benchmark/IOL/ioling_hf/evals/results/Qwen__Qwen2.5-3B-Instruct__diverse5.scores.jsonl @@ -0,0 +1,5 @@ +{"record_id": "iol-2006-individual-p1-sub-assignment_1", "score": 0.0, "max_score": 4.0, "score_fraction": 0.0, "verdict": "incorrect", "matched_units": [], "missed_units": ["assignment_1.1", "assignment_1.2", "assignment_1.3", "assignment_1.4"], "unit_results": [{"unit_id": "assignment_1.1", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 0.0, "full_output_similarity": 92.5}, {"unit_id": "assignment_1.2", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 0.0, "full_output_similarity": 84.848}, {"unit_id": "assignment_1.3", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 0.0, "full_output_similarity": 54.545}, {"unit_id": "assignment_1.4", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 0.0, "full_output_similarity": 78.571}], "method": "normalized_final_answer_unit_fuzzy_v3", "scoring_scope": "final_answer_only", "scorer_thresholds": {"final_partial_ratio": 92, "full_output_partial_ratio": null}, "needs_human_review": true, "model": "Qwen/Qwen2.5-3B-Instruct"} +{"record_id": "iol-2011-individual-p1-sub-a", "score": 0.0, "max_score": 1.0, "score_fraction": 0.0, "verdict": "incorrect", "matched_units": [], "missed_units": ["a.1"], "unit_results": [{"unit_id": "a.1", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 49.0, "full_output_similarity": 49.0}], "method": "normalized_final_answer_unit_fuzzy_v3", "scoring_scope": "final_answer_only", "scorer_thresholds": {"final_partial_ratio": 92, "full_output_partial_ratio": null}, "needs_human_review": true, "model": "Qwen/Qwen2.5-3B-Instruct"} +{"record_id": "iol-2015-individual-p5-sub-b", "score": 0.0, "max_score": 9.0, "score_fraction": 0.0, "verdict": "incorrect", "matched_units": [], "missed_units": ["b.1", "b.2", "b.3", "b.4", "b.5", "b.6", "b.7", "b.8", "b.9"], "unit_results": [{"unit_id": "b.1", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 22.857, "full_output_similarity": 77.778}, {"unit_id": "b.2", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 22.222, "full_output_similarity": 82.609}, {"unit_id": "b.3", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 20.0, "full_output_similarity": 77.778}, {"unit_id": "b.4", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 25.0, "full_output_similarity": 75.0}, {"unit_id": "b.5", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 22.222, "full_output_similarity": 75.0}, {"unit_id": "b.6", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 25.0, "full_output_similarity": 75.862}, {"unit_id": "b.7", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 22.222, "full_output_similarity": 52.0}, {"unit_id": "b.8", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 24.242, "full_output_similarity": 50.0}, {"unit_id": "b.9", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 22.222, "full_output_similarity": 77.778}], "method": "normalized_final_answer_unit_fuzzy_v3", "scoring_scope": "final_answer_only", "scorer_thresholds": {"final_partial_ratio": 92, "full_output_partial_ratio": null}, "needs_human_review": true, "model": "Qwen/Qwen2.5-3B-Instruct"} +{"record_id": "iol-2021-individual-p2-sub-a", "score": 0.0, "max_score": 9.0, "score_fraction": 0.0, "verdict": "incorrect", "matched_units": [], "missed_units": ["a.1", "a.2", "a.3", "a.4", "a.5", "a.6", "a.7", "a.8", "a.9"], "unit_results": [{"unit_id": "a.1", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 30.769, "full_output_similarity": 46.154}, {"unit_id": "a.2", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 33.333, "full_output_similarity": 66.667}, {"unit_id": "a.3", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 34.483, "full_output_similarity": 70.0}, {"unit_id": "a.4", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 28.571, "full_output_similarity": 89.286}, {"unit_id": "a.5", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 36.364, "full_output_similarity": 60.606}, {"unit_id": "a.6", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 35.714, "full_output_similarity": 73.333}, {"unit_id": "a.7", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 33.333, "full_output_similarity": 77.778}, {"unit_id": "a.8", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 35.484, "full_output_similarity": 67.742}, {"unit_id": "a.9", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 32.787, "full_output_similarity": 75.0}], "method": "normalized_final_answer_unit_fuzzy_v3", "scoring_scope": "final_answer_only", "scorer_thresholds": {"final_partial_ratio": 92, "full_output_partial_ratio": null}, "needs_human_review": true, "model": "Qwen/Qwen2.5-3B-Instruct"} +{"record_id": "iol-2025-team-p1-sub-a", "score": 0.0, "max_score": 1.0, "score_fraction": 0.0, "verdict": "incorrect", "matched_units": [], "missed_units": ["a.1"], "unit_results": [{"unit_id": "a.1", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 32.143, "full_output_similarity": 36.31}], "method": "normalized_final_answer_unit_fuzzy_v3", "scoring_scope": "final_answer_only", "scorer_thresholds": {"final_partial_ratio": 92, "full_output_partial_ratio": null}, "needs_human_review": true, "model": "Qwen/Qwen2.5-3B-Instruct"} diff --git a/benchmark/IOL/ioling_hf/evals/results/google__gemma-3-12b-it__diverse5.scores.jsonl b/benchmark/IOL/ioling_hf/evals/results/google__gemma-3-12b-it__diverse5.scores.jsonl new file mode 100644 index 0000000000000000000000000000000000000000..8ed5230f580a9b01262fd8e217634710fcbc0c44 --- /dev/null +++ b/benchmark/IOL/ioling_hf/evals/results/google__gemma-3-12b-it__diverse5.scores.jsonl @@ -0,0 +1,5 @@ +{"record_id": "iol-2006-individual-p1-sub-assignment_1", "score": 0.0, "max_score": 4.0, "score_fraction": 0.0, "verdict": "incorrect", "matched_units": [], "missed_units": ["assignment_1.1", "assignment_1.2", "assignment_1.3", "assignment_1.4"], "unit_results": [{"unit_id": "assignment_1.1", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 80.0, "full_output_similarity": 80.0}, {"unit_id": "assignment_1.2", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 75.758, "full_output_similarity": 75.758}, {"unit_id": "assignment_1.3", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 51.19, "full_output_similarity": 51.19}, {"unit_id": "assignment_1.4", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 72.727, "full_output_similarity": 72.727}], "method": "normalized_final_answer_unit_fuzzy_v3", "scoring_scope": "final_answer_only", "scorer_thresholds": {"final_partial_ratio": 92, "full_output_partial_ratio": null}, "needs_human_review": true, "model": "google/gemma-3-12b-it"} +{"record_id": "iol-2011-individual-p1-sub-a", "score": 0.0, "max_score": 1.0, "score_fraction": 0.0, "verdict": "incorrect", "matched_units": [], "missed_units": ["a.1"], "unit_results": [{"unit_id": "a.1", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 57.0, "full_output_similarity": 50.98}], "method": "normalized_final_answer_unit_fuzzy_v3", "scoring_scope": "final_answer_only", "scorer_thresholds": {"final_partial_ratio": 92, "full_output_partial_ratio": null}, "needs_human_review": true, "model": "google/gemma-3-12b-it"} +{"record_id": "iol-2015-individual-p5-sub-b", "score": 0.0, "max_score": 9.0, "score_fraction": 0.0, "verdict": "incorrect", "matched_units": [], "missed_units": ["b.1", "b.2", "b.3", "b.4", "b.5", "b.6", "b.7", "b.8", "b.9"], "unit_results": [{"unit_id": "b.1", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 29.63, "full_output_similarity": 77.778}, {"unit_id": "b.2", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 30.435, "full_output_similarity": 82.609}, {"unit_id": "b.3", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 29.787, "full_output_similarity": 77.778}, {"unit_id": "b.4", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 29.167, "full_output_similarity": 75.0}, {"unit_id": "b.5", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 25.532, "full_output_similarity": 75.0}, {"unit_id": "b.6", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 31.034, "full_output_similarity": 75.862}, {"unit_id": "b.7", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 32.0, "full_output_similarity": 80.0}, {"unit_id": "b.8", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 30.0, "full_output_similarity": 70.0}, {"unit_id": "b.9", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 29.63, "full_output_similarity": 77.778}], "method": "normalized_final_answer_unit_fuzzy_v3", "scoring_scope": "final_answer_only", "scorer_thresholds": {"final_partial_ratio": 92, "full_output_partial_ratio": null}, "needs_human_review": true, "model": "google/gemma-3-12b-it"} +{"record_id": "iol-2021-individual-p2-sub-a", "score": 0.0, "max_score": 9.0, "score_fraction": 0.0, "verdict": "incorrect", "matched_units": [], "missed_units": ["a.1", "a.2", "a.3", "a.4", "a.5", "a.6", "a.7", "a.8", "a.9"], "unit_results": [{"unit_id": "a.1", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 50.0, "full_output_similarity": 50.0}, {"unit_id": "a.2", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 66.667, "full_output_similarity": 66.667}, {"unit_id": "a.3", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 70.0, "full_output_similarity": 70.0}, {"unit_id": "a.4", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 89.286, "full_output_similarity": 89.286}, {"unit_id": "a.5", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 60.606, "full_output_similarity": 60.606}, {"unit_id": "a.6", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 73.333, "full_output_similarity": 73.333}, {"unit_id": "a.7", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 77.778, "full_output_similarity": 77.778}, {"unit_id": "a.8", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 67.742, "full_output_similarity": 67.742}, {"unit_id": "a.9", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 75.0, "full_output_similarity": 75.0}], "method": "normalized_final_answer_unit_fuzzy_v3", "scoring_scope": "final_answer_only", "scorer_thresholds": {"final_partial_ratio": 92, "full_output_partial_ratio": null}, "needs_human_review": true, "model": "google/gemma-3-12b-it"} +{"record_id": "iol-2025-team-p1-sub-a", "score": 0.0, "max_score": 1.0, "score_fraction": 0.0, "verdict": "incorrect", "matched_units": [], "missed_units": ["a.1"], "unit_results": [{"unit_id": "a.1", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 44.444, "full_output_similarity": 28.571}], "method": "normalized_final_answer_unit_fuzzy_v3", "scoring_scope": "final_answer_only", "scorer_thresholds": {"final_partial_ratio": 92, "full_output_partial_ratio": null}, "needs_human_review": true, "model": "google/gemma-3-12b-it"} diff --git a/benchmark/IOL/ioling_hf/evals/results/google__gemma-3-12b-it__strict30.scores.jsonl b/benchmark/IOL/ioling_hf/evals/results/google__gemma-3-12b-it__strict30.scores.jsonl new file mode 100644 index 0000000000000000000000000000000000000000..b627aab52fa3059b103d0bdec57ed97c47629723 --- /dev/null +++ b/benchmark/IOL/ioling_hf/evals/results/google__gemma-3-12b-it__strict30.scores.jsonl @@ -0,0 +1,30 @@ +{"record_id": "iol-2006-individual-p1-sub-assignment_1", "score": 0.0, "max_score": 4.0, "score_fraction": 0.0, "verdict": "incorrect", "matched_units": [], "missed_units": ["assignment_1.1", "assignment_1.2", "assignment_1.3", "assignment_1.4"], "unit_results": [{"unit_id": "assignment_1.1", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 81.013, "full_output_similarity": 80.0}, {"unit_id": "assignment_1.2", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 75.758, "full_output_similarity": 75.758}, {"unit_id": "assignment_1.3", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 55.682, "full_output_similarity": 55.682}, {"unit_id": "assignment_1.4", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 74.074, "full_output_similarity": 71.429}], "method": "normalized_final_answer_unit_fuzzy_v3", "scoring_scope": "final_answer_only", "scorer_thresholds": {"final_partial_ratio": 92, "full_output_partial_ratio": null}, "needs_human_review": true, "model": "google/gemma-3-12b-it"} +{"record_id": "iol-2006-individual-p5", "score": 0.0, "max_score": 1.0, "score_fraction": 0.0, "verdict": "incorrect", "matched_units": [], "missed_units": ["full.1"], "unit_results": [{"unit_id": "full.1", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 52.83, "full_output_similarity": 45.879}], "method": "normalized_final_answer_unit_fuzzy_v3", "scoring_scope": "final_answer_only", "scorer_thresholds": {"final_partial_ratio": 92, "full_output_partial_ratio": null}, "needs_human_review": true, "model": "google/gemma-3-12b-it"} +{"record_id": "iol-2007-individual-p5", "score": 0.0, "max_score": 4.0, "score_fraction": 0.0, "verdict": "incorrect", "matched_units": [], "missed_units": ["full.1", "full.2", "full.3", "full.4"], "unit_results": [{"unit_id": "full.1", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 41.379, "full_output_similarity": 65.517}, {"unit_id": "full.2", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 43.333, "full_output_similarity": 45.714}, {"unit_id": "full.3", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 47.826, "full_output_similarity": 56.522}, {"unit_id": "full.4", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 44.444, "full_output_similarity": 45.161}], "method": "normalized_final_answer_unit_fuzzy_v3", "scoring_scope": "final_answer_only", "scorer_thresholds": {"final_partial_ratio": 92, "full_output_partial_ratio": null}, "needs_human_review": true, "model": "google/gemma-3-12b-it"} +{"record_id": "iol-2008-individual-p2-sub-b", "score": 0.0, "max_score": 1.0, "score_fraction": 0.0, "verdict": "incorrect", "matched_units": [], "missed_units": ["b.1"], "unit_results": [{"unit_id": "b.1", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 34.703, "full_output_similarity": 47.953}], "method": "normalized_final_answer_unit_fuzzy_v3", "scoring_scope": "final_answer_only", "scorer_thresholds": {"final_partial_ratio": 92, "full_output_partial_ratio": null}, "needs_human_review": true, "model": "google/gemma-3-12b-it"} +{"record_id": "iol-2008-team-p1-sub-a", "score": 0.0, "max_score": 1.0, "score_fraction": 0.0, "verdict": "incorrect", "matched_units": [], "missed_units": ["a.1"], "unit_results": [{"unit_id": "a.1", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 44.646, "full_output_similarity": 46.552}], "method": "normalized_final_answer_unit_fuzzy_v3", "scoring_scope": "final_answer_only", "scorer_thresholds": {"final_partial_ratio": 92, "full_output_partial_ratio": null}, "needs_human_review": true, "model": "google/gemma-3-12b-it"} +{"record_id": "iol-2009-individual-p4-sub-a", "score": 0.0, "max_score": 1.0, "score_fraction": 0.0, "verdict": "incorrect", "matched_units": [], "missed_units": ["a.1"], "unit_results": [{"unit_id": "a.1", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 53.927, "full_output_similarity": 53.927}], "method": "normalized_final_answer_unit_fuzzy_v3", "scoring_scope": "final_answer_only", "scorer_thresholds": {"final_partial_ratio": 92, "full_output_partial_ratio": null}, "needs_human_review": true, "model": "google/gemma-3-12b-it"} +{"record_id": "iol-2010-individual-p2-sub-a", "score": 0.0, "max_score": 1.0, "score_fraction": 0.0, "verdict": "incorrect", "matched_units": [], "missed_units": ["a.1"], "unit_results": [{"unit_id": "a.1", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 86.653, "full_output_similarity": 86.885}], "method": "normalized_final_answer_unit_fuzzy_v3", "scoring_scope": "final_answer_only", "scorer_thresholds": {"final_partial_ratio": 92, "full_output_partial_ratio": null}, "needs_human_review": true, "model": "google/gemma-3-12b-it"} +{"record_id": "iol-2010-team-p1", "score": 0.0, "max_score": 1.0, "score_fraction": 0.0, "verdict": "incorrect", "matched_units": [], "missed_units": ["full.1"], "unit_results": [{"unit_id": "full.1", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 39.037, "full_output_similarity": 35.579}], "method": "normalized_final_answer_unit_fuzzy_v3", "scoring_scope": "final_answer_only", "scorer_thresholds": {"final_partial_ratio": 92, "full_output_partial_ratio": null}, "needs_human_review": true, "model": "google/gemma-3-12b-it"} +{"record_id": "iol-2011-individual-p3-sub-a", "score": 0.0, "max_score": 1.0, "score_fraction": 0.0, "verdict": "incorrect", "matched_units": [], "missed_units": ["a.1"], "unit_results": [{"unit_id": "a.1", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 51.667, "full_output_similarity": 79.137}], "method": "normalized_final_answer_unit_fuzzy_v3", "scoring_scope": "final_answer_only", "scorer_thresholds": {"final_partial_ratio": 92, "full_output_partial_ratio": null}, "needs_human_review": true, "model": "google/gemma-3-12b-it"} +{"record_id": "iol-2012-individual-p1-sub-a", "score": 0.0, "max_score": 1.0, "score_fraction": 0.0, "verdict": "incorrect", "matched_units": [], "missed_units": ["a.1"], "unit_results": [{"unit_id": "a.1", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 33.333, "full_output_similarity": 46.377}], "method": "normalized_final_answer_unit_fuzzy_v3", "scoring_scope": "final_answer_only", "scorer_thresholds": {"final_partial_ratio": 92, "full_output_partial_ratio": null}, "needs_human_review": true, "model": "google/gemma-3-12b-it"} +{"record_id": "iol-2012-individual-p5-sub-a", "score": 0.0, "max_score": 1.0, "score_fraction": 0.0, "verdict": "incorrect", "matched_units": [], "missed_units": ["a.1"], "unit_results": [{"unit_id": "a.1", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 82.796, "full_output_similarity": 80.412}], "method": "normalized_final_answer_unit_fuzzy_v3", "scoring_scope": "final_answer_only", "scorer_thresholds": {"final_partial_ratio": 92, "full_output_partial_ratio": null}, "needs_human_review": true, "model": "google/gemma-3-12b-it"} +{"record_id": "iol-2013-individual-p3", "score": 0.0, "max_score": 5.0, "score_fraction": 0.0, "verdict": "incorrect", "matched_units": [], "missed_units": ["full.1", "full.2", "full.3", "full.4", "full.5"], "unit_results": [{"unit_id": "full.1", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 50.0, "full_output_similarity": 66.667}, {"unit_id": "full.2", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 31.765, "full_output_similarity": 47.059}, {"unit_id": "full.3", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 27.5, "full_output_similarity": 43.75}, {"unit_id": "full.4", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 26.846, "full_output_similarity": 40.0}, {"unit_id": "full.5", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 29.885, "full_output_similarity": 55.172}], "method": "normalized_final_answer_unit_fuzzy_v3", "scoring_scope": "final_answer_only", "scorer_thresholds": {"final_partial_ratio": 92, "full_output_partial_ratio": null}, "needs_human_review": true, "model": "google/gemma-3-12b-it"} +{"record_id": "iol-2014-individual-p2", "score": 0.0, "max_score": 1.0, "score_fraction": 0.0, "verdict": "incorrect", "matched_units": [], "missed_units": ["full.1"], "unit_results": [{"unit_id": "full.1", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 66.667, "full_output_similarity": 66.667}], "method": "normalized_final_answer_unit_fuzzy_v3", "scoring_scope": "final_answer_only", "scorer_thresholds": {"final_partial_ratio": 92, "full_output_partial_ratio": null}, "needs_human_review": true, "model": "google/gemma-3-12b-it"} +{"record_id": "iol-2014-individual-p5-sub-a", "score": 0.0, "max_score": 1.0, "score_fraction": 0.0, "verdict": "incorrect", "matched_units": [], "missed_units": ["a.1"], "unit_results": [{"unit_id": "a.1", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 44.531, "full_output_similarity": 48.59}], "method": "normalized_final_answer_unit_fuzzy_v3", "scoring_scope": "final_answer_only", "scorer_thresholds": {"final_partial_ratio": 92, "full_output_partial_ratio": null}, "needs_human_review": true, "model": "google/gemma-3-12b-it"} +{"record_id": "iol-2015-individual-p3-sub-a", "score": 0.0, "max_score": 5.0, "score_fraction": 0.0, "verdict": "incorrect", "matched_units": [], "missed_units": ["a.1", "a.2", "a.3", "a.4", "a.5"], "unit_results": [{"unit_id": "a.1", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 60.0, "full_output_similarity": 60.0}, {"unit_id": "a.2", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 49.367, "full_output_similarity": 50.633}, {"unit_id": "a.3", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 48.571, "full_output_similarity": 52.857}, {"unit_id": "a.4", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 70.27, "full_output_similarity": 72.973}, {"unit_id": "a.5", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 51.25, "full_output_similarity": 53.75}], "method": "normalized_final_answer_unit_fuzzy_v3", "scoring_scope": "final_answer_only", "scorer_thresholds": {"final_partial_ratio": 92, "full_output_partial_ratio": null}, "needs_human_review": true, "model": "google/gemma-3-12b-it"} +{"record_id": "iol-2016-individual-p1", "score": 0.0, "max_score": 15.0, "score_fraction": 0.0, "verdict": "incorrect", "matched_units": [], "missed_units": ["full.1", "full.2", "full.3", "full.4", "full.5", "full.6", "full.7", "full.8", "full.9", "full.10", "full.11", "full.12", "full.13", "full.14", "full.15"], "unit_results": [{"unit_id": "full.1", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 16.216, "full_output_similarity": 74.468}, {"unit_id": "full.2", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 16.667, "full_output_similarity": 84.444}, {"unit_id": "full.3", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 17.143, "full_output_similarity": 75.0}, {"unit_id": "full.4", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 17.647, "full_output_similarity": 73.171}, {"unit_id": "full.5", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 16.216, "full_output_similarity": 77.778}, {"unit_id": "full.6", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 16.438, "full_output_similarity": 73.171}, {"unit_id": "full.7", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 16.216, "full_output_similarity": 77.083}, {"unit_id": "full.8", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 16.901, "full_output_similarity": 79.487}, {"unit_id": "full.9", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 16.667, "full_output_similarity": 83.333}, {"unit_id": "full.10", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 16.667, "full_output_similarity": 72.5}, {"unit_id": "full.11", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 16.667, "full_output_similarity": 73.81}, {"unit_id": "full.12", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 16.901, "full_output_similarity": 77.273}, {"unit_id": "full.13", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 16.901, "full_output_similarity": 69.048}, {"unit_id": "full.14", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 16.216, "full_output_similarity": 75.0}, {"unit_id": "full.15", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 16.216, "full_output_similarity": 76.596}], "method": "normalized_final_answer_unit_fuzzy_v3", "scoring_scope": "final_answer_only", "scorer_thresholds": {"final_partial_ratio": 92, "full_output_partial_ratio": null}, "needs_human_review": true, "model": "google/gemma-3-12b-it"} +{"record_id": "iol-2016-individual-p5-sub-a", "score": 0.0, "max_score": 2.0, "score_fraction": 0.0, "verdict": "incorrect", "matched_units": [], "missed_units": ["a.1", "a.2"], "unit_results": [{"unit_id": "a.1", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 53.659, "full_output_similarity": 60.87}, {"unit_id": "a.2", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 53.125, "full_output_similarity": 56.25}], "method": "normalized_final_answer_unit_fuzzy_v3", "scoring_scope": "final_answer_only", "scorer_thresholds": {"final_partial_ratio": 92, "full_output_partial_ratio": null}, "needs_human_review": true, "model": "google/gemma-3-12b-it"} +{"record_id": "iol-2017-individual-p2-sub-a", "score": 0.0, "max_score": 16.0, "score_fraction": 0.0, "verdict": "incorrect", "matched_units": [], "missed_units": ["a.1", "a.2", "a.3", "a.4", "a.5", "a.6", "a.7", "a.8", "a.9", "a.10", "a.11", "a.12", "a.13", "a.14", "a.15", "a.16"], "unit_results": [{"unit_id": "a.1", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 25.21, "full_output_similarity": 62.295}, {"unit_id": "a.2", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 24.528, "full_output_similarity": 66.038}, {"unit_id": "a.3", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 26.667, "full_output_similarity": 83.333}, {"unit_id": "a.4", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 25.688, "full_output_similarity": 65.079}, {"unit_id": "a.5", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 26.829, "full_output_similarity": 95.122}, {"unit_id": "a.6", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 26.19, "full_output_similarity": 52.381}, {"unit_id": "a.7", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 29.787, "full_output_similarity": 52.0}, {"unit_id": "a.8", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 36.842, "full_output_similarity": 73.684}, {"unit_id": "a.9", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 25.714, "full_output_similarity": 68.571}, {"unit_id": "a.10", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 33.333, "full_output_similarity": 77.778}, {"unit_id": "a.11", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 28.0, "full_output_similarity": 92.0}, {"unit_id": "a.12", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 26.667, "full_output_similarity": 72.0}, {"unit_id": "a.13", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 29.268, "full_output_similarity": 80.488}, {"unit_id": "a.14", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 23.256, "full_output_similarity": 51.163}, {"unit_id": "a.15", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 27.273, "full_output_similarity": 52.273}, {"unit_id": "a.16", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 30.0, "full_output_similarity": 76.667}], "method": "normalized_final_answer_unit_fuzzy_v3", "scoring_scope": "final_answer_only", "scorer_thresholds": {"final_partial_ratio": 92, "full_output_partial_ratio": null}, "needs_human_review": true, "model": "google/gemma-3-12b-it"} +{"record_id": "iol-2017-team-p1", "score": 0.0, "max_score": 1.0, "score_fraction": 0.0, "verdict": "incorrect", "matched_units": [], "missed_units": ["full.1"], "unit_results": [{"unit_id": "full.1", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 45.161, "full_output_similarity": 71.398}], "method": "normalized_final_answer_unit_fuzzy_v3", "scoring_scope": "final_answer_only", "scorer_thresholds": {"final_partial_ratio": 92, "full_output_partial_ratio": null}, "needs_human_review": true, "model": "google/gemma-3-12b-it"} +{"record_id": "iol-2018-individual-p4-sub-a", "score": 0.0, "max_score": 1.0, "score_fraction": 0.0, "verdict": "incorrect", "matched_units": [], "missed_units": ["a.1"], "unit_results": [{"unit_id": "a.1", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 31.944, "full_output_similarity": 40.278}], "method": "normalized_final_answer_unit_fuzzy_v3", "scoring_scope": "final_answer_only", "scorer_thresholds": {"final_partial_ratio": 92, "full_output_partial_ratio": null}, "needs_human_review": true, "model": "google/gemma-3-12b-it"} +{"record_id": "iol-2019-individual-p2-sub-a", "score": 0.0, "max_score": 17.0, "score_fraction": 0.0, "verdict": "incorrect", "matched_units": [], "missed_units": ["a.1", "a.2", "a.3", "a.4", "a.5", "a.6", "a.7", "a.8", "a.9", "a.10", "a.11", "a.12", "a.13", "a.14", "a.15", "a.16", "a.17"], "unit_results": [{"unit_id": "a.1", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 20.93, "full_output_similarity": 72.093}, {"unit_id": "a.2", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 25.0, "full_output_similarity": 69.697}, {"unit_id": "a.3", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 25.532, "full_output_similarity": 68.571}, {"unit_id": "a.4", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 22.5, "full_output_similarity": 70.0}, {"unit_id": "a.5", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 26.923, "full_output_similarity": 65.385}, {"unit_id": "a.6", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 24.0, "full_output_similarity": 71.429}, {"unit_id": "a.7", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 25.0, "full_output_similarity": 72.727}, {"unit_id": "a.8", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 26.471, "full_output_similarity": 76.471}, {"unit_id": "a.9", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 26.087, "full_output_similarity": 69.697}, {"unit_id": "a.10", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 21.429, "full_output_similarity": 63.415}, {"unit_id": "a.11", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 26.087, "full_output_similarity": 70.968}, {"unit_id": "a.12", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 26.087, "full_output_similarity": 66.667}, {"unit_id": "a.13", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 25.641, "full_output_similarity": 59.259}, {"unit_id": "a.14", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 22.857, "full_output_similarity": 75.61}, {"unit_id": "a.15", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 27.907, "full_output_similarity": 62.963}, {"unit_id": "a.16", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 25.532, "full_output_similarity": 68.75}, {"unit_id": "a.17", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 25.926, "full_output_similarity": 66.667}], "method": "normalized_final_answer_unit_fuzzy_v3", "scoring_scope": "final_answer_only", "scorer_thresholds": {"final_partial_ratio": 92, "full_output_partial_ratio": null}, "needs_human_review": true, "model": "google/gemma-3-12b-it"} +{"record_id": "iol-2019-team-p1", "score": 0.0, "max_score": 1.0, "score_fraction": 0.0, "verdict": "incorrect", "matched_units": [], "missed_units": ["full.1"], "unit_results": [{"unit_id": "full.1", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 48.485, "full_output_similarity": 77.582}], "method": "normalized_final_answer_unit_fuzzy_v3", "scoring_scope": "final_answer_only", "scorer_thresholds": {"final_partial_ratio": 92, "full_output_partial_ratio": null}, "needs_human_review": true, "model": "google/gemma-3-12b-it"} +{"record_id": "iol-2021-individual-p3-sub-a", "score": 0.0, "max_score": 4.0, "score_fraction": 0.0, "verdict": "incorrect", "matched_units": [], "missed_units": ["a.1", "a.2", "a.3", "a.4"], "unit_results": [{"unit_id": "a.1", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 39.216, "full_output_similarity": 100.0}, {"unit_id": "a.2", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 30.435, "full_output_similarity": 100.0}, {"unit_id": "a.3", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 30.769, "full_output_similarity": 100.0}, {"unit_id": "a.4", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 38.71, "full_output_similarity": 100.0}], "method": "normalized_final_answer_unit_fuzzy_v3", "scoring_scope": "final_answer_only", "scorer_thresholds": {"final_partial_ratio": 92, "full_output_partial_ratio": null}, "needs_human_review": true, "model": "google/gemma-3-12b-it"} +{"record_id": "iol-2022-individual-p1-sub-a", "score": 0.0, "max_score": 1.0, "score_fraction": 0.0, "verdict": "incorrect", "matched_units": [], "missed_units": ["a.1"], "unit_results": [{"unit_id": "a.1", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 73.684, "full_output_similarity": 86.486}], "method": "normalized_final_answer_unit_fuzzy_v3", "scoring_scope": "final_answer_only", "scorer_thresholds": {"final_partial_ratio": 92, "full_output_partial_ratio": null}, "needs_human_review": true, "model": "google/gemma-3-12b-it"} +{"record_id": "iol-2022-individual-p5-sub-a", "score": 0.0, "max_score": 1.0, "score_fraction": 0.0, "verdict": "incorrect", "matched_units": [], "missed_units": ["a.1"], "unit_results": [{"unit_id": "a.1", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 50.0, "full_output_similarity": 66.667}], "method": "normalized_final_answer_unit_fuzzy_v3", "scoring_scope": "final_answer_only", "scorer_thresholds": {"final_partial_ratio": 92, "full_output_partial_ratio": null}, "needs_human_review": true, "model": "google/gemma-3-12b-it"} +{"record_id": "iol-2023-individual-p3", "score": 0.0, "max_score": 13.0, "score_fraction": 0.0, "verdict": "incorrect", "matched_units": [], "missed_units": ["full.1", "full.2", "full.3", "full.4", "full.5", "full.6", "full.7", "full.8", "full.9", "full.10", "full.11", "full.12", "full.13"], "unit_results": [{"unit_id": "full.1", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 87.5, "full_output_similarity": 87.5}, {"unit_id": "full.2", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 51.613, "full_output_similarity": 51.613}, {"unit_id": "full.3", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 55.556, "full_output_similarity": 55.556}, {"unit_id": "full.4", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 69.231, "full_output_similarity": 69.231}, {"unit_id": "full.5", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 45.714, "full_output_similarity": 45.714}, {"unit_id": "full.6", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 66.667, "full_output_similarity": 66.667}, {"unit_id": "full.7", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 64.583, "full_output_similarity": 64.583}, {"unit_id": "full.8", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 65.789, "full_output_similarity": 65.789}, {"unit_id": "full.9", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 55.102, "full_output_similarity": 55.102}, {"unit_id": "full.10", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 91.176, "full_output_similarity": 91.176}, {"unit_id": "full.11", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 82.353, "full_output_similarity": 82.353}, {"unit_id": "full.12", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 81.081, "full_output_similarity": 81.081}, {"unit_id": "full.13", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 83.333, "full_output_similarity": 83.333}], "method": "normalized_final_answer_unit_fuzzy_v3", "scoring_scope": "final_answer_only", "scorer_thresholds": {"final_partial_ratio": 92, "full_output_partial_ratio": null}, "needs_human_review": true, "model": "google/gemma-3-12b-it"} +{"record_id": "iol-2024-individual-p1", "score": 0.0, "max_score": 17.0, "score_fraction": 0.0, "verdict": "incorrect", "matched_units": [], "missed_units": ["full.1", "full.2", "full.3", "full.4", "full.5", "full.6", "full.7", "full.8", "full.9", "full.10", "full.11", "full.12", "full.13", "full.14", "full.15", "full.16", "full.17"], "unit_results": [{"unit_id": "full.1", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 32.258, "full_output_similarity": 45.161}, {"unit_id": "full.2", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 34.375, "full_output_similarity": 43.75}, {"unit_id": "full.3", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 35.0, "full_output_similarity": 47.5}, {"unit_id": "full.4", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 36.0, "full_output_similarity": 45.333}, {"unit_id": "full.5", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 33.333, "full_output_similarity": 55.556}, {"unit_id": "full.6", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 33.929, "full_output_similarity": 46.429}, {"unit_id": "full.7", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 30.303, "full_output_similarity": 48.485}, {"unit_id": "full.8", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 34.375, "full_output_similarity": 43.75}, {"unit_id": "full.9", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 32.857, "full_output_similarity": 44.737}, {"unit_id": "full.10", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 43.75, "full_output_similarity": 71.875}, {"unit_id": "full.11", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 51.852, "full_output_similarity": 62.963}, {"unit_id": "full.12", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 54.054, "full_output_similarity": 81.081}, {"unit_id": "full.13", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 50.0, "full_output_similarity": 86.667}, {"unit_id": "full.14", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 48.0, "full_output_similarity": 84.0}, {"unit_id": "full.15", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 51.064, "full_output_similarity": 67.742}, {"unit_id": "full.16", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 48.387, "full_output_similarity": 83.871}, {"unit_id": "full.17", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 50.0, "full_output_similarity": 83.333}], "method": "normalized_final_answer_unit_fuzzy_v3", "scoring_scope": "final_answer_only", "scorer_thresholds": {"final_partial_ratio": 92, "full_output_partial_ratio": null}, "needs_human_review": true, "model": "google/gemma-3-12b-it"} +{"record_id": "iol-2024-individual-p4-sub-a", "score": 0.0, "max_score": 19.0, "score_fraction": 0.0, "verdict": "incorrect", "matched_units": [], "missed_units": ["a.1", "a.2", "a.3", "a.4", "a.5", "a.6", "a.7", "a.8", "a.9", "a.10", "a.11", "a.12", "a.13", "a.14", "a.15", "a.16", "a.17", "a.18", "a.19"], "unit_results": [{"unit_id": "a.1", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 33.962, "full_output_similarity": 54.545}, {"unit_id": "a.2", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 33.333, "full_output_similarity": 50.0}, {"unit_id": "a.3", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 27.66, "full_output_similarity": 55.556}, {"unit_id": "a.4", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 29.508, "full_output_similarity": 56.098}, {"unit_id": "a.5", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 29.358, "full_output_similarity": 48.529}, {"unit_id": "a.6", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 33.962, "full_output_similarity": 51.515}, {"unit_id": "a.7", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 28.571, "full_output_similarity": 63.636}, {"unit_id": "a.8", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 34.375, "full_output_similarity": 50.0}, {"unit_id": "a.9", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 30.137, "full_output_similarity": 54.348}, {"unit_id": "a.10", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 29.73, "full_output_similarity": 48.649}, {"unit_id": "a.11", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 33.962, "full_output_similarity": 45.455}, {"unit_id": "a.12", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 28.571, "full_output_similarity": 52.381}, {"unit_id": "a.13", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 31.746, "full_output_similarity": 50.0}, {"unit_id": "a.14", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 32.727, "full_output_similarity": 56.757}, {"unit_id": "a.15", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 30.189, "full_output_similarity": 56.757}, {"unit_id": "a.16", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 28.235, "full_output_similarity": 60.0}, {"unit_id": "a.17", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 26.829, "full_output_similarity": 61.111}, {"unit_id": "a.18", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 25.0, "full_output_similarity": 63.333}, {"unit_id": "a.19", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 30.508, "full_output_similarity": 53.846}], "method": "normalized_final_answer_unit_fuzzy_v3", "scoring_scope": "final_answer_only", "scorer_thresholds": {"final_partial_ratio": 92, "full_output_partial_ratio": null}, "needs_human_review": true, "model": "google/gemma-3-12b-it"} +{"record_id": "iol-2025-individual-p2-sub-a", "score": 0.0, "max_score": 1.0, "score_fraction": 0.0, "verdict": "incorrect", "matched_units": [], "missed_units": ["a.1"], "unit_results": [{"unit_id": "a.1", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 38.298, "full_output_similarity": 38.298}], "method": "normalized_final_answer_unit_fuzzy_v3", "scoring_scope": "final_answer_only", "scorer_thresholds": {"final_partial_ratio": 92, "full_output_partial_ratio": null}, "needs_human_review": true, "model": "google/gemma-3-12b-it"} +{"record_id": "iol-2025-team-p1-sub-a", "score": 0.0, "max_score": 1.0, "score_fraction": 0.0, "verdict": "incorrect", "matched_units": [], "missed_units": ["a.1"], "unit_results": [{"unit_id": "a.1", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 44.444, "full_output_similarity": 27.976}], "method": "normalized_final_answer_unit_fuzzy_v3", "scoring_scope": "final_answer_only", "scorer_thresholds": {"final_partial_ratio": 92, "full_output_partial_ratio": null}, "needs_human_review": true, "model": "google/gemma-3-12b-it"} diff --git a/benchmark/IOL/ioling_hf/evals/results/meta-llama__Llama-3.2-3B-Instruct__diverse5.scores.jsonl b/benchmark/IOL/ioling_hf/evals/results/meta-llama__Llama-3.2-3B-Instruct__diverse5.scores.jsonl new file mode 100644 index 0000000000000000000000000000000000000000..ca32cf0c553a64c5c480fb04dec375ca82950983 --- /dev/null +++ b/benchmark/IOL/ioling_hf/evals/results/meta-llama__Llama-3.2-3B-Instruct__diverse5.scores.jsonl @@ -0,0 +1,5 @@ +{"record_id": "iol-2006-individual-p1-sub-assignment_1", "score": 1.0, "max_score": 4.0, "score_fraction": 0.25, "verdict": "partial", "matched_units": ["assignment_1.1"], "missed_units": ["assignment_1.2", "assignment_1.3", "assignment_1.4"], "unit_results": [{"unit_id": "assignment_1.1", "points": 1.0, "matched": true, "match_type": "fuzzy_final_partial_ratio", "final_similarity": 95.0, "full_output_similarity": 95.0}, {"unit_id": "assignment_1.2", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 57.576, "full_output_similarity": 60.606}, {"unit_id": "assignment_1.3", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 48.0, "full_output_similarity": 56.818}, {"unit_id": "assignment_1.4", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 75.0, "full_output_similarity": 72.0}], "method": "normalized_final_answer_unit_fuzzy_v3", "scoring_scope": "final_answer_only", "scorer_thresholds": {"final_partial_ratio": 92, "full_output_partial_ratio": null}, "needs_human_review": true, "model": "meta-llama/Llama-3.2-3B-Instruct"} +{"record_id": "iol-2011-individual-p1-sub-a", "score": 0.0, "max_score": 1.0, "score_fraction": 0.0, "verdict": "incorrect", "matched_units": [], "missed_units": ["a.1"], "unit_results": [{"unit_id": "a.1", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 46.832, "full_output_similarity": 59.0}], "method": "normalized_final_answer_unit_fuzzy_v3", "scoring_scope": "final_answer_only", "scorer_thresholds": {"final_partial_ratio": 92, "full_output_partial_ratio": null}, "needs_human_review": true, "model": "meta-llama/Llama-3.2-3B-Instruct"} +{"record_id": "iol-2015-individual-p5-sub-b", "score": 0.0, "max_score": 9.0, "score_fraction": 0.0, "verdict": "incorrect", "matched_units": [], "missed_units": ["b.1", "b.2", "b.3", "b.4", "b.5", "b.6", "b.7", "b.8", "b.9"], "unit_results": [{"unit_id": "b.1", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 22.857, "full_output_similarity": 40.741}, {"unit_id": "b.2", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 22.222, "full_output_similarity": 39.13}, {"unit_id": "b.3", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 20.0, "full_output_similarity": 40.741}, {"unit_id": "b.4", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 25.0, "full_output_similarity": 45.833}, {"unit_id": "b.5", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 22.222, "full_output_similarity": 41.667}, {"unit_id": "b.6", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 25.0, "full_output_similarity": 44.828}, {"unit_id": "b.7", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 22.222, "full_output_similarity": 48.0}, {"unit_id": "b.8", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 24.242, "full_output_similarity": 46.667}, {"unit_id": "b.9", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 22.222, "full_output_similarity": 40.741}], "method": "normalized_final_answer_unit_fuzzy_v3", "scoring_scope": "final_answer_only", "scorer_thresholds": {"final_partial_ratio": 92, "full_output_partial_ratio": null}, "needs_human_review": true, "model": "meta-llama/Llama-3.2-3B-Instruct"} +{"record_id": "iol-2021-individual-p2-sub-a", "score": 0.0, "max_score": 9.0, "score_fraction": 0.0, "verdict": "incorrect", "matched_units": [], "missed_units": ["a.1", "a.2", "a.3", "a.4", "a.5", "a.6", "a.7", "a.8", "a.9"], "unit_results": [{"unit_id": "a.1", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 44.872, "full_output_similarity": 44.872}, {"unit_id": "a.2", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 60.0, "full_output_similarity": 60.0}, {"unit_id": "a.3", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 65.0, "full_output_similarity": 65.0}, {"unit_id": "a.4", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 57.143, "full_output_similarity": 57.143}, {"unit_id": "a.5", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 54.545, "full_output_similarity": 54.545}, {"unit_id": "a.6", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 53.333, "full_output_similarity": 53.333}, {"unit_id": "a.7", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 66.667, "full_output_similarity": 66.667}, {"unit_id": "a.8", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 58.065, "full_output_similarity": 58.065}, {"unit_id": "a.9", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 63.889, "full_output_similarity": 63.889}], "method": "normalized_final_answer_unit_fuzzy_v3", "scoring_scope": "final_answer_only", "scorer_thresholds": {"final_partial_ratio": 92, "full_output_partial_ratio": null}, "needs_human_review": true, "model": "meta-llama/Llama-3.2-3B-Instruct"} +{"record_id": "iol-2025-team-p1-sub-a", "score": 0.0, "max_score": 1.0, "score_fraction": 0.0, "verdict": "incorrect", "matched_units": [], "missed_units": ["a.1"], "unit_results": [{"unit_id": "a.1", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 36.842, "full_output_similarity": 32.738}], "method": "normalized_final_answer_unit_fuzzy_v3", "scoring_scope": "final_answer_only", "scorer_thresholds": {"final_partial_ratio": 92, "full_output_partial_ratio": null}, "needs_human_review": true, "model": "meta-llama/Llama-3.2-3B-Instruct"} diff --git a/benchmark/IOL/ioling_hf/evals/results/meta-llama__Llama-3.2-3B-Instruct__strict30.scores.jsonl b/benchmark/IOL/ioling_hf/evals/results/meta-llama__Llama-3.2-3B-Instruct__strict30.scores.jsonl new file mode 100644 index 0000000000000000000000000000000000000000..5e8fdb6fece0269d7aec69c1447a1647add7c372 --- /dev/null +++ b/benchmark/IOL/ioling_hf/evals/results/meta-llama__Llama-3.2-3B-Instruct__strict30.scores.jsonl @@ -0,0 +1,30 @@ +{"record_id": "iol-2006-individual-p1-sub-assignment_1", "score": 0.0, "max_score": 4.0, "score_fraction": 0.0, "verdict": "incorrect", "matched_units": [], "missed_units": ["assignment_1.1", "assignment_1.2", "assignment_1.3", "assignment_1.4"], "unit_results": [{"unit_id": "assignment_1.1", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 82.5, "full_output_similarity": 82.5}, {"unit_id": "assignment_1.2", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 66.667, "full_output_similarity": 66.667}, {"unit_id": "assignment_1.3", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 46.591, "full_output_similarity": 53.409}, {"unit_id": "assignment_1.4", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 64.286, "full_output_similarity": 64.286}], "method": "normalized_final_answer_unit_fuzzy_v3", "scoring_scope": "final_answer_only", "scorer_thresholds": {"final_partial_ratio": 92, "full_output_partial_ratio": null}, "needs_human_review": true, "model": "meta-llama/Llama-3.2-3B-Instruct"} +{"record_id": "iol-2006-individual-p5", "score": 0.0, "max_score": 1.0, "score_fraction": 0.0, "verdict": "incorrect", "matched_units": [], "missed_units": ["full.1"], "unit_results": [{"unit_id": "full.1", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 61.446, "full_output_similarity": 43.173}], "method": "normalized_final_answer_unit_fuzzy_v3", "scoring_scope": "final_answer_only", "scorer_thresholds": {"final_partial_ratio": 92, "full_output_partial_ratio": null}, "needs_human_review": true, "model": "meta-llama/Llama-3.2-3B-Instruct"} +{"record_id": "iol-2007-individual-p5", "score": 0.0, "max_score": 4.0, "score_fraction": 0.0, "verdict": "incorrect", "matched_units": [], "missed_units": ["full.1", "full.2", "full.3", "full.4"], "unit_results": [{"unit_id": "full.1", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 41.379, "full_output_similarity": 55.172}, {"unit_id": "full.2", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 34.286, "full_output_similarity": 48.571}, {"unit_id": "full.3", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 39.13, "full_output_similarity": 56.522}, {"unit_id": "full.4", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 38.71, "full_output_similarity": 41.935}], "method": "normalized_final_answer_unit_fuzzy_v3", "scoring_scope": "final_answer_only", "scorer_thresholds": {"final_partial_ratio": 92, "full_output_partial_ratio": null}, "needs_human_review": true, "model": "meta-llama/Llama-3.2-3B-Instruct"} +{"record_id": "iol-2008-individual-p2-sub-b", "score": 0.0, "max_score": 1.0, "score_fraction": 0.0, "verdict": "incorrect", "matched_units": [], "missed_units": ["b.1"], "unit_results": [{"unit_id": "b.1", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 45.029, "full_output_similarity": 45.029}], "method": "normalized_final_answer_unit_fuzzy_v3", "scoring_scope": "final_answer_only", "scorer_thresholds": {"final_partial_ratio": 92, "full_output_partial_ratio": null}, "needs_human_review": true, "model": "meta-llama/Llama-3.2-3B-Instruct"} +{"record_id": "iol-2008-team-p1-sub-a", "score": 0.0, "max_score": 1.0, "score_fraction": 0.0, "verdict": "incorrect", "matched_units": [], "missed_units": ["a.1"], "unit_results": [{"unit_id": "a.1", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 43.284, "full_output_similarity": 46.207}], "method": "normalized_final_answer_unit_fuzzy_v3", "scoring_scope": "final_answer_only", "scorer_thresholds": {"final_partial_ratio": 92, "full_output_partial_ratio": null}, "needs_human_review": true, "model": "meta-llama/Llama-3.2-3B-Instruct"} +{"record_id": "iol-2009-individual-p4-sub-a", "score": 1.0, "max_score": 1.0, "score_fraction": 1.0, "verdict": "correct", "matched_units": ["a.1"], "missed_units": [], "unit_results": [{"unit_id": "a.1", "points": 1.0, "matched": true, "match_type": "fuzzy_final_partial_ratio", "final_similarity": 100.0, "full_output_similarity": 49.738}], "method": "normalized_final_answer_unit_fuzzy_v3", "scoring_scope": "final_answer_only", "scorer_thresholds": {"final_partial_ratio": 92, "full_output_partial_ratio": null}, "needs_human_review": true, "model": "meta-llama/Llama-3.2-3B-Instruct"} +{"record_id": "iol-2010-individual-p2-sub-a", "score": 0.0, "max_score": 1.0, "score_fraction": 0.0, "verdict": "incorrect", "matched_units": [], "missed_units": ["a.1"], "unit_results": [{"unit_id": "a.1", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 41.163, "full_output_similarity": 41.163}], "method": "normalized_final_answer_unit_fuzzy_v3", "scoring_scope": "final_answer_only", "scorer_thresholds": {"final_partial_ratio": 92, "full_output_partial_ratio": null}, "needs_human_review": true, "model": "meta-llama/Llama-3.2-3B-Instruct"} +{"record_id": "iol-2010-team-p1", "score": 1.0, "max_score": 1.0, "score_fraction": 1.0, "verdict": "correct", "matched_units": ["full.1"], "missed_units": [], "unit_results": [{"unit_id": "full.1", "points": 1.0, "matched": true, "match_type": "fuzzy_final_partial_ratio", "final_similarity": 100.0, "full_output_similarity": 34.182}], "method": "normalized_final_answer_unit_fuzzy_v3", "scoring_scope": "final_answer_only", "scorer_thresholds": {"final_partial_ratio": 92, "full_output_partial_ratio": null}, "needs_human_review": true, "model": "meta-llama/Llama-3.2-3B-Instruct"} +{"record_id": "iol-2011-individual-p3-sub-a", "score": 0.0, "max_score": 1.0, "score_fraction": 0.0, "verdict": "incorrect", "matched_units": [], "missed_units": ["a.1"], "unit_results": [{"unit_id": "a.1", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 51.079, "full_output_similarity": 51.079}], "method": "normalized_final_answer_unit_fuzzy_v3", "scoring_scope": "final_answer_only", "scorer_thresholds": {"final_partial_ratio": 92, "full_output_partial_ratio": null}, "needs_human_review": true, "model": "meta-llama/Llama-3.2-3B-Instruct"} +{"record_id": "iol-2012-individual-p1-sub-a", "score": 0.0, "max_score": 1.0, "score_fraction": 0.0, "verdict": "incorrect", "matched_units": [], "missed_units": ["a.1"], "unit_results": [{"unit_id": "a.1", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 49.275, "full_output_similarity": 49.275}], "method": "normalized_final_answer_unit_fuzzy_v3", "scoring_scope": "final_answer_only", "scorer_thresholds": {"final_partial_ratio": 92, "full_output_partial_ratio": null}, "needs_human_review": true, "model": "meta-llama/Llama-3.2-3B-Instruct"} +{"record_id": "iol-2012-individual-p5-sub-a", "score": 0.0, "max_score": 1.0, "score_fraction": 0.0, "verdict": "incorrect", "matched_units": [], "missed_units": ["a.1"], "unit_results": [{"unit_id": "a.1", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 73.885, "full_output_similarity": 69.892}], "method": "normalized_final_answer_unit_fuzzy_v3", "scoring_scope": "final_answer_only", "scorer_thresholds": {"final_partial_ratio": 92, "full_output_partial_ratio": null}, "needs_human_review": true, "model": "meta-llama/Llama-3.2-3B-Instruct"} +{"record_id": "iol-2013-individual-p3", "score": 0.0, "max_score": 5.0, "score_fraction": 0.0, "verdict": "incorrect", "matched_units": [], "missed_units": ["full.1", "full.2", "full.3", "full.4", "full.5"], "unit_results": [{"unit_id": "full.1", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 33.333, "full_output_similarity": 66.667}, {"unit_id": "full.2", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 37.037, "full_output_similarity": 50.588}, {"unit_id": "full.3", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 32.0, "full_output_similarity": 47.5}, {"unit_id": "full.4", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 30.645, "full_output_similarity": 45.333}, {"unit_id": "full.5", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 40.23, "full_output_similarity": 55.172}], "method": "normalized_final_answer_unit_fuzzy_v3", "scoring_scope": "final_answer_only", "scorer_thresholds": {"final_partial_ratio": 92, "full_output_partial_ratio": null}, "needs_human_review": true, "model": "meta-llama/Llama-3.2-3B-Instruct"} +{"record_id": "iol-2014-individual-p2", "score": 0.0, "max_score": 1.0, "score_fraction": 0.0, "verdict": "incorrect", "matched_units": [], "missed_units": ["full.1"], "unit_results": [{"unit_id": "full.1", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 66.667, "full_output_similarity": 66.667}], "method": "normalized_final_answer_unit_fuzzy_v3", "scoring_scope": "final_answer_only", "scorer_thresholds": {"final_partial_ratio": 92, "full_output_partial_ratio": null}, "needs_human_review": true, "model": "meta-llama/Llama-3.2-3B-Instruct"} +{"record_id": "iol-2014-individual-p5-sub-a", "score": 0.0, "max_score": 1.0, "score_fraction": 0.0, "verdict": "incorrect", "matched_units": [], "missed_units": ["a.1"], "unit_results": [{"unit_id": "a.1", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 40.796, "full_output_similarity": 40.796}], "method": "normalized_final_answer_unit_fuzzy_v3", "scoring_scope": "final_answer_only", "scorer_thresholds": {"final_partial_ratio": 92, "full_output_partial_ratio": null}, "needs_human_review": true, "model": "meta-llama/Llama-3.2-3B-Instruct"} +{"record_id": "iol-2015-individual-p3-sub-a", "score": 0.0, "max_score": 5.0, "score_fraction": 0.0, "verdict": "incorrect", "matched_units": [], "missed_units": ["a.1", "a.2", "a.3", "a.4", "a.5"], "unit_results": [{"unit_id": "a.1", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 33.333, "full_output_similarity": 53.333}, {"unit_id": "a.2", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 25.0, "full_output_similarity": 51.899}, {"unit_id": "a.3", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 25.0, "full_output_similarity": 45.714}, {"unit_id": "a.4", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 25.0, "full_output_similarity": 51.351}, {"unit_id": "a.5", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 0.0, "full_output_similarity": 52.5}], "method": "normalized_final_answer_unit_fuzzy_v3", "scoring_scope": "final_answer_only", "scorer_thresholds": {"final_partial_ratio": 92, "full_output_partial_ratio": null}, "needs_human_review": true, "model": "meta-llama/Llama-3.2-3B-Instruct"} +{"record_id": "iol-2016-individual-p1", "score": 15.0, "max_score": 15.0, "score_fraction": 1.0, "verdict": "correct", "matched_units": ["full.1", "full.2", "full.3", "full.4", "full.5", "full.6", "full.7", "full.8", "full.9", "full.10", "full.11", "full.12", "full.13", "full.14", "full.15"], "missed_units": [], "unit_results": [{"unit_id": "full.1", "points": 1.0, "matched": true, "match_type": "fuzzy_final_partial_ratio", "final_similarity": 100.0, "full_output_similarity": 74.468}, {"unit_id": "full.2", "points": 1.0, "matched": true, "match_type": "fuzzy_final_partial_ratio", "final_similarity": 100.0, "full_output_similarity": 77.778}, {"unit_id": "full.3", "points": 1.0, "matched": true, "match_type": "fuzzy_final_partial_ratio", "final_similarity": 100.0, "full_output_similarity": 85.0}, {"unit_id": "full.4", "points": 1.0, "matched": true, "match_type": "fuzzy_final_partial_ratio", "final_similarity": 100.0, "full_output_similarity": 78.049}, {"unit_id": "full.5", "points": 1.0, "matched": true, "match_type": "fuzzy_final_partial_ratio", "final_similarity": 100.0, "full_output_similarity": 75.556}, {"unit_id": "full.6", "points": 1.0, "matched": true, "match_type": "fuzzy_final_partial_ratio", "final_similarity": 100.0, "full_output_similarity": 75.61}, {"unit_id": "full.7", "points": 1.0, "matched": true, "match_type": "fuzzy_final_partial_ratio", "final_similarity": 100.0, "full_output_similarity": 83.333}, {"unit_id": "full.8", "points": 1.0, "matched": true, "match_type": "fuzzy_final_partial_ratio", "final_similarity": 100.0, "full_output_similarity": 79.487}, {"unit_id": "full.9", "points": 1.0, "matched": true, "match_type": "fuzzy_final_partial_ratio", "final_similarity": 100.0, "full_output_similarity": 76.19}, {"unit_id": "full.10", "points": 1.0, "matched": true, "match_type": "fuzzy_final_partial_ratio", "final_similarity": 100.0, "full_output_similarity": 90.0}, {"unit_id": "full.11", "points": 1.0, "matched": true, "match_type": "fuzzy_final_partial_ratio", "final_similarity": 100.0, "full_output_similarity": 88.095}, {"unit_id": "full.12", "points": 1.0, "matched": true, "match_type": "fuzzy_final_partial_ratio", "final_similarity": 100.0, "full_output_similarity": 79.545}, {"unit_id": "full.13", "points": 1.0, "matched": true, "match_type": "fuzzy_final_partial_ratio", "final_similarity": 100.0, "full_output_similarity": 83.333}, {"unit_id": "full.14", "points": 1.0, "matched": true, "match_type": "fuzzy_final_partial_ratio", "final_similarity": 100.0, "full_output_similarity": 85.417}, {"unit_id": "full.15", "points": 1.0, "matched": true, "match_type": "fuzzy_final_partial_ratio", "final_similarity": 100.0, "full_output_similarity": 82.979}], "method": "normalized_final_answer_unit_fuzzy_v3", "scoring_scope": "final_answer_only", "scorer_thresholds": {"final_partial_ratio": 92, "full_output_partial_ratio": null}, "needs_human_review": true, "model": "meta-llama/Llama-3.2-3B-Instruct"} +{"record_id": "iol-2016-individual-p5-sub-a", "score": 0.0, "max_score": 2.0, "score_fraction": 0.0, "verdict": "incorrect", "matched_units": [], "missed_units": ["a.1", "a.2"], "unit_results": [{"unit_id": "a.1", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 40.0, "full_output_similarity": 60.87}, {"unit_id": "a.2", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 40.0, "full_output_similarity": 53.125}], "method": "normalized_final_answer_unit_fuzzy_v3", "scoring_scope": "final_answer_only", "scorer_thresholds": {"final_partial_ratio": 92, "full_output_partial_ratio": null}, "needs_human_review": true, "model": "meta-llama/Llama-3.2-3B-Instruct"} +{"record_id": "iol-2017-individual-p2-sub-a", "score": 0.0, "max_score": 16.0, "score_fraction": 0.0, "verdict": "incorrect", "matched_units": [], "missed_units": ["a.1", "a.2", "a.3", "a.4", "a.5", "a.6", "a.7", "a.8", "a.9", "a.10", "a.11", "a.12", "a.13", "a.14", "a.15", "a.16"], "unit_results": [{"unit_id": "a.1", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 0.0, "full_output_similarity": 54.098}, {"unit_id": "a.2", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 0.0, "full_output_similarity": 60.377}, {"unit_id": "a.3", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 0.0, "full_output_similarity": 79.167}, {"unit_id": "a.4", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 0.0, "full_output_similarity": 57.143}, {"unit_id": "a.5", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 0.0, "full_output_similarity": 73.171}, {"unit_id": "a.6", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 0.0, "full_output_similarity": 54.762}, {"unit_id": "a.7", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 0.0, "full_output_similarity": 54.0}, {"unit_id": "a.8", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 0.0, "full_output_similarity": 78.947}, {"unit_id": "a.9", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 0.0, "full_output_similarity": 62.857}, {"unit_id": "a.10", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 0.0, "full_output_similarity": 72.222}, {"unit_id": "a.11", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 0.0, "full_output_similarity": 80.0}, {"unit_id": "a.12", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 0.0, "full_output_similarity": 76.0}, {"unit_id": "a.13", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 0.0, "full_output_similarity": 75.61}, {"unit_id": "a.14", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 0.0, "full_output_similarity": 53.488}, {"unit_id": "a.15", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 0.0, "full_output_similarity": 59.091}, {"unit_id": "a.16", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 0.0, "full_output_similarity": 76.667}], "method": "normalized_final_answer_unit_fuzzy_v3", "scoring_scope": "final_answer_only", "scorer_thresholds": {"final_partial_ratio": 92, "full_output_partial_ratio": null}, "needs_human_review": true, "model": "meta-llama/Llama-3.2-3B-Instruct"} +{"record_id": "iol-2017-team-p1", "score": 0.0, "max_score": 1.0, "score_fraction": 0.0, "verdict": "incorrect", "matched_units": [], "missed_units": ["full.1"], "unit_results": [{"unit_id": "full.1", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 42.017, "full_output_similarity": 61.585}], "method": "normalized_final_answer_unit_fuzzy_v3", "scoring_scope": "final_answer_only", "scorer_thresholds": {"final_partial_ratio": 92, "full_output_partial_ratio": null}, "needs_human_review": true, "model": "meta-llama/Llama-3.2-3B-Instruct"} +{"record_id": "iol-2018-individual-p4-sub-a", "score": 0.0, "max_score": 1.0, "score_fraction": 0.0, "verdict": "incorrect", "matched_units": [], "missed_units": ["a.1"], "unit_results": [{"unit_id": "a.1", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 25.0, "full_output_similarity": 37.5}], "method": "normalized_final_answer_unit_fuzzy_v3", "scoring_scope": "final_answer_only", "scorer_thresholds": {"final_partial_ratio": 92, "full_output_partial_ratio": null}, "needs_human_review": true, "model": "meta-llama/Llama-3.2-3B-Instruct"} +{"record_id": "iol-2019-individual-p2-sub-a", "score": 0.0, "max_score": 17.0, "score_fraction": 0.0, "verdict": "incorrect", "matched_units": [], "missed_units": ["a.1", "a.2", "a.3", "a.4", "a.5", "a.6", "a.7", "a.8", "a.9", "a.10", "a.11", "a.12", "a.13", "a.14", "a.15", "a.16", "a.17"], "unit_results": [{"unit_id": "a.1", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 0.0, "full_output_similarity": 76.744}, {"unit_id": "a.2", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 0.0, "full_output_similarity": 75.758}, {"unit_id": "a.3", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 0.0, "full_output_similarity": 77.143}, {"unit_id": "a.4", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 0.0, "full_output_similarity": 75.0}, {"unit_id": "a.5", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 0.0, "full_output_similarity": 73.077}, {"unit_id": "a.6", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 0.0, "full_output_similarity": 71.429}, {"unit_id": "a.7", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 0.0, "full_output_similarity": 84.848}, {"unit_id": "a.8", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 0.0, "full_output_similarity": 88.235}, {"unit_id": "a.9", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 0.0, "full_output_similarity": 81.818}, {"unit_id": "a.10", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 0.0, "full_output_similarity": 68.293}, {"unit_id": "a.11", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 0.0, "full_output_similarity": 70.968}, {"unit_id": "a.12", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 0.0, "full_output_similarity": 66.667}, {"unit_id": "a.13", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 0.0, "full_output_similarity": 70.37}, {"unit_id": "a.14", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 0.0, "full_output_similarity": 78.049}, {"unit_id": "a.15", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 0.0, "full_output_similarity": 66.667}, {"unit_id": "a.16", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 0.0, "full_output_similarity": 71.875}, {"unit_id": "a.17", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 0.0, "full_output_similarity": 74.074}], "method": "normalized_final_answer_unit_fuzzy_v3", "scoring_scope": "final_answer_only", "scorer_thresholds": {"final_partial_ratio": 92, "full_output_partial_ratio": null}, "needs_human_review": true, "model": "meta-llama/Llama-3.2-3B-Instruct"} +{"record_id": "iol-2019-team-p1", "score": 0.0, "max_score": 1.0, "score_fraction": 0.0, "verdict": "incorrect", "matched_units": [], "missed_units": ["full.1"], "unit_results": [{"unit_id": "full.1", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 41.491, "full_output_similarity": 41.491}], "method": "normalized_final_answer_unit_fuzzy_v3", "scoring_scope": "final_answer_only", "scorer_thresholds": {"final_partial_ratio": 92, "full_output_partial_ratio": null}, "needs_human_review": true, "model": "meta-llama/Llama-3.2-3B-Instruct"} +{"record_id": "iol-2021-individual-p3-sub-a", "score": 0.0, "max_score": 4.0, "score_fraction": 0.0, "verdict": "incorrect", "matched_units": [], "missed_units": ["a.1", "a.2", "a.3", "a.4"], "unit_results": [{"unit_id": "a.1", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 38.235, "full_output_similarity": 97.059}, {"unit_id": "a.2", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 43.478, "full_output_similarity": 100.0}, {"unit_id": "a.3", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 38.095, "full_output_similarity": 100.0}, {"unit_id": "a.4", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 41.026, "full_output_similarity": 97.436}], "method": "normalized_final_answer_unit_fuzzy_v3", "scoring_scope": "final_answer_only", "scorer_thresholds": {"final_partial_ratio": 92, "full_output_partial_ratio": null}, "needs_human_review": true, "model": "meta-llama/Llama-3.2-3B-Instruct"} +{"record_id": "iol-2022-individual-p1-sub-a", "score": 0.0, "max_score": 1.0, "score_fraction": 0.0, "verdict": "incorrect", "matched_units": [], "missed_units": ["a.1"], "unit_results": [{"unit_id": "a.1", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 80.0, "full_output_similarity": 83.784}], "method": "normalized_final_answer_unit_fuzzy_v3", "scoring_scope": "final_answer_only", "scorer_thresholds": {"final_partial_ratio": 92, "full_output_partial_ratio": null}, "needs_human_review": true, "model": "meta-llama/Llama-3.2-3B-Instruct"} +{"record_id": "iol-2022-individual-p5-sub-a", "score": 0.0, "max_score": 1.0, "score_fraction": 0.0, "verdict": "incorrect", "matched_units": [], "missed_units": ["a.1"], "unit_results": [{"unit_id": "a.1", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 16.667, "full_output_similarity": 50.0}], "method": "normalized_final_answer_unit_fuzzy_v3", "scoring_scope": "final_answer_only", "scorer_thresholds": {"final_partial_ratio": 92, "full_output_partial_ratio": null}, "needs_human_review": true, "model": "meta-llama/Llama-3.2-3B-Instruct"} +{"record_id": "iol-2023-individual-p3", "score": 0.0, "max_score": 13.0, "score_fraction": 0.0, "verdict": "incorrect", "matched_units": [], "missed_units": ["full.1", "full.2", "full.3", "full.4", "full.5", "full.6", "full.7", "full.8", "full.9", "full.10", "full.11", "full.12", "full.13"], "unit_results": [{"unit_id": "full.1", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 37.5, "full_output_similarity": 87.5}, {"unit_id": "full.2", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 48.387, "full_output_similarity": 48.387}, {"unit_id": "full.3", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 37.037, "full_output_similarity": 59.259}, {"unit_id": "full.4", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 75.0, "full_output_similarity": 72.0}, {"unit_id": "full.5", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 40.0, "full_output_similarity": 54.286}, {"unit_id": "full.6", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 62.963, "full_output_similarity": 66.667}, {"unit_id": "full.7", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 72.0, "full_output_similarity": 72.917}, {"unit_id": "full.8", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 42.105, "full_output_similarity": 73.684}, {"unit_id": "full.9", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 48.98, "full_output_similarity": 65.306}, {"unit_id": "full.10", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 70.588, "full_output_similarity": 70.588}, {"unit_id": "full.11", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 67.647, "full_output_similarity": 73.529}, {"unit_id": "full.12", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 75.676, "full_output_similarity": 78.378}, {"unit_id": "full.13", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 80.0, "full_output_similarity": 79.012}], "method": "normalized_final_answer_unit_fuzzy_v3", "scoring_scope": "final_answer_only", "scorer_thresholds": {"final_partial_ratio": 92, "full_output_partial_ratio": null}, "needs_human_review": true, "model": "meta-llama/Llama-3.2-3B-Instruct"} +{"record_id": "iol-2024-individual-p1", "score": 0.0, "max_score": 17.0, "score_fraction": 0.0, "verdict": "incorrect", "matched_units": [], "missed_units": ["full.1", "full.2", "full.3", "full.4", "full.5", "full.6", "full.7", "full.8", "full.9", "full.10", "full.11", "full.12", "full.13", "full.14", "full.15", "full.16", "full.17"], "unit_results": [{"unit_id": "full.1", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 34.667, "full_output_similarity": 46.237}, {"unit_id": "full.2", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 33.333, "full_output_similarity": 47.917}, {"unit_id": "full.3", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 37.5, "full_output_similarity": 47.5}, {"unit_id": "full.4", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 36.22, "full_output_similarity": 44.0}, {"unit_id": "full.5", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 33.333, "full_output_similarity": 66.667}, {"unit_id": "full.6", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 35.714, "full_output_similarity": 44.643}, {"unit_id": "full.7", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 36.364, "full_output_similarity": 45.455}, {"unit_id": "full.8", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 33.333, "full_output_similarity": 47.917}, {"unit_id": "full.9", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 35.714, "full_output_similarity": 42.105}, {"unit_id": "full.10", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 59.574, "full_output_similarity": 68.75}, {"unit_id": "full.11", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 40.741, "full_output_similarity": 59.259}, {"unit_id": "full.12", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 48.649, "full_output_similarity": 78.378}, {"unit_id": "full.13", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 46.667, "full_output_similarity": 86.667}, {"unit_id": "full.14", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 64.0, "full_output_similarity": 64.0}, {"unit_id": "full.15", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 61.29, "full_output_similarity": 67.742}, {"unit_id": "full.16", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 61.29, "full_output_similarity": 61.29}, {"unit_id": "full.17", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 73.684, "full_output_similarity": 71.795}], "method": "normalized_final_answer_unit_fuzzy_v3", "scoring_scope": "final_answer_only", "scorer_thresholds": {"final_partial_ratio": 92, "full_output_partial_ratio": null}, "needs_human_review": true, "model": "meta-llama/Llama-3.2-3B-Instruct"} +{"record_id": "iol-2024-individual-p4-sub-a", "score": 0.0, "max_score": 19.0, "score_fraction": 0.0, "verdict": "incorrect", "matched_units": [], "missed_units": ["a.1", "a.2", "a.3", "a.4", "a.5", "a.6", "a.7", "a.8", "a.9", "a.10", "a.11", "a.12", "a.13", "a.14", "a.15", "a.16", "a.17", "a.18", "a.19"], "unit_results": [{"unit_id": "a.1", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 39.394, "full_output_similarity": 39.394}, {"unit_id": "a.2", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 41.176, "full_output_similarity": 41.176}, {"unit_id": "a.3", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 44.444, "full_output_similarity": 44.444}, {"unit_id": "a.4", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 41.463, "full_output_similarity": 41.463}, {"unit_id": "a.5", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 44.118, "full_output_similarity": 44.118}, {"unit_id": "a.6", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 42.424, "full_output_similarity": 42.424}, {"unit_id": "a.7", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 41.818, "full_output_similarity": 41.818}, {"unit_id": "a.8", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 46.875, "full_output_similarity": 46.875}, {"unit_id": "a.9", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 45.652, "full_output_similarity": 45.652}, {"unit_id": "a.10", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 40.541, "full_output_similarity": 40.541}, {"unit_id": "a.11", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 42.424, "full_output_similarity": 42.424}, {"unit_id": "a.12", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 42.857, "full_output_similarity": 42.857}, {"unit_id": "a.13", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 41.667, "full_output_similarity": 41.667}, {"unit_id": "a.14", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 43.243, "full_output_similarity": 43.243}, {"unit_id": "a.15", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 43.243, "full_output_similarity": 43.243}, {"unit_id": "a.16", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 43.636, "full_output_similarity": 43.636}, {"unit_id": "a.17", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 40.741, "full_output_similarity": 40.741}, {"unit_id": "a.18", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 48.333, "full_output_similarity": 48.333}, {"unit_id": "a.19", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 46.154, "full_output_similarity": 46.154}], "method": "normalized_final_answer_unit_fuzzy_v3", "scoring_scope": "final_answer_only", "scorer_thresholds": {"final_partial_ratio": 92, "full_output_partial_ratio": null}, "needs_human_review": true, "model": "meta-llama/Llama-3.2-3B-Instruct"} +{"record_id": "iol-2025-individual-p2-sub-a", "score": 0.0, "max_score": 1.0, "score_fraction": 0.0, "verdict": "incorrect", "matched_units": [], "missed_units": ["a.1"], "unit_results": [{"unit_id": "a.1", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 32.979, "full_output_similarity": 32.979}], "method": "normalized_final_answer_unit_fuzzy_v3", "scoring_scope": "final_answer_only", "scorer_thresholds": {"final_partial_ratio": 92, "full_output_partial_ratio": null}, "needs_human_review": true, "model": "meta-llama/Llama-3.2-3B-Instruct"} +{"record_id": "iol-2025-team-p1-sub-a", "score": 0.0, "max_score": 1.0, "score_fraction": 0.0, "verdict": "incorrect", "matched_units": [], "missed_units": ["a.1"], "unit_results": [{"unit_id": "a.1", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 36.842, "full_output_similarity": 32.738}], "method": "normalized_final_answer_unit_fuzzy_v3", "scoring_scope": "final_answer_only", "scorer_thresholds": {"final_partial_ratio": 92, "full_output_partial_ratio": null}, "needs_human_review": true, "model": "meta-llama/Llama-3.2-3B-Instruct"} diff --git a/benchmark/IOL/ioling_hf/evals/results/microsoft__Phi-4-mini-instruct.scores.jsonl b/benchmark/IOL/ioling_hf/evals/results/microsoft__Phi-4-mini-instruct.scores.jsonl new file mode 100644 index 0000000000000000000000000000000000000000..7ad6759abb46e3b8d3804a3d176ab84fdc940e03 --- /dev/null +++ b/benchmark/IOL/ioling_hf/evals/results/microsoft__Phi-4-mini-instruct.scores.jsonl @@ -0,0 +1,3 @@ +{"record_id": "iol-2006-individual-p1", "score": 0.0, "max_score": 9.0, "score_fraction": 0.0, "verdict": "incorrect", "matched_units": [], "missed_units": ["assignment_1.1", "assignment_1.2", "assignment_1.3", "assignment_1.4", "assignment_2.1", "assignment_3.1", "assignment_3.2", "assignment_3.3", "assignment_3.4"], "unit_results": [{"unit_id": "assignment_1.1", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 72.5, "full_output_similarity": 72.5}, {"unit_id": "assignment_1.2", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 57.576, "full_output_similarity": 57.576}, {"unit_id": "assignment_1.3", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 54.545, "full_output_similarity": 54.545}, {"unit_id": "assignment_1.4", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 64.286, "full_output_similarity": 64.286}, {"unit_id": "assignment_2.1", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 55.556, "full_output_similarity": 55.556}, {"unit_id": "assignment_3.1", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 69.767, "full_output_similarity": 69.767}, {"unit_id": "assignment_3.2", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 70.833, "full_output_similarity": 70.833}, {"unit_id": "assignment_3.3", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 69.231, "full_output_similarity": 69.231}, {"unit_id": "assignment_3.4", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 60.606, "full_output_similarity": 60.606}], "method": "normalized_final_answer_unit_fuzzy_v3", "scoring_scope": "final_answer_only", "scorer_thresholds": {"final_partial_ratio": 92, "full_output_partial_ratio": null}, "needs_human_review": true, "model": "microsoft/Phi-4-mini-instruct"} +{"record_id": "iol-2006-individual-p1-sub-assignment_1", "score": 0.0, "max_score": 4.0, "score_fraction": 0.0, "verdict": "incorrect", "matched_units": [], "missed_units": ["assignment_1.1", "assignment_1.2", "assignment_1.3", "assignment_1.4"], "unit_results": [{"unit_id": "assignment_1.1", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 77.5, "full_output_similarity": 77.5}, {"unit_id": "assignment_1.2", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 60.606, "full_output_similarity": 60.606}, {"unit_id": "assignment_1.3", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 54.545, "full_output_similarity": 54.545}, {"unit_id": "assignment_1.4", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 71.429, "full_output_similarity": 71.429}], "method": "normalized_final_answer_unit_fuzzy_v3", "scoring_scope": "final_answer_only", "scorer_thresholds": {"final_partial_ratio": 92, "full_output_partial_ratio": null}, "needs_human_review": true, "model": "microsoft/Phi-4-mini-instruct"} +{"record_id": "iol-2006-individual-p1-sub-assignment_2", "score": 0.0, "max_score": 1.0, "score_fraction": 0.0, "verdict": "incorrect", "matched_units": [], "missed_units": ["assignment_2.1"], "unit_results": [{"unit_id": "assignment_2.1", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 58.333, "full_output_similarity": 58.333}], "method": "normalized_final_answer_unit_fuzzy_v3", "scoring_scope": "final_answer_only", "scorer_thresholds": {"final_partial_ratio": 92, "full_output_partial_ratio": null}, "needs_human_review": true, "model": "microsoft/Phi-4-mini-instruct"} diff --git a/benchmark/IOL/ioling_hf/evals/results/microsoft__Phi-4-mini-instruct__diverse5.scores.jsonl b/benchmark/IOL/ioling_hf/evals/results/microsoft__Phi-4-mini-instruct__diverse5.scores.jsonl new file mode 100644 index 0000000000000000000000000000000000000000..1fcae6f0c4cc056c4ec29fcd8d364bf3437a029d --- /dev/null +++ b/benchmark/IOL/ioling_hf/evals/results/microsoft__Phi-4-mini-instruct__diverse5.scores.jsonl @@ -0,0 +1,5 @@ +{"record_id": "iol-2006-individual-p1-sub-assignment_1", "score": 0.0, "max_score": 4.0, "score_fraction": 0.0, "verdict": "incorrect", "matched_units": [], "missed_units": ["assignment_1.1", "assignment_1.2", "assignment_1.3", "assignment_1.4"], "unit_results": [{"unit_id": "assignment_1.1", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 77.5, "full_output_similarity": 77.5}, {"unit_id": "assignment_1.2", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 54.545, "full_output_similarity": 54.545}, {"unit_id": "assignment_1.3", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 52.273, "full_output_similarity": 52.273}, {"unit_id": "assignment_1.4", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 72.727, "full_output_similarity": 72.727}], "method": "normalized_final_answer_unit_fuzzy_v3", "scoring_scope": "final_answer_only", "scorer_thresholds": {"final_partial_ratio": 92, "full_output_partial_ratio": null}, "needs_human_review": true, "model": "microsoft/Phi-4-mini-instruct"} +{"record_id": "iol-2011-individual-p1-sub-a", "score": 0.0, "max_score": 1.0, "score_fraction": 0.0, "verdict": "incorrect", "matched_units": [], "missed_units": ["a.1"], "unit_results": [{"unit_id": "a.1", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 0.0, "full_output_similarity": 0.0}], "method": "normalized_final_answer_unit_fuzzy_v3", "scoring_scope": "final_answer_only", "scorer_thresholds": {"final_partial_ratio": 92, "full_output_partial_ratio": null}, "needs_human_review": true, "model": "microsoft/Phi-4-mini-instruct"} +{"record_id": "iol-2015-individual-p5-sub-b", "score": 0.0, "max_score": 9.0, "score_fraction": 0.0, "verdict": "incorrect", "matched_units": [], "missed_units": ["b.1", "b.2", "b.3", "b.4", "b.5", "b.6", "b.7", "b.8", "b.9"], "unit_results": [{"unit_id": "b.1", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 77.778, "full_output_similarity": 77.778}, {"unit_id": "b.2", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 73.913, "full_output_similarity": 73.913}, {"unit_id": "b.3", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 77.778, "full_output_similarity": 77.778}, {"unit_id": "b.4", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 75.0, "full_output_similarity": 75.0}, {"unit_id": "b.5", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 45.833, "full_output_similarity": 45.833}, {"unit_id": "b.6", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 44.828, "full_output_similarity": 44.828}, {"unit_id": "b.7", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 52.0, "full_output_similarity": 52.0}, {"unit_id": "b.8", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 46.667, "full_output_similarity": 46.667}, {"unit_id": "b.9", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 44.444, "full_output_similarity": 44.444}], "method": "normalized_final_answer_unit_fuzzy_v3", "scoring_scope": "final_answer_only", "scorer_thresholds": {"final_partial_ratio": 92, "full_output_partial_ratio": null}, "needs_human_review": true, "model": "microsoft/Phi-4-mini-instruct"} +{"record_id": "iol-2021-individual-p2-sub-a", "score": 0.0, "max_score": 9.0, "score_fraction": 0.0, "verdict": "incorrect", "matched_units": [], "missed_units": ["a.1", "a.2", "a.3", "a.4", "a.5", "a.6", "a.7", "a.8", "a.9"], "unit_results": [{"unit_id": "a.1", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 46.154, "full_output_similarity": 46.154}, {"unit_id": "a.2", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 46.667, "full_output_similarity": 46.667}, {"unit_id": "a.3", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 50.0, "full_output_similarity": 50.0}, {"unit_id": "a.4", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 42.857, "full_output_similarity": 42.857}, {"unit_id": "a.5", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 51.515, "full_output_similarity": 51.515}, {"unit_id": "a.6", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 46.667, "full_output_similarity": 46.667}, {"unit_id": "a.7", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 66.667, "full_output_similarity": 66.667}, {"unit_id": "a.8", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 41.935, "full_output_similarity": 41.935}, {"unit_id": "a.9", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 36.111, "full_output_similarity": 36.111}], "method": "normalized_final_answer_unit_fuzzy_v3", "scoring_scope": "final_answer_only", "scorer_thresholds": {"final_partial_ratio": 92, "full_output_partial_ratio": null}, "needs_human_review": true, "model": "microsoft/Phi-4-mini-instruct"} +{"record_id": "iol-2025-team-p1-sub-a", "score": 0.0, "max_score": 1.0, "score_fraction": 0.0, "verdict": "incorrect", "matched_units": [], "missed_units": ["a.1"], "unit_results": [{"unit_id": "a.1", "points": 1.0, "matched": false, "match_type": "none", "final_similarity": 32.738, "full_output_similarity": 32.738}], "method": "normalized_final_answer_unit_fuzzy_v3", "scoring_scope": "final_answer_only", "scorer_thresholds": {"final_partial_ratio": 92, "full_output_partial_ratio": null}, "needs_human_review": true, "model": "microsoft/Phi-4-mini-instruct"} diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/py/_code/__init__.py b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/py/_code/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..f15acf85132113f090b1a53cdd0bac39af924d4d --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/py/_code/__init__.py @@ -0,0 +1 @@ +""" python inspection/code generation API """ diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/py/_code/_assertionnew.py b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/py/_code/_assertionnew.py new file mode 100644 index 0000000000000000000000000000000000000000..d03f29d870814283d3f2d537d91b8a527821ee1f --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/py/_code/_assertionnew.py @@ -0,0 +1,322 @@ +""" +Find intermediate evalutation results in assert statements through builtin AST. +This should replace _assertionold.py eventually. +""" + +import sys +import ast + +import py +from py._code.assertion import _format_explanation, BuiltinAssertionError + + +def _is_ast_expr(node): + return isinstance(node, ast.expr) +def _is_ast_stmt(node): + return isinstance(node, ast.stmt) + + +class Failure(Exception): + """Error found while interpreting AST.""" + + def __init__(self, explanation=""): + self.cause = sys.exc_info() + self.explanation = explanation + + +def interpret(source, frame, should_fail=False): + mod = ast.parse(source) + visitor = DebugInterpreter(frame) + try: + visitor.visit(mod) + except Failure: + failure = sys.exc_info()[1] + return getfailure(failure) + if should_fail: + return ("(assertion failed, but when it was re-run for " + "printing intermediate values, it did not fail. Suggestions: " + "compute assert expression before the assert or use --no-assert)") + +def run(offending_line, frame=None): + if frame is None: + frame = py.code.Frame(sys._getframe(1)) + return interpret(offending_line, frame) + +def getfailure(failure): + explanation = _format_explanation(failure.explanation) + value = failure.cause[1] + if str(value): + lines = explanation.splitlines() + if not lines: + lines.append("") + lines[0] += " << %s" % (value,) + explanation = "\n".join(lines) + text = "%s: %s" % (failure.cause[0].__name__, explanation) + if text.startswith("AssertionError: assert "): + text = text[16:] + return text + + +operator_map = { + ast.BitOr : "|", + ast.BitXor : "^", + ast.BitAnd : "&", + ast.LShift : "<<", + ast.RShift : ">>", + ast.Add : "+", + ast.Sub : "-", + ast.Mult : "*", + ast.Div : "/", + ast.FloorDiv : "//", + ast.Mod : "%", + ast.Eq : "==", + ast.NotEq : "!=", + ast.Lt : "<", + ast.LtE : "<=", + ast.Gt : ">", + ast.GtE : ">=", + ast.Pow : "**", + ast.Is : "is", + ast.IsNot : "is not", + ast.In : "in", + ast.NotIn : "not in" +} + +unary_map = { + ast.Not : "not %s", + ast.Invert : "~%s", + ast.USub : "-%s", + ast.UAdd : "+%s" +} + + +class DebugInterpreter(ast.NodeVisitor): + """Interpret AST nodes to gleam useful debugging information. """ + + def __init__(self, frame): + self.frame = frame + + def generic_visit(self, node): + # Fallback when we don't have a special implementation. + if _is_ast_expr(node): + mod = ast.Expression(node) + co = self._compile(mod) + try: + result = self.frame.eval(co) + except Exception: + raise Failure() + explanation = self.frame.repr(result) + return explanation, result + elif _is_ast_stmt(node): + mod = ast.Module([node]) + co = self._compile(mod, "exec") + try: + self.frame.exec_(co) + except Exception: + raise Failure() + return None, None + else: + raise AssertionError("can't handle %s" %(node,)) + + def _compile(self, source, mode="eval"): + return compile(source, "", mode) + + def visit_Expr(self, expr): + return self.visit(expr.value) + + def visit_Module(self, mod): + for stmt in mod.body: + self.visit(stmt) + + def visit_Name(self, name): + explanation, result = self.generic_visit(name) + # See if the name is local. + source = "%r in locals() is not globals()" % (name.id,) + co = self._compile(source) + try: + local = self.frame.eval(co) + except Exception: + # have to assume it isn't + local = False + if not local: + return name.id, result + return explanation, result + + def visit_Compare(self, comp): + left = comp.left + left_explanation, left_result = self.visit(left) + for op, next_op in zip(comp.ops, comp.comparators): + next_explanation, next_result = self.visit(next_op) + op_symbol = operator_map[op.__class__] + explanation = "%s %s %s" % (left_explanation, op_symbol, + next_explanation) + source = "__exprinfo_left %s __exprinfo_right" % (op_symbol,) + co = self._compile(source) + try: + result = self.frame.eval(co, __exprinfo_left=left_result, + __exprinfo_right=next_result) + except Exception: + raise Failure(explanation) + try: + if not result: + break + except KeyboardInterrupt: + raise + except: + break + left_explanation, left_result = next_explanation, next_result + + rcomp = py.code._reprcompare + if rcomp: + res = rcomp(op_symbol, left_result, next_result) + if res: + explanation = res + return explanation, result + + def visit_BoolOp(self, boolop): + is_or = isinstance(boolop.op, ast.Or) + explanations = [] + for operand in boolop.values: + explanation, result = self.visit(operand) + explanations.append(explanation) + if result == is_or: + break + name = is_or and " or " or " and " + explanation = "(" + name.join(explanations) + ")" + return explanation, result + + def visit_UnaryOp(self, unary): + pattern = unary_map[unary.op.__class__] + operand_explanation, operand_result = self.visit(unary.operand) + explanation = pattern % (operand_explanation,) + co = self._compile(pattern % ("__exprinfo_expr",)) + try: + result = self.frame.eval(co, __exprinfo_expr=operand_result) + except Exception: + raise Failure(explanation) + return explanation, result + + def visit_BinOp(self, binop): + left_explanation, left_result = self.visit(binop.left) + right_explanation, right_result = self.visit(binop.right) + symbol = operator_map[binop.op.__class__] + explanation = "(%s %s %s)" % (left_explanation, symbol, + right_explanation) + source = "__exprinfo_left %s __exprinfo_right" % (symbol,) + co = self._compile(source) + try: + result = self.frame.eval(co, __exprinfo_left=left_result, + __exprinfo_right=right_result) + except Exception: + raise Failure(explanation) + return explanation, result + + def visit_Call(self, call): + func_explanation, func = self.visit(call.func) + arg_explanations = [] + ns = {"__exprinfo_func" : func} + arguments = [] + for arg in call.args: + arg_explanation, arg_result = self.visit(arg) + arg_name = "__exprinfo_%s" % (len(ns),) + ns[arg_name] = arg_result + arguments.append(arg_name) + arg_explanations.append(arg_explanation) + for keyword in call.keywords: + arg_explanation, arg_result = self.visit(keyword.value) + arg_name = "__exprinfo_%s" % (len(ns),) + ns[arg_name] = arg_result + keyword_source = "%s=%%s" % (keyword.arg) + arguments.append(keyword_source % (arg_name,)) + arg_explanations.append(keyword_source % (arg_explanation,)) + if call.starargs: + arg_explanation, arg_result = self.visit(call.starargs) + arg_name = "__exprinfo_star" + ns[arg_name] = arg_result + arguments.append("*%s" % (arg_name,)) + arg_explanations.append("*%s" % (arg_explanation,)) + if call.kwargs: + arg_explanation, arg_result = self.visit(call.kwargs) + arg_name = "__exprinfo_kwds" + ns[arg_name] = arg_result + arguments.append("**%s" % (arg_name,)) + arg_explanations.append("**%s" % (arg_explanation,)) + args_explained = ", ".join(arg_explanations) + explanation = "%s(%s)" % (func_explanation, args_explained) + args = ", ".join(arguments) + source = "__exprinfo_func(%s)" % (args,) + co = self._compile(source) + try: + result = self.frame.eval(co, **ns) + except Exception: + raise Failure(explanation) + pattern = "%s\n{%s = %s\n}" + rep = self.frame.repr(result) + explanation = pattern % (rep, rep, explanation) + return explanation, result + + def _is_builtin_name(self, name): + pattern = "%r not in globals() and %r not in locals()" + source = pattern % (name.id, name.id) + co = self._compile(source) + try: + return self.frame.eval(co) + except Exception: + return False + + def visit_Attribute(self, attr): + if not isinstance(attr.ctx, ast.Load): + return self.generic_visit(attr) + source_explanation, source_result = self.visit(attr.value) + explanation = "%s.%s" % (source_explanation, attr.attr) + source = "__exprinfo_expr.%s" % (attr.attr,) + co = self._compile(source) + try: + result = self.frame.eval(co, __exprinfo_expr=source_result) + except Exception: + raise Failure(explanation) + explanation = "%s\n{%s = %s.%s\n}" % (self.frame.repr(result), + self.frame.repr(result), + source_explanation, attr.attr) + # Check if the attr is from an instance. + source = "%r in getattr(__exprinfo_expr, '__dict__', {})" + source = source % (attr.attr,) + co = self._compile(source) + try: + from_instance = self.frame.eval(co, __exprinfo_expr=source_result) + except Exception: + from_instance = True + if from_instance: + rep = self.frame.repr(result) + pattern = "%s\n{%s = %s\n}" + explanation = pattern % (rep, rep, explanation) + return explanation, result + + def visit_Assert(self, assrt): + test_explanation, test_result = self.visit(assrt.test) + if test_explanation.startswith("False\n{False =") and \ + test_explanation.endswith("\n"): + test_explanation = test_explanation[15:-2] + explanation = "assert %s" % (test_explanation,) + if not test_result: + try: + raise BuiltinAssertionError + except Exception: + raise Failure(explanation) + return explanation, test_result + + def visit_Assign(self, assign): + value_explanation, value_result = self.visit(assign.value) + explanation = "... = %s" % (value_explanation,) + name = ast.Name("__exprinfo_expr", ast.Load(), + lineno=assign.value.lineno, + col_offset=assign.value.col_offset) + new_assign = ast.Assign(assign.targets, name, lineno=assign.lineno, + col_offset=assign.col_offset) + mod = ast.Module([new_assign]) + co = self._compile(mod, "exec") + try: + self.frame.exec_(co, __exprinfo_expr=value_result) + except Exception: + raise Failure(explanation) + return explanation, value_result diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/py/_code/_assertionold.py b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/py/_code/_assertionold.py new file mode 100644 index 0000000000000000000000000000000000000000..1bb70a875d059d664c6518701963864afad86593 --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/py/_code/_assertionold.py @@ -0,0 +1,556 @@ +import py +import sys, inspect +from compiler import parse, ast, pycodegen +from py._code.assertion import BuiltinAssertionError, _format_explanation +import types + +passthroughex = py.builtin._sysex + +class Failure: + def __init__(self, node): + self.exc, self.value, self.tb = sys.exc_info() + self.node = node + +class View(object): + """View base class. + + If C is a subclass of View, then C(x) creates a proxy object around + the object x. The actual class of the proxy is not C in general, + but a *subclass* of C determined by the rules below. To avoid confusion + we call view class the class of the proxy (a subclass of C, so of View) + and object class the class of x. + + Attributes and methods not found in the proxy are automatically read on x. + Other operations like setting attributes are performed on the proxy, as + determined by its view class. The object x is available from the proxy + as its __obj__ attribute. + + The view class selection is determined by the __view__ tuples and the + optional __viewkey__ method. By default, the selected view class is the + most specific subclass of C whose __view__ mentions the class of x. + If no such subclass is found, the search proceeds with the parent + object classes. For example, C(True) will first look for a subclass + of C with __view__ = (..., bool, ...) and only if it doesn't find any + look for one with __view__ = (..., int, ...), and then ..., object,... + If everything fails the class C itself is considered to be the default. + + Alternatively, the view class selection can be driven by another aspect + of the object x, instead of the class of x, by overriding __viewkey__. + See last example at the end of this module. + """ + + _viewcache = {} + __view__ = () + + def __new__(rootclass, obj, *args, **kwds): + self = object.__new__(rootclass) + self.__obj__ = obj + self.__rootclass__ = rootclass + key = self.__viewkey__() + try: + self.__class__ = self._viewcache[key] + except KeyError: + self.__class__ = self._selectsubclass(key) + return self + + def __getattr__(self, attr): + # attributes not found in the normal hierarchy rooted on View + # are looked up in the object's real class + return getattr(self.__obj__, attr) + + def __viewkey__(self): + return self.__obj__.__class__ + + def __matchkey__(self, key, subclasses): + if inspect.isclass(key): + keys = inspect.getmro(key) + else: + keys = [key] + for key in keys: + result = [C for C in subclasses if key in C.__view__] + if result: + return result + return [] + + def _selectsubclass(self, key): + subclasses = list(enumsubclasses(self.__rootclass__)) + for C in subclasses: + if not isinstance(C.__view__, tuple): + C.__view__ = (C.__view__,) + choices = self.__matchkey__(key, subclasses) + if not choices: + return self.__rootclass__ + elif len(choices) == 1: + return choices[0] + else: + # combine the multiple choices + return type('?', tuple(choices), {}) + + def __repr__(self): + return '%s(%r)' % (self.__rootclass__.__name__, self.__obj__) + + +def enumsubclasses(cls): + for subcls in cls.__subclasses__(): + for subsubclass in enumsubclasses(subcls): + yield subsubclass + yield cls + + +class Interpretable(View): + """A parse tree node with a few extra methods.""" + explanation = None + + def is_builtin(self, frame): + return False + + def eval(self, frame): + # fall-back for unknown expression nodes + try: + expr = ast.Expression(self.__obj__) + expr.filename = '' + self.__obj__.filename = '' + co = pycodegen.ExpressionCodeGenerator(expr).getCode() + result = frame.eval(co) + except passthroughex: + raise + except: + raise Failure(self) + self.result = result + self.explanation = self.explanation or frame.repr(self.result) + + def run(self, frame): + # fall-back for unknown statement nodes + try: + expr = ast.Module(None, ast.Stmt([self.__obj__])) + expr.filename = '' + co = pycodegen.ModuleCodeGenerator(expr).getCode() + frame.exec_(co) + except passthroughex: + raise + except: + raise Failure(self) + + def nice_explanation(self): + return _format_explanation(self.explanation) + + +class Name(Interpretable): + __view__ = ast.Name + + def is_local(self, frame): + source = '%r in locals() is not globals()' % self.name + try: + return frame.is_true(frame.eval(source)) + except passthroughex: + raise + except: + return False + + def is_global(self, frame): + source = '%r in globals()' % self.name + try: + return frame.is_true(frame.eval(source)) + except passthroughex: + raise + except: + return False + + def is_builtin(self, frame): + source = '%r not in locals() and %r not in globals()' % ( + self.name, self.name) + try: + return frame.is_true(frame.eval(source)) + except passthroughex: + raise + except: + return False + + def eval(self, frame): + super(Name, self).eval(frame) + if not self.is_local(frame): + self.explanation = self.name + +class Compare(Interpretable): + __view__ = ast.Compare + + def eval(self, frame): + expr = Interpretable(self.expr) + expr.eval(frame) + for operation, expr2 in self.ops: + if hasattr(self, 'result'): + # shortcutting in chained expressions + if not frame.is_true(self.result): + break + expr2 = Interpretable(expr2) + expr2.eval(frame) + self.explanation = "%s %s %s" % ( + expr.explanation, operation, expr2.explanation) + source = "__exprinfo_left %s __exprinfo_right" % operation + try: + self.result = frame.eval(source, + __exprinfo_left=expr.result, + __exprinfo_right=expr2.result) + except passthroughex: + raise + except: + raise Failure(self) + expr = expr2 + +class And(Interpretable): + __view__ = ast.And + + def eval(self, frame): + explanations = [] + for expr in self.nodes: + expr = Interpretable(expr) + expr.eval(frame) + explanations.append(expr.explanation) + self.result = expr.result + if not frame.is_true(expr.result): + break + self.explanation = '(' + ' and '.join(explanations) + ')' + +class Or(Interpretable): + __view__ = ast.Or + + def eval(self, frame): + explanations = [] + for expr in self.nodes: + expr = Interpretable(expr) + expr.eval(frame) + explanations.append(expr.explanation) + self.result = expr.result + if frame.is_true(expr.result): + break + self.explanation = '(' + ' or '.join(explanations) + ')' + + +# == Unary operations == +keepalive = [] +for astclass, astpattern in { + ast.Not : 'not __exprinfo_expr', + ast.Invert : '(~__exprinfo_expr)', + }.items(): + + class UnaryArith(Interpretable): + __view__ = astclass + + def eval(self, frame, astpattern=astpattern): + expr = Interpretable(self.expr) + expr.eval(frame) + self.explanation = astpattern.replace('__exprinfo_expr', + expr.explanation) + try: + self.result = frame.eval(astpattern, + __exprinfo_expr=expr.result) + except passthroughex: + raise + except: + raise Failure(self) + + keepalive.append(UnaryArith) + +# == Binary operations == +for astclass, astpattern in { + ast.Add : '(__exprinfo_left + __exprinfo_right)', + ast.Sub : '(__exprinfo_left - __exprinfo_right)', + ast.Mul : '(__exprinfo_left * __exprinfo_right)', + ast.Div : '(__exprinfo_left / __exprinfo_right)', + ast.Mod : '(__exprinfo_left % __exprinfo_right)', + ast.Power : '(__exprinfo_left ** __exprinfo_right)', + }.items(): + + class BinaryArith(Interpretable): + __view__ = astclass + + def eval(self, frame, astpattern=astpattern): + left = Interpretable(self.left) + left.eval(frame) + right = Interpretable(self.right) + right.eval(frame) + self.explanation = (astpattern + .replace('__exprinfo_left', left .explanation) + .replace('__exprinfo_right', right.explanation)) + try: + self.result = frame.eval(astpattern, + __exprinfo_left=left.result, + __exprinfo_right=right.result) + except passthroughex: + raise + except: + raise Failure(self) + + keepalive.append(BinaryArith) + + +class CallFunc(Interpretable): + __view__ = ast.CallFunc + + def is_bool(self, frame): + source = 'isinstance(__exprinfo_value, bool)' + try: + return frame.is_true(frame.eval(source, + __exprinfo_value=self.result)) + except passthroughex: + raise + except: + return False + + def eval(self, frame): + node = Interpretable(self.node) + node.eval(frame) + explanations = [] + vars = {'__exprinfo_fn': node.result} + source = '__exprinfo_fn(' + for a in self.args: + if isinstance(a, ast.Keyword): + keyword = a.name + a = a.expr + else: + keyword = None + a = Interpretable(a) + a.eval(frame) + argname = '__exprinfo_%d' % len(vars) + vars[argname] = a.result + if keyword is None: + source += argname + ',' + explanations.append(a.explanation) + else: + source += '%s=%s,' % (keyword, argname) + explanations.append('%s=%s' % (keyword, a.explanation)) + if self.star_args: + star_args = Interpretable(self.star_args) + star_args.eval(frame) + argname = '__exprinfo_star' + vars[argname] = star_args.result + source += '*' + argname + ',' + explanations.append('*' + star_args.explanation) + if self.dstar_args: + dstar_args = Interpretable(self.dstar_args) + dstar_args.eval(frame) + argname = '__exprinfo_kwds' + vars[argname] = dstar_args.result + source += '**' + argname + ',' + explanations.append('**' + dstar_args.explanation) + self.explanation = "%s(%s)" % ( + node.explanation, ', '.join(explanations)) + if source.endswith(','): + source = source[:-1] + source += ')' + try: + self.result = frame.eval(source, **vars) + except passthroughex: + raise + except: + raise Failure(self) + if not node.is_builtin(frame) or not self.is_bool(frame): + r = frame.repr(self.result) + self.explanation = '%s\n{%s = %s\n}' % (r, r, self.explanation) + +class Getattr(Interpretable): + __view__ = ast.Getattr + + def eval(self, frame): + expr = Interpretable(self.expr) + expr.eval(frame) + source = '__exprinfo_expr.%s' % self.attrname + try: + self.result = frame.eval(source, __exprinfo_expr=expr.result) + except passthroughex: + raise + except: + raise Failure(self) + self.explanation = '%s.%s' % (expr.explanation, self.attrname) + # if the attribute comes from the instance, its value is interesting + source = ('hasattr(__exprinfo_expr, "__dict__") and ' + '%r in __exprinfo_expr.__dict__' % self.attrname) + try: + from_instance = frame.is_true( + frame.eval(source, __exprinfo_expr=expr.result)) + except passthroughex: + raise + except: + from_instance = True + if from_instance: + r = frame.repr(self.result) + self.explanation = '%s\n{%s = %s\n}' % (r, r, self.explanation) + +# == Re-interpretation of full statements == + +class Assert(Interpretable): + __view__ = ast.Assert + + def run(self, frame): + test = Interpretable(self.test) + test.eval(frame) + # simplify 'assert False where False = ...' + if (test.explanation.startswith('False\n{False = ') and + test.explanation.endswith('\n}')): + test.explanation = test.explanation[15:-2] + # print the result as 'assert ' + self.result = test.result + self.explanation = 'assert ' + test.explanation + if not frame.is_true(test.result): + try: + raise BuiltinAssertionError + except passthroughex: + raise + except: + raise Failure(self) + +class Assign(Interpretable): + __view__ = ast.Assign + + def run(self, frame): + expr = Interpretable(self.expr) + expr.eval(frame) + self.result = expr.result + self.explanation = '... = ' + expr.explanation + # fall-back-run the rest of the assignment + ass = ast.Assign(self.nodes, ast.Name('__exprinfo_expr')) + mod = ast.Module(None, ast.Stmt([ass])) + mod.filename = '' + co = pycodegen.ModuleCodeGenerator(mod).getCode() + try: + frame.exec_(co, __exprinfo_expr=expr.result) + except passthroughex: + raise + except: + raise Failure(self) + +class Discard(Interpretable): + __view__ = ast.Discard + + def run(self, frame): + expr = Interpretable(self.expr) + expr.eval(frame) + self.result = expr.result + self.explanation = expr.explanation + +class Stmt(Interpretable): + __view__ = ast.Stmt + + def run(self, frame): + for stmt in self.nodes: + stmt = Interpretable(stmt) + stmt.run(frame) + + +def report_failure(e): + explanation = e.node.nice_explanation() + if explanation: + explanation = ", in: " + explanation + else: + explanation = "" + sys.stdout.write("%s: %s%s\n" % (e.exc.__name__, e.value, explanation)) + +def check(s, frame=None): + if frame is None: + frame = sys._getframe(1) + frame = py.code.Frame(frame) + expr = parse(s, 'eval') + assert isinstance(expr, ast.Expression) + node = Interpretable(expr.node) + try: + node.eval(frame) + except passthroughex: + raise + except Failure: + e = sys.exc_info()[1] + report_failure(e) + else: + if not frame.is_true(node.result): + sys.stderr.write("assertion failed: %s\n" % node.nice_explanation()) + + +########################################################### +# API / Entry points +# ######################################################### + +def interpret(source, frame, should_fail=False): + module = Interpretable(parse(source, 'exec').node) + #print "got module", module + if isinstance(frame, types.FrameType): + frame = py.code.Frame(frame) + try: + module.run(frame) + except Failure: + e = sys.exc_info()[1] + return getfailure(e) + except passthroughex: + raise + except: + import traceback + traceback.print_exc() + if should_fail: + return ("(assertion failed, but when it was re-run for " + "printing intermediate values, it did not fail. Suggestions: " + "compute assert expression before the assert or use --nomagic)") + else: + return None + +def getmsg(excinfo): + if isinstance(excinfo, tuple): + excinfo = py.code.ExceptionInfo(excinfo) + #frame, line = gettbline(tb) + #frame = py.code.Frame(frame) + #return interpret(line, frame) + + tb = excinfo.traceback[-1] + source = str(tb.statement).strip() + x = interpret(source, tb.frame, should_fail=True) + if not isinstance(x, str): + raise TypeError("interpret returned non-string %r" % (x,)) + return x + +def getfailure(e): + explanation = e.node.nice_explanation() + if str(e.value): + lines = explanation.split('\n') + lines[0] += " << %s" % (e.value,) + explanation = '\n'.join(lines) + text = "%s: %s" % (e.exc.__name__, explanation) + if text.startswith('AssertionError: assert '): + text = text[16:] + return text + +def run(s, frame=None): + if frame is None: + frame = sys._getframe(1) + frame = py.code.Frame(frame) + module = Interpretable(parse(s, 'exec').node) + try: + module.run(frame) + except Failure: + e = sys.exc_info()[1] + report_failure(e) + + +if __name__ == '__main__': + # example: + def f(): + return 5 + def g(): + return 3 + def h(x): + return 'never' + check("f() * g() == 5") + check("not f()") + check("not (f() and g() or 0)") + check("f() == g()") + i = 4 + check("i == f()") + check("len(f()) == 0") + check("isinstance(2+3+4, float)") + + run("x = i") + check("x == 5") + + run("assert not f(), 'oops'") + run("a, b, c = 1, 2") + run("a, b, c = f()") + + check("max([f(),g()]) == 4") + check("'hello'[g()] == 'h'") + run("'guk%d' % h(f())") diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/py/_code/_py2traceback.py b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/py/_code/_py2traceback.py new file mode 100644 index 0000000000000000000000000000000000000000..d65e27cb73077bbd33bc0fad0d20a89e443bef9e --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/py/_code/_py2traceback.py @@ -0,0 +1,79 @@ +# copied from python-2.7.3's traceback.py +# CHANGES: +# - some_str is replaced, trying to create unicode strings +# +import types + +def format_exception_only(etype, value): + """Format the exception part of a traceback. + + The arguments are the exception type and value such as given by + sys.last_type and sys.last_value. The return value is a list of + strings, each ending in a newline. + + Normally, the list contains a single string; however, for + SyntaxError exceptions, it contains several lines that (when + printed) display detailed information about where the syntax + error occurred. + + The message indicating which exception occurred is always the last + string in the list. + + """ + + # An instance should not have a meaningful value parameter, but + # sometimes does, particularly for string exceptions, such as + # >>> raise string1, string2 # deprecated + # + # Clear these out first because issubtype(string1, SyntaxError) + # would throw another exception and mask the original problem. + if (isinstance(etype, BaseException) or + isinstance(etype, types.InstanceType) or + etype is None or type(etype) is str): + return [_format_final_exc_line(etype, value)] + + stype = etype.__name__ + + if not issubclass(etype, SyntaxError): + return [_format_final_exc_line(stype, value)] + + # It was a syntax error; show exactly where the problem was found. + lines = [] + try: + msg, (filename, lineno, offset, badline) = value.args + except Exception: + pass + else: + filename = filename or "" + lines.append(' File "%s", line %d\n' % (filename, lineno)) + if badline is not None: + lines.append(' %s\n' % badline.strip()) + if offset is not None: + caretspace = badline.rstrip('\n')[:offset].lstrip() + # non-space whitespace (likes tabs) must be kept for alignment + caretspace = ((c.isspace() and c or ' ') for c in caretspace) + # only three spaces to account for offset1 == pos 0 + lines.append(' %s^\n' % ''.join(caretspace)) + value = msg + + lines.append(_format_final_exc_line(stype, value)) + return lines + +def _format_final_exc_line(etype, value): + """Return a list of a single line -- normal case for format_exception_only""" + valuestr = _some_str(value) + if value is None or not valuestr: + line = "%s\n" % etype + else: + line = "%s: %s\n" % (etype, valuestr) + return line + +def _some_str(value): + try: + return unicode(value) + except Exception: + try: + return str(value) + except Exception: + pass + return '' % type(value).__name__ diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/py/_code/assertion.py b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/py/_code/assertion.py new file mode 100644 index 0000000000000000000000000000000000000000..ff1643799c9e015a8e351b89958ae3eb8111d668 --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/py/_code/assertion.py @@ -0,0 +1,90 @@ +import sys +import py + +BuiltinAssertionError = py.builtin.builtins.AssertionError + +_reprcompare = None # if set, will be called by assert reinterp for comparison ops + +def _format_explanation(explanation): + """This formats an explanation + + Normally all embedded newlines are escaped, however there are + three exceptions: \n{, \n} and \n~. The first two are intended + cover nested explanations, see function and attribute explanations + for examples (.visit_Call(), visit_Attribute()). The last one is + for when one explanation needs to span multiple lines, e.g. when + displaying diffs. + """ + raw_lines = (explanation or '').split('\n') + # escape newlines not followed by {, } and ~ + lines = [raw_lines[0]] + for l in raw_lines[1:]: + if l.startswith('{') or l.startswith('}') or l.startswith('~'): + lines.append(l) + else: + lines[-1] += '\\n' + l + + result = lines[:1] + stack = [0] + stackcnt = [0] + for line in lines[1:]: + if line.startswith('{'): + if stackcnt[-1]: + s = 'and ' + else: + s = 'where ' + stack.append(len(result)) + stackcnt[-1] += 1 + stackcnt.append(0) + result.append(' +' + ' '*(len(stack)-1) + s + line[1:]) + elif line.startswith('}'): + assert line.startswith('}') + stack.pop() + stackcnt.pop() + result[stack[-1]] += line[1:] + else: + assert line.startswith('~') + result.append(' '*len(stack) + line[1:]) + assert len(stack) == 1 + return '\n'.join(result) + + +class AssertionError(BuiltinAssertionError): + def __init__(self, *args): + BuiltinAssertionError.__init__(self, *args) + if args: + try: + self.msg = str(args[0]) + except py.builtin._sysex: + raise + except: + self.msg = "<[broken __repr__] %s at %0xd>" %( + args[0].__class__, id(args[0])) + else: + f = py.code.Frame(sys._getframe(1)) + try: + source = f.code.fullsource + if source is not None: + try: + source = source.getstatement(f.lineno, assertion=True) + except IndexError: + source = None + else: + source = str(source.deindent()).strip() + except py.error.ENOENT: + source = None + # this can also occur during reinterpretation, when the + # co_filename is set to "". + if source: + self.msg = reinterpret(source, f, should_fail=True) + else: + self.msg = "" + if not self.args: + self.args = (self.msg,) + +if sys.version_info > (3, 0): + AssertionError.__module__ = "builtins" + reinterpret_old = "old reinterpretation not available for py3" +else: + from py._code._assertionold import interpret as reinterpret_old +from py._code._assertionnew import interpret as reinterpret diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/py/_code/code.py b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/py/_code/code.py new file mode 100644 index 0000000000000000000000000000000000000000..dad796283fe64c89f5f99f2bc72adc4a7657d238 --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/py/_code/code.py @@ -0,0 +1,796 @@ +import py +import sys +from inspect import CO_VARARGS, CO_VARKEYWORDS, isclass + +builtin_repr = repr + +reprlib = py.builtin._tryimport('repr', 'reprlib') + +if sys.version_info[0] >= 3: + from traceback import format_exception_only +else: + from py._code._py2traceback import format_exception_only + +import traceback + + +class Code(object): + """ wrapper around Python code objects """ + def __init__(self, rawcode): + if not hasattr(rawcode, "co_filename"): + rawcode = py.code.getrawcode(rawcode) + try: + self.filename = rawcode.co_filename + self.firstlineno = rawcode.co_firstlineno - 1 + self.name = rawcode.co_name + except AttributeError: + raise TypeError("not a code object: %r" % (rawcode,)) + self.raw = rawcode + + def __eq__(self, other): + return self.raw == other.raw + + def __ne__(self, other): + return not self == other + + @property + def path(self): + """ return a path object pointing to source code (note that it + might not point to an actually existing file). """ + p = py.path.local(self.raw.co_filename) + # maybe don't try this checking + if not p.check(): + # XXX maybe try harder like the weird logic + # in the standard lib [linecache.updatecache] does? + p = self.raw.co_filename + return p + + @property + def fullsource(self): + """ return a py.code.Source object for the full source file of the code + """ + from py._code import source + full, _ = source.findsource(self.raw) + return full + + def source(self): + """ return a py.code.Source object for the code object's source only + """ + # return source only for that part of code + return py.code.Source(self.raw) + + def getargs(self, var=False): + """ return a tuple with the argument names for the code object + + if 'var' is set True also return the names of the variable and + keyword arguments when present + """ + # handfull shortcut for getting args + raw = self.raw + argcount = raw.co_argcount + if var: + argcount += raw.co_flags & CO_VARARGS + argcount += raw.co_flags & CO_VARKEYWORDS + return raw.co_varnames[:argcount] + +class Frame(object): + """Wrapper around a Python frame holding f_locals and f_globals + in which expressions can be evaluated.""" + + def __init__(self, frame): + self.lineno = frame.f_lineno - 1 + self.f_globals = frame.f_globals + self.f_locals = frame.f_locals + self.raw = frame + self.code = py.code.Code(frame.f_code) + + @property + def statement(self): + """ statement this frame is at """ + if self.code.fullsource is None: + return py.code.Source("") + return self.code.fullsource.getstatement(self.lineno) + + def eval(self, code, **vars): + """ evaluate 'code' in the frame + + 'vars' are optional additional local variables + + returns the result of the evaluation + """ + f_locals = self.f_locals.copy() + f_locals.update(vars) + return eval(code, self.f_globals, f_locals) + + def exec_(self, code, **vars): + """ exec 'code' in the frame + + 'vars' are optiona; additional local variables + """ + f_locals = self.f_locals.copy() + f_locals.update(vars) + py.builtin.exec_(code, self.f_globals, f_locals) + + def repr(self, object): + """ return a 'safe' (non-recursive, one-line) string repr for 'object' + """ + return py.io.saferepr(object) + + def is_true(self, object): + return object + + def getargs(self, var=False): + """ return a list of tuples (name, value) for all arguments + + if 'var' is set True also include the variable and keyword + arguments when present + """ + retval = [] + for arg in self.code.getargs(var): + try: + retval.append((arg, self.f_locals[arg])) + except KeyError: + pass # this can occur when using Psyco + return retval + + +class TracebackEntry(object): + """ a single entry in a traceback """ + + _repr_style = None + exprinfo = None + + def __init__(self, rawentry): + self._rawentry = rawentry + self.lineno = rawentry.tb_lineno - 1 + + def set_repr_style(self, mode): + assert mode in ("short", "long") + self._repr_style = mode + + @property + def frame(self): + return py.code.Frame(self._rawentry.tb_frame) + + @property + def relline(self): + return self.lineno - self.frame.code.firstlineno + + def __repr__(self): + return "" % (self.frame.code.path, self.lineno+1) + + @property + def statement(self): + """ py.code.Source object for the current statement """ + source = self.frame.code.fullsource + return source.getstatement(self.lineno) + + @property + def path(self): + """ path to the source code """ + return self.frame.code.path + + def getlocals(self): + return self.frame.f_locals + locals = property(getlocals, None, None, "locals of underlaying frame") + + def reinterpret(self): + """Reinterpret the failing statement and returns a detailed information + about what operations are performed.""" + if self.exprinfo is None: + source = str(self.statement).strip() + x = py.code._reinterpret(source, self.frame, should_fail=True) + if not isinstance(x, str): + raise TypeError("interpret returned non-string %r" % (x,)) + self.exprinfo = x + return self.exprinfo + + def getfirstlinesource(self): + # on Jython this firstlineno can be -1 apparently + return max(self.frame.code.firstlineno, 0) + + def getsource(self, astcache=None): + """ return failing source code. """ + # we use the passed in astcache to not reparse asttrees + # within exception info printing + from py._code.source import getstatementrange_ast + source = self.frame.code.fullsource + if source is None: + return None + key = astnode = None + if astcache is not None: + key = self.frame.code.path + if key is not None: + astnode = astcache.get(key, None) + start = self.getfirstlinesource() + try: + astnode, _, end = getstatementrange_ast(self.lineno, source, + astnode=astnode) + except SyntaxError: + end = self.lineno + 1 + else: + if key is not None: + astcache[key] = astnode + return source[start:end] + + source = property(getsource) + + def ishidden(self): + """ return True if the current frame has a var __tracebackhide__ + resolving to True + + mostly for internal use + """ + try: + return self.frame.f_locals['__tracebackhide__'] + except KeyError: + try: + return self.frame.f_globals['__tracebackhide__'] + except KeyError: + return False + + def __str__(self): + try: + fn = str(self.path) + except py.error.Error: + fn = '???' + name = self.frame.code.name + try: + line = str(self.statement).lstrip() + except KeyboardInterrupt: + raise + except: + line = "???" + return " File %r:%d in %s\n %s\n" % (fn, self.lineno+1, name, line) + + def name(self): + return self.frame.code.raw.co_name + name = property(name, None, None, "co_name of underlaying code") + + +class Traceback(list): + """ Traceback objects encapsulate and offer higher level + access to Traceback entries. + """ + Entry = TracebackEntry + + def __init__(self, tb): + """ initialize from given python traceback object. """ + if hasattr(tb, 'tb_next'): + def f(cur): + while cur is not None: + yield self.Entry(cur) + cur = cur.tb_next + list.__init__(self, f(tb)) + else: + list.__init__(self, tb) + + def cut(self, path=None, lineno=None, firstlineno=None, excludepath=None): + """ return a Traceback instance wrapping part of this Traceback + + by provding any combination of path, lineno and firstlineno, the + first frame to start the to-be-returned traceback is determined + + this allows cutting the first part of a Traceback instance e.g. + for formatting reasons (removing some uninteresting bits that deal + with handling of the exception/traceback) + """ + for x in self: + code = x.frame.code + codepath = code.path + if ((path is None or codepath == path) and + (excludepath is None or not hasattr(codepath, 'relto') or + not codepath.relto(excludepath)) and + (lineno is None or x.lineno == lineno) and + (firstlineno is None or x.frame.code.firstlineno == firstlineno)): + return Traceback(x._rawentry) + return self + + def __getitem__(self, key): + val = super(Traceback, self).__getitem__(key) + if isinstance(key, type(slice(0))): + val = self.__class__(val) + return val + + def filter(self, fn=lambda x: not x.ishidden()): + """ return a Traceback instance with certain items removed + + fn is a function that gets a single argument, a TracebackItem + instance, and should return True when the item should be added + to the Traceback, False when not + + by default this removes all the TracebackItems which are hidden + (see ishidden() above) + """ + return Traceback(filter(fn, self)) + + def getcrashentry(self): + """ return last non-hidden traceback entry that lead + to the exception of a traceback. + """ + for i in range(-1, -len(self)-1, -1): + entry = self[i] + if not entry.ishidden(): + return entry + return self[-1] + + def recursionindex(self): + """ return the index of the frame/TracebackItem where recursion + originates if appropriate, None if no recursion occurred + """ + cache = {} + for i, entry in enumerate(self): + # id for the code.raw is needed to work around + # the strange metaprogramming in the decorator lib from pypi + # which generates code objects that have hash/value equality + #XXX needs a test + key = entry.frame.code.path, id(entry.frame.code.raw), entry.lineno + #print "checking for recursion at", key + l = cache.setdefault(key, []) + if l: + f = entry.frame + loc = f.f_locals + for otherloc in l: + if f.is_true(f.eval(co_equal, + __recursioncache_locals_1=loc, + __recursioncache_locals_2=otherloc)): + return i + l.append(entry.frame.f_locals) + return None + +co_equal = compile('__recursioncache_locals_1 == __recursioncache_locals_2', + '?', 'eval') + +class ExceptionInfo(object): + """ wraps sys.exc_info() objects and offers + help for navigating the traceback. + """ + _striptext = '' + def __init__(self, tup=None, exprinfo=None): + if tup is None: + tup = sys.exc_info() + if exprinfo is None and isinstance(tup[1], AssertionError): + exprinfo = getattr(tup[1], 'msg', None) + if exprinfo is None: + exprinfo = str(tup[1]) + if exprinfo and exprinfo.startswith('assert '): + self._striptext = 'AssertionError: ' + self._excinfo = tup + #: the exception class + self.type = tup[0] + #: the exception instance + self.value = tup[1] + #: the exception raw traceback + self.tb = tup[2] + #: the exception type name + self.typename = self.type.__name__ + #: the exception traceback (py.code.Traceback instance) + self.traceback = py.code.Traceback(self.tb) + + def __repr__(self): + return "" % ( + self.typename, len(self.traceback)) + + def exconly(self, tryshort=False): + """ return the exception as a string + + when 'tryshort' resolves to True, and the exception is a + py.code._AssertionError, only the actual exception part of + the exception representation is returned (so 'AssertionError: ' is + removed from the beginning) + """ + lines = format_exception_only(self.type, self.value) + text = ''.join(lines) + text = text.rstrip() + if tryshort: + if text.startswith(self._striptext): + text = text[len(self._striptext):] + return text + + def errisinstance(self, exc): + """ return True if the exception is an instance of exc """ + return isinstance(self.value, exc) + + def _getreprcrash(self): + exconly = self.exconly(tryshort=True) + entry = self.traceback.getcrashentry() + path, lineno = entry.frame.code.raw.co_filename, entry.lineno + return ReprFileLocation(path, lineno+1, exconly) + + def getrepr(self, showlocals=False, style="long", + abspath=False, tbfilter=True, funcargs=False): + """ return str()able representation of this exception info. + showlocals: show locals per traceback entry + style: long|short|no|native traceback style + tbfilter: hide entries (where __tracebackhide__ is true) + + in case of style==native, tbfilter and showlocals is ignored. + """ + if style == 'native': + return ReprExceptionInfo(ReprTracebackNative( + traceback.format_exception( + self.type, + self.value, + self.traceback[0]._rawentry, + )), self._getreprcrash()) + + fmt = FormattedExcinfo( + showlocals=showlocals, style=style, + abspath=abspath, tbfilter=tbfilter, funcargs=funcargs) + return fmt.repr_excinfo(self) + + def __str__(self): + entry = self.traceback[-1] + loc = ReprFileLocation(entry.path, entry.lineno + 1, self.exconly()) + return str(loc) + + def __unicode__(self): + entry = self.traceback[-1] + loc = ReprFileLocation(entry.path, entry.lineno + 1, self.exconly()) + return loc.__unicode__() + + +class FormattedExcinfo(object): + """ presenting information about failing Functions and Generators. """ + # for traceback entries + flow_marker = ">" + fail_marker = "E" + + def __init__(self, showlocals=False, style="long", + abspath=True, tbfilter=True, funcargs=False): + self.showlocals = showlocals + self.style = style + self.tbfilter = tbfilter + self.funcargs = funcargs + self.abspath = abspath + self.astcache = {} + + def _getindent(self, source): + # figure out indent for given source + try: + s = str(source.getstatement(len(source)-1)) + except KeyboardInterrupt: + raise + except: + try: + s = str(source[-1]) + except KeyboardInterrupt: + raise + except: + return 0 + return 4 + (len(s) - len(s.lstrip())) + + def _getentrysource(self, entry): + source = entry.getsource(self.astcache) + if source is not None: + source = source.deindent() + return source + + def _saferepr(self, obj): + return py.io.saferepr(obj) + + def repr_args(self, entry): + if self.funcargs: + args = [] + for argname, argvalue in entry.frame.getargs(var=True): + args.append((argname, self._saferepr(argvalue))) + return ReprFuncArgs(args) + + def get_source(self, source, line_index=-1, excinfo=None, short=False): + """ return formatted and marked up source lines. """ + lines = [] + if source is None or line_index >= len(source.lines): + source = py.code.Source("???") + line_index = 0 + if line_index < 0: + line_index += len(source) + space_prefix = " " + if short: + lines.append(space_prefix + source.lines[line_index].strip()) + else: + for line in source.lines[:line_index]: + lines.append(space_prefix + line) + lines.append(self.flow_marker + " " + source.lines[line_index]) + for line in source.lines[line_index+1:]: + lines.append(space_prefix + line) + if excinfo is not None: + indent = 4 if short else self._getindent(source) + lines.extend(self.get_exconly(excinfo, indent=indent, markall=True)) + return lines + + def get_exconly(self, excinfo, indent=4, markall=False): + lines = [] + indent = " " * indent + # get the real exception information out + exlines = excinfo.exconly(tryshort=True).split('\n') + failindent = self.fail_marker + indent[1:] + for line in exlines: + lines.append(failindent + line) + if not markall: + failindent = indent + return lines + + def repr_locals(self, locals): + if self.showlocals: + lines = [] + keys = [loc for loc in locals if loc[0] != "@"] + keys.sort() + for name in keys: + value = locals[name] + if name == '__builtins__': + lines.append("__builtins__ = ") + else: + # This formatting could all be handled by the + # _repr() function, which is only reprlib.Repr in + # disguise, so is very configurable. + str_repr = self._saferepr(value) + #if len(str_repr) < 70 or not isinstance(value, + # (list, tuple, dict)): + lines.append("%-10s = %s" %(name, str_repr)) + #else: + # self._line("%-10s =\\" % (name,)) + # # XXX + # pprint.pprint(value, stream=self.excinfowriter) + return ReprLocals(lines) + + def repr_traceback_entry(self, entry, excinfo=None): + source = self._getentrysource(entry) + if source is None: + source = py.code.Source("???") + line_index = 0 + else: + # entry.getfirstlinesource() can be -1, should be 0 on jython + line_index = entry.lineno - max(entry.getfirstlinesource(), 0) + + lines = [] + style = entry._repr_style + if style is None: + style = self.style + if style in ("short", "long"): + short = style == "short" + reprargs = self.repr_args(entry) if not short else None + s = self.get_source(source, line_index, excinfo, short=short) + lines.extend(s) + if short: + message = "in %s" %(entry.name) + else: + message = excinfo and excinfo.typename or "" + path = self._makepath(entry.path) + filelocrepr = ReprFileLocation(path, entry.lineno+1, message) + localsrepr = None + if not short: + localsrepr = self.repr_locals(entry.locals) + return ReprEntry(lines, reprargs, localsrepr, filelocrepr, style) + if excinfo: + lines.extend(self.get_exconly(excinfo, indent=4)) + return ReprEntry(lines, None, None, None, style) + + def _makepath(self, path): + if not self.abspath: + try: + np = py.path.local().bestrelpath(path) + except OSError: + return path + if len(np) < len(str(path)): + path = np + return path + + def repr_traceback(self, excinfo): + traceback = excinfo.traceback + if self.tbfilter: + traceback = traceback.filter() + recursionindex = None + if excinfo.errisinstance(RuntimeError): + if "maximum recursion depth exceeded" in str(excinfo.value): + recursionindex = traceback.recursionindex() + last = traceback[-1] + entries = [] + extraline = None + for index, entry in enumerate(traceback): + einfo = (last == entry) and excinfo or None + reprentry = self.repr_traceback_entry(entry, einfo) + entries.append(reprentry) + if index == recursionindex: + extraline = "!!! Recursion detected (same locals & position)" + break + return ReprTraceback(entries, extraline, style=self.style) + + def repr_excinfo(self, excinfo): + reprtraceback = self.repr_traceback(excinfo) + reprcrash = excinfo._getreprcrash() + return ReprExceptionInfo(reprtraceback, reprcrash) + +class TerminalRepr: + def __str__(self): + s = self.__unicode__() + if sys.version_info[0] < 3: + s = s.encode('utf-8') + return s + + def __unicode__(self): + # FYI this is called from pytest-xdist's serialization of exception + # information. + io = py.io.TextIO() + tw = py.io.TerminalWriter(file=io) + self.toterminal(tw) + return io.getvalue().strip() + + def __repr__(self): + return "<%s instance at %0x>" %(self.__class__, id(self)) + + +class ReprExceptionInfo(TerminalRepr): + def __init__(self, reprtraceback, reprcrash): + self.reprtraceback = reprtraceback + self.reprcrash = reprcrash + self.sections = [] + + def addsection(self, name, content, sep="-"): + self.sections.append((name, content, sep)) + + def toterminal(self, tw): + self.reprtraceback.toterminal(tw) + for name, content, sep in self.sections: + tw.sep(sep, name) + tw.line(content) + +class ReprTraceback(TerminalRepr): + entrysep = "_ " + + def __init__(self, reprentries, extraline, style): + self.reprentries = reprentries + self.extraline = extraline + self.style = style + + def toterminal(self, tw): + # the entries might have different styles + last_style = None + for i, entry in enumerate(self.reprentries): + if entry.style == "long": + tw.line("") + entry.toterminal(tw) + if i < len(self.reprentries) - 1: + next_entry = self.reprentries[i+1] + if entry.style == "long" or \ + entry.style == "short" and next_entry.style == "long": + tw.sep(self.entrysep) + + if self.extraline: + tw.line(self.extraline) + +class ReprTracebackNative(ReprTraceback): + def __init__(self, tblines): + self.style = "native" + self.reprentries = [ReprEntryNative(tblines)] + self.extraline = None + +class ReprEntryNative(TerminalRepr): + style = "native" + + def __init__(self, tblines): + self.lines = tblines + + def toterminal(self, tw): + tw.write("".join(self.lines)) + +class ReprEntry(TerminalRepr): + localssep = "_ " + + def __init__(self, lines, reprfuncargs, reprlocals, filelocrepr, style): + self.lines = lines + self.reprfuncargs = reprfuncargs + self.reprlocals = reprlocals + self.reprfileloc = filelocrepr + self.style = style + + def toterminal(self, tw): + if self.style == "short": + self.reprfileloc.toterminal(tw) + for line in self.lines: + red = line.startswith("E ") + tw.line(line, bold=True, red=red) + #tw.line("") + return + if self.reprfuncargs: + self.reprfuncargs.toterminal(tw) + for line in self.lines: + red = line.startswith("E ") + tw.line(line, bold=True, red=red) + if self.reprlocals: + #tw.sep(self.localssep, "Locals") + tw.line("") + self.reprlocals.toterminal(tw) + if self.reprfileloc: + if self.lines: + tw.line("") + self.reprfileloc.toterminal(tw) + + def __str__(self): + return "%s\n%s\n%s" % ("\n".join(self.lines), + self.reprlocals, + self.reprfileloc) + +class ReprFileLocation(TerminalRepr): + def __init__(self, path, lineno, message): + self.path = str(path) + self.lineno = lineno + self.message = message + + def toterminal(self, tw): + # filename and lineno output for each entry, + # using an output format that most editors unterstand + msg = self.message + i = msg.find("\n") + if i != -1: + msg = msg[:i] + tw.line("%s:%s: %s" %(self.path, self.lineno, msg)) + +class ReprLocals(TerminalRepr): + def __init__(self, lines): + self.lines = lines + + def toterminal(self, tw): + for line in self.lines: + tw.line(line) + +class ReprFuncArgs(TerminalRepr): + def __init__(self, args): + self.args = args + + def toterminal(self, tw): + if self.args: + linesofar = "" + for name, value in self.args: + ns = "%s = %s" %(name, value) + if len(ns) + len(linesofar) + 2 > tw.fullwidth: + if linesofar: + tw.line(linesofar) + linesofar = ns + else: + if linesofar: + linesofar += ", " + ns + else: + linesofar = ns + if linesofar: + tw.line(linesofar) + tw.line("") + + + +oldbuiltins = {} + +def patch_builtins(assertion=True, compile=True): + """ put compile and AssertionError builtins to Python's builtins. """ + if assertion: + from py._code import assertion + l = oldbuiltins.setdefault('AssertionError', []) + l.append(py.builtin.builtins.AssertionError) + py.builtin.builtins.AssertionError = assertion.AssertionError + if compile: + l = oldbuiltins.setdefault('compile', []) + l.append(py.builtin.builtins.compile) + py.builtin.builtins.compile = py.code.compile + +def unpatch_builtins(assertion=True, compile=True): + """ remove compile and AssertionError builtins from Python builtins. """ + if assertion: + py.builtin.builtins.AssertionError = oldbuiltins['AssertionError'].pop() + if compile: + py.builtin.builtins.compile = oldbuiltins['compile'].pop() + +def getrawcode(obj, trycall=True): + """ return code object for given function. """ + try: + return obj.__code__ + except AttributeError: + obj = getattr(obj, 'im_func', obj) + obj = getattr(obj, 'func_code', obj) + obj = getattr(obj, 'f_code', obj) + obj = getattr(obj, '__code__', obj) + if trycall and not hasattr(obj, 'co_firstlineno'): + if hasattr(obj, '__call__') and not isclass(obj): + x = getrawcode(obj.__call__, trycall=False) + if hasattr(x, 'co_firstlineno'): + return x + return obj + diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/py/_code/source.py b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/py/_code/source.py new file mode 100644 index 0000000000000000000000000000000000000000..7fc7b23a96c32e603f1e678d5dad272e84a0e27d --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/py/_code/source.py @@ -0,0 +1,410 @@ +from __future__ import generators + +from bisect import bisect_right +import sys +import inspect, tokenize +import py +from types import ModuleType +cpy_compile = compile + +try: + import _ast + from _ast import PyCF_ONLY_AST as _AST_FLAG +except ImportError: + _AST_FLAG = 0 + _ast = None + + +class Source(object): + """ a immutable object holding a source code fragment, + possibly deindenting it. + """ + _compilecounter = 0 + def __init__(self, *parts, **kwargs): + self.lines = lines = [] + de = kwargs.get('deindent', True) + rstrip = kwargs.get('rstrip', True) + for part in parts: + if not part: + partlines = [] + if isinstance(part, Source): + partlines = part.lines + elif isinstance(part, (tuple, list)): + partlines = [x.rstrip("\n") for x in part] + elif isinstance(part, py.builtin._basestring): + partlines = part.split('\n') + if rstrip: + while partlines: + if partlines[-1].strip(): + break + partlines.pop() + else: + partlines = getsource(part, deindent=de).lines + if de: + partlines = deindent(partlines) + lines.extend(partlines) + + def __eq__(self, other): + try: + return self.lines == other.lines + except AttributeError: + if isinstance(other, str): + return str(self) == other + return False + + def __getitem__(self, key): + if isinstance(key, int): + return self.lines[key] + else: + if key.step not in (None, 1): + raise IndexError("cannot slice a Source with a step") + return self.__getslice__(key.start, key.stop) + + def __len__(self): + return len(self.lines) + + def __getslice__(self, start, end): + newsource = Source() + newsource.lines = self.lines[start:end] + return newsource + + def strip(self): + """ return new source object with trailing + and leading blank lines removed. + """ + start, end = 0, len(self) + while start < end and not self.lines[start].strip(): + start += 1 + while end > start and not self.lines[end-1].strip(): + end -= 1 + source = Source() + source.lines[:] = self.lines[start:end] + return source + + def putaround(self, before='', after='', indent=' ' * 4): + """ return a copy of the source object with + 'before' and 'after' wrapped around it. + """ + before = Source(before) + after = Source(after) + newsource = Source() + lines = [ (indent + line) for line in self.lines] + newsource.lines = before.lines + lines + after.lines + return newsource + + def indent(self, indent=' ' * 4): + """ return a copy of the source object with + all lines indented by the given indent-string. + """ + newsource = Source() + newsource.lines = [(indent+line) for line in self.lines] + return newsource + + def getstatement(self, lineno, assertion=False): + """ return Source statement which contains the + given linenumber (counted from 0). + """ + start, end = self.getstatementrange(lineno, assertion) + return self[start:end] + + def getstatementrange(self, lineno, assertion=False): + """ return (start, end) tuple which spans the minimal + statement region which containing the given lineno. + """ + if not (0 <= lineno < len(self)): + raise IndexError("lineno out of range") + ast, start, end = getstatementrange_ast(lineno, self) + return start, end + + def deindent(self, offset=None): + """ return a new source object deindented by offset. + If offset is None then guess an indentation offset from + the first non-blank line. Subsequent lines which have a + lower indentation offset will be copied verbatim as + they are assumed to be part of multilines. + """ + # XXX maybe use the tokenizer to properly handle multiline + # strings etc.pp? + newsource = Source() + newsource.lines[:] = deindent(self.lines, offset) + return newsource + + def isparseable(self, deindent=True): + """ return True if source is parseable, heuristically + deindenting it by default. + """ + try: + import parser + except ImportError: + syntax_checker = lambda x: compile(x, 'asd', 'exec') + else: + syntax_checker = parser.suite + + if deindent: + source = str(self.deindent()) + else: + source = str(self) + try: + #compile(source+'\n', "x", "exec") + syntax_checker(source+'\n') + except KeyboardInterrupt: + raise + except Exception: + return False + else: + return True + + def __str__(self): + return "\n".join(self.lines) + + def compile(self, filename=None, mode='exec', + flag=generators.compiler_flag, + dont_inherit=0, _genframe=None): + """ return compiled code object. if filename is None + invent an artificial filename which displays + the source/line position of the caller frame. + """ + if not filename or py.path.local(filename).check(file=0): + if _genframe is None: + _genframe = sys._getframe(1) # the caller + fn,lineno = _genframe.f_code.co_filename, _genframe.f_lineno + base = "<%d-codegen " % self._compilecounter + self.__class__._compilecounter += 1 + if not filename: + filename = base + '%s:%d>' % (fn, lineno) + else: + filename = base + '%r %s:%d>' % (filename, fn, lineno) + source = "\n".join(self.lines) + '\n' + try: + co = cpy_compile(source, filename, mode, flag) + except SyntaxError: + ex = sys.exc_info()[1] + # re-represent syntax errors from parsing python strings + msglines = self.lines[:ex.lineno] + if ex.offset: + msglines.append(" "*ex.offset + '^') + msglines.append("(code was compiled probably from here: %s)" % filename) + newex = SyntaxError('\n'.join(msglines)) + newex.offset = ex.offset + newex.lineno = ex.lineno + newex.text = ex.text + raise newex + else: + if flag & _AST_FLAG: + return co + lines = [(x + "\n") for x in self.lines] + import linecache + linecache.cache[filename] = (1, None, lines, filename) + return co + +# +# public API shortcut functions +# + +def compile_(source, filename=None, mode='exec', flags= + generators.compiler_flag, dont_inherit=0): + """ compile the given source to a raw code object, + and maintain an internal cache which allows later + retrieval of the source code for the code object + and any recursively created code objects. + """ + if _ast is not None and isinstance(source, _ast.AST): + # XXX should Source support having AST? + return cpy_compile(source, filename, mode, flags, dont_inherit) + _genframe = sys._getframe(1) # the caller + s = Source(source) + co = s.compile(filename, mode, flags, _genframe=_genframe) + return co + + +def getfslineno(obj): + """ Return source location (path, lineno) for the given object. + If the source cannot be determined return ("", -1) + """ + try: + code = py.code.Code(obj) + except TypeError: + try: + fn = (inspect.getsourcefile(obj) or + inspect.getfile(obj)) + except TypeError: + return "", -1 + + fspath = fn and py.path.local(fn) or None + lineno = -1 + if fspath: + try: + _, lineno = findsource(obj) + except IOError: + pass + else: + fspath = code.path + lineno = code.firstlineno + assert isinstance(lineno, int) + return fspath, lineno + +# +# helper functions +# + +def findsource(obj): + try: + sourcelines, lineno = inspect.findsource(obj) + except py.builtin._sysex: + raise + except: + return None, -1 + source = Source() + source.lines = [line.rstrip() for line in sourcelines] + return source, lineno + +def getsource(obj, **kwargs): + obj = py.code.getrawcode(obj) + try: + strsrc = inspect.getsource(obj) + except IndentationError: + strsrc = "\"Buggy python version consider upgrading, cannot get source\"" + assert isinstance(strsrc, str) + return Source(strsrc, **kwargs) + +def deindent(lines, offset=None): + if offset is None: + for line in lines: + line = line.expandtabs() + s = line.lstrip() + if s: + offset = len(line)-len(s) + break + else: + offset = 0 + if offset == 0: + return list(lines) + newlines = [] + def readline_generator(lines): + for line in lines: + yield line + '\n' + while True: + yield '' + + it = readline_generator(lines) + + try: + for _, _, (sline, _), (eline, _), _ in tokenize.generate_tokens(lambda: next(it)): + if sline > len(lines): + break # End of input reached + if sline > len(newlines): + line = lines[sline - 1].expandtabs() + if line.lstrip() and line[:offset].isspace(): + line = line[offset:] # Deindent + newlines.append(line) + + for i in range(sline, eline): + # Don't deindent continuing lines of + # multiline tokens (i.e. multiline strings) + newlines.append(lines[i]) + except (IndentationError, tokenize.TokenError): + pass + # Add any lines we didn't see. E.g. if an exception was raised. + newlines.extend(lines[len(newlines):]) + return newlines + + +def get_statement_startend2(lineno, node): + import ast + # flatten all statements and except handlers into one lineno-list + # AST's line numbers start indexing at 1 + l = [] + for x in ast.walk(node): + if isinstance(x, _ast.stmt) or isinstance(x, _ast.ExceptHandler): + l.append(x.lineno - 1) + for name in "finalbody", "orelse": + val = getattr(x, name, None) + if val: + # treat the finally/orelse part as its own statement + l.append(val[0].lineno - 1 - 1) + l.sort() + insert_index = bisect_right(l, lineno) + start = l[insert_index - 1] + if insert_index >= len(l): + end = None + else: + end = l[insert_index] + return start, end + + +def getstatementrange_ast(lineno, source, assertion=False, astnode=None): + if astnode is None: + content = str(source) + try: + astnode = compile(content, "source", "exec", 1024) # 1024 for AST + except ValueError: + start, end = getstatementrange_old(lineno, source, assertion) + return None, start, end + start, end = get_statement_startend2(lineno, astnode) + # we need to correct the end: + # - ast-parsing strips comments + # - there might be empty lines + # - we might have lesser indented code blocks at the end + if end is None: + end = len(source.lines) + + if end > start + 1: + # make sure we don't span differently indented code blocks + # by using the BlockFinder helper used which inspect.getsource() uses itself + block_finder = inspect.BlockFinder() + # if we start with an indented line, put blockfinder to "started" mode + block_finder.started = source.lines[start][0].isspace() + it = ((x + "\n") for x in source.lines[start:end]) + try: + for tok in tokenize.generate_tokens(lambda: next(it)): + block_finder.tokeneater(*tok) + except (inspect.EndOfBlock, IndentationError): + end = block_finder.last + start + except Exception: + pass + + # the end might still point to a comment or empty line, correct it + while end: + line = source.lines[end - 1].lstrip() + if line.startswith("#") or not line: + end -= 1 + else: + break + return astnode, start, end + + +def getstatementrange_old(lineno, source, assertion=False): + """ return (start, end) tuple which spans the minimal + statement region which containing the given lineno. + raise an IndexError if no such statementrange can be found. + """ + # XXX this logic is only used on python2.4 and below + # 1. find the start of the statement + from codeop import compile_command + for start in range(lineno, -1, -1): + if assertion: + line = source.lines[start] + # the following lines are not fully tested, change with care + if 'super' in line and 'self' in line and '__init__' in line: + raise IndexError("likely a subclass") + if "assert" not in line and "raise" not in line: + continue + trylines = source.lines[start:lineno+1] + # quick hack to prepare parsing an indented line with + # compile_command() (which errors on "return" outside defs) + trylines.insert(0, 'def xxx():') + trysource = '\n '.join(trylines) + # ^ space here + try: + compile_command(trysource) + except (SyntaxError, OverflowError, ValueError): + continue + + # 2. find the end of the statement + for end in range(lineno+1, len(source)+1): + trysource = source[start:end] + if trysource.isparseable(): + return start, end + raise SyntaxError("no valid source range around line %d " % (lineno,)) + + diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/py/_io/__init__.py b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/py/_io/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..835f01f3ab9dcb656dce1e580f0d98d7b8abfe3a --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/py/_io/__init__.py @@ -0,0 +1 @@ +""" input/output helping """ diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/py/_io/capture.py b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/py/_io/capture.py new file mode 100644 index 0000000000000000000000000000000000000000..bc157ed978f72dd8d1956faf4c5954c8174bf4df --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/py/_io/capture.py @@ -0,0 +1,371 @@ +import os +import sys +import py +import tempfile + +try: + from io import StringIO +except ImportError: + from StringIO import StringIO + +if sys.version_info < (3,0): + class TextIO(StringIO): + def write(self, data): + if not isinstance(data, unicode): + data = unicode(data, getattr(self, '_encoding', 'UTF-8'), 'replace') + StringIO.write(self, data) +else: + TextIO = StringIO + +try: + from io import BytesIO +except ImportError: + class BytesIO(StringIO): + def write(self, data): + if isinstance(data, unicode): + raise TypeError("not a byte value: %r" %(data,)) + StringIO.write(self, data) + +patchsysdict = {0: 'stdin', 1: 'stdout', 2: 'stderr'} + +class FDCapture: + """ Capture IO to/from a given os-level filedescriptor. """ + + def __init__(self, targetfd, tmpfile=None, now=True, patchsys=False): + """ save targetfd descriptor, and open a new + temporary file there. If no tmpfile is + specified a tempfile.Tempfile() will be opened + in text mode. + """ + self.targetfd = targetfd + if tmpfile is None and targetfd != 0: + f = tempfile.TemporaryFile('wb+') + tmpfile = dupfile(f, encoding="UTF-8") + f.close() + self.tmpfile = tmpfile + self._savefd = os.dup(self.targetfd) + if patchsys: + self._oldsys = getattr(sys, patchsysdict[targetfd]) + if now: + self.start() + + def start(self): + try: + os.fstat(self._savefd) + except OSError: + raise ValueError("saved filedescriptor not valid, " + "did you call start() twice?") + if self.targetfd == 0 and not self.tmpfile: + fd = os.open(devnullpath, os.O_RDONLY) + os.dup2(fd, 0) + os.close(fd) + if hasattr(self, '_oldsys'): + setattr(sys, patchsysdict[self.targetfd], DontReadFromInput()) + else: + os.dup2(self.tmpfile.fileno(), self.targetfd) + if hasattr(self, '_oldsys'): + setattr(sys, patchsysdict[self.targetfd], self.tmpfile) + + def done(self): + """ unpatch and clean up, returns the self.tmpfile (file object) + """ + os.dup2(self._savefd, self.targetfd) + os.close(self._savefd) + if self.targetfd != 0: + self.tmpfile.seek(0) + if hasattr(self, '_oldsys'): + setattr(sys, patchsysdict[self.targetfd], self._oldsys) + return self.tmpfile + + def writeorg(self, data): + """ write a string to the original file descriptor + """ + tempfp = tempfile.TemporaryFile() + try: + os.dup2(self._savefd, tempfp.fileno()) + tempfp.write(data) + finally: + tempfp.close() + + +def dupfile(f, mode=None, buffering=0, raising=False, encoding=None): + """ return a new open file object that's a duplicate of f + + mode is duplicated if not given, 'buffering' controls + buffer size (defaulting to no buffering) and 'raising' + defines whether an exception is raised when an incompatible + file object is passed in (if raising is False, the file + object itself will be returned) + """ + try: + fd = f.fileno() + mode = mode or f.mode + except AttributeError: + if raising: + raise + return f + newfd = os.dup(fd) + if sys.version_info >= (3,0): + if encoding is not None: + mode = mode.replace("b", "") + buffering = True + return os.fdopen(newfd, mode, buffering, encoding, closefd=True) + else: + f = os.fdopen(newfd, mode, buffering) + if encoding is not None: + return EncodedFile(f, encoding) + return f + +class EncodedFile(object): + def __init__(self, _stream, encoding): + self._stream = _stream + self.encoding = encoding + + def write(self, obj): + if isinstance(obj, unicode): + obj = obj.encode(self.encoding) + elif isinstance(obj, str): + pass + else: + obj = str(obj) + self._stream.write(obj) + + def writelines(self, linelist): + data = ''.join(linelist) + self.write(data) + + def __getattr__(self, name): + return getattr(self._stream, name) + +class Capture(object): + def call(cls, func, *args, **kwargs): + """ return a (res, out, err) tuple where + out and err represent the output/error output + during function execution. + call the given function with args/kwargs + and capture output/error during its execution. + """ + so = cls() + try: + res = func(*args, **kwargs) + finally: + out, err = so.reset() + return res, out, err + call = classmethod(call) + + def reset(self): + """ reset sys.stdout/stderr and return captured output as strings. """ + if hasattr(self, '_reset'): + raise ValueError("was already reset") + self._reset = True + outfile, errfile = self.done(save=False) + out, err = "", "" + if outfile and not outfile.closed: + out = outfile.read() + outfile.close() + if errfile and errfile != outfile and not errfile.closed: + err = errfile.read() + errfile.close() + return out, err + + def suspend(self): + """ return current snapshot captures, memorize tempfiles. """ + outerr = self.readouterr() + outfile, errfile = self.done() + return outerr + + +class StdCaptureFD(Capture): + """ This class allows to capture writes to FD1 and FD2 + and may connect a NULL file to FD0 (and prevent + reads from sys.stdin). If any of the 0,1,2 file descriptors + is invalid it will not be captured. + """ + def __init__(self, out=True, err=True, mixed=False, + in_=True, patchsys=True, now=True): + self._options = { + "out": out, + "err": err, + "mixed": mixed, + "in_": in_, + "patchsys": patchsys, + "now": now, + } + self._save() + if now: + self.startall() + + def _save(self): + in_ = self._options['in_'] + out = self._options['out'] + err = self._options['err'] + mixed = self._options['mixed'] + patchsys = self._options['patchsys'] + if in_: + try: + self.in_ = FDCapture(0, tmpfile=None, now=False, + patchsys=patchsys) + except OSError: + pass + if out: + tmpfile = None + if hasattr(out, 'write'): + tmpfile = out + try: + self.out = FDCapture(1, tmpfile=tmpfile, + now=False, patchsys=patchsys) + self._options['out'] = self.out.tmpfile + except OSError: + pass + if err: + if out and mixed: + tmpfile = self.out.tmpfile + elif hasattr(err, 'write'): + tmpfile = err + else: + tmpfile = None + try: + self.err = FDCapture(2, tmpfile=tmpfile, + now=False, patchsys=patchsys) + self._options['err'] = self.err.tmpfile + except OSError: + pass + + def startall(self): + if hasattr(self, 'in_'): + self.in_.start() + if hasattr(self, 'out'): + self.out.start() + if hasattr(self, 'err'): + self.err.start() + + def resume(self): + """ resume capturing with original temp files. """ + self.startall() + + def done(self, save=True): + """ return (outfile, errfile) and stop capturing. """ + outfile = errfile = None + if hasattr(self, 'out') and not self.out.tmpfile.closed: + outfile = self.out.done() + if hasattr(self, 'err') and not self.err.tmpfile.closed: + errfile = self.err.done() + if hasattr(self, 'in_'): + tmpfile = self.in_.done() + if save: + self._save() + return outfile, errfile + + def readouterr(self): + """ return snapshot value of stdout/stderr capturings. """ + if hasattr(self, "out"): + out = self._readsnapshot(self.out.tmpfile) + else: + out = "" + if hasattr(self, "err"): + err = self._readsnapshot(self.err.tmpfile) + else: + err = "" + return [out, err] + + def _readsnapshot(self, f): + f.seek(0) + res = f.read() + enc = getattr(f, "encoding", None) + if enc: + res = py.builtin._totext(res, enc, "replace") + f.truncate(0) + f.seek(0) + return res + + +class StdCapture(Capture): + """ This class allows to capture writes to sys.stdout|stderr "in-memory" + and will raise errors on tries to read from sys.stdin. It only + modifies sys.stdout|stderr|stdin attributes and does not + touch underlying File Descriptors (use StdCaptureFD for that). + """ + def __init__(self, out=True, err=True, in_=True, mixed=False, now=True): + self._oldout = sys.stdout + self._olderr = sys.stderr + self._oldin = sys.stdin + if out and not hasattr(out, 'file'): + out = TextIO() + self.out = out + if err: + if mixed: + err = out + elif not hasattr(err, 'write'): + err = TextIO() + self.err = err + self.in_ = in_ + if now: + self.startall() + + def startall(self): + if self.out: + sys.stdout = self.out + if self.err: + sys.stderr = self.err + if self.in_: + sys.stdin = self.in_ = DontReadFromInput() + + def done(self, save=True): + """ return (outfile, errfile) and stop capturing. """ + outfile = errfile = None + if self.out and not self.out.closed: + sys.stdout = self._oldout + outfile = self.out + outfile.seek(0) + if self.err and not self.err.closed: + sys.stderr = self._olderr + errfile = self.err + errfile.seek(0) + if self.in_: + sys.stdin = self._oldin + return outfile, errfile + + def resume(self): + """ resume capturing with original temp files. """ + self.startall() + + def readouterr(self): + """ return snapshot value of stdout/stderr capturings. """ + out = err = "" + if self.out: + out = self.out.getvalue() + self.out.truncate(0) + self.out.seek(0) + if self.err: + err = self.err.getvalue() + self.err.truncate(0) + self.err.seek(0) + return out, err + +class DontReadFromInput: + """Temporary stub class. Ideally when stdin is accessed, the + capturing should be turned off, with possibly all data captured + so far sent to the screen. This should be configurable, though, + because in automated test runs it is better to crash than + hang indefinitely. + """ + def read(self, *args): + raise IOError("reading from stdin while output is captured") + readline = read + readlines = read + __iter__ = read + + def fileno(self): + raise ValueError("redirected Stdin is pseudofile, has no fileno()") + def isatty(self): + return False + def close(self): + pass + +try: + devnullpath = os.devnull +except AttributeError: + if os.name == 'nt': + devnullpath = 'NUL' + else: + devnullpath = '/dev/null' diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/py/_io/saferepr.py b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/py/_io/saferepr.py new file mode 100644 index 0000000000000000000000000000000000000000..8518290efddecdc8524c642abbd5aba76dada44c --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/py/_io/saferepr.py @@ -0,0 +1,71 @@ +import py +import sys + +builtin_repr = repr + +reprlib = py.builtin._tryimport('repr', 'reprlib') + +class SafeRepr(reprlib.Repr): + """ subclass of repr.Repr that limits the resulting size of repr() + and includes information on exceptions raised during the call. + """ + def repr(self, x): + return self._callhelper(reprlib.Repr.repr, self, x) + + def repr_unicode(self, x, level): + # Strictly speaking wrong on narrow builds + def repr(u): + if "'" not in u: + return py.builtin._totext("'%s'") % u + elif '"' not in u: + return py.builtin._totext('"%s"') % u + else: + return py.builtin._totext("'%s'") % u.replace("'", r"\'") + s = repr(x[:self.maxstring]) + if len(s) > self.maxstring: + i = max(0, (self.maxstring-3)//2) + j = max(0, self.maxstring-3-i) + s = repr(x[:i] + x[len(x)-j:]) + s = s[:i] + '...' + s[len(s)-j:] + return s + + def repr_instance(self, x, level): + return self._callhelper(builtin_repr, x) + + def _callhelper(self, call, x, *args): + try: + # Try the vanilla repr and make sure that the result is a string + s = call(x, *args) + except py.builtin._sysex: + raise + except: + cls, e, tb = sys.exc_info() + exc_name = getattr(cls, '__name__', 'unknown') + try: + exc_info = str(e) + except py.builtin._sysex: + raise + except: + exc_info = 'unknown' + return '<[%s("%s") raised in repr()] %s object at 0x%x>' % ( + exc_name, exc_info, x.__class__.__name__, id(x)) + else: + if len(s) > self.maxsize: + i = max(0, (self.maxsize-3)//2) + j = max(0, self.maxsize-3-i) + s = s[:i] + '...' + s[len(s)-j:] + return s + +def saferepr(obj, maxsize=240): + """ return a size-limited safe repr-string for the given object. + Failing __repr__ functions of user instances will be represented + with a short exception info and 'saferepr' generally takes + care to never raise exceptions itself. This function is a wrapper + around the Repr/reprlib functionality of the standard 2.6 lib. + """ + # review exception handling + srepr = SafeRepr() + srepr.maxstring = maxsize + srepr.maxsize = maxsize + srepr.maxother = 160 + return srepr.repr(obj) diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/py/_io/terminalwriter.py b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/py/_io/terminalwriter.py new file mode 100644 index 0000000000000000000000000000000000000000..be559867c22c004c77bf46890c836f591e67f407 --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/py/_io/terminalwriter.py @@ -0,0 +1,421 @@ +""" + +Helper functions for writing to terminals and files. + +""" + + +import sys, os, unicodedata +import py +py3k = sys.version_info[0] >= 3 +py33 = sys.version_info >= (3, 3) +from py.builtin import text, bytes + +win32_and_ctypes = False +colorama = None +if sys.platform == "win32": + try: + import colorama + except ImportError: + try: + import ctypes + win32_and_ctypes = True + except ImportError: + pass + + +def _getdimensions(): + if py33: + import shutil + size = shutil.get_terminal_size() + return size.lines, size.columns + else: + import termios, fcntl, struct + call = fcntl.ioctl(1, termios.TIOCGWINSZ, "\000" * 8) + height, width = struct.unpack("hhhh", call)[:2] + return height, width + + +def get_terminal_width(): + width = 0 + try: + _, width = _getdimensions() + except py.builtin._sysex: + raise + except: + # pass to fallback below + pass + + if width == 0: + # FALLBACK: + # * some exception happened + # * or this is emacs terminal which reports (0,0) + width = int(os.environ.get('COLUMNS', 80)) + + # XXX the windows getdimensions may be bogus, let's sanify a bit + if width < 40: + width = 80 + return width + +terminal_width = get_terminal_width() + +char_width = { + 'A': 1, # "Ambiguous" + 'F': 2, # Fullwidth + 'H': 1, # Halfwidth + 'N': 1, # Neutral + 'Na': 1, # Narrow + 'W': 2, # Wide +} + + +def get_line_width(text): + text = unicodedata.normalize('NFC', text) + return sum(char_width.get(unicodedata.east_asian_width(c), 1) for c in text) + + +# XXX unify with _escaped func below +def ansi_print(text, esc, file=None, newline=True, flush=False): + if file is None: + file = sys.stderr + text = text.rstrip() + if esc and not isinstance(esc, tuple): + esc = (esc,) + if esc and sys.platform != "win32" and file.isatty(): + text = (''.join(['\x1b[%sm' % cod for cod in esc]) + + text + + '\x1b[0m') # ANSI color code "reset" + if newline: + text += '\n' + + if esc and win32_and_ctypes and file.isatty(): + if 1 in esc: + bold = True + esc = tuple([x for x in esc if x != 1]) + else: + bold = False + esctable = {() : FOREGROUND_WHITE, # normal + (31,): FOREGROUND_RED, # red + (32,): FOREGROUND_GREEN, # green + (33,): FOREGROUND_GREEN|FOREGROUND_RED, # yellow + (34,): FOREGROUND_BLUE, # blue + (35,): FOREGROUND_BLUE|FOREGROUND_RED, # purple + (36,): FOREGROUND_BLUE|FOREGROUND_GREEN, # cyan + (37,): FOREGROUND_WHITE, # white + (39,): FOREGROUND_WHITE, # reset + } + attr = esctable.get(esc, FOREGROUND_WHITE) + if bold: + attr |= FOREGROUND_INTENSITY + STD_OUTPUT_HANDLE = -11 + STD_ERROR_HANDLE = -12 + if file is sys.stderr: + handle = GetStdHandle(STD_ERROR_HANDLE) + else: + handle = GetStdHandle(STD_OUTPUT_HANDLE) + oldcolors = GetConsoleInfo(handle).wAttributes + attr |= (oldcolors & 0x0f0) + SetConsoleTextAttribute(handle, attr) + while len(text) > 32768: + file.write(text[:32768]) + text = text[32768:] + if text: + file.write(text) + SetConsoleTextAttribute(handle, oldcolors) + else: + file.write(text) + + if flush: + file.flush() + +def should_do_markup(file): + if os.environ.get('PY_COLORS') == '1': + return True + if os.environ.get('PY_COLORS') == '0': + return False + return hasattr(file, 'isatty') and file.isatty() \ + and os.environ.get('TERM') != 'dumb' \ + and not (sys.platform.startswith('java') and os._name == 'nt') + +class TerminalWriter(object): + _esctable = dict(black=30, red=31, green=32, yellow=33, + blue=34, purple=35, cyan=36, white=37, + Black=40, Red=41, Green=42, Yellow=43, + Blue=44, Purple=45, Cyan=46, White=47, + bold=1, light=2, blink=5, invert=7) + + # XXX deprecate stringio argument + def __init__(self, file=None, stringio=False, encoding=None): + if file is None: + if stringio: + self.stringio = file = py.io.TextIO() + else: + from sys import stdout as file + elif py.builtin.callable(file) and not ( + hasattr(file, "write") and hasattr(file, "flush")): + file = WriteFile(file, encoding=encoding) + if hasattr(file, "isatty") and file.isatty() and colorama: + file = colorama.AnsiToWin32(file).stream + self.encoding = encoding or getattr(file, 'encoding', "utf-8") + self._file = file + self.hasmarkup = should_do_markup(file) + self._lastlen = 0 + self._chars_on_current_line = 0 + self._width_of_current_line = 0 + + @property + def fullwidth(self): + if hasattr(self, '_terminal_width'): + return self._terminal_width + return get_terminal_width() + + @fullwidth.setter + def fullwidth(self, value): + self._terminal_width = value + + @property + def chars_on_current_line(self): + """Return the number of characters written so far in the current line. + + Please note that this count does not produce correct results after a reline() call, + see #164. + + .. versionadded:: 1.5.0 + + :rtype: int + """ + return self._chars_on_current_line + + @property + def width_of_current_line(self): + """Return an estimate of the width so far in the current line. + + .. versionadded:: 1.6.0 + + :rtype: int + """ + return self._width_of_current_line + + def _escaped(self, text, esc): + if esc and self.hasmarkup: + text = (''.join(['\x1b[%sm' % cod for cod in esc]) + + text +'\x1b[0m') + return text + + def markup(self, text, **kw): + esc = [] + for name in kw: + if name not in self._esctable: + raise ValueError("unknown markup: %r" %(name,)) + if kw[name]: + esc.append(self._esctable[name]) + return self._escaped(text, tuple(esc)) + + def sep(self, sepchar, title=None, fullwidth=None, **kw): + if fullwidth is None: + fullwidth = self.fullwidth + # the goal is to have the line be as long as possible + # under the condition that len(line) <= fullwidth + if sys.platform == "win32": + # if we print in the last column on windows we are on a + # new line but there is no way to verify/neutralize this + # (we may not know the exact line width) + # so let's be defensive to avoid empty lines in the output + fullwidth -= 1 + if title is not None: + # we want 2 + 2*len(fill) + len(title) <= fullwidth + # i.e. 2 + 2*len(sepchar)*N + len(title) <= fullwidth + # 2*len(sepchar)*N <= fullwidth - len(title) - 2 + # N <= (fullwidth - len(title) - 2) // (2*len(sepchar)) + N = max((fullwidth - len(title) - 2) // (2*len(sepchar)), 1) + fill = sepchar * N + line = "%s %s %s" % (fill, title, fill) + else: + # we want len(sepchar)*N <= fullwidth + # i.e. N <= fullwidth // len(sepchar) + line = sepchar * (fullwidth // len(sepchar)) + # in some situations there is room for an extra sepchar at the right, + # in particular if we consider that with a sepchar like "_ " the + # trailing space is not important at the end of the line + if len(line) + len(sepchar.rstrip()) <= fullwidth: + line += sepchar.rstrip() + + self.line(line, **kw) + + def write(self, msg, **kw): + if msg: + if not isinstance(msg, (bytes, text)): + msg = text(msg) + + self._update_chars_on_current_line(msg) + + if self.hasmarkup and kw: + markupmsg = self.markup(msg, **kw) + else: + markupmsg = msg + write_out(self._file, markupmsg) + + def _update_chars_on_current_line(self, text_or_bytes): + newline = b'\n' if isinstance(text_or_bytes, bytes) else '\n' + current_line = text_or_bytes.rsplit(newline, 1)[-1] + if isinstance(current_line, bytes): + current_line = current_line.decode('utf-8', errors='replace') + if newline in text_or_bytes: + self._chars_on_current_line = len(current_line) + self._width_of_current_line = get_line_width(current_line) + else: + self._chars_on_current_line += len(current_line) + self._width_of_current_line += get_line_width(current_line) + + def line(self, s='', **kw): + self.write(s, **kw) + self._checkfill(s) + self.write('\n') + + def reline(self, line, **kw): + if not self.hasmarkup: + raise ValueError("cannot use rewrite-line without terminal") + self.write(line, **kw) + self._checkfill(line) + self.write('\r') + self._lastlen = len(line) + + def _checkfill(self, line): + diff2last = self._lastlen - len(line) + if diff2last > 0: + self.write(" " * diff2last) + +class Win32ConsoleWriter(TerminalWriter): + def write(self, msg, **kw): + if msg: + if not isinstance(msg, (bytes, text)): + msg = text(msg) + + self._update_chars_on_current_line(msg) + + oldcolors = None + if self.hasmarkup and kw: + handle = GetStdHandle(STD_OUTPUT_HANDLE) + oldcolors = GetConsoleInfo(handle).wAttributes + default_bg = oldcolors & 0x00F0 + attr = default_bg + if kw.pop('bold', False): + attr |= FOREGROUND_INTENSITY + + if kw.pop('red', False): + attr |= FOREGROUND_RED + elif kw.pop('blue', False): + attr |= FOREGROUND_BLUE + elif kw.pop('green', False): + attr |= FOREGROUND_GREEN + elif kw.pop('yellow', False): + attr |= FOREGROUND_GREEN|FOREGROUND_RED + else: + attr |= oldcolors & 0x0007 + + SetConsoleTextAttribute(handle, attr) + write_out(self._file, msg) + if oldcolors: + SetConsoleTextAttribute(handle, oldcolors) + +class WriteFile(object): + def __init__(self, writemethod, encoding=None): + self.encoding = encoding + self._writemethod = writemethod + + def write(self, data): + if self.encoding: + data = data.encode(self.encoding, "replace") + self._writemethod(data) + + def flush(self): + return + + +if win32_and_ctypes: + TerminalWriter = Win32ConsoleWriter + import ctypes + from ctypes import wintypes + + # ctypes access to the Windows console + STD_OUTPUT_HANDLE = -11 + STD_ERROR_HANDLE = -12 + FOREGROUND_BLACK = 0x0000 # black text + FOREGROUND_BLUE = 0x0001 # text color contains blue. + FOREGROUND_GREEN = 0x0002 # text color contains green. + FOREGROUND_RED = 0x0004 # text color contains red. + FOREGROUND_WHITE = 0x0007 + FOREGROUND_INTENSITY = 0x0008 # text color is intensified. + BACKGROUND_BLACK = 0x0000 # background color black + BACKGROUND_BLUE = 0x0010 # background color contains blue. + BACKGROUND_GREEN = 0x0020 # background color contains green. + BACKGROUND_RED = 0x0040 # background color contains red. + BACKGROUND_WHITE = 0x0070 + BACKGROUND_INTENSITY = 0x0080 # background color is intensified. + + SHORT = ctypes.c_short + class COORD(ctypes.Structure): + _fields_ = [('X', SHORT), + ('Y', SHORT)] + class SMALL_RECT(ctypes.Structure): + _fields_ = [('Left', SHORT), + ('Top', SHORT), + ('Right', SHORT), + ('Bottom', SHORT)] + class CONSOLE_SCREEN_BUFFER_INFO(ctypes.Structure): + _fields_ = [('dwSize', COORD), + ('dwCursorPosition', COORD), + ('wAttributes', wintypes.WORD), + ('srWindow', SMALL_RECT), + ('dwMaximumWindowSize', COORD)] + + _GetStdHandle = ctypes.windll.kernel32.GetStdHandle + _GetStdHandle.argtypes = [wintypes.DWORD] + _GetStdHandle.restype = wintypes.HANDLE + def GetStdHandle(kind): + return _GetStdHandle(kind) + + SetConsoleTextAttribute = ctypes.windll.kernel32.SetConsoleTextAttribute + SetConsoleTextAttribute.argtypes = [wintypes.HANDLE, wintypes.WORD] + SetConsoleTextAttribute.restype = wintypes.BOOL + + _GetConsoleScreenBufferInfo = \ + ctypes.windll.kernel32.GetConsoleScreenBufferInfo + _GetConsoleScreenBufferInfo.argtypes = [wintypes.HANDLE, + ctypes.POINTER(CONSOLE_SCREEN_BUFFER_INFO)] + _GetConsoleScreenBufferInfo.restype = wintypes.BOOL + def GetConsoleInfo(handle): + info = CONSOLE_SCREEN_BUFFER_INFO() + _GetConsoleScreenBufferInfo(handle, ctypes.byref(info)) + return info + + def _getdimensions(): + handle = GetStdHandle(STD_OUTPUT_HANDLE) + info = GetConsoleInfo(handle) + # Substract one from the width, otherwise the cursor wraps + # and the ending \n causes an empty line to display. + return info.dwSize.Y, info.dwSize.X - 1 + +def write_out(fil, msg): + # XXX sometimes "msg" is of type bytes, sometimes text which + # complicates the situation. Should we try to enforce unicode? + try: + # on py27 and above writing out to sys.stdout with an encoding + # should usually work for unicode messages (if the encoding is + # capable of it) + fil.write(msg) + except UnicodeEncodeError: + # on py26 it might not work because stdout expects bytes + if fil.encoding: + try: + fil.write(msg.encode(fil.encoding)) + except UnicodeEncodeError: + # it might still fail if the encoding is not capable + pass + else: + fil.flush() + return + # fallback: escape all unicode characters + msg = msg.encode("unicode-escape").decode("ascii") + fil.write(msg) + fil.flush() diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/py/_log/__init__.py b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/py/_log/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..fad62e960d4fc0d5faf479467aaa0bbf57008a52 --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/py/_log/__init__.py @@ -0,0 +1,2 @@ +""" logging API ('producers' and 'consumers' connected via keywords) """ + diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/py/_log/log.py b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/py/_log/log.py new file mode 100644 index 0000000000000000000000000000000000000000..56969bcb58c3322248efc7de7a04fef96074fe65 --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/py/_log/log.py @@ -0,0 +1,206 @@ +""" +basic logging functionality based on a producer/consumer scheme. + +XXX implement this API: (maybe put it into slogger.py?) + + log = Logger( + info=py.log.STDOUT, + debug=py.log.STDOUT, + command=None) + log.info("hello", "world") + log.command("hello", "world") + + log = Logger(info=Logger(something=...), + debug=py.log.STDOUT, + command=None) +""" +import py +import sys + + +class Message(object): + def __init__(self, keywords, args): + self.keywords = keywords + self.args = args + + def content(self): + return " ".join(map(str, self.args)) + + def prefix(self): + return "[%s] " % (":".join(self.keywords)) + + def __str__(self): + return self.prefix() + self.content() + + +class Producer(object): + """ (deprecated) Log producer API which sends messages to be logged + to a 'consumer' object, which then prints them to stdout, + stderr, files, etc. Used extensively by PyPy-1.1. + """ + + Message = Message # to allow later customization + keywords2consumer = {} + + def __init__(self, keywords, keywordmapper=None, **kw): + if hasattr(keywords, 'split'): + keywords = tuple(keywords.split()) + self._keywords = keywords + if keywordmapper is None: + keywordmapper = default_keywordmapper + self._keywordmapper = keywordmapper + + def __repr__(self): + return "" % ":".join(self._keywords) + + def __getattr__(self, name): + if '_' in name: + raise AttributeError(name) + producer = self.__class__(self._keywords + (name,)) + setattr(self, name, producer) + return producer + + def __call__(self, *args): + """ write a message to the appropriate consumer(s) """ + func = self._keywordmapper.getconsumer(self._keywords) + if func is not None: + func(self.Message(self._keywords, args)) + +class KeywordMapper: + def __init__(self): + self.keywords2consumer = {} + + def getstate(self): + return self.keywords2consumer.copy() + + def setstate(self, state): + self.keywords2consumer.clear() + self.keywords2consumer.update(state) + + def getconsumer(self, keywords): + """ return a consumer matching the given keywords. + + tries to find the most suitable consumer by walking, starting from + the back, the list of keywords, the first consumer matching a + keyword is returned (falling back to py.log.default) + """ + for i in range(len(keywords), 0, -1): + try: + return self.keywords2consumer[keywords[:i]] + except KeyError: + continue + return self.keywords2consumer.get('default', default_consumer) + + def setconsumer(self, keywords, consumer): + """ set a consumer for a set of keywords. """ + # normalize to tuples + if isinstance(keywords, str): + keywords = tuple(filter(None, keywords.split())) + elif hasattr(keywords, '_keywords'): + keywords = keywords._keywords + elif not isinstance(keywords, tuple): + raise TypeError("key %r is not a string or tuple" % (keywords,)) + if consumer is not None and not py.builtin.callable(consumer): + if not hasattr(consumer, 'write'): + raise TypeError( + "%r should be None, callable or file-like" % (consumer,)) + consumer = File(consumer) + self.keywords2consumer[keywords] = consumer + + +def default_consumer(msg): + """ the default consumer, prints the message to stdout (using 'print') """ + sys.stderr.write(str(msg)+"\n") + +default_keywordmapper = KeywordMapper() + + +def setconsumer(keywords, consumer): + default_keywordmapper.setconsumer(keywords, consumer) + + +def setstate(state): + default_keywordmapper.setstate(state) + + +def getstate(): + return default_keywordmapper.getstate() + +# +# Consumers +# + + +class File(object): + """ log consumer wrapping a file(-like) object """ + def __init__(self, f): + assert hasattr(f, 'write') + # assert isinstance(f, file) or not hasattr(f, 'open') + self._file = f + + def __call__(self, msg): + """ write a message to the log """ + self._file.write(str(msg) + "\n") + if hasattr(self._file, 'flush'): + self._file.flush() + + +class Path(object): + """ log consumer that opens and writes to a Path """ + def __init__(self, filename, append=False, + delayed_create=False, buffering=False): + self._append = append + self._filename = str(filename) + self._buffering = buffering + if not delayed_create: + self._openfile() + + def _openfile(self): + mode = self._append and 'a' or 'w' + f = open(self._filename, mode) + self._file = f + + def __call__(self, msg): + """ write a message to the log """ + if not hasattr(self, "_file"): + self._openfile() + self._file.write(str(msg) + "\n") + if not self._buffering: + self._file.flush() + + +def STDOUT(msg): + """ consumer that writes to sys.stdout """ + sys.stdout.write(str(msg)+"\n") + + +def STDERR(msg): + """ consumer that writes to sys.stderr """ + sys.stderr.write(str(msg)+"\n") + + +class Syslog: + """ consumer that writes to the syslog daemon """ + + def __init__(self, priority=None): + if priority is None: + priority = self.LOG_INFO + self.priority = priority + + def __call__(self, msg): + """ write a message to the log """ + import syslog + syslog.syslog(self.priority, str(msg)) + + +try: + import syslog +except ImportError: + pass +else: + for _prio in "EMERG ALERT CRIT ERR WARNING NOTICE INFO DEBUG".split(): + _prio = "LOG_" + _prio + try: + setattr(Syslog, _prio, getattr(syslog, _prio)) + except AttributeError: + pass diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/py/_log/warning.py b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/py/_log/warning.py new file mode 100644 index 0000000000000000000000000000000000000000..6ef20d98a2dc0e7be240c593e0303c501ecb7835 --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/py/_log/warning.py @@ -0,0 +1,79 @@ +import py, sys + +class DeprecationWarning(DeprecationWarning): + def __init__(self, msg, path, lineno): + self.msg = msg + self.path = path + self.lineno = lineno + def __repr__(self): + return "%s:%d: %s" %(self.path, self.lineno+1, self.msg) + def __str__(self): + return self.msg + +def _apiwarn(startversion, msg, stacklevel=2, function=None): + # below is mostly COPIED from python2.4/warnings.py's def warn() + # Get context information + if isinstance(stacklevel, str): + frame = sys._getframe(1) + level = 1 + found = frame.f_code.co_filename.find(stacklevel) != -1 + while frame: + co = frame.f_code + if co.co_filename.find(stacklevel) == -1: + if found: + stacklevel = level + break + else: + found = True + level += 1 + frame = frame.f_back + else: + stacklevel = 1 + msg = "%s (since version %s)" %(msg, startversion) + warn(msg, stacklevel=stacklevel+1, function=function) + + +def warn(msg, stacklevel=1, function=None): + if function is not None: + import inspect + filename = inspect.getfile(function) + lineno = py.code.getrawcode(function).co_firstlineno + else: + try: + caller = sys._getframe(stacklevel) + except ValueError: + globals = sys.__dict__ + lineno = 1 + else: + globals = caller.f_globals + lineno = caller.f_lineno + if '__name__' in globals: + module = globals['__name__'] + else: + module = "" + filename = globals.get('__file__') + if filename: + fnl = filename.lower() + if fnl.endswith(".pyc") or fnl.endswith(".pyo"): + filename = filename[:-1] + elif fnl.endswith("$py.class"): + filename = filename.replace('$py.class', '.py') + else: + if module == "__main__": + try: + filename = sys.argv[0] + except AttributeError: + # embedded interpreters don't have sys.argv, see bug #839151 + filename = '__main__' + if not filename: + filename = module + path = py.path.local(filename) + warning = DeprecationWarning(msg, path, lineno) + import warnings + warnings.warn_explicit(warning, category=Warning, + filename=str(warning.path), + lineno=warning.lineno, + registry=warnings.__dict__.setdefault( + "__warningsregistry__", {}) + ) + diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pycparser/ply/__init__.py b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pycparser/ply/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..6e53cddcf6740cfb5317ce75efd7930c19e66f17 --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pycparser/ply/__init__.py @@ -0,0 +1,5 @@ +# PLY package +# Author: David Beazley (dave@dabeaz.com) + +__version__ = '3.9' +__all__ = ['lex','yacc'] diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pycparser/ply/cpp.py b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pycparser/ply/cpp.py new file mode 100644 index 0000000000000000000000000000000000000000..86273eac77a5b404cb41cf4d2650d8a37415fb67 --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pycparser/ply/cpp.py @@ -0,0 +1,905 @@ +# ----------------------------------------------------------------------------- +# cpp.py +# +# Author: David Beazley (http://www.dabeaz.com) +# Copyright (C) 2017 +# All rights reserved +# +# This module implements an ANSI-C style lexical preprocessor for PLY. +# ----------------------------------------------------------------------------- +import sys + +# Some Python 3 compatibility shims +if sys.version_info.major < 3: + STRING_TYPES = (str, unicode) +else: + STRING_TYPES = str + xrange = range + +# ----------------------------------------------------------------------------- +# Default preprocessor lexer definitions. These tokens are enough to get +# a basic preprocessor working. Other modules may import these if they want +# ----------------------------------------------------------------------------- + +tokens = ( + 'CPP_ID','CPP_INTEGER', 'CPP_FLOAT', 'CPP_STRING', 'CPP_CHAR', 'CPP_WS', 'CPP_COMMENT1', 'CPP_COMMENT2', 'CPP_POUND','CPP_DPOUND' +) + +literals = "+-*/%|&~^<>=!?()[]{}.,;:\\\'\"" + +# Whitespace +def t_CPP_WS(t): + r'\s+' + t.lexer.lineno += t.value.count("\n") + return t + +t_CPP_POUND = r'\#' +t_CPP_DPOUND = r'\#\#' + +# Identifier +t_CPP_ID = r'[A-Za-z_][\w_]*' + +# Integer literal +def CPP_INTEGER(t): + r'(((((0x)|(0X))[0-9a-fA-F]+)|(\d+))([uU][lL]|[lL][uU]|[uU]|[lL])?)' + return t + +t_CPP_INTEGER = CPP_INTEGER + +# Floating literal +t_CPP_FLOAT = r'((\d+)(\.\d+)(e(\+|-)?(\d+))? | (\d+)e(\+|-)?(\d+))([lL]|[fF])?' + +# String literal +def t_CPP_STRING(t): + r'\"([^\\\n]|(\\(.|\n)))*?\"' + t.lexer.lineno += t.value.count("\n") + return t + +# Character constant 'c' or L'c' +def t_CPP_CHAR(t): + r'(L)?\'([^\\\n]|(\\(.|\n)))*?\'' + t.lexer.lineno += t.value.count("\n") + return t + +# Comment +def t_CPP_COMMENT1(t): + r'(/\*(.|\n)*?\*/)' + ncr = t.value.count("\n") + t.lexer.lineno += ncr + # replace with one space or a number of '\n' + t.type = 'CPP_WS'; t.value = '\n' * ncr if ncr else ' ' + return t + +# Line comment +def t_CPP_COMMENT2(t): + r'(//.*?(\n|$))' + # replace with '/n' + t.type = 'CPP_WS'; t.value = '\n' + return t + +def t_error(t): + t.type = t.value[0] + t.value = t.value[0] + t.lexer.skip(1) + return t + +import re +import copy +import time +import os.path + +# ----------------------------------------------------------------------------- +# trigraph() +# +# Given an input string, this function replaces all trigraph sequences. +# The following mapping is used: +# +# ??= # +# ??/ \ +# ??' ^ +# ??( [ +# ??) ] +# ??! | +# ??< { +# ??> } +# ??- ~ +# ----------------------------------------------------------------------------- + +_trigraph_pat = re.compile(r'''\?\?[=/\'\(\)\!<>\-]''') +_trigraph_rep = { + '=':'#', + '/':'\\', + "'":'^', + '(':'[', + ')':']', + '!':'|', + '<':'{', + '>':'}', + '-':'~' +} + +def trigraph(input): + return _trigraph_pat.sub(lambda g: _trigraph_rep[g.group()[-1]],input) + +# ------------------------------------------------------------------ +# Macro object +# +# This object holds information about preprocessor macros +# +# .name - Macro name (string) +# .value - Macro value (a list of tokens) +# .arglist - List of argument names +# .variadic - Boolean indicating whether or not variadic macro +# .vararg - Name of the variadic parameter +# +# When a macro is created, the macro replacement token sequence is +# pre-scanned and used to create patch lists that are later used +# during macro expansion +# ------------------------------------------------------------------ + +class Macro(object): + def __init__(self,name,value,arglist=None,variadic=False): + self.name = name + self.value = value + self.arglist = arglist + self.variadic = variadic + if variadic: + self.vararg = arglist[-1] + self.source = None + +# ------------------------------------------------------------------ +# Preprocessor object +# +# Object representing a preprocessor. Contains macro definitions, +# include directories, and other information +# ------------------------------------------------------------------ + +class Preprocessor(object): + def __init__(self,lexer=None): + if lexer is None: + lexer = lex.lexer + self.lexer = lexer + self.macros = { } + self.path = [] + self.temp_path = [] + + # Probe the lexer for selected tokens + self.lexprobe() + + tm = time.localtime() + self.define("__DATE__ \"%s\"" % time.strftime("%b %d %Y",tm)) + self.define("__TIME__ \"%s\"" % time.strftime("%H:%M:%S",tm)) + self.parser = None + + # ----------------------------------------------------------------------------- + # tokenize() + # + # Utility function. Given a string of text, tokenize into a list of tokens + # ----------------------------------------------------------------------------- + + def tokenize(self,text): + tokens = [] + self.lexer.input(text) + while True: + tok = self.lexer.token() + if not tok: break + tokens.append(tok) + return tokens + + # --------------------------------------------------------------------- + # error() + # + # Report a preprocessor error/warning of some kind + # ---------------------------------------------------------------------- + + def error(self,file,line,msg): + print("%s:%d %s" % (file,line,msg)) + + # ---------------------------------------------------------------------- + # lexprobe() + # + # This method probes the preprocessor lexer object to discover + # the token types of symbols that are important to the preprocessor. + # If this works right, the preprocessor will simply "work" + # with any suitable lexer regardless of how tokens have been named. + # ---------------------------------------------------------------------- + + def lexprobe(self): + + # Determine the token type for identifiers + self.lexer.input("identifier") + tok = self.lexer.token() + if not tok or tok.value != "identifier": + print("Couldn't determine identifier type") + else: + self.t_ID = tok.type + + # Determine the token type for integers + self.lexer.input("12345") + tok = self.lexer.token() + if not tok or int(tok.value) != 12345: + print("Couldn't determine integer type") + else: + self.t_INTEGER = tok.type + self.t_INTEGER_TYPE = type(tok.value) + + # Determine the token type for strings enclosed in double quotes + self.lexer.input("\"filename\"") + tok = self.lexer.token() + if not tok or tok.value != "\"filename\"": + print("Couldn't determine string type") + else: + self.t_STRING = tok.type + + # Determine the token type for whitespace--if any + self.lexer.input(" ") + tok = self.lexer.token() + if not tok or tok.value != " ": + self.t_SPACE = None + else: + self.t_SPACE = tok.type + + # Determine the token type for newlines + self.lexer.input("\n") + tok = self.lexer.token() + if not tok or tok.value != "\n": + self.t_NEWLINE = None + print("Couldn't determine token for newlines") + else: + self.t_NEWLINE = tok.type + + self.t_WS = (self.t_SPACE, self.t_NEWLINE) + + # Check for other characters used by the preprocessor + chars = [ '<','>','#','##','\\','(',')',',','.'] + for c in chars: + self.lexer.input(c) + tok = self.lexer.token() + if not tok or tok.value != c: + print("Unable to lex '%s' required for preprocessor" % c) + + # ---------------------------------------------------------------------- + # add_path() + # + # Adds a search path to the preprocessor. + # ---------------------------------------------------------------------- + + def add_path(self,path): + self.path.append(path) + + # ---------------------------------------------------------------------- + # group_lines() + # + # Given an input string, this function splits it into lines. Trailing whitespace + # is removed. Any line ending with \ is grouped with the next line. This + # function forms the lowest level of the preprocessor---grouping into text into + # a line-by-line format. + # ---------------------------------------------------------------------- + + def group_lines(self,input): + lex = self.lexer.clone() + lines = [x.rstrip() for x in input.splitlines()] + for i in xrange(len(lines)): + j = i+1 + while lines[i].endswith('\\') and (j < len(lines)): + lines[i] = lines[i][:-1]+lines[j] + lines[j] = "" + j += 1 + + input = "\n".join(lines) + lex.input(input) + lex.lineno = 1 + + current_line = [] + while True: + tok = lex.token() + if not tok: + break + current_line.append(tok) + if tok.type in self.t_WS and '\n' in tok.value: + yield current_line + current_line = [] + + if current_line: + yield current_line + + # ---------------------------------------------------------------------- + # tokenstrip() + # + # Remove leading/trailing whitespace tokens from a token list + # ---------------------------------------------------------------------- + + def tokenstrip(self,tokens): + i = 0 + while i < len(tokens) and tokens[i].type in self.t_WS: + i += 1 + del tokens[:i] + i = len(tokens)-1 + while i >= 0 and tokens[i].type in self.t_WS: + i -= 1 + del tokens[i+1:] + return tokens + + + # ---------------------------------------------------------------------- + # collect_args() + # + # Collects comma separated arguments from a list of tokens. The arguments + # must be enclosed in parenthesis. Returns a tuple (tokencount,args,positions) + # where tokencount is the number of tokens consumed, args is a list of arguments, + # and positions is a list of integers containing the starting index of each + # argument. Each argument is represented by a list of tokens. + # + # When collecting arguments, leading and trailing whitespace is removed + # from each argument. + # + # This function properly handles nested parenthesis and commas---these do not + # define new arguments. + # ---------------------------------------------------------------------- + + def collect_args(self,tokenlist): + args = [] + positions = [] + current_arg = [] + nesting = 1 + tokenlen = len(tokenlist) + + # Search for the opening '('. + i = 0 + while (i < tokenlen) and (tokenlist[i].type in self.t_WS): + i += 1 + + if (i < tokenlen) and (tokenlist[i].value == '('): + positions.append(i+1) + else: + self.error(self.source,tokenlist[0].lineno,"Missing '(' in macro arguments") + return 0, [], [] + + i += 1 + + while i < tokenlen: + t = tokenlist[i] + if t.value == '(': + current_arg.append(t) + nesting += 1 + elif t.value == ')': + nesting -= 1 + if nesting == 0: + if current_arg: + args.append(self.tokenstrip(current_arg)) + positions.append(i) + return i+1,args,positions + current_arg.append(t) + elif t.value == ',' and nesting == 1: + args.append(self.tokenstrip(current_arg)) + positions.append(i+1) + current_arg = [] + else: + current_arg.append(t) + i += 1 + + # Missing end argument + self.error(self.source,tokenlist[-1].lineno,"Missing ')' in macro arguments") + return 0, [],[] + + # ---------------------------------------------------------------------- + # macro_prescan() + # + # Examine the macro value (token sequence) and identify patch points + # This is used to speed up macro expansion later on---we'll know + # right away where to apply patches to the value to form the expansion + # ---------------------------------------------------------------------- + + def macro_prescan(self,macro): + macro.patch = [] # Standard macro arguments + macro.str_patch = [] # String conversion expansion + macro.var_comma_patch = [] # Variadic macro comma patch + i = 0 + while i < len(macro.value): + if macro.value[i].type == self.t_ID and macro.value[i].value in macro.arglist: + argnum = macro.arglist.index(macro.value[i].value) + # Conversion of argument to a string + if i > 0 and macro.value[i-1].value == '#': + macro.value[i] = copy.copy(macro.value[i]) + macro.value[i].type = self.t_STRING + del macro.value[i-1] + macro.str_patch.append((argnum,i-1)) + continue + # Concatenation + elif (i > 0 and macro.value[i-1].value == '##'): + macro.patch.append(('c',argnum,i-1)) + del macro.value[i-1] + continue + elif ((i+1) < len(macro.value) and macro.value[i+1].value == '##'): + macro.patch.append(('c',argnum,i)) + i += 1 + continue + # Standard expansion + else: + macro.patch.append(('e',argnum,i)) + elif macro.value[i].value == '##': + if macro.variadic and (i > 0) and (macro.value[i-1].value == ',') and \ + ((i+1) < len(macro.value)) and (macro.value[i+1].type == self.t_ID) and \ + (macro.value[i+1].value == macro.vararg): + macro.var_comma_patch.append(i-1) + i += 1 + macro.patch.sort(key=lambda x: x[2],reverse=True) + + # ---------------------------------------------------------------------- + # macro_expand_args() + # + # Given a Macro and list of arguments (each a token list), this method + # returns an expanded version of a macro. The return value is a token sequence + # representing the replacement macro tokens + # ---------------------------------------------------------------------- + + def macro_expand_args(self,macro,args): + # Make a copy of the macro token sequence + rep = [copy.copy(_x) for _x in macro.value] + + # Make string expansion patches. These do not alter the length of the replacement sequence + + str_expansion = {} + for argnum, i in macro.str_patch: + if argnum not in str_expansion: + str_expansion[argnum] = ('"%s"' % "".join([x.value for x in args[argnum]])).replace("\\","\\\\") + rep[i] = copy.copy(rep[i]) + rep[i].value = str_expansion[argnum] + + # Make the variadic macro comma patch. If the variadic macro argument is empty, we get rid + comma_patch = False + if macro.variadic and not args[-1]: + for i in macro.var_comma_patch: + rep[i] = None + comma_patch = True + + # Make all other patches. The order of these matters. It is assumed that the patch list + # has been sorted in reverse order of patch location since replacements will cause the + # size of the replacement sequence to expand from the patch point. + + expanded = { } + for ptype, argnum, i in macro.patch: + # Concatenation. Argument is left unexpanded + if ptype == 'c': + rep[i:i+1] = args[argnum] + # Normal expansion. Argument is macro expanded first + elif ptype == 'e': + if argnum not in expanded: + expanded[argnum] = self.expand_macros(args[argnum]) + rep[i:i+1] = expanded[argnum] + + # Get rid of removed comma if necessary + if comma_patch: + rep = [_i for _i in rep if _i] + + return rep + + + # ---------------------------------------------------------------------- + # expand_macros() + # + # Given a list of tokens, this function performs macro expansion. + # The expanded argument is a dictionary that contains macros already + # expanded. This is used to prevent infinite recursion. + # ---------------------------------------------------------------------- + + def expand_macros(self,tokens,expanded=None): + if expanded is None: + expanded = {} + i = 0 + while i < len(tokens): + t = tokens[i] + if t.type == self.t_ID: + if t.value in self.macros and t.value not in expanded: + # Yes, we found a macro match + expanded[t.value] = True + + m = self.macros[t.value] + if not m.arglist: + # A simple macro + ex = self.expand_macros([copy.copy(_x) for _x in m.value],expanded) + for e in ex: + e.lineno = t.lineno + tokens[i:i+1] = ex + i += len(ex) + else: + # A macro with arguments + j = i + 1 + while j < len(tokens) and tokens[j].type in self.t_WS: + j += 1 + if tokens[j].value == '(': + tokcount,args,positions = self.collect_args(tokens[j:]) + if not m.variadic and len(args) != len(m.arglist): + self.error(self.source,t.lineno,"Macro %s requires %d arguments" % (t.value,len(m.arglist))) + i = j + tokcount + elif m.variadic and len(args) < len(m.arglist)-1: + if len(m.arglist) > 2: + self.error(self.source,t.lineno,"Macro %s must have at least %d arguments" % (t.value, len(m.arglist)-1)) + else: + self.error(self.source,t.lineno,"Macro %s must have at least %d argument" % (t.value, len(m.arglist)-1)) + i = j + tokcount + else: + if m.variadic: + if len(args) == len(m.arglist)-1: + args.append([]) + else: + args[len(m.arglist)-1] = tokens[j+positions[len(m.arglist)-1]:j+tokcount-1] + del args[len(m.arglist):] + + # Get macro replacement text + rep = self.macro_expand_args(m,args) + rep = self.expand_macros(rep,expanded) + for r in rep: + r.lineno = t.lineno + tokens[i:j+tokcount] = rep + i += len(rep) + del expanded[t.value] + continue + elif t.value == '__LINE__': + t.type = self.t_INTEGER + t.value = self.t_INTEGER_TYPE(t.lineno) + + i += 1 + return tokens + + # ---------------------------------------------------------------------- + # evalexpr() + # + # Evaluate an expression token sequence for the purposes of evaluating + # integral expressions. + # ---------------------------------------------------------------------- + + def evalexpr(self,tokens): + # tokens = tokenize(line) + # Search for defined macros + i = 0 + while i < len(tokens): + if tokens[i].type == self.t_ID and tokens[i].value == 'defined': + j = i + 1 + needparen = False + result = "0L" + while j < len(tokens): + if tokens[j].type in self.t_WS: + j += 1 + continue + elif tokens[j].type == self.t_ID: + if tokens[j].value in self.macros: + result = "1L" + else: + result = "0L" + if not needparen: break + elif tokens[j].value == '(': + needparen = True + elif tokens[j].value == ')': + break + else: + self.error(self.source,tokens[i].lineno,"Malformed defined()") + j += 1 + tokens[i].type = self.t_INTEGER + tokens[i].value = self.t_INTEGER_TYPE(result) + del tokens[i+1:j+1] + i += 1 + tokens = self.expand_macros(tokens) + for i,t in enumerate(tokens): + if t.type == self.t_ID: + tokens[i] = copy.copy(t) + tokens[i].type = self.t_INTEGER + tokens[i].value = self.t_INTEGER_TYPE("0L") + elif t.type == self.t_INTEGER: + tokens[i] = copy.copy(t) + # Strip off any trailing suffixes + tokens[i].value = str(tokens[i].value) + while tokens[i].value[-1] not in "0123456789abcdefABCDEF": + tokens[i].value = tokens[i].value[:-1] + + expr = "".join([str(x.value) for x in tokens]) + expr = expr.replace("&&"," and ") + expr = expr.replace("||"," or ") + expr = expr.replace("!"," not ") + try: + result = eval(expr) + except Exception: + self.error(self.source,tokens[0].lineno,"Couldn't evaluate expression") + result = 0 + return result + + # ---------------------------------------------------------------------- + # parsegen() + # + # Parse an input string/ + # ---------------------------------------------------------------------- + def parsegen(self,input,source=None): + + # Replace trigraph sequences + t = trigraph(input) + lines = self.group_lines(t) + + if not source: + source = "" + + self.define("__FILE__ \"%s\"" % source) + + self.source = source + chunk = [] + enable = True + iftrigger = False + ifstack = [] + + for x in lines: + for i,tok in enumerate(x): + if tok.type not in self.t_WS: break + if tok.value == '#': + # Preprocessor directive + + # insert necessary whitespace instead of eaten tokens + for tok in x: + if tok.type in self.t_WS and '\n' in tok.value: + chunk.append(tok) + + dirtokens = self.tokenstrip(x[i+1:]) + if dirtokens: + name = dirtokens[0].value + args = self.tokenstrip(dirtokens[1:]) + else: + name = "" + args = [] + + if name == 'define': + if enable: + for tok in self.expand_macros(chunk): + yield tok + chunk = [] + self.define(args) + elif name == 'include': + if enable: + for tok in self.expand_macros(chunk): + yield tok + chunk = [] + oldfile = self.macros['__FILE__'] + for tok in self.include(args): + yield tok + self.macros['__FILE__'] = oldfile + self.source = source + elif name == 'undef': + if enable: + for tok in self.expand_macros(chunk): + yield tok + chunk = [] + self.undef(args) + elif name == 'ifdef': + ifstack.append((enable,iftrigger)) + if enable: + if not args[0].value in self.macros: + enable = False + iftrigger = False + else: + iftrigger = True + elif name == 'ifndef': + ifstack.append((enable,iftrigger)) + if enable: + if args[0].value in self.macros: + enable = False + iftrigger = False + else: + iftrigger = True + elif name == 'if': + ifstack.append((enable,iftrigger)) + if enable: + result = self.evalexpr(args) + if not result: + enable = False + iftrigger = False + else: + iftrigger = True + elif name == 'elif': + if ifstack: + if ifstack[-1][0]: # We only pay attention if outer "if" allows this + if enable: # If already true, we flip enable False + enable = False + elif not iftrigger: # If False, but not triggered yet, we'll check expression + result = self.evalexpr(args) + if result: + enable = True + iftrigger = True + else: + self.error(self.source,dirtokens[0].lineno,"Misplaced #elif") + + elif name == 'else': + if ifstack: + if ifstack[-1][0]: + if enable: + enable = False + elif not iftrigger: + enable = True + iftrigger = True + else: + self.error(self.source,dirtokens[0].lineno,"Misplaced #else") + + elif name == 'endif': + if ifstack: + enable,iftrigger = ifstack.pop() + else: + self.error(self.source,dirtokens[0].lineno,"Misplaced #endif") + else: + # Unknown preprocessor directive + pass + + else: + # Normal text + if enable: + chunk.extend(x) + + for tok in self.expand_macros(chunk): + yield tok + chunk = [] + + # ---------------------------------------------------------------------- + # include() + # + # Implementation of file-inclusion + # ---------------------------------------------------------------------- + + def include(self,tokens): + # Try to extract the filename and then process an include file + if not tokens: + return + if tokens: + if tokens[0].value != '<' and tokens[0].type != self.t_STRING: + tokens = self.expand_macros(tokens) + + if tokens[0].value == '<': + # Include <...> + i = 1 + while i < len(tokens): + if tokens[i].value == '>': + break + i += 1 + else: + print("Malformed #include <...>") + return + filename = "".join([x.value for x in tokens[1:i]]) + path = self.path + [""] + self.temp_path + elif tokens[0].type == self.t_STRING: + filename = tokens[0].value[1:-1] + path = self.temp_path + [""] + self.path + else: + print("Malformed #include statement") + return + for p in path: + iname = os.path.join(p,filename) + try: + data = open(iname,"r").read() + dname = os.path.dirname(iname) + if dname: + self.temp_path.insert(0,dname) + for tok in self.parsegen(data,filename): + yield tok + if dname: + del self.temp_path[0] + break + except IOError: + pass + else: + print("Couldn't find '%s'" % filename) + + # ---------------------------------------------------------------------- + # define() + # + # Define a new macro + # ---------------------------------------------------------------------- + + def define(self,tokens): + if isinstance(tokens,STRING_TYPES): + tokens = self.tokenize(tokens) + + linetok = tokens + try: + name = linetok[0] + if len(linetok) > 1: + mtype = linetok[1] + else: + mtype = None + if not mtype: + m = Macro(name.value,[]) + self.macros[name.value] = m + elif mtype.type in self.t_WS: + # A normal macro + m = Macro(name.value,self.tokenstrip(linetok[2:])) + self.macros[name.value] = m + elif mtype.value == '(': + # A macro with arguments + tokcount, args, positions = self.collect_args(linetok[1:]) + variadic = False + for a in args: + if variadic: + print("No more arguments may follow a variadic argument") + break + astr = "".join([str(_i.value) for _i in a]) + if astr == "...": + variadic = True + a[0].type = self.t_ID + a[0].value = '__VA_ARGS__' + variadic = True + del a[1:] + continue + elif astr[-3:] == "..." and a[0].type == self.t_ID: + variadic = True + del a[1:] + # If, for some reason, "." is part of the identifier, strip off the name for the purposes + # of macro expansion + if a[0].value[-3:] == '...': + a[0].value = a[0].value[:-3] + continue + if len(a) > 1 or a[0].type != self.t_ID: + print("Invalid macro argument") + break + else: + mvalue = self.tokenstrip(linetok[1+tokcount:]) + i = 0 + while i < len(mvalue): + if i+1 < len(mvalue): + if mvalue[i].type in self.t_WS and mvalue[i+1].value == '##': + del mvalue[i] + continue + elif mvalue[i].value == '##' and mvalue[i+1].type in self.t_WS: + del mvalue[i+1] + i += 1 + m = Macro(name.value,mvalue,[x[0].value for x in args],variadic) + self.macro_prescan(m) + self.macros[name.value] = m + else: + print("Bad macro definition") + except LookupError: + print("Bad macro definition") + + # ---------------------------------------------------------------------- + # undef() + # + # Undefine a macro + # ---------------------------------------------------------------------- + + def undef(self,tokens): + id = tokens[0].value + try: + del self.macros[id] + except LookupError: + pass + + # ---------------------------------------------------------------------- + # parse() + # + # Parse input text. + # ---------------------------------------------------------------------- + def parse(self,input,source=None,ignore={}): + self.ignore = ignore + self.parser = self.parsegen(input,source) + + # ---------------------------------------------------------------------- + # token() + # + # Method to return individual tokens + # ---------------------------------------------------------------------- + def token(self): + try: + while True: + tok = next(self.parser) + if tok.type not in self.ignore: return tok + except StopIteration: + self.parser = None + return None + +if __name__ == '__main__': + import ply.lex as lex + lexer = lex.lex() + + # Run a preprocessor + import sys + f = open(sys.argv[1]) + input = f.read() + + p = Preprocessor(lexer) + p.parse(input,sys.argv[1]) + while True: + tok = p.token() + if not tok: break + print(p.source, tok) diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pycparser/ply/ctokens.py b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pycparser/ply/ctokens.py new file mode 100644 index 0000000000000000000000000000000000000000..f6f6952d605ee5fa0a25eff03f18769b6b445fae --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pycparser/ply/ctokens.py @@ -0,0 +1,133 @@ +# ---------------------------------------------------------------------- +# ctokens.py +# +# Token specifications for symbols in ANSI C and C++. This file is +# meant to be used as a library in other tokenizers. +# ---------------------------------------------------------------------- + +# Reserved words + +tokens = [ + # Literals (identifier, integer constant, float constant, string constant, char const) + 'ID', 'TYPEID', 'INTEGER', 'FLOAT', 'STRING', 'CHARACTER', + + # Operators (+,-,*,/,%,|,&,~,^,<<,>>, ||, &&, !, <, <=, >, >=, ==, !=) + 'PLUS', 'MINUS', 'TIMES', 'DIVIDE', 'MODULO', + 'OR', 'AND', 'NOT', 'XOR', 'LSHIFT', 'RSHIFT', + 'LOR', 'LAND', 'LNOT', + 'LT', 'LE', 'GT', 'GE', 'EQ', 'NE', + + # Assignment (=, *=, /=, %=, +=, -=, <<=, >>=, &=, ^=, |=) + 'EQUALS', 'TIMESEQUAL', 'DIVEQUAL', 'MODEQUAL', 'PLUSEQUAL', 'MINUSEQUAL', + 'LSHIFTEQUAL','RSHIFTEQUAL', 'ANDEQUAL', 'XOREQUAL', 'OREQUAL', + + # Increment/decrement (++,--) + 'INCREMENT', 'DECREMENT', + + # Structure dereference (->) + 'ARROW', + + # Ternary operator (?) + 'TERNARY', + + # Delimeters ( ) [ ] { } , . ; : + 'LPAREN', 'RPAREN', + 'LBRACKET', 'RBRACKET', + 'LBRACE', 'RBRACE', + 'COMMA', 'PERIOD', 'SEMI', 'COLON', + + # Ellipsis (...) + 'ELLIPSIS', +] + +# Operators +t_PLUS = r'\+' +t_MINUS = r'-' +t_TIMES = r'\*' +t_DIVIDE = r'/' +t_MODULO = r'%' +t_OR = r'\|' +t_AND = r'&' +t_NOT = r'~' +t_XOR = r'\^' +t_LSHIFT = r'<<' +t_RSHIFT = r'>>' +t_LOR = r'\|\|' +t_LAND = r'&&' +t_LNOT = r'!' +t_LT = r'<' +t_GT = r'>' +t_LE = r'<=' +t_GE = r'>=' +t_EQ = r'==' +t_NE = r'!=' + +# Assignment operators + +t_EQUALS = r'=' +t_TIMESEQUAL = r'\*=' +t_DIVEQUAL = r'/=' +t_MODEQUAL = r'%=' +t_PLUSEQUAL = r'\+=' +t_MINUSEQUAL = r'-=' +t_LSHIFTEQUAL = r'<<=' +t_RSHIFTEQUAL = r'>>=' +t_ANDEQUAL = r'&=' +t_OREQUAL = r'\|=' +t_XOREQUAL = r'\^=' + +# Increment/decrement +t_INCREMENT = r'\+\+' +t_DECREMENT = r'--' + +# -> +t_ARROW = r'->' + +# ? +t_TERNARY = r'\?' + +# Delimeters +t_LPAREN = r'\(' +t_RPAREN = r'\)' +t_LBRACKET = r'\[' +t_RBRACKET = r'\]' +t_LBRACE = r'\{' +t_RBRACE = r'\}' +t_COMMA = r',' +t_PERIOD = r'\.' +t_SEMI = r';' +t_COLON = r':' +t_ELLIPSIS = r'\.\.\.' + +# Identifiers +t_ID = r'[A-Za-z_][A-Za-z0-9_]*' + +# Integer literal +t_INTEGER = r'\d+([uU]|[lL]|[uU][lL]|[lL][uU])?' + +# Floating literal +t_FLOAT = r'((\d+)(\.\d+)(e(\+|-)?(\d+))? | (\d+)e(\+|-)?(\d+))([lL]|[fF])?' + +# String literal +t_STRING = r'\"([^\\\n]|(\\.))*?\"' + +# Character constant 'c' or L'c' +t_CHARACTER = r'(L)?\'([^\\\n]|(\\.))*?\'' + +# Comment (C-Style) +def t_COMMENT(t): + r'/\*(.|\n)*?\*/' + t.lexer.lineno += t.value.count('\n') + return t + +# Comment (C++-Style) +def t_CPPCOMMENT(t): + r'//.*\n' + t.lexer.lineno += 1 + return t + + + + + + diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pycparser/ply/lex.py b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pycparser/ply/lex.py new file mode 100644 index 0000000000000000000000000000000000000000..4bdd76ca06d1aee995142be8a3183894776df6fa --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pycparser/ply/lex.py @@ -0,0 +1,1099 @@ +# ----------------------------------------------------------------------------- +# ply: lex.py +# +# Copyright (C) 2001-2017 +# David M. Beazley (Dabeaz LLC) +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# * Neither the name of the David Beazley or Dabeaz LLC may be used to +# endorse or promote products derived from this software without +# specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# ----------------------------------------------------------------------------- + +__version__ = '3.10' +__tabversion__ = '3.10' + +import re +import sys +import types +import copy +import os +import inspect + +# This tuple contains known string types +try: + # Python 2.6 + StringTypes = (types.StringType, types.UnicodeType) +except AttributeError: + # Python 3.0 + StringTypes = (str, bytes) + +# This regular expression is used to match valid token names +_is_identifier = re.compile(r'^[a-zA-Z0-9_]+$') + +# Exception thrown when invalid token encountered and no default error +# handler is defined. +class LexError(Exception): + def __init__(self, message, s): + self.args = (message,) + self.text = s + + +# Token class. This class is used to represent the tokens produced. +class LexToken(object): + def __str__(self): + return 'LexToken(%s,%r,%d,%d)' % (self.type, self.value, self.lineno, self.lexpos) + + def __repr__(self): + return str(self) + + +# This object is a stand-in for a logging object created by the +# logging module. + +class PlyLogger(object): + def __init__(self, f): + self.f = f + + def critical(self, msg, *args, **kwargs): + self.f.write((msg % args) + '\n') + + def warning(self, msg, *args, **kwargs): + self.f.write('WARNING: ' + (msg % args) + '\n') + + def error(self, msg, *args, **kwargs): + self.f.write('ERROR: ' + (msg % args) + '\n') + + info = critical + debug = critical + + +# Null logger is used when no output is generated. Does nothing. +class NullLogger(object): + def __getattribute__(self, name): + return self + + def __call__(self, *args, **kwargs): + return self + + +# ----------------------------------------------------------------------------- +# === Lexing Engine === +# +# The following Lexer class implements the lexer runtime. There are only +# a few public methods and attributes: +# +# input() - Store a new string in the lexer +# token() - Get the next token +# clone() - Clone the lexer +# +# lineno - Current line number +# lexpos - Current position in the input string +# ----------------------------------------------------------------------------- + +class Lexer: + def __init__(self): + self.lexre = None # Master regular expression. This is a list of + # tuples (re, findex) where re is a compiled + # regular expression and findex is a list + # mapping regex group numbers to rules + self.lexretext = None # Current regular expression strings + self.lexstatere = {} # Dictionary mapping lexer states to master regexs + self.lexstateretext = {} # Dictionary mapping lexer states to regex strings + self.lexstaterenames = {} # Dictionary mapping lexer states to symbol names + self.lexstate = 'INITIAL' # Current lexer state + self.lexstatestack = [] # Stack of lexer states + self.lexstateinfo = None # State information + self.lexstateignore = {} # Dictionary of ignored characters for each state + self.lexstateerrorf = {} # Dictionary of error functions for each state + self.lexstateeoff = {} # Dictionary of eof functions for each state + self.lexreflags = 0 # Optional re compile flags + self.lexdata = None # Actual input data (as a string) + self.lexpos = 0 # Current position in input text + self.lexlen = 0 # Length of the input text + self.lexerrorf = None # Error rule (if any) + self.lexeoff = None # EOF rule (if any) + self.lextokens = None # List of valid tokens + self.lexignore = '' # Ignored characters + self.lexliterals = '' # Literal characters that can be passed through + self.lexmodule = None # Module + self.lineno = 1 # Current line number + self.lexoptimize = False # Optimized mode + + def clone(self, object=None): + c = copy.copy(self) + + # If the object parameter has been supplied, it means we are attaching the + # lexer to a new object. In this case, we have to rebind all methods in + # the lexstatere and lexstateerrorf tables. + + if object: + newtab = {} + for key, ritem in self.lexstatere.items(): + newre = [] + for cre, findex in ritem: + newfindex = [] + for f in findex: + if not f or not f[0]: + newfindex.append(f) + continue + newfindex.append((getattr(object, f[0].__name__), f[1])) + newre.append((cre, newfindex)) + newtab[key] = newre + c.lexstatere = newtab + c.lexstateerrorf = {} + for key, ef in self.lexstateerrorf.items(): + c.lexstateerrorf[key] = getattr(object, ef.__name__) + c.lexmodule = object + return c + + # ------------------------------------------------------------ + # writetab() - Write lexer information to a table file + # ------------------------------------------------------------ + def writetab(self, lextab, outputdir=''): + if isinstance(lextab, types.ModuleType): + raise IOError("Won't overwrite existing lextab module") + basetabmodule = lextab.split('.')[-1] + filename = os.path.join(outputdir, basetabmodule) + '.py' + with open(filename, 'w') as tf: + tf.write('# %s.py. This file automatically created by PLY (version %s). Don\'t edit!\n' % (basetabmodule, __version__)) + tf.write('_tabversion = %s\n' % repr(__tabversion__)) + tf.write('_lextokens = set(%s)\n' % repr(tuple(self.lextokens))) + tf.write('_lexreflags = %s\n' % repr(self.lexreflags)) + tf.write('_lexliterals = %s\n' % repr(self.lexliterals)) + tf.write('_lexstateinfo = %s\n' % repr(self.lexstateinfo)) + + # Rewrite the lexstatere table, replacing function objects with function names + tabre = {} + for statename, lre in self.lexstatere.items(): + titem = [] + for (pat, func), retext, renames in zip(lre, self.lexstateretext[statename], self.lexstaterenames[statename]): + titem.append((retext, _funcs_to_names(func, renames))) + tabre[statename] = titem + + tf.write('_lexstatere = %s\n' % repr(tabre)) + tf.write('_lexstateignore = %s\n' % repr(self.lexstateignore)) + + taberr = {} + for statename, ef in self.lexstateerrorf.items(): + taberr[statename] = ef.__name__ if ef else None + tf.write('_lexstateerrorf = %s\n' % repr(taberr)) + + tabeof = {} + for statename, ef in self.lexstateeoff.items(): + tabeof[statename] = ef.__name__ if ef else None + tf.write('_lexstateeoff = %s\n' % repr(tabeof)) + + # ------------------------------------------------------------ + # readtab() - Read lexer information from a tab file + # ------------------------------------------------------------ + def readtab(self, tabfile, fdict): + if isinstance(tabfile, types.ModuleType): + lextab = tabfile + else: + exec('import %s' % tabfile) + lextab = sys.modules[tabfile] + + if getattr(lextab, '_tabversion', '0.0') != __tabversion__: + raise ImportError('Inconsistent PLY version') + + self.lextokens = lextab._lextokens + self.lexreflags = lextab._lexreflags + self.lexliterals = lextab._lexliterals + self.lextokens_all = self.lextokens | set(self.lexliterals) + self.lexstateinfo = lextab._lexstateinfo + self.lexstateignore = lextab._lexstateignore + self.lexstatere = {} + self.lexstateretext = {} + for statename, lre in lextab._lexstatere.items(): + titem = [] + txtitem = [] + for pat, func_name in lre: + titem.append((re.compile(pat, lextab._lexreflags), _names_to_funcs(func_name, fdict))) + + self.lexstatere[statename] = titem + self.lexstateretext[statename] = txtitem + + self.lexstateerrorf = {} + for statename, ef in lextab._lexstateerrorf.items(): + self.lexstateerrorf[statename] = fdict[ef] + + self.lexstateeoff = {} + for statename, ef in lextab._lexstateeoff.items(): + self.lexstateeoff[statename] = fdict[ef] + + self.begin('INITIAL') + + # ------------------------------------------------------------ + # input() - Push a new string into the lexer + # ------------------------------------------------------------ + def input(self, s): + # Pull off the first character to see if s looks like a string + c = s[:1] + if not isinstance(c, StringTypes): + raise ValueError('Expected a string') + self.lexdata = s + self.lexpos = 0 + self.lexlen = len(s) + + # ------------------------------------------------------------ + # begin() - Changes the lexing state + # ------------------------------------------------------------ + def begin(self, state): + if state not in self.lexstatere: + raise ValueError('Undefined state') + self.lexre = self.lexstatere[state] + self.lexretext = self.lexstateretext[state] + self.lexignore = self.lexstateignore.get(state, '') + self.lexerrorf = self.lexstateerrorf.get(state, None) + self.lexeoff = self.lexstateeoff.get(state, None) + self.lexstate = state + + # ------------------------------------------------------------ + # push_state() - Changes the lexing state and saves old on stack + # ------------------------------------------------------------ + def push_state(self, state): + self.lexstatestack.append(self.lexstate) + self.begin(state) + + # ------------------------------------------------------------ + # pop_state() - Restores the previous state + # ------------------------------------------------------------ + def pop_state(self): + self.begin(self.lexstatestack.pop()) + + # ------------------------------------------------------------ + # current_state() - Returns the current lexing state + # ------------------------------------------------------------ + def current_state(self): + return self.lexstate + + # ------------------------------------------------------------ + # skip() - Skip ahead n characters + # ------------------------------------------------------------ + def skip(self, n): + self.lexpos += n + + # ------------------------------------------------------------ + # opttoken() - Return the next token from the Lexer + # + # Note: This function has been carefully implemented to be as fast + # as possible. Don't make changes unless you really know what + # you are doing + # ------------------------------------------------------------ + def token(self): + # Make local copies of frequently referenced attributes + lexpos = self.lexpos + lexlen = self.lexlen + lexignore = self.lexignore + lexdata = self.lexdata + + while lexpos < lexlen: + # This code provides some short-circuit code for whitespace, tabs, and other ignored characters + if lexdata[lexpos] in lexignore: + lexpos += 1 + continue + + # Look for a regular expression match + for lexre, lexindexfunc in self.lexre: + m = lexre.match(lexdata, lexpos) + if not m: + continue + + # Create a token for return + tok = LexToken() + tok.value = m.group() + tok.lineno = self.lineno + tok.lexpos = lexpos + + i = m.lastindex + func, tok.type = lexindexfunc[i] + + if not func: + # If no token type was set, it's an ignored token + if tok.type: + self.lexpos = m.end() + return tok + else: + lexpos = m.end() + break + + lexpos = m.end() + + # If token is processed by a function, call it + + tok.lexer = self # Set additional attributes useful in token rules + self.lexmatch = m + self.lexpos = lexpos + + newtok = func(tok) + + # Every function must return a token, if nothing, we just move to next token + if not newtok: + lexpos = self.lexpos # This is here in case user has updated lexpos. + lexignore = self.lexignore # This is here in case there was a state change + break + + # Verify type of the token. If not in the token map, raise an error + if not self.lexoptimize: + if newtok.type not in self.lextokens_all: + raise LexError("%s:%d: Rule '%s' returned an unknown token type '%s'" % ( + func.__code__.co_filename, func.__code__.co_firstlineno, + func.__name__, newtok.type), lexdata[lexpos:]) + + return newtok + else: + # No match, see if in literals + if lexdata[lexpos] in self.lexliterals: + tok = LexToken() + tok.value = lexdata[lexpos] + tok.lineno = self.lineno + tok.type = tok.value + tok.lexpos = lexpos + self.lexpos = lexpos + 1 + return tok + + # No match. Call t_error() if defined. + if self.lexerrorf: + tok = LexToken() + tok.value = self.lexdata[lexpos:] + tok.lineno = self.lineno + tok.type = 'error' + tok.lexer = self + tok.lexpos = lexpos + self.lexpos = lexpos + newtok = self.lexerrorf(tok) + if lexpos == self.lexpos: + # Error method didn't change text position at all. This is an error. + raise LexError("Scanning error. Illegal character '%s'" % (lexdata[lexpos]), lexdata[lexpos:]) + lexpos = self.lexpos + if not newtok: + continue + return newtok + + self.lexpos = lexpos + raise LexError("Illegal character '%s' at index %d" % (lexdata[lexpos], lexpos), lexdata[lexpos:]) + + if self.lexeoff: + tok = LexToken() + tok.type = 'eof' + tok.value = '' + tok.lineno = self.lineno + tok.lexpos = lexpos + tok.lexer = self + self.lexpos = lexpos + newtok = self.lexeoff(tok) + return newtok + + self.lexpos = lexpos + 1 + if self.lexdata is None: + raise RuntimeError('No input string given with input()') + return None + + # Iterator interface + def __iter__(self): + return self + + def next(self): + t = self.token() + if t is None: + raise StopIteration + return t + + __next__ = next + +# ----------------------------------------------------------------------------- +# ==== Lex Builder === +# +# The functions and classes below are used to collect lexing information +# and build a Lexer object from it. +# ----------------------------------------------------------------------------- + +# ----------------------------------------------------------------------------- +# _get_regex(func) +# +# Returns the regular expression assigned to a function either as a doc string +# or as a .regex attribute attached by the @TOKEN decorator. +# ----------------------------------------------------------------------------- +def _get_regex(func): + return getattr(func, 'regex', func.__doc__) + +# ----------------------------------------------------------------------------- +# get_caller_module_dict() +# +# This function returns a dictionary containing all of the symbols defined within +# a caller further down the call stack. This is used to get the environment +# associated with the yacc() call if none was provided. +# ----------------------------------------------------------------------------- +def get_caller_module_dict(levels): + f = sys._getframe(levels) + ldict = f.f_globals.copy() + if f.f_globals != f.f_locals: + ldict.update(f.f_locals) + return ldict + +# ----------------------------------------------------------------------------- +# _funcs_to_names() +# +# Given a list of regular expression functions, this converts it to a list +# suitable for output to a table file +# ----------------------------------------------------------------------------- +def _funcs_to_names(funclist, namelist): + result = [] + for f, name in zip(funclist, namelist): + if f and f[0]: + result.append((name, f[1])) + else: + result.append(f) + return result + +# ----------------------------------------------------------------------------- +# _names_to_funcs() +# +# Given a list of regular expression function names, this converts it back to +# functions. +# ----------------------------------------------------------------------------- +def _names_to_funcs(namelist, fdict): + result = [] + for n in namelist: + if n and n[0]: + result.append((fdict[n[0]], n[1])) + else: + result.append(n) + return result + +# ----------------------------------------------------------------------------- +# _form_master_re() +# +# This function takes a list of all of the regex components and attempts to +# form the master regular expression. Given limitations in the Python re +# module, it may be necessary to break the master regex into separate expressions. +# ----------------------------------------------------------------------------- +def _form_master_re(relist, reflags, ldict, toknames): + if not relist: + return [] + regex = '|'.join(relist) + try: + lexre = re.compile(regex, reflags) + + # Build the index to function map for the matching engine + lexindexfunc = [None] * (max(lexre.groupindex.values()) + 1) + lexindexnames = lexindexfunc[:] + + for f, i in lexre.groupindex.items(): + handle = ldict.get(f, None) + if type(handle) in (types.FunctionType, types.MethodType): + lexindexfunc[i] = (handle, toknames[f]) + lexindexnames[i] = f + elif handle is not None: + lexindexnames[i] = f + if f.find('ignore_') > 0: + lexindexfunc[i] = (None, None) + else: + lexindexfunc[i] = (None, toknames[f]) + + return [(lexre, lexindexfunc)], [regex], [lexindexnames] + except Exception: + m = int(len(relist)/2) + if m == 0: + m = 1 + llist, lre, lnames = _form_master_re(relist[:m], reflags, ldict, toknames) + rlist, rre, rnames = _form_master_re(relist[m:], reflags, ldict, toknames) + return (llist+rlist), (lre+rre), (lnames+rnames) + +# ----------------------------------------------------------------------------- +# def _statetoken(s,names) +# +# Given a declaration name s of the form "t_" and a dictionary whose keys are +# state names, this function returns a tuple (states,tokenname) where states +# is a tuple of state names and tokenname is the name of the token. For example, +# calling this with s = "t_foo_bar_SPAM" might return (('foo','bar'),'SPAM') +# ----------------------------------------------------------------------------- +def _statetoken(s, names): + nonstate = 1 + parts = s.split('_') + for i, part in enumerate(parts[1:], 1): + if part not in names and part != 'ANY': + break + + if i > 1: + states = tuple(parts[1:i]) + else: + states = ('INITIAL',) + + if 'ANY' in states: + states = tuple(names) + + tokenname = '_'.join(parts[i:]) + return (states, tokenname) + + +# ----------------------------------------------------------------------------- +# LexerReflect() +# +# This class represents information needed to build a lexer as extracted from a +# user's input file. +# ----------------------------------------------------------------------------- +class LexerReflect(object): + def __init__(self, ldict, log=None, reflags=0): + self.ldict = ldict + self.error_func = None + self.tokens = [] + self.reflags = reflags + self.stateinfo = {'INITIAL': 'inclusive'} + self.modules = set() + self.error = False + self.log = PlyLogger(sys.stderr) if log is None else log + + # Get all of the basic information + def get_all(self): + self.get_tokens() + self.get_literals() + self.get_states() + self.get_rules() + + # Validate all of the information + def validate_all(self): + self.validate_tokens() + self.validate_literals() + self.validate_rules() + return self.error + + # Get the tokens map + def get_tokens(self): + tokens = self.ldict.get('tokens', None) + if not tokens: + self.log.error('No token list is defined') + self.error = True + return + + if not isinstance(tokens, (list, tuple)): + self.log.error('tokens must be a list or tuple') + self.error = True + return + + if not tokens: + self.log.error('tokens is empty') + self.error = True + return + + self.tokens = tokens + + # Validate the tokens + def validate_tokens(self): + terminals = {} + for n in self.tokens: + if not _is_identifier.match(n): + self.log.error("Bad token name '%s'", n) + self.error = True + if n in terminals: + self.log.warning("Token '%s' multiply defined", n) + terminals[n] = 1 + + # Get the literals specifier + def get_literals(self): + self.literals = self.ldict.get('literals', '') + if not self.literals: + self.literals = '' + + # Validate literals + def validate_literals(self): + try: + for c in self.literals: + if not isinstance(c, StringTypes) or len(c) > 1: + self.log.error('Invalid literal %s. Must be a single character', repr(c)) + self.error = True + + except TypeError: + self.log.error('Invalid literals specification. literals must be a sequence of characters') + self.error = True + + def get_states(self): + self.states = self.ldict.get('states', None) + # Build statemap + if self.states: + if not isinstance(self.states, (tuple, list)): + self.log.error('states must be defined as a tuple or list') + self.error = True + else: + for s in self.states: + if not isinstance(s, tuple) or len(s) != 2: + self.log.error("Invalid state specifier %s. Must be a tuple (statename,'exclusive|inclusive')", repr(s)) + self.error = True + continue + name, statetype = s + if not isinstance(name, StringTypes): + self.log.error('State name %s must be a string', repr(name)) + self.error = True + continue + if not (statetype == 'inclusive' or statetype == 'exclusive'): + self.log.error("State type for state %s must be 'inclusive' or 'exclusive'", name) + self.error = True + continue + if name in self.stateinfo: + self.log.error("State '%s' already defined", name) + self.error = True + continue + self.stateinfo[name] = statetype + + # Get all of the symbols with a t_ prefix and sort them into various + # categories (functions, strings, error functions, and ignore characters) + + def get_rules(self): + tsymbols = [f for f in self.ldict if f[:2] == 't_'] + + # Now build up a list of functions and a list of strings + self.toknames = {} # Mapping of symbols to token names + self.funcsym = {} # Symbols defined as functions + self.strsym = {} # Symbols defined as strings + self.ignore = {} # Ignore strings by state + self.errorf = {} # Error functions by state + self.eoff = {} # EOF functions by state + + for s in self.stateinfo: + self.funcsym[s] = [] + self.strsym[s] = [] + + if len(tsymbols) == 0: + self.log.error('No rules of the form t_rulename are defined') + self.error = True + return + + for f in tsymbols: + t = self.ldict[f] + states, tokname = _statetoken(f, self.stateinfo) + self.toknames[f] = tokname + + if hasattr(t, '__call__'): + if tokname == 'error': + for s in states: + self.errorf[s] = t + elif tokname == 'eof': + for s in states: + self.eoff[s] = t + elif tokname == 'ignore': + line = t.__code__.co_firstlineno + file = t.__code__.co_filename + self.log.error("%s:%d: Rule '%s' must be defined as a string", file, line, t.__name__) + self.error = True + else: + for s in states: + self.funcsym[s].append((f, t)) + elif isinstance(t, StringTypes): + if tokname == 'ignore': + for s in states: + self.ignore[s] = t + if '\\' in t: + self.log.warning("%s contains a literal backslash '\\'", f) + + elif tokname == 'error': + self.log.error("Rule '%s' must be defined as a function", f) + self.error = True + else: + for s in states: + self.strsym[s].append((f, t)) + else: + self.log.error('%s not defined as a function or string', f) + self.error = True + + # Sort the functions by line number + for f in self.funcsym.values(): + f.sort(key=lambda x: x[1].__code__.co_firstlineno) + + # Sort the strings by regular expression length + for s in self.strsym.values(): + s.sort(key=lambda x: len(x[1]), reverse=True) + + # Validate all of the t_rules collected + def validate_rules(self): + for state in self.stateinfo: + # Validate all rules defined by functions + + for fname, f in self.funcsym[state]: + line = f.__code__.co_firstlineno + file = f.__code__.co_filename + module = inspect.getmodule(f) + self.modules.add(module) + + tokname = self.toknames[fname] + if isinstance(f, types.MethodType): + reqargs = 2 + else: + reqargs = 1 + nargs = f.__code__.co_argcount + if nargs > reqargs: + self.log.error("%s:%d: Rule '%s' has too many arguments", file, line, f.__name__) + self.error = True + continue + + if nargs < reqargs: + self.log.error("%s:%d: Rule '%s' requires an argument", file, line, f.__name__) + self.error = True + continue + + if not _get_regex(f): + self.log.error("%s:%d: No regular expression defined for rule '%s'", file, line, f.__name__) + self.error = True + continue + + try: + c = re.compile('(?P<%s>%s)' % (fname, _get_regex(f)), self.reflags) + if c.match(''): + self.log.error("%s:%d: Regular expression for rule '%s' matches empty string", file, line, f.__name__) + self.error = True + except re.error as e: + self.log.error("%s:%d: Invalid regular expression for rule '%s'. %s", file, line, f.__name__, e) + if '#' in _get_regex(f): + self.log.error("%s:%d. Make sure '#' in rule '%s' is escaped with '\\#'", file, line, f.__name__) + self.error = True + + # Validate all rules defined by strings + for name, r in self.strsym[state]: + tokname = self.toknames[name] + if tokname == 'error': + self.log.error("Rule '%s' must be defined as a function", name) + self.error = True + continue + + if tokname not in self.tokens and tokname.find('ignore_') < 0: + self.log.error("Rule '%s' defined for an unspecified token %s", name, tokname) + self.error = True + continue + + try: + c = re.compile('(?P<%s>%s)' % (name, r), self.reflags) + if (c.match('')): + self.log.error("Regular expression for rule '%s' matches empty string", name) + self.error = True + except re.error as e: + self.log.error("Invalid regular expression for rule '%s'. %s", name, e) + if '#' in r: + self.log.error("Make sure '#' in rule '%s' is escaped with '\\#'", name) + self.error = True + + if not self.funcsym[state] and not self.strsym[state]: + self.log.error("No rules defined for state '%s'", state) + self.error = True + + # Validate the error function + efunc = self.errorf.get(state, None) + if efunc: + f = efunc + line = f.__code__.co_firstlineno + file = f.__code__.co_filename + module = inspect.getmodule(f) + self.modules.add(module) + + if isinstance(f, types.MethodType): + reqargs = 2 + else: + reqargs = 1 + nargs = f.__code__.co_argcount + if nargs > reqargs: + self.log.error("%s:%d: Rule '%s' has too many arguments", file, line, f.__name__) + self.error = True + + if nargs < reqargs: + self.log.error("%s:%d: Rule '%s' requires an argument", file, line, f.__name__) + self.error = True + + for module in self.modules: + self.validate_module(module) + + # ----------------------------------------------------------------------------- + # validate_module() + # + # This checks to see if there are duplicated t_rulename() functions or strings + # in the parser input file. This is done using a simple regular expression + # match on each line in the source code of the given module. + # ----------------------------------------------------------------------------- + + def validate_module(self, module): + try: + lines, linen = inspect.getsourcelines(module) + except IOError: + return + + fre = re.compile(r'\s*def\s+(t_[a-zA-Z_0-9]*)\(') + sre = re.compile(r'\s*(t_[a-zA-Z_0-9]*)\s*=') + + counthash = {} + linen += 1 + for line in lines: + m = fre.match(line) + if not m: + m = sre.match(line) + if m: + name = m.group(1) + prev = counthash.get(name) + if not prev: + counthash[name] = linen + else: + filename = inspect.getsourcefile(module) + self.log.error('%s:%d: Rule %s redefined. Previously defined on line %d', filename, linen, name, prev) + self.error = True + linen += 1 + +# ----------------------------------------------------------------------------- +# lex(module) +# +# Build all of the regular expression rules from definitions in the supplied module +# ----------------------------------------------------------------------------- +def lex(module=None, object=None, debug=False, optimize=False, lextab='lextab', + reflags=int(re.VERBOSE), nowarn=False, outputdir=None, debuglog=None, errorlog=None): + + if lextab is None: + lextab = 'lextab' + + global lexer + + ldict = None + stateinfo = {'INITIAL': 'inclusive'} + lexobj = Lexer() + lexobj.lexoptimize = optimize + global token, input + + if errorlog is None: + errorlog = PlyLogger(sys.stderr) + + if debug: + if debuglog is None: + debuglog = PlyLogger(sys.stderr) + + # Get the module dictionary used for the lexer + if object: + module = object + + # Get the module dictionary used for the parser + if module: + _items = [(k, getattr(module, k)) for k in dir(module)] + ldict = dict(_items) + # If no __file__ attribute is available, try to obtain it from the __module__ instead + if '__file__' not in ldict: + ldict['__file__'] = sys.modules[ldict['__module__']].__file__ + else: + ldict = get_caller_module_dict(2) + + # Determine if the module is package of a package or not. + # If so, fix the tabmodule setting so that tables load correctly + pkg = ldict.get('__package__') + if pkg and isinstance(lextab, str): + if '.' not in lextab: + lextab = pkg + '.' + lextab + + # Collect parser information from the dictionary + linfo = LexerReflect(ldict, log=errorlog, reflags=reflags) + linfo.get_all() + if not optimize: + if linfo.validate_all(): + raise SyntaxError("Can't build lexer") + + if optimize and lextab: + try: + lexobj.readtab(lextab, ldict) + token = lexobj.token + input = lexobj.input + lexer = lexobj + return lexobj + + except ImportError: + pass + + # Dump some basic debugging information + if debug: + debuglog.info('lex: tokens = %r', linfo.tokens) + debuglog.info('lex: literals = %r', linfo.literals) + debuglog.info('lex: states = %r', linfo.stateinfo) + + # Build a dictionary of valid token names + lexobj.lextokens = set() + for n in linfo.tokens: + lexobj.lextokens.add(n) + + # Get literals specification + if isinstance(linfo.literals, (list, tuple)): + lexobj.lexliterals = type(linfo.literals[0])().join(linfo.literals) + else: + lexobj.lexliterals = linfo.literals + + lexobj.lextokens_all = lexobj.lextokens | set(lexobj.lexliterals) + + # Get the stateinfo dictionary + stateinfo = linfo.stateinfo + + regexs = {} + # Build the master regular expressions + for state in stateinfo: + regex_list = [] + + # Add rules defined by functions first + for fname, f in linfo.funcsym[state]: + line = f.__code__.co_firstlineno + file = f.__code__.co_filename + regex_list.append('(?P<%s>%s)' % (fname, _get_regex(f))) + if debug: + debuglog.info("lex: Adding rule %s -> '%s' (state '%s')", fname, _get_regex(f), state) + + # Now add all of the simple rules + for name, r in linfo.strsym[state]: + regex_list.append('(?P<%s>%s)' % (name, r)) + if debug: + debuglog.info("lex: Adding rule %s -> '%s' (state '%s')", name, r, state) + + regexs[state] = regex_list + + # Build the master regular expressions + + if debug: + debuglog.info('lex: ==== MASTER REGEXS FOLLOW ====') + + for state in regexs: + lexre, re_text, re_names = _form_master_re(regexs[state], reflags, ldict, linfo.toknames) + lexobj.lexstatere[state] = lexre + lexobj.lexstateretext[state] = re_text + lexobj.lexstaterenames[state] = re_names + if debug: + for i, text in enumerate(re_text): + debuglog.info("lex: state '%s' : regex[%d] = '%s'", state, i, text) + + # For inclusive states, we need to add the regular expressions from the INITIAL state + for state, stype in stateinfo.items(): + if state != 'INITIAL' and stype == 'inclusive': + lexobj.lexstatere[state].extend(lexobj.lexstatere['INITIAL']) + lexobj.lexstateretext[state].extend(lexobj.lexstateretext['INITIAL']) + lexobj.lexstaterenames[state].extend(lexobj.lexstaterenames['INITIAL']) + + lexobj.lexstateinfo = stateinfo + lexobj.lexre = lexobj.lexstatere['INITIAL'] + lexobj.lexretext = lexobj.lexstateretext['INITIAL'] + lexobj.lexreflags = reflags + + # Set up ignore variables + lexobj.lexstateignore = linfo.ignore + lexobj.lexignore = lexobj.lexstateignore.get('INITIAL', '') + + # Set up error functions + lexobj.lexstateerrorf = linfo.errorf + lexobj.lexerrorf = linfo.errorf.get('INITIAL', None) + if not lexobj.lexerrorf: + errorlog.warning('No t_error rule is defined') + + # Set up eof functions + lexobj.lexstateeoff = linfo.eoff + lexobj.lexeoff = linfo.eoff.get('INITIAL', None) + + # Check state information for ignore and error rules + for s, stype in stateinfo.items(): + if stype == 'exclusive': + if s not in linfo.errorf: + errorlog.warning("No error rule is defined for exclusive state '%s'", s) + if s not in linfo.ignore and lexobj.lexignore: + errorlog.warning("No ignore rule is defined for exclusive state '%s'", s) + elif stype == 'inclusive': + if s not in linfo.errorf: + linfo.errorf[s] = linfo.errorf.get('INITIAL', None) + if s not in linfo.ignore: + linfo.ignore[s] = linfo.ignore.get('INITIAL', '') + + # Create global versions of the token() and input() functions + token = lexobj.token + input = lexobj.input + lexer = lexobj + + # If in optimize mode, we write the lextab + if lextab and optimize: + if outputdir is None: + # If no output directory is set, the location of the output files + # is determined according to the following rules: + # - If lextab specifies a package, files go into that package directory + # - Otherwise, files go in the same directory as the specifying module + if isinstance(lextab, types.ModuleType): + srcfile = lextab.__file__ + else: + if '.' not in lextab: + srcfile = ldict['__file__'] + else: + parts = lextab.split('.') + pkgname = '.'.join(parts[:-1]) + exec('import %s' % pkgname) + srcfile = getattr(sys.modules[pkgname], '__file__', '') + outputdir = os.path.dirname(srcfile) + try: + lexobj.writetab(lextab, outputdir) + except IOError as e: + errorlog.warning("Couldn't write lextab module %r. %s" % (lextab, e)) + + return lexobj + +# ----------------------------------------------------------------------------- +# runmain() +# +# This runs the lexer as a main program +# ----------------------------------------------------------------------------- + +def runmain(lexer=None, data=None): + if not data: + try: + filename = sys.argv[1] + f = open(filename) + data = f.read() + f.close() + except IndexError: + sys.stdout.write('Reading from standard input (type EOF to end):\n') + data = sys.stdin.read() + + if lexer: + _input = lexer.input + else: + _input = input + _input(data) + if lexer: + _token = lexer.token + else: + _token = token + + while True: + tok = _token() + if not tok: + break + sys.stdout.write('(%s,%r,%d,%d)\n' % (tok.type, tok.value, tok.lineno, tok.lexpos)) + +# ----------------------------------------------------------------------------- +# @TOKEN(regex) +# +# This decorator function can be used to set the regex expression on a function +# when its docstring might need to be set in an alternative way +# ----------------------------------------------------------------------------- + +def TOKEN(r): + def set_regex(f): + if hasattr(r, '__call__'): + f.regex = _get_regex(r) + else: + f.regex = r + return f + return set_regex + +# Alternative spelling of the TOKEN decorator +Token = TOKEN diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pycparser/ply/yacc.py b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pycparser/ply/yacc.py new file mode 100644 index 0000000000000000000000000000000000000000..20b4f2863cc7193ad4b779a30375c865495fa50c --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pycparser/ply/yacc.py @@ -0,0 +1,3494 @@ +# ----------------------------------------------------------------------------- +# ply: yacc.py +# +# Copyright (C) 2001-2017 +# David M. Beazley (Dabeaz LLC) +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# * Neither the name of the David Beazley or Dabeaz LLC may be used to +# endorse or promote products derived from this software without +# specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# ----------------------------------------------------------------------------- +# +# This implements an LR parser that is constructed from grammar rules defined +# as Python functions. The grammer is specified by supplying the BNF inside +# Python documentation strings. The inspiration for this technique was borrowed +# from John Aycock's Spark parsing system. PLY might be viewed as cross between +# Spark and the GNU bison utility. +# +# The current implementation is only somewhat object-oriented. The +# LR parser itself is defined in terms of an object (which allows multiple +# parsers to co-exist). However, most of the variables used during table +# construction are defined in terms of global variables. Users shouldn't +# notice unless they are trying to define multiple parsers at the same +# time using threads (in which case they should have their head examined). +# +# This implementation supports both SLR and LALR(1) parsing. LALR(1) +# support was originally implemented by Elias Ioup (ezioup@alumni.uchicago.edu), +# using the algorithm found in Aho, Sethi, and Ullman "Compilers: Principles, +# Techniques, and Tools" (The Dragon Book). LALR(1) has since been replaced +# by the more efficient DeRemer and Pennello algorithm. +# +# :::::::: WARNING ::::::: +# +# Construction of LR parsing tables is fairly complicated and expensive. +# To make this module run fast, a *LOT* of work has been put into +# optimization---often at the expensive of readability and what might +# consider to be good Python "coding style." Modify the code at your +# own risk! +# ---------------------------------------------------------------------------- + +import re +import types +import sys +import os.path +import inspect +import base64 +import warnings + +__version__ = '3.10' +__tabversion__ = '3.10' + +#----------------------------------------------------------------------------- +# === User configurable parameters === +# +# Change these to modify the default behavior of yacc (if you wish) +#----------------------------------------------------------------------------- + +yaccdebug = True # Debugging mode. If set, yacc generates a + # a 'parser.out' file in the current directory + +debug_file = 'parser.out' # Default name of the debugging file +tab_module = 'parsetab' # Default name of the table module +default_lr = 'LALR' # Default LR table generation method + +error_count = 3 # Number of symbols that must be shifted to leave recovery mode + +yaccdevel = False # Set to True if developing yacc. This turns off optimized + # implementations of certain functions. + +resultlimit = 40 # Size limit of results when running in debug mode. + +pickle_protocol = 0 # Protocol to use when writing pickle files + +# String type-checking compatibility +if sys.version_info[0] < 3: + string_types = basestring +else: + string_types = str + +MAXINT = sys.maxsize + +# This object is a stand-in for a logging object created by the +# logging module. PLY will use this by default to create things +# such as the parser.out file. If a user wants more detailed +# information, they can create their own logging object and pass +# it into PLY. + +class PlyLogger(object): + def __init__(self, f): + self.f = f + + def debug(self, msg, *args, **kwargs): + self.f.write((msg % args) + '\n') + + info = debug + + def warning(self, msg, *args, **kwargs): + self.f.write('WARNING: ' + (msg % args) + '\n') + + def error(self, msg, *args, **kwargs): + self.f.write('ERROR: ' + (msg % args) + '\n') + + critical = debug + +# Null logger is used when no output is generated. Does nothing. +class NullLogger(object): + def __getattribute__(self, name): + return self + + def __call__(self, *args, **kwargs): + return self + +# Exception raised for yacc-related errors +class YaccError(Exception): + pass + +# Format the result message that the parser produces when running in debug mode. +def format_result(r): + repr_str = repr(r) + if '\n' in repr_str: + repr_str = repr(repr_str) + if len(repr_str) > resultlimit: + repr_str = repr_str[:resultlimit] + ' ...' + result = '<%s @ 0x%x> (%s)' % (type(r).__name__, id(r), repr_str) + return result + +# Format stack entries when the parser is running in debug mode +def format_stack_entry(r): + repr_str = repr(r) + if '\n' in repr_str: + repr_str = repr(repr_str) + if len(repr_str) < 16: + return repr_str + else: + return '<%s @ 0x%x>' % (type(r).__name__, id(r)) + +# Panic mode error recovery support. This feature is being reworked--much of the +# code here is to offer a deprecation/backwards compatible transition + +_errok = None +_token = None +_restart = None +_warnmsg = '''PLY: Don't use global functions errok(), token(), and restart() in p_error(). +Instead, invoke the methods on the associated parser instance: + + def p_error(p): + ... + # Use parser.errok(), parser.token(), parser.restart() + ... + + parser = yacc.yacc() +''' + +def errok(): + warnings.warn(_warnmsg) + return _errok() + +def restart(): + warnings.warn(_warnmsg) + return _restart() + +def token(): + warnings.warn(_warnmsg) + return _token() + +# Utility function to call the p_error() function with some deprecation hacks +def call_errorfunc(errorfunc, token, parser): + global _errok, _token, _restart + _errok = parser.errok + _token = parser.token + _restart = parser.restart + r = errorfunc(token) + try: + del _errok, _token, _restart + except NameError: + pass + return r + +#----------------------------------------------------------------------------- +# === LR Parsing Engine === +# +# The following classes are used for the LR parser itself. These are not +# used during table construction and are independent of the actual LR +# table generation algorithm +#----------------------------------------------------------------------------- + +# This class is used to hold non-terminal grammar symbols during parsing. +# It normally has the following attributes set: +# .type = Grammar symbol type +# .value = Symbol value +# .lineno = Starting line number +# .endlineno = Ending line number (optional, set automatically) +# .lexpos = Starting lex position +# .endlexpos = Ending lex position (optional, set automatically) + +class YaccSymbol: + def __str__(self): + return self.type + + def __repr__(self): + return str(self) + +# This class is a wrapper around the objects actually passed to each +# grammar rule. Index lookup and assignment actually assign the +# .value attribute of the underlying YaccSymbol object. +# The lineno() method returns the line number of a given +# item (or 0 if not defined). The linespan() method returns +# a tuple of (startline,endline) representing the range of lines +# for a symbol. The lexspan() method returns a tuple (lexpos,endlexpos) +# representing the range of positional information for a symbol. + +class YaccProduction: + def __init__(self, s, stack=None): + self.slice = s + self.stack = stack + self.lexer = None + self.parser = None + + def __getitem__(self, n): + if isinstance(n, slice): + return [s.value for s in self.slice[n]] + elif n >= 0: + return self.slice[n].value + else: + return self.stack[n].value + + def __setitem__(self, n, v): + self.slice[n].value = v + + def __getslice__(self, i, j): + return [s.value for s in self.slice[i:j]] + + def __len__(self): + return len(self.slice) + + def lineno(self, n): + return getattr(self.slice[n], 'lineno', 0) + + def set_lineno(self, n, lineno): + self.slice[n].lineno = lineno + + def linespan(self, n): + startline = getattr(self.slice[n], 'lineno', 0) + endline = getattr(self.slice[n], 'endlineno', startline) + return startline, endline + + def lexpos(self, n): + return getattr(self.slice[n], 'lexpos', 0) + + def lexspan(self, n): + startpos = getattr(self.slice[n], 'lexpos', 0) + endpos = getattr(self.slice[n], 'endlexpos', startpos) + return startpos, endpos + + def error(self): + raise SyntaxError + +# ----------------------------------------------------------------------------- +# == LRParser == +# +# The LR Parsing engine. +# ----------------------------------------------------------------------------- + +class LRParser: + def __init__(self, lrtab, errorf): + self.productions = lrtab.lr_productions + self.action = lrtab.lr_action + self.goto = lrtab.lr_goto + self.errorfunc = errorf + self.set_defaulted_states() + self.errorok = True + + def errok(self): + self.errorok = True + + def restart(self): + del self.statestack[:] + del self.symstack[:] + sym = YaccSymbol() + sym.type = '$end' + self.symstack.append(sym) + self.statestack.append(0) + + # Defaulted state support. + # This method identifies parser states where there is only one possible reduction action. + # For such states, the parser can make a choose to make a rule reduction without consuming + # the next look-ahead token. This delayed invocation of the tokenizer can be useful in + # certain kinds of advanced parsing situations where the lexer and parser interact with + # each other or change states (i.e., manipulation of scope, lexer states, etc.). + # + # See: https://www.gnu.org/software/bison/manual/html_node/Default-Reductions.html#Default-Reductions + def set_defaulted_states(self): + self.defaulted_states = {} + for state, actions in self.action.items(): + rules = list(actions.values()) + if len(rules) == 1 and rules[0] < 0: + self.defaulted_states[state] = rules[0] + + def disable_defaulted_states(self): + self.defaulted_states = {} + + def parse(self, input=None, lexer=None, debug=False, tracking=False, tokenfunc=None): + if debug or yaccdevel: + if isinstance(debug, int): + debug = PlyLogger(sys.stderr) + return self.parsedebug(input, lexer, debug, tracking, tokenfunc) + elif tracking: + return self.parseopt(input, lexer, debug, tracking, tokenfunc) + else: + return self.parseopt_notrack(input, lexer, debug, tracking, tokenfunc) + + + # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + # parsedebug(). + # + # This is the debugging enabled version of parse(). All changes made to the + # parsing engine should be made here. Optimized versions of this function + # are automatically created by the ply/ygen.py script. This script cuts out + # sections enclosed in markers such as this: + # + # #--! DEBUG + # statements + # #--! DEBUG + # + # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + + def parsedebug(self, input=None, lexer=None, debug=False, tracking=False, tokenfunc=None): + #--! parsedebug-start + lookahead = None # Current lookahead symbol + lookaheadstack = [] # Stack of lookahead symbols + actions = self.action # Local reference to action table (to avoid lookup on self.) + goto = self.goto # Local reference to goto table (to avoid lookup on self.) + prod = self.productions # Local reference to production list (to avoid lookup on self.) + defaulted_states = self.defaulted_states # Local reference to defaulted states + pslice = YaccProduction(None) # Production object passed to grammar rules + errorcount = 0 # Used during error recovery + + #--! DEBUG + debug.info('PLY: PARSE DEBUG START') + #--! DEBUG + + # If no lexer was given, we will try to use the lex module + if not lexer: + from . import lex + lexer = lex.lexer + + # Set up the lexer and parser objects on pslice + pslice.lexer = lexer + pslice.parser = self + + # If input was supplied, pass to lexer + if input is not None: + lexer.input(input) + + if tokenfunc is None: + # Tokenize function + get_token = lexer.token + else: + get_token = tokenfunc + + # Set the parser() token method (sometimes used in error recovery) + self.token = get_token + + # Set up the state and symbol stacks + + statestack = [] # Stack of parsing states + self.statestack = statestack + symstack = [] # Stack of grammar symbols + self.symstack = symstack + + pslice.stack = symstack # Put in the production + errtoken = None # Err token + + # The start state is assumed to be (0,$end) + + statestack.append(0) + sym = YaccSymbol() + sym.type = '$end' + symstack.append(sym) + state = 0 + while True: + # Get the next symbol on the input. If a lookahead symbol + # is already set, we just use that. Otherwise, we'll pull + # the next token off of the lookaheadstack or from the lexer + + #--! DEBUG + debug.debug('') + debug.debug('State : %s', state) + #--! DEBUG + + if state not in defaulted_states: + if not lookahead: + if not lookaheadstack: + lookahead = get_token() # Get the next token + else: + lookahead = lookaheadstack.pop() + if not lookahead: + lookahead = YaccSymbol() + lookahead.type = '$end' + + # Check the action table + ltype = lookahead.type + t = actions[state].get(ltype) + else: + t = defaulted_states[state] + #--! DEBUG + debug.debug('Defaulted state %s: Reduce using %d', state, -t) + #--! DEBUG + + #--! DEBUG + debug.debug('Stack : %s', + ('%s . %s' % (' '.join([xx.type for xx in symstack][1:]), str(lookahead))).lstrip()) + #--! DEBUG + + if t is not None: + if t > 0: + # shift a symbol on the stack + statestack.append(t) + state = t + + #--! DEBUG + debug.debug('Action : Shift and goto state %s', t) + #--! DEBUG + + symstack.append(lookahead) + lookahead = None + + # Decrease error count on successful shift + if errorcount: + errorcount -= 1 + continue + + if t < 0: + # reduce a symbol on the stack, emit a production + p = prod[-t] + pname = p.name + plen = p.len + + # Get production function + sym = YaccSymbol() + sym.type = pname # Production name + sym.value = None + + #--! DEBUG + if plen: + debug.info('Action : Reduce rule [%s] with %s and goto state %d', p.str, + '['+','.join([format_stack_entry(_v.value) for _v in symstack[-plen:]])+']', + goto[statestack[-1-plen]][pname]) + else: + debug.info('Action : Reduce rule [%s] with %s and goto state %d', p.str, [], + goto[statestack[-1]][pname]) + + #--! DEBUG + + if plen: + targ = symstack[-plen-1:] + targ[0] = sym + + #--! TRACKING + if tracking: + t1 = targ[1] + sym.lineno = t1.lineno + sym.lexpos = t1.lexpos + t1 = targ[-1] + sym.endlineno = getattr(t1, 'endlineno', t1.lineno) + sym.endlexpos = getattr(t1, 'endlexpos', t1.lexpos) + #--! TRACKING + + # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + # The code enclosed in this section is duplicated + # below as a performance optimization. Make sure + # changes get made in both locations. + + pslice.slice = targ + + try: + # Call the grammar rule with our special slice object + del symstack[-plen:] + self.state = state + p.callable(pslice) + del statestack[-plen:] + #--! DEBUG + debug.info('Result : %s', format_result(pslice[0])) + #--! DEBUG + symstack.append(sym) + state = goto[statestack[-1]][pname] + statestack.append(state) + except SyntaxError: + # If an error was set. Enter error recovery state + lookaheadstack.append(lookahead) # Save the current lookahead token + symstack.extend(targ[1:-1]) # Put the production slice back on the stack + statestack.pop() # Pop back one state (before the reduce) + state = statestack[-1] + sym.type = 'error' + sym.value = 'error' + lookahead = sym + errorcount = error_count + self.errorok = False + + continue + # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + + else: + + #--! TRACKING + if tracking: + sym.lineno = lexer.lineno + sym.lexpos = lexer.lexpos + #--! TRACKING + + targ = [sym] + + # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + # The code enclosed in this section is duplicated + # above as a performance optimization. Make sure + # changes get made in both locations. + + pslice.slice = targ + + try: + # Call the grammar rule with our special slice object + self.state = state + p.callable(pslice) + #--! DEBUG + debug.info('Result : %s', format_result(pslice[0])) + #--! DEBUG + symstack.append(sym) + state = goto[statestack[-1]][pname] + statestack.append(state) + except SyntaxError: + # If an error was set. Enter error recovery state + lookaheadstack.append(lookahead) # Save the current lookahead token + statestack.pop() # Pop back one state (before the reduce) + state = statestack[-1] + sym.type = 'error' + sym.value = 'error' + lookahead = sym + errorcount = error_count + self.errorok = False + + continue + # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + + if t == 0: + n = symstack[-1] + result = getattr(n, 'value', None) + #--! DEBUG + debug.info('Done : Returning %s', format_result(result)) + debug.info('PLY: PARSE DEBUG END') + #--! DEBUG + return result + + if t is None: + + #--! DEBUG + debug.error('Error : %s', + ('%s . %s' % (' '.join([xx.type for xx in symstack][1:]), str(lookahead))).lstrip()) + #--! DEBUG + + # We have some kind of parsing error here. To handle + # this, we are going to push the current token onto + # the tokenstack and replace it with an 'error' token. + # If there are any synchronization rules, they may + # catch it. + # + # In addition to pushing the error token, we call call + # the user defined p_error() function if this is the + # first syntax error. This function is only called if + # errorcount == 0. + if errorcount == 0 or self.errorok: + errorcount = error_count + self.errorok = False + errtoken = lookahead + if errtoken.type == '$end': + errtoken = None # End of file! + if self.errorfunc: + if errtoken and not hasattr(errtoken, 'lexer'): + errtoken.lexer = lexer + self.state = state + tok = call_errorfunc(self.errorfunc, errtoken, self) + if self.errorok: + # User must have done some kind of panic + # mode recovery on their own. The + # returned token is the next lookahead + lookahead = tok + errtoken = None + continue + else: + if errtoken: + if hasattr(errtoken, 'lineno'): + lineno = lookahead.lineno + else: + lineno = 0 + if lineno: + sys.stderr.write('yacc: Syntax error at line %d, token=%s\n' % (lineno, errtoken.type)) + else: + sys.stderr.write('yacc: Syntax error, token=%s' % errtoken.type) + else: + sys.stderr.write('yacc: Parse error in input. EOF\n') + return + + else: + errorcount = error_count + + # case 1: the statestack only has 1 entry on it. If we're in this state, the + # entire parse has been rolled back and we're completely hosed. The token is + # discarded and we just keep going. + + if len(statestack) <= 1 and lookahead.type != '$end': + lookahead = None + errtoken = None + state = 0 + # Nuke the pushback stack + del lookaheadstack[:] + continue + + # case 2: the statestack has a couple of entries on it, but we're + # at the end of the file. nuke the top entry and generate an error token + + # Start nuking entries on the stack + if lookahead.type == '$end': + # Whoa. We're really hosed here. Bail out + return + + if lookahead.type != 'error': + sym = symstack[-1] + if sym.type == 'error': + # Hmmm. Error is on top of stack, we'll just nuke input + # symbol and continue + #--! TRACKING + if tracking: + sym.endlineno = getattr(lookahead, 'lineno', sym.lineno) + sym.endlexpos = getattr(lookahead, 'lexpos', sym.lexpos) + #--! TRACKING + lookahead = None + continue + + # Create the error symbol for the first time and make it the new lookahead symbol + t = YaccSymbol() + t.type = 'error' + + if hasattr(lookahead, 'lineno'): + t.lineno = t.endlineno = lookahead.lineno + if hasattr(lookahead, 'lexpos'): + t.lexpos = t.endlexpos = lookahead.lexpos + t.value = lookahead + lookaheadstack.append(lookahead) + lookahead = t + else: + sym = symstack.pop() + #--! TRACKING + if tracking: + lookahead.lineno = sym.lineno + lookahead.lexpos = sym.lexpos + #--! TRACKING + statestack.pop() + state = statestack[-1] + + continue + + # Call an error function here + raise RuntimeError('yacc: internal parser error!!!\n') + + #--! parsedebug-end + + # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + # parseopt(). + # + # Optimized version of parse() method. DO NOT EDIT THIS CODE DIRECTLY! + # This code is automatically generated by the ply/ygen.py script. Make + # changes to the parsedebug() method instead. + # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + + def parseopt(self, input=None, lexer=None, debug=False, tracking=False, tokenfunc=None): + #--! parseopt-start + lookahead = None # Current lookahead symbol + lookaheadstack = [] # Stack of lookahead symbols + actions = self.action # Local reference to action table (to avoid lookup on self.) + goto = self.goto # Local reference to goto table (to avoid lookup on self.) + prod = self.productions # Local reference to production list (to avoid lookup on self.) + defaulted_states = self.defaulted_states # Local reference to defaulted states + pslice = YaccProduction(None) # Production object passed to grammar rules + errorcount = 0 # Used during error recovery + + + # If no lexer was given, we will try to use the lex module + if not lexer: + from . import lex + lexer = lex.lexer + + # Set up the lexer and parser objects on pslice + pslice.lexer = lexer + pslice.parser = self + + # If input was supplied, pass to lexer + if input is not None: + lexer.input(input) + + if tokenfunc is None: + # Tokenize function + get_token = lexer.token + else: + get_token = tokenfunc + + # Set the parser() token method (sometimes used in error recovery) + self.token = get_token + + # Set up the state and symbol stacks + + statestack = [] # Stack of parsing states + self.statestack = statestack + symstack = [] # Stack of grammar symbols + self.symstack = symstack + + pslice.stack = symstack # Put in the production + errtoken = None # Err token + + # The start state is assumed to be (0,$end) + + statestack.append(0) + sym = YaccSymbol() + sym.type = '$end' + symstack.append(sym) + state = 0 + while True: + # Get the next symbol on the input. If a lookahead symbol + # is already set, we just use that. Otherwise, we'll pull + # the next token off of the lookaheadstack or from the lexer + + + if state not in defaulted_states: + if not lookahead: + if not lookaheadstack: + lookahead = get_token() # Get the next token + else: + lookahead = lookaheadstack.pop() + if not lookahead: + lookahead = YaccSymbol() + lookahead.type = '$end' + + # Check the action table + ltype = lookahead.type + t = actions[state].get(ltype) + else: + t = defaulted_states[state] + + + if t is not None: + if t > 0: + # shift a symbol on the stack + statestack.append(t) + state = t + + + symstack.append(lookahead) + lookahead = None + + # Decrease error count on successful shift + if errorcount: + errorcount -= 1 + continue + + if t < 0: + # reduce a symbol on the stack, emit a production + p = prod[-t] + pname = p.name + plen = p.len + + # Get production function + sym = YaccSymbol() + sym.type = pname # Production name + sym.value = None + + + if plen: + targ = symstack[-plen-1:] + targ[0] = sym + + #--! TRACKING + if tracking: + t1 = targ[1] + sym.lineno = t1.lineno + sym.lexpos = t1.lexpos + t1 = targ[-1] + sym.endlineno = getattr(t1, 'endlineno', t1.lineno) + sym.endlexpos = getattr(t1, 'endlexpos', t1.lexpos) + #--! TRACKING + + # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + # The code enclosed in this section is duplicated + # below as a performance optimization. Make sure + # changes get made in both locations. + + pslice.slice = targ + + try: + # Call the grammar rule with our special slice object + del symstack[-plen:] + self.state = state + p.callable(pslice) + del statestack[-plen:] + symstack.append(sym) + state = goto[statestack[-1]][pname] + statestack.append(state) + except SyntaxError: + # If an error was set. Enter error recovery state + lookaheadstack.append(lookahead) # Save the current lookahead token + symstack.extend(targ[1:-1]) # Put the production slice back on the stack + statestack.pop() # Pop back one state (before the reduce) + state = statestack[-1] + sym.type = 'error' + sym.value = 'error' + lookahead = sym + errorcount = error_count + self.errorok = False + + continue + # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + + else: + + #--! TRACKING + if tracking: + sym.lineno = lexer.lineno + sym.lexpos = lexer.lexpos + #--! TRACKING + + targ = [sym] + + # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + # The code enclosed in this section is duplicated + # above as a performance optimization. Make sure + # changes get made in both locations. + + pslice.slice = targ + + try: + # Call the grammar rule with our special slice object + self.state = state + p.callable(pslice) + symstack.append(sym) + state = goto[statestack[-1]][pname] + statestack.append(state) + except SyntaxError: + # If an error was set. Enter error recovery state + lookaheadstack.append(lookahead) # Save the current lookahead token + statestack.pop() # Pop back one state (before the reduce) + state = statestack[-1] + sym.type = 'error' + sym.value = 'error' + lookahead = sym + errorcount = error_count + self.errorok = False + + continue + # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + + if t == 0: + n = symstack[-1] + result = getattr(n, 'value', None) + return result + + if t is None: + + + # We have some kind of parsing error here. To handle + # this, we are going to push the current token onto + # the tokenstack and replace it with an 'error' token. + # If there are any synchronization rules, they may + # catch it. + # + # In addition to pushing the error token, we call call + # the user defined p_error() function if this is the + # first syntax error. This function is only called if + # errorcount == 0. + if errorcount == 0 or self.errorok: + errorcount = error_count + self.errorok = False + errtoken = lookahead + if errtoken.type == '$end': + errtoken = None # End of file! + if self.errorfunc: + if errtoken and not hasattr(errtoken, 'lexer'): + errtoken.lexer = lexer + self.state = state + tok = call_errorfunc(self.errorfunc, errtoken, self) + if self.errorok: + # User must have done some kind of panic + # mode recovery on their own. The + # returned token is the next lookahead + lookahead = tok + errtoken = None + continue + else: + if errtoken: + if hasattr(errtoken, 'lineno'): + lineno = lookahead.lineno + else: + lineno = 0 + if lineno: + sys.stderr.write('yacc: Syntax error at line %d, token=%s\n' % (lineno, errtoken.type)) + else: + sys.stderr.write('yacc: Syntax error, token=%s' % errtoken.type) + else: + sys.stderr.write('yacc: Parse error in input. EOF\n') + return + + else: + errorcount = error_count + + # case 1: the statestack only has 1 entry on it. If we're in this state, the + # entire parse has been rolled back and we're completely hosed. The token is + # discarded and we just keep going. + + if len(statestack) <= 1 and lookahead.type != '$end': + lookahead = None + errtoken = None + state = 0 + # Nuke the pushback stack + del lookaheadstack[:] + continue + + # case 2: the statestack has a couple of entries on it, but we're + # at the end of the file. nuke the top entry and generate an error token + + # Start nuking entries on the stack + if lookahead.type == '$end': + # Whoa. We're really hosed here. Bail out + return + + if lookahead.type != 'error': + sym = symstack[-1] + if sym.type == 'error': + # Hmmm. Error is on top of stack, we'll just nuke input + # symbol and continue + #--! TRACKING + if tracking: + sym.endlineno = getattr(lookahead, 'lineno', sym.lineno) + sym.endlexpos = getattr(lookahead, 'lexpos', sym.lexpos) + #--! TRACKING + lookahead = None + continue + + # Create the error symbol for the first time and make it the new lookahead symbol + t = YaccSymbol() + t.type = 'error' + + if hasattr(lookahead, 'lineno'): + t.lineno = t.endlineno = lookahead.lineno + if hasattr(lookahead, 'lexpos'): + t.lexpos = t.endlexpos = lookahead.lexpos + t.value = lookahead + lookaheadstack.append(lookahead) + lookahead = t + else: + sym = symstack.pop() + #--! TRACKING + if tracking: + lookahead.lineno = sym.lineno + lookahead.lexpos = sym.lexpos + #--! TRACKING + statestack.pop() + state = statestack[-1] + + continue + + # Call an error function here + raise RuntimeError('yacc: internal parser error!!!\n') + + #--! parseopt-end + + # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + # parseopt_notrack(). + # + # Optimized version of parseopt() with line number tracking removed. + # DO NOT EDIT THIS CODE DIRECTLY. This code is automatically generated + # by the ply/ygen.py script. Make changes to the parsedebug() method instead. + # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + + def parseopt_notrack(self, input=None, lexer=None, debug=False, tracking=False, tokenfunc=None): + #--! parseopt-notrack-start + lookahead = None # Current lookahead symbol + lookaheadstack = [] # Stack of lookahead symbols + actions = self.action # Local reference to action table (to avoid lookup on self.) + goto = self.goto # Local reference to goto table (to avoid lookup on self.) + prod = self.productions # Local reference to production list (to avoid lookup on self.) + defaulted_states = self.defaulted_states # Local reference to defaulted states + pslice = YaccProduction(None) # Production object passed to grammar rules + errorcount = 0 # Used during error recovery + + + # If no lexer was given, we will try to use the lex module + if not lexer: + from . import lex + lexer = lex.lexer + + # Set up the lexer and parser objects on pslice + pslice.lexer = lexer + pslice.parser = self + + # If input was supplied, pass to lexer + if input is not None: + lexer.input(input) + + if tokenfunc is None: + # Tokenize function + get_token = lexer.token + else: + get_token = tokenfunc + + # Set the parser() token method (sometimes used in error recovery) + self.token = get_token + + # Set up the state and symbol stacks + + statestack = [] # Stack of parsing states + self.statestack = statestack + symstack = [] # Stack of grammar symbols + self.symstack = symstack + + pslice.stack = symstack # Put in the production + errtoken = None # Err token + + # The start state is assumed to be (0,$end) + + statestack.append(0) + sym = YaccSymbol() + sym.type = '$end' + symstack.append(sym) + state = 0 + while True: + # Get the next symbol on the input. If a lookahead symbol + # is already set, we just use that. Otherwise, we'll pull + # the next token off of the lookaheadstack or from the lexer + + + if state not in defaulted_states: + if not lookahead: + if not lookaheadstack: + lookahead = get_token() # Get the next token + else: + lookahead = lookaheadstack.pop() + if not lookahead: + lookahead = YaccSymbol() + lookahead.type = '$end' + + # Check the action table + ltype = lookahead.type + t = actions[state].get(ltype) + else: + t = defaulted_states[state] + + + if t is not None: + if t > 0: + # shift a symbol on the stack + statestack.append(t) + state = t + + + symstack.append(lookahead) + lookahead = None + + # Decrease error count on successful shift + if errorcount: + errorcount -= 1 + continue + + if t < 0: + # reduce a symbol on the stack, emit a production + p = prod[-t] + pname = p.name + plen = p.len + + # Get production function + sym = YaccSymbol() + sym.type = pname # Production name + sym.value = None + + + if plen: + targ = symstack[-plen-1:] + targ[0] = sym + + + # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + # The code enclosed in this section is duplicated + # below as a performance optimization. Make sure + # changes get made in both locations. + + pslice.slice = targ + + try: + # Call the grammar rule with our special slice object + del symstack[-plen:] + self.state = state + p.callable(pslice) + del statestack[-plen:] + symstack.append(sym) + state = goto[statestack[-1]][pname] + statestack.append(state) + except SyntaxError: + # If an error was set. Enter error recovery state + lookaheadstack.append(lookahead) # Save the current lookahead token + symstack.extend(targ[1:-1]) # Put the production slice back on the stack + statestack.pop() # Pop back one state (before the reduce) + state = statestack[-1] + sym.type = 'error' + sym.value = 'error' + lookahead = sym + errorcount = error_count + self.errorok = False + + continue + # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + + else: + + + targ = [sym] + + # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + # The code enclosed in this section is duplicated + # above as a performance optimization. Make sure + # changes get made in both locations. + + pslice.slice = targ + + try: + # Call the grammar rule with our special slice object + self.state = state + p.callable(pslice) + symstack.append(sym) + state = goto[statestack[-1]][pname] + statestack.append(state) + except SyntaxError: + # If an error was set. Enter error recovery state + lookaheadstack.append(lookahead) # Save the current lookahead token + statestack.pop() # Pop back one state (before the reduce) + state = statestack[-1] + sym.type = 'error' + sym.value = 'error' + lookahead = sym + errorcount = error_count + self.errorok = False + + continue + # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + + if t == 0: + n = symstack[-1] + result = getattr(n, 'value', None) + return result + + if t is None: + + + # We have some kind of parsing error here. To handle + # this, we are going to push the current token onto + # the tokenstack and replace it with an 'error' token. + # If there are any synchronization rules, they may + # catch it. + # + # In addition to pushing the error token, we call call + # the user defined p_error() function if this is the + # first syntax error. This function is only called if + # errorcount == 0. + if errorcount == 0 or self.errorok: + errorcount = error_count + self.errorok = False + errtoken = lookahead + if errtoken.type == '$end': + errtoken = None # End of file! + if self.errorfunc: + if errtoken and not hasattr(errtoken, 'lexer'): + errtoken.lexer = lexer + self.state = state + tok = call_errorfunc(self.errorfunc, errtoken, self) + if self.errorok: + # User must have done some kind of panic + # mode recovery on their own. The + # returned token is the next lookahead + lookahead = tok + errtoken = None + continue + else: + if errtoken: + if hasattr(errtoken, 'lineno'): + lineno = lookahead.lineno + else: + lineno = 0 + if lineno: + sys.stderr.write('yacc: Syntax error at line %d, token=%s\n' % (lineno, errtoken.type)) + else: + sys.stderr.write('yacc: Syntax error, token=%s' % errtoken.type) + else: + sys.stderr.write('yacc: Parse error in input. EOF\n') + return + + else: + errorcount = error_count + + # case 1: the statestack only has 1 entry on it. If we're in this state, the + # entire parse has been rolled back and we're completely hosed. The token is + # discarded and we just keep going. + + if len(statestack) <= 1 and lookahead.type != '$end': + lookahead = None + errtoken = None + state = 0 + # Nuke the pushback stack + del lookaheadstack[:] + continue + + # case 2: the statestack has a couple of entries on it, but we're + # at the end of the file. nuke the top entry and generate an error token + + # Start nuking entries on the stack + if lookahead.type == '$end': + # Whoa. We're really hosed here. Bail out + return + + if lookahead.type != 'error': + sym = symstack[-1] + if sym.type == 'error': + # Hmmm. Error is on top of stack, we'll just nuke input + # symbol and continue + lookahead = None + continue + + # Create the error symbol for the first time and make it the new lookahead symbol + t = YaccSymbol() + t.type = 'error' + + if hasattr(lookahead, 'lineno'): + t.lineno = t.endlineno = lookahead.lineno + if hasattr(lookahead, 'lexpos'): + t.lexpos = t.endlexpos = lookahead.lexpos + t.value = lookahead + lookaheadstack.append(lookahead) + lookahead = t + else: + sym = symstack.pop() + statestack.pop() + state = statestack[-1] + + continue + + # Call an error function here + raise RuntimeError('yacc: internal parser error!!!\n') + + #--! parseopt-notrack-end + +# ----------------------------------------------------------------------------- +# === Grammar Representation === +# +# The following functions, classes, and variables are used to represent and +# manipulate the rules that make up a grammar. +# ----------------------------------------------------------------------------- + +# regex matching identifiers +_is_identifier = re.compile(r'^[a-zA-Z0-9_-]+$') + +# ----------------------------------------------------------------------------- +# class Production: +# +# This class stores the raw information about a single production or grammar rule. +# A grammar rule refers to a specification such as this: +# +# expr : expr PLUS term +# +# Here are the basic attributes defined on all productions +# +# name - Name of the production. For example 'expr' +# prod - A list of symbols on the right side ['expr','PLUS','term'] +# prec - Production precedence level +# number - Production number. +# func - Function that executes on reduce +# file - File where production function is defined +# lineno - Line number where production function is defined +# +# The following attributes are defined or optional. +# +# len - Length of the production (number of symbols on right hand side) +# usyms - Set of unique symbols found in the production +# ----------------------------------------------------------------------------- + +class Production(object): + reduced = 0 + def __init__(self, number, name, prod, precedence=('right', 0), func=None, file='', line=0): + self.name = name + self.prod = tuple(prod) + self.number = number + self.func = func + self.callable = None + self.file = file + self.line = line + self.prec = precedence + + # Internal settings used during table construction + + self.len = len(self.prod) # Length of the production + + # Create a list of unique production symbols used in the production + self.usyms = [] + for s in self.prod: + if s not in self.usyms: + self.usyms.append(s) + + # List of all LR items for the production + self.lr_items = [] + self.lr_next = None + + # Create a string representation + if self.prod: + self.str = '%s -> %s' % (self.name, ' '.join(self.prod)) + else: + self.str = '%s -> ' % self.name + + def __str__(self): + return self.str + + def __repr__(self): + return 'Production(' + str(self) + ')' + + def __len__(self): + return len(self.prod) + + def __nonzero__(self): + return 1 + + def __getitem__(self, index): + return self.prod[index] + + # Return the nth lr_item from the production (or None if at the end) + def lr_item(self, n): + if n > len(self.prod): + return None + p = LRItem(self, n) + # Precompute the list of productions immediately following. + try: + p.lr_after = Prodnames[p.prod[n+1]] + except (IndexError, KeyError): + p.lr_after = [] + try: + p.lr_before = p.prod[n-1] + except IndexError: + p.lr_before = None + return p + + # Bind the production function name to a callable + def bind(self, pdict): + if self.func: + self.callable = pdict[self.func] + +# This class serves as a minimal standin for Production objects when +# reading table data from files. It only contains information +# actually used by the LR parsing engine, plus some additional +# debugging information. +class MiniProduction(object): + def __init__(self, str, name, len, func, file, line): + self.name = name + self.len = len + self.func = func + self.callable = None + self.file = file + self.line = line + self.str = str + + def __str__(self): + return self.str + + def __repr__(self): + return 'MiniProduction(%s)' % self.str + + # Bind the production function name to a callable + def bind(self, pdict): + if self.func: + self.callable = pdict[self.func] + + +# ----------------------------------------------------------------------------- +# class LRItem +# +# This class represents a specific stage of parsing a production rule. For +# example: +# +# expr : expr . PLUS term +# +# In the above, the "." represents the current location of the parse. Here +# basic attributes: +# +# name - Name of the production. For example 'expr' +# prod - A list of symbols on the right side ['expr','.', 'PLUS','term'] +# number - Production number. +# +# lr_next Next LR item. Example, if we are ' expr -> expr . PLUS term' +# then lr_next refers to 'expr -> expr PLUS . term' +# lr_index - LR item index (location of the ".") in the prod list. +# lookaheads - LALR lookahead symbols for this item +# len - Length of the production (number of symbols on right hand side) +# lr_after - List of all productions that immediately follow +# lr_before - Grammar symbol immediately before +# ----------------------------------------------------------------------------- + +class LRItem(object): + def __init__(self, p, n): + self.name = p.name + self.prod = list(p.prod) + self.number = p.number + self.lr_index = n + self.lookaheads = {} + self.prod.insert(n, '.') + self.prod = tuple(self.prod) + self.len = len(self.prod) + self.usyms = p.usyms + + def __str__(self): + if self.prod: + s = '%s -> %s' % (self.name, ' '.join(self.prod)) + else: + s = '%s -> ' % self.name + return s + + def __repr__(self): + return 'LRItem(' + str(self) + ')' + +# ----------------------------------------------------------------------------- +# rightmost_terminal() +# +# Return the rightmost terminal from a list of symbols. Used in add_production() +# ----------------------------------------------------------------------------- +def rightmost_terminal(symbols, terminals): + i = len(symbols) - 1 + while i >= 0: + if symbols[i] in terminals: + return symbols[i] + i -= 1 + return None + +# ----------------------------------------------------------------------------- +# === GRAMMAR CLASS === +# +# The following class represents the contents of the specified grammar along +# with various computed properties such as first sets, follow sets, LR items, etc. +# This data is used for critical parts of the table generation process later. +# ----------------------------------------------------------------------------- + +class GrammarError(YaccError): + pass + +class Grammar(object): + def __init__(self, terminals): + self.Productions = [None] # A list of all of the productions. The first + # entry is always reserved for the purpose of + # building an augmented grammar + + self.Prodnames = {} # A dictionary mapping the names of nonterminals to a list of all + # productions of that nonterminal. + + self.Prodmap = {} # A dictionary that is only used to detect duplicate + # productions. + + self.Terminals = {} # A dictionary mapping the names of terminal symbols to a + # list of the rules where they are used. + + for term in terminals: + self.Terminals[term] = [] + + self.Terminals['error'] = [] + + self.Nonterminals = {} # A dictionary mapping names of nonterminals to a list + # of rule numbers where they are used. + + self.First = {} # A dictionary of precomputed FIRST(x) symbols + + self.Follow = {} # A dictionary of precomputed FOLLOW(x) symbols + + self.Precedence = {} # Precedence rules for each terminal. Contains tuples of the + # form ('right',level) or ('nonassoc', level) or ('left',level) + + self.UsedPrecedence = set() # Precedence rules that were actually used by the grammer. + # This is only used to provide error checking and to generate + # a warning about unused precedence rules. + + self.Start = None # Starting symbol for the grammar + + + def __len__(self): + return len(self.Productions) + + def __getitem__(self, index): + return self.Productions[index] + + # ----------------------------------------------------------------------------- + # set_precedence() + # + # Sets the precedence for a given terminal. assoc is the associativity such as + # 'left','right', or 'nonassoc'. level is a numeric level. + # + # ----------------------------------------------------------------------------- + + def set_precedence(self, term, assoc, level): + assert self.Productions == [None], 'Must call set_precedence() before add_production()' + if term in self.Precedence: + raise GrammarError('Precedence already specified for terminal %r' % term) + if assoc not in ['left', 'right', 'nonassoc']: + raise GrammarError("Associativity must be one of 'left','right', or 'nonassoc'") + self.Precedence[term] = (assoc, level) + + # ----------------------------------------------------------------------------- + # add_production() + # + # Given an action function, this function assembles a production rule and + # computes its precedence level. + # + # The production rule is supplied as a list of symbols. For example, + # a rule such as 'expr : expr PLUS term' has a production name of 'expr' and + # symbols ['expr','PLUS','term']. + # + # Precedence is determined by the precedence of the right-most non-terminal + # or the precedence of a terminal specified by %prec. + # + # A variety of error checks are performed to make sure production symbols + # are valid and that %prec is used correctly. + # ----------------------------------------------------------------------------- + + def add_production(self, prodname, syms, func=None, file='', line=0): + + if prodname in self.Terminals: + raise GrammarError('%s:%d: Illegal rule name %r. Already defined as a token' % (file, line, prodname)) + if prodname == 'error': + raise GrammarError('%s:%d: Illegal rule name %r. error is a reserved word' % (file, line, prodname)) + if not _is_identifier.match(prodname): + raise GrammarError('%s:%d: Illegal rule name %r' % (file, line, prodname)) + + # Look for literal tokens + for n, s in enumerate(syms): + if s[0] in "'\"": + try: + c = eval(s) + if (len(c) > 1): + raise GrammarError('%s:%d: Literal token %s in rule %r may only be a single character' % + (file, line, s, prodname)) + if c not in self.Terminals: + self.Terminals[c] = [] + syms[n] = c + continue + except SyntaxError: + pass + if not _is_identifier.match(s) and s != '%prec': + raise GrammarError('%s:%d: Illegal name %r in rule %r' % (file, line, s, prodname)) + + # Determine the precedence level + if '%prec' in syms: + if syms[-1] == '%prec': + raise GrammarError('%s:%d: Syntax error. Nothing follows %%prec' % (file, line)) + if syms[-2] != '%prec': + raise GrammarError('%s:%d: Syntax error. %%prec can only appear at the end of a grammar rule' % + (file, line)) + precname = syms[-1] + prodprec = self.Precedence.get(precname) + if not prodprec: + raise GrammarError('%s:%d: Nothing known about the precedence of %r' % (file, line, precname)) + else: + self.UsedPrecedence.add(precname) + del syms[-2:] # Drop %prec from the rule + else: + # If no %prec, precedence is determined by the rightmost terminal symbol + precname = rightmost_terminal(syms, self.Terminals) + prodprec = self.Precedence.get(precname, ('right', 0)) + + # See if the rule is already in the rulemap + map = '%s -> %s' % (prodname, syms) + if map in self.Prodmap: + m = self.Prodmap[map] + raise GrammarError('%s:%d: Duplicate rule %s. ' % (file, line, m) + + 'Previous definition at %s:%d' % (m.file, m.line)) + + # From this point on, everything is valid. Create a new Production instance + pnumber = len(self.Productions) + if prodname not in self.Nonterminals: + self.Nonterminals[prodname] = [] + + # Add the production number to Terminals and Nonterminals + for t in syms: + if t in self.Terminals: + self.Terminals[t].append(pnumber) + else: + if t not in self.Nonterminals: + self.Nonterminals[t] = [] + self.Nonterminals[t].append(pnumber) + + # Create a production and add it to the list of productions + p = Production(pnumber, prodname, syms, prodprec, func, file, line) + self.Productions.append(p) + self.Prodmap[map] = p + + # Add to the global productions list + try: + self.Prodnames[prodname].append(p) + except KeyError: + self.Prodnames[prodname] = [p] + + # ----------------------------------------------------------------------------- + # set_start() + # + # Sets the starting symbol and creates the augmented grammar. Production + # rule 0 is S' -> start where start is the start symbol. + # ----------------------------------------------------------------------------- + + def set_start(self, start=None): + if not start: + start = self.Productions[1].name + if start not in self.Nonterminals: + raise GrammarError('start symbol %s undefined' % start) + self.Productions[0] = Production(0, "S'", [start]) + self.Nonterminals[start].append(0) + self.Start = start + + # ----------------------------------------------------------------------------- + # find_unreachable() + # + # Find all of the nonterminal symbols that can't be reached from the starting + # symbol. Returns a list of nonterminals that can't be reached. + # ----------------------------------------------------------------------------- + + def find_unreachable(self): + + # Mark all symbols that are reachable from a symbol s + def mark_reachable_from(s): + if s in reachable: + return + reachable.add(s) + for p in self.Prodnames.get(s, []): + for r in p.prod: + mark_reachable_from(r) + + reachable = set() + mark_reachable_from(self.Productions[0].prod[0]) + return [s for s in self.Nonterminals if s not in reachable] + + # ----------------------------------------------------------------------------- + # infinite_cycles() + # + # This function looks at the various parsing rules and tries to detect + # infinite recursion cycles (grammar rules where there is no possible way + # to derive a string of only terminals). + # ----------------------------------------------------------------------------- + + def infinite_cycles(self): + terminates = {} + + # Terminals: + for t in self.Terminals: + terminates[t] = True + + terminates['$end'] = True + + # Nonterminals: + + # Initialize to false: + for n in self.Nonterminals: + terminates[n] = False + + # Then propagate termination until no change: + while True: + some_change = False + for (n, pl) in self.Prodnames.items(): + # Nonterminal n terminates iff any of its productions terminates. + for p in pl: + # Production p terminates iff all of its rhs symbols terminate. + for s in p.prod: + if not terminates[s]: + # The symbol s does not terminate, + # so production p does not terminate. + p_terminates = False + break + else: + # didn't break from the loop, + # so every symbol s terminates + # so production p terminates. + p_terminates = True + + if p_terminates: + # symbol n terminates! + if not terminates[n]: + terminates[n] = True + some_change = True + # Don't need to consider any more productions for this n. + break + + if not some_change: + break + + infinite = [] + for (s, term) in terminates.items(): + if not term: + if s not in self.Prodnames and s not in self.Terminals and s != 'error': + # s is used-but-not-defined, and we've already warned of that, + # so it would be overkill to say that it's also non-terminating. + pass + else: + infinite.append(s) + + return infinite + + # ----------------------------------------------------------------------------- + # undefined_symbols() + # + # Find all symbols that were used the grammar, but not defined as tokens or + # grammar rules. Returns a list of tuples (sym, prod) where sym in the symbol + # and prod is the production where the symbol was used. + # ----------------------------------------------------------------------------- + def undefined_symbols(self): + result = [] + for p in self.Productions: + if not p: + continue + + for s in p.prod: + if s not in self.Prodnames and s not in self.Terminals and s != 'error': + result.append((s, p)) + return result + + # ----------------------------------------------------------------------------- + # unused_terminals() + # + # Find all terminals that were defined, but not used by the grammar. Returns + # a list of all symbols. + # ----------------------------------------------------------------------------- + def unused_terminals(self): + unused_tok = [] + for s, v in self.Terminals.items(): + if s != 'error' and not v: + unused_tok.append(s) + + return unused_tok + + # ------------------------------------------------------------------------------ + # unused_rules() + # + # Find all grammar rules that were defined, but not used (maybe not reachable) + # Returns a list of productions. + # ------------------------------------------------------------------------------ + + def unused_rules(self): + unused_prod = [] + for s, v in self.Nonterminals.items(): + if not v: + p = self.Prodnames[s][0] + unused_prod.append(p) + return unused_prod + + # ----------------------------------------------------------------------------- + # unused_precedence() + # + # Returns a list of tuples (term,precedence) corresponding to precedence + # rules that were never used by the grammar. term is the name of the terminal + # on which precedence was applied and precedence is a string such as 'left' or + # 'right' corresponding to the type of precedence. + # ----------------------------------------------------------------------------- + + def unused_precedence(self): + unused = [] + for termname in self.Precedence: + if not (termname in self.Terminals or termname in self.UsedPrecedence): + unused.append((termname, self.Precedence[termname][0])) + + return unused + + # ------------------------------------------------------------------------- + # _first() + # + # Compute the value of FIRST1(beta) where beta is a tuple of symbols. + # + # During execution of compute_first1, the result may be incomplete. + # Afterward (e.g., when called from compute_follow()), it will be complete. + # ------------------------------------------------------------------------- + def _first(self, beta): + + # We are computing First(x1,x2,x3,...,xn) + result = [] + for x in beta: + x_produces_empty = False + + # Add all the non- symbols of First[x] to the result. + for f in self.First[x]: + if f == '': + x_produces_empty = True + else: + if f not in result: + result.append(f) + + if x_produces_empty: + # We have to consider the next x in beta, + # i.e. stay in the loop. + pass + else: + # We don't have to consider any further symbols in beta. + break + else: + # There was no 'break' from the loop, + # so x_produces_empty was true for all x in beta, + # so beta produces empty as well. + result.append('') + + return result + + # ------------------------------------------------------------------------- + # compute_first() + # + # Compute the value of FIRST1(X) for all symbols + # ------------------------------------------------------------------------- + def compute_first(self): + if self.First: + return self.First + + # Terminals: + for t in self.Terminals: + self.First[t] = [t] + + self.First['$end'] = ['$end'] + + # Nonterminals: + + # Initialize to the empty set: + for n in self.Nonterminals: + self.First[n] = [] + + # Then propagate symbols until no change: + while True: + some_change = False + for n in self.Nonterminals: + for p in self.Prodnames[n]: + for f in self._first(p.prod): + if f not in self.First[n]: + self.First[n].append(f) + some_change = True + if not some_change: + break + + return self.First + + # --------------------------------------------------------------------- + # compute_follow() + # + # Computes all of the follow sets for every non-terminal symbol. The + # follow set is the set of all symbols that might follow a given + # non-terminal. See the Dragon book, 2nd Ed. p. 189. + # --------------------------------------------------------------------- + def compute_follow(self, start=None): + # If already computed, return the result + if self.Follow: + return self.Follow + + # If first sets not computed yet, do that first. + if not self.First: + self.compute_first() + + # Add '$end' to the follow list of the start symbol + for k in self.Nonterminals: + self.Follow[k] = [] + + if not start: + start = self.Productions[1].name + + self.Follow[start] = ['$end'] + + while True: + didadd = False + for p in self.Productions[1:]: + # Here is the production set + for i, B in enumerate(p.prod): + if B in self.Nonterminals: + # Okay. We got a non-terminal in a production + fst = self._first(p.prod[i+1:]) + hasempty = False + for f in fst: + if f != '' and f not in self.Follow[B]: + self.Follow[B].append(f) + didadd = True + if f == '': + hasempty = True + if hasempty or i == (len(p.prod)-1): + # Add elements of follow(a) to follow(b) + for f in self.Follow[p.name]: + if f not in self.Follow[B]: + self.Follow[B].append(f) + didadd = True + if not didadd: + break + return self.Follow + + + # ----------------------------------------------------------------------------- + # build_lritems() + # + # This function walks the list of productions and builds a complete set of the + # LR items. The LR items are stored in two ways: First, they are uniquely + # numbered and placed in the list _lritems. Second, a linked list of LR items + # is built for each production. For example: + # + # E -> E PLUS E + # + # Creates the list + # + # [E -> . E PLUS E, E -> E . PLUS E, E -> E PLUS . E, E -> E PLUS E . ] + # ----------------------------------------------------------------------------- + + def build_lritems(self): + for p in self.Productions: + lastlri = p + i = 0 + lr_items = [] + while True: + if i > len(p): + lri = None + else: + lri = LRItem(p, i) + # Precompute the list of productions immediately following + try: + lri.lr_after = self.Prodnames[lri.prod[i+1]] + except (IndexError, KeyError): + lri.lr_after = [] + try: + lri.lr_before = lri.prod[i-1] + except IndexError: + lri.lr_before = None + + lastlri.lr_next = lri + if not lri: + break + lr_items.append(lri) + lastlri = lri + i += 1 + p.lr_items = lr_items + +# ----------------------------------------------------------------------------- +# == Class LRTable == +# +# This basic class represents a basic table of LR parsing information. +# Methods for generating the tables are not defined here. They are defined +# in the derived class LRGeneratedTable. +# ----------------------------------------------------------------------------- + +class VersionError(YaccError): + pass + +class LRTable(object): + def __init__(self): + self.lr_action = None + self.lr_goto = None + self.lr_productions = None + self.lr_method = None + + def read_table(self, module): + if isinstance(module, types.ModuleType): + parsetab = module + else: + exec('import %s' % module) + parsetab = sys.modules[module] + + if parsetab._tabversion != __tabversion__: + raise VersionError('yacc table file version is out of date') + + self.lr_action = parsetab._lr_action + self.lr_goto = parsetab._lr_goto + + self.lr_productions = [] + for p in parsetab._lr_productions: + self.lr_productions.append(MiniProduction(*p)) + + self.lr_method = parsetab._lr_method + return parsetab._lr_signature + + def read_pickle(self, filename): + try: + import cPickle as pickle + except ImportError: + import pickle + + if not os.path.exists(filename): + raise ImportError + + in_f = open(filename, 'rb') + + tabversion = pickle.load(in_f) + if tabversion != __tabversion__: + raise VersionError('yacc table file version is out of date') + self.lr_method = pickle.load(in_f) + signature = pickle.load(in_f) + self.lr_action = pickle.load(in_f) + self.lr_goto = pickle.load(in_f) + productions = pickle.load(in_f) + + self.lr_productions = [] + for p in productions: + self.lr_productions.append(MiniProduction(*p)) + + in_f.close() + return signature + + # Bind all production function names to callable objects in pdict + def bind_callables(self, pdict): + for p in self.lr_productions: + p.bind(pdict) + + +# ----------------------------------------------------------------------------- +# === LR Generator === +# +# The following classes and functions are used to generate LR parsing tables on +# a grammar. +# ----------------------------------------------------------------------------- + +# ----------------------------------------------------------------------------- +# digraph() +# traverse() +# +# The following two functions are used to compute set valued functions +# of the form: +# +# F(x) = F'(x) U U{F(y) | x R y} +# +# This is used to compute the values of Read() sets as well as FOLLOW sets +# in LALR(1) generation. +# +# Inputs: X - An input set +# R - A relation +# FP - Set-valued function +# ------------------------------------------------------------------------------ + +def digraph(X, R, FP): + N = {} + for x in X: + N[x] = 0 + stack = [] + F = {} + for x in X: + if N[x] == 0: + traverse(x, N, stack, F, X, R, FP) + return F + +def traverse(x, N, stack, F, X, R, FP): + stack.append(x) + d = len(stack) + N[x] = d + F[x] = FP(x) # F(X) <- F'(x) + + rel = R(x) # Get y's related to x + for y in rel: + if N[y] == 0: + traverse(y, N, stack, F, X, R, FP) + N[x] = min(N[x], N[y]) + for a in F.get(y, []): + if a not in F[x]: + F[x].append(a) + if N[x] == d: + N[stack[-1]] = MAXINT + F[stack[-1]] = F[x] + element = stack.pop() + while element != x: + N[stack[-1]] = MAXINT + F[stack[-1]] = F[x] + element = stack.pop() + +class LALRError(YaccError): + pass + +# ----------------------------------------------------------------------------- +# == LRGeneratedTable == +# +# This class implements the LR table generation algorithm. There are no +# public methods except for write() +# ----------------------------------------------------------------------------- + +class LRGeneratedTable(LRTable): + def __init__(self, grammar, method='LALR', log=None): + if method not in ['SLR', 'LALR']: + raise LALRError('Unsupported method %s' % method) + + self.grammar = grammar + self.lr_method = method + + # Set up the logger + if not log: + log = NullLogger() + self.log = log + + # Internal attributes + self.lr_action = {} # Action table + self.lr_goto = {} # Goto table + self.lr_productions = grammar.Productions # Copy of grammar Production array + self.lr_goto_cache = {} # Cache of computed gotos + self.lr0_cidhash = {} # Cache of closures + + self._add_count = 0 # Internal counter used to detect cycles + + # Diagonistic information filled in by the table generator + self.sr_conflict = 0 + self.rr_conflict = 0 + self.conflicts = [] # List of conflicts + + self.sr_conflicts = [] + self.rr_conflicts = [] + + # Build the tables + self.grammar.build_lritems() + self.grammar.compute_first() + self.grammar.compute_follow() + self.lr_parse_table() + + # Compute the LR(0) closure operation on I, where I is a set of LR(0) items. + + def lr0_closure(self, I): + self._add_count += 1 + + # Add everything in I to J + J = I[:] + didadd = True + while didadd: + didadd = False + for j in J: + for x in j.lr_after: + if getattr(x, 'lr0_added', 0) == self._add_count: + continue + # Add B --> .G to J + J.append(x.lr_next) + x.lr0_added = self._add_count + didadd = True + + return J + + # Compute the LR(0) goto function goto(I,X) where I is a set + # of LR(0) items and X is a grammar symbol. This function is written + # in a way that guarantees uniqueness of the generated goto sets + # (i.e. the same goto set will never be returned as two different Python + # objects). With uniqueness, we can later do fast set comparisons using + # id(obj) instead of element-wise comparison. + + def lr0_goto(self, I, x): + # First we look for a previously cached entry + g = self.lr_goto_cache.get((id(I), x)) + if g: + return g + + # Now we generate the goto set in a way that guarantees uniqueness + # of the result + + s = self.lr_goto_cache.get(x) + if not s: + s = {} + self.lr_goto_cache[x] = s + + gs = [] + for p in I: + n = p.lr_next + if n and n.lr_before == x: + s1 = s.get(id(n)) + if not s1: + s1 = {} + s[id(n)] = s1 + gs.append(n) + s = s1 + g = s.get('$end') + if not g: + if gs: + g = self.lr0_closure(gs) + s['$end'] = g + else: + s['$end'] = gs + self.lr_goto_cache[(id(I), x)] = g + return g + + # Compute the LR(0) sets of item function + def lr0_items(self): + C = [self.lr0_closure([self.grammar.Productions[0].lr_next])] + i = 0 + for I in C: + self.lr0_cidhash[id(I)] = i + i += 1 + + # Loop over the items in C and each grammar symbols + i = 0 + while i < len(C): + I = C[i] + i += 1 + + # Collect all of the symbols that could possibly be in the goto(I,X) sets + asyms = {} + for ii in I: + for s in ii.usyms: + asyms[s] = None + + for x in asyms: + g = self.lr0_goto(I, x) + if not g or id(g) in self.lr0_cidhash: + continue + self.lr0_cidhash[id(g)] = len(C) + C.append(g) + + return C + + # ----------------------------------------------------------------------------- + # ==== LALR(1) Parsing ==== + # + # LALR(1) parsing is almost exactly the same as SLR except that instead of + # relying upon Follow() sets when performing reductions, a more selective + # lookahead set that incorporates the state of the LR(0) machine is utilized. + # Thus, we mainly just have to focus on calculating the lookahead sets. + # + # The method used here is due to DeRemer and Pennelo (1982). + # + # DeRemer, F. L., and T. J. Pennelo: "Efficient Computation of LALR(1) + # Lookahead Sets", ACM Transactions on Programming Languages and Systems, + # Vol. 4, No. 4, Oct. 1982, pp. 615-649 + # + # Further details can also be found in: + # + # J. Tremblay and P. Sorenson, "The Theory and Practice of Compiler Writing", + # McGraw-Hill Book Company, (1985). + # + # ----------------------------------------------------------------------------- + + # ----------------------------------------------------------------------------- + # compute_nullable_nonterminals() + # + # Creates a dictionary containing all of the non-terminals that might produce + # an empty production. + # ----------------------------------------------------------------------------- + + def compute_nullable_nonterminals(self): + nullable = set() + num_nullable = 0 + while True: + for p in self.grammar.Productions[1:]: + if p.len == 0: + nullable.add(p.name) + continue + for t in p.prod: + if t not in nullable: + break + else: + nullable.add(p.name) + if len(nullable) == num_nullable: + break + num_nullable = len(nullable) + return nullable + + # ----------------------------------------------------------------------------- + # find_nonterminal_trans(C) + # + # Given a set of LR(0) items, this functions finds all of the non-terminal + # transitions. These are transitions in which a dot appears immediately before + # a non-terminal. Returns a list of tuples of the form (state,N) where state + # is the state number and N is the nonterminal symbol. + # + # The input C is the set of LR(0) items. + # ----------------------------------------------------------------------------- + + def find_nonterminal_transitions(self, C): + trans = [] + for stateno, state in enumerate(C): + for p in state: + if p.lr_index < p.len - 1: + t = (stateno, p.prod[p.lr_index+1]) + if t[1] in self.grammar.Nonterminals: + if t not in trans: + trans.append(t) + return trans + + # ----------------------------------------------------------------------------- + # dr_relation() + # + # Computes the DR(p,A) relationships for non-terminal transitions. The input + # is a tuple (state,N) where state is a number and N is a nonterminal symbol. + # + # Returns a list of terminals. + # ----------------------------------------------------------------------------- + + def dr_relation(self, C, trans, nullable): + dr_set = {} + state, N = trans + terms = [] + + g = self.lr0_goto(C[state], N) + for p in g: + if p.lr_index < p.len - 1: + a = p.prod[p.lr_index+1] + if a in self.grammar.Terminals: + if a not in terms: + terms.append(a) + + # This extra bit is to handle the start state + if state == 0 and N == self.grammar.Productions[0].prod[0]: + terms.append('$end') + + return terms + + # ----------------------------------------------------------------------------- + # reads_relation() + # + # Computes the READS() relation (p,A) READS (t,C). + # ----------------------------------------------------------------------------- + + def reads_relation(self, C, trans, empty): + # Look for empty transitions + rel = [] + state, N = trans + + g = self.lr0_goto(C[state], N) + j = self.lr0_cidhash.get(id(g), -1) + for p in g: + if p.lr_index < p.len - 1: + a = p.prod[p.lr_index + 1] + if a in empty: + rel.append((j, a)) + + return rel + + # ----------------------------------------------------------------------------- + # compute_lookback_includes() + # + # Determines the lookback and includes relations + # + # LOOKBACK: + # + # This relation is determined by running the LR(0) state machine forward. + # For example, starting with a production "N : . A B C", we run it forward + # to obtain "N : A B C ." We then build a relationship between this final + # state and the starting state. These relationships are stored in a dictionary + # lookdict. + # + # INCLUDES: + # + # Computes the INCLUDE() relation (p,A) INCLUDES (p',B). + # + # This relation is used to determine non-terminal transitions that occur + # inside of other non-terminal transition states. (p,A) INCLUDES (p', B) + # if the following holds: + # + # B -> LAT, where T -> epsilon and p' -L-> p + # + # L is essentially a prefix (which may be empty), T is a suffix that must be + # able to derive an empty string. State p' must lead to state p with the string L. + # + # ----------------------------------------------------------------------------- + + def compute_lookback_includes(self, C, trans, nullable): + lookdict = {} # Dictionary of lookback relations + includedict = {} # Dictionary of include relations + + # Make a dictionary of non-terminal transitions + dtrans = {} + for t in trans: + dtrans[t] = 1 + + # Loop over all transitions and compute lookbacks and includes + for state, N in trans: + lookb = [] + includes = [] + for p in C[state]: + if p.name != N: + continue + + # Okay, we have a name match. We now follow the production all the way + # through the state machine until we get the . on the right hand side + + lr_index = p.lr_index + j = state + while lr_index < p.len - 1: + lr_index = lr_index + 1 + t = p.prod[lr_index] + + # Check to see if this symbol and state are a non-terminal transition + if (j, t) in dtrans: + # Yes. Okay, there is some chance that this is an includes relation + # the only way to know for certain is whether the rest of the + # production derives empty + + li = lr_index + 1 + while li < p.len: + if p.prod[li] in self.grammar.Terminals: + break # No forget it + if p.prod[li] not in nullable: + break + li = li + 1 + else: + # Appears to be a relation between (j,t) and (state,N) + includes.append((j, t)) + + g = self.lr0_goto(C[j], t) # Go to next set + j = self.lr0_cidhash.get(id(g), -1) # Go to next state + + # When we get here, j is the final state, now we have to locate the production + for r in C[j]: + if r.name != p.name: + continue + if r.len != p.len: + continue + i = 0 + # This look is comparing a production ". A B C" with "A B C ." + while i < r.lr_index: + if r.prod[i] != p.prod[i+1]: + break + i = i + 1 + else: + lookb.append((j, r)) + for i in includes: + if i not in includedict: + includedict[i] = [] + includedict[i].append((state, N)) + lookdict[(state, N)] = lookb + + return lookdict, includedict + + # ----------------------------------------------------------------------------- + # compute_read_sets() + # + # Given a set of LR(0) items, this function computes the read sets. + # + # Inputs: C = Set of LR(0) items + # ntrans = Set of nonterminal transitions + # nullable = Set of empty transitions + # + # Returns a set containing the read sets + # ----------------------------------------------------------------------------- + + def compute_read_sets(self, C, ntrans, nullable): + FP = lambda x: self.dr_relation(C, x, nullable) + R = lambda x: self.reads_relation(C, x, nullable) + F = digraph(ntrans, R, FP) + return F + + # ----------------------------------------------------------------------------- + # compute_follow_sets() + # + # Given a set of LR(0) items, a set of non-terminal transitions, a readset, + # and an include set, this function computes the follow sets + # + # Follow(p,A) = Read(p,A) U U {Follow(p',B) | (p,A) INCLUDES (p',B)} + # + # Inputs: + # ntrans = Set of nonterminal transitions + # readsets = Readset (previously computed) + # inclsets = Include sets (previously computed) + # + # Returns a set containing the follow sets + # ----------------------------------------------------------------------------- + + def compute_follow_sets(self, ntrans, readsets, inclsets): + FP = lambda x: readsets[x] + R = lambda x: inclsets.get(x, []) + F = digraph(ntrans, R, FP) + return F + + # ----------------------------------------------------------------------------- + # add_lookaheads() + # + # Attaches the lookahead symbols to grammar rules. + # + # Inputs: lookbacks - Set of lookback relations + # followset - Computed follow set + # + # This function directly attaches the lookaheads to productions contained + # in the lookbacks set + # ----------------------------------------------------------------------------- + + def add_lookaheads(self, lookbacks, followset): + for trans, lb in lookbacks.items(): + # Loop over productions in lookback + for state, p in lb: + if state not in p.lookaheads: + p.lookaheads[state] = [] + f = followset.get(trans, []) + for a in f: + if a not in p.lookaheads[state]: + p.lookaheads[state].append(a) + + # ----------------------------------------------------------------------------- + # add_lalr_lookaheads() + # + # This function does all of the work of adding lookahead information for use + # with LALR parsing + # ----------------------------------------------------------------------------- + + def add_lalr_lookaheads(self, C): + # Determine all of the nullable nonterminals + nullable = self.compute_nullable_nonterminals() + + # Find all non-terminal transitions + trans = self.find_nonterminal_transitions(C) + + # Compute read sets + readsets = self.compute_read_sets(C, trans, nullable) + + # Compute lookback/includes relations + lookd, included = self.compute_lookback_includes(C, trans, nullable) + + # Compute LALR FOLLOW sets + followsets = self.compute_follow_sets(trans, readsets, included) + + # Add all of the lookaheads + self.add_lookaheads(lookd, followsets) + + # ----------------------------------------------------------------------------- + # lr_parse_table() + # + # This function constructs the parse tables for SLR or LALR + # ----------------------------------------------------------------------------- + def lr_parse_table(self): + Productions = self.grammar.Productions + Precedence = self.grammar.Precedence + goto = self.lr_goto # Goto array + action = self.lr_action # Action array + log = self.log # Logger for output + + actionp = {} # Action production array (temporary) + + log.info('Parsing method: %s', self.lr_method) + + # Step 1: Construct C = { I0, I1, ... IN}, collection of LR(0) items + # This determines the number of states + + C = self.lr0_items() + + if self.lr_method == 'LALR': + self.add_lalr_lookaheads(C) + + # Build the parser table, state by state + st = 0 + for I in C: + # Loop over each production in I + actlist = [] # List of actions + st_action = {} + st_actionp = {} + st_goto = {} + log.info('') + log.info('state %d', st) + log.info('') + for p in I: + log.info(' (%d) %s', p.number, p) + log.info('') + + for p in I: + if p.len == p.lr_index + 1: + if p.name == "S'": + # Start symbol. Accept! + st_action['$end'] = 0 + st_actionp['$end'] = p + else: + # We are at the end of a production. Reduce! + if self.lr_method == 'LALR': + laheads = p.lookaheads[st] + else: + laheads = self.grammar.Follow[p.name] + for a in laheads: + actlist.append((a, p, 'reduce using rule %d (%s)' % (p.number, p))) + r = st_action.get(a) + if r is not None: + # Whoa. Have a shift/reduce or reduce/reduce conflict + if r > 0: + # Need to decide on shift or reduce here + # By default we favor shifting. Need to add + # some precedence rules here. + + # Shift precedence comes from the token + sprec, slevel = Precedence.get(a, ('right', 0)) + + # Reduce precedence comes from rule being reduced (p) + rprec, rlevel = Productions[p.number].prec + + if (slevel < rlevel) or ((slevel == rlevel) and (rprec == 'left')): + # We really need to reduce here. + st_action[a] = -p.number + st_actionp[a] = p + if not slevel and not rlevel: + log.info(' ! shift/reduce conflict for %s resolved as reduce', a) + self.sr_conflicts.append((st, a, 'reduce')) + Productions[p.number].reduced += 1 + elif (slevel == rlevel) and (rprec == 'nonassoc'): + st_action[a] = None + else: + # Hmmm. Guess we'll keep the shift + if not rlevel: + log.info(' ! shift/reduce conflict for %s resolved as shift', a) + self.sr_conflicts.append((st, a, 'shift')) + elif r < 0: + # Reduce/reduce conflict. In this case, we favor the rule + # that was defined first in the grammar file + oldp = Productions[-r] + pp = Productions[p.number] + if oldp.line > pp.line: + st_action[a] = -p.number + st_actionp[a] = p + chosenp, rejectp = pp, oldp + Productions[p.number].reduced += 1 + Productions[oldp.number].reduced -= 1 + else: + chosenp, rejectp = oldp, pp + self.rr_conflicts.append((st, chosenp, rejectp)) + log.info(' ! reduce/reduce conflict for %s resolved using rule %d (%s)', + a, st_actionp[a].number, st_actionp[a]) + else: + raise LALRError('Unknown conflict in state %d' % st) + else: + st_action[a] = -p.number + st_actionp[a] = p + Productions[p.number].reduced += 1 + else: + i = p.lr_index + a = p.prod[i+1] # Get symbol right after the "." + if a in self.grammar.Terminals: + g = self.lr0_goto(I, a) + j = self.lr0_cidhash.get(id(g), -1) + if j >= 0: + # We are in a shift state + actlist.append((a, p, 'shift and go to state %d' % j)) + r = st_action.get(a) + if r is not None: + # Whoa have a shift/reduce or shift/shift conflict + if r > 0: + if r != j: + raise LALRError('Shift/shift conflict in state %d' % st) + elif r < 0: + # Do a precedence check. + # - if precedence of reduce rule is higher, we reduce. + # - if precedence of reduce is same and left assoc, we reduce. + # - otherwise we shift + + # Shift precedence comes from the token + sprec, slevel = Precedence.get(a, ('right', 0)) + + # Reduce precedence comes from the rule that could have been reduced + rprec, rlevel = Productions[st_actionp[a].number].prec + + if (slevel > rlevel) or ((slevel == rlevel) and (rprec == 'right')): + # We decide to shift here... highest precedence to shift + Productions[st_actionp[a].number].reduced -= 1 + st_action[a] = j + st_actionp[a] = p + if not rlevel: + log.info(' ! shift/reduce conflict for %s resolved as shift', a) + self.sr_conflicts.append((st, a, 'shift')) + elif (slevel == rlevel) and (rprec == 'nonassoc'): + st_action[a] = None + else: + # Hmmm. Guess we'll keep the reduce + if not slevel and not rlevel: + log.info(' ! shift/reduce conflict for %s resolved as reduce', a) + self.sr_conflicts.append((st, a, 'reduce')) + + else: + raise LALRError('Unknown conflict in state %d' % st) + else: + st_action[a] = j + st_actionp[a] = p + + # Print the actions associated with each terminal + _actprint = {} + for a, p, m in actlist: + if a in st_action: + if p is st_actionp[a]: + log.info(' %-15s %s', a, m) + _actprint[(a, m)] = 1 + log.info('') + # Print the actions that were not used. (debugging) + not_used = 0 + for a, p, m in actlist: + if a in st_action: + if p is not st_actionp[a]: + if not (a, m) in _actprint: + log.debug(' ! %-15s [ %s ]', a, m) + not_used = 1 + _actprint[(a, m)] = 1 + if not_used: + log.debug('') + + # Construct the goto table for this state + + nkeys = {} + for ii in I: + for s in ii.usyms: + if s in self.grammar.Nonterminals: + nkeys[s] = None + for n in nkeys: + g = self.lr0_goto(I, n) + j = self.lr0_cidhash.get(id(g), -1) + if j >= 0: + st_goto[n] = j + log.info(' %-30s shift and go to state %d', n, j) + + action[st] = st_action + actionp[st] = st_actionp + goto[st] = st_goto + st += 1 + + # ----------------------------------------------------------------------------- + # write() + # + # This function writes the LR parsing tables to a file + # ----------------------------------------------------------------------------- + + def write_table(self, tabmodule, outputdir='', signature=''): + if isinstance(tabmodule, types.ModuleType): + raise IOError("Won't overwrite existing tabmodule") + + basemodulename = tabmodule.split('.')[-1] + filename = os.path.join(outputdir, basemodulename) + '.py' + try: + f = open(filename, 'w') + + f.write(''' +# %s +# This file is automatically generated. Do not edit. +_tabversion = %r + +_lr_method = %r + +_lr_signature = %r + ''' % (os.path.basename(filename), __tabversion__, self.lr_method, signature)) + + # Change smaller to 0 to go back to original tables + smaller = 1 + + # Factor out names to try and make smaller + if smaller: + items = {} + + for s, nd in self.lr_action.items(): + for name, v in nd.items(): + i = items.get(name) + if not i: + i = ([], []) + items[name] = i + i[0].append(s) + i[1].append(v) + + f.write('\n_lr_action_items = {') + for k, v in items.items(): + f.write('%r:([' % k) + for i in v[0]: + f.write('%r,' % i) + f.write('],[') + for i in v[1]: + f.write('%r,' % i) + + f.write(']),') + f.write('}\n') + + f.write(''' +_lr_action = {} +for _k, _v in _lr_action_items.items(): + for _x,_y in zip(_v[0],_v[1]): + if not _x in _lr_action: _lr_action[_x] = {} + _lr_action[_x][_k] = _y +del _lr_action_items +''') + + else: + f.write('\n_lr_action = { ') + for k, v in self.lr_action.items(): + f.write('(%r,%r):%r,' % (k[0], k[1], v)) + f.write('}\n') + + if smaller: + # Factor out names to try and make smaller + items = {} + + for s, nd in self.lr_goto.items(): + for name, v in nd.items(): + i = items.get(name) + if not i: + i = ([], []) + items[name] = i + i[0].append(s) + i[1].append(v) + + f.write('\n_lr_goto_items = {') + for k, v in items.items(): + f.write('%r:([' % k) + for i in v[0]: + f.write('%r,' % i) + f.write('],[') + for i in v[1]: + f.write('%r,' % i) + + f.write(']),') + f.write('}\n') + + f.write(''' +_lr_goto = {} +for _k, _v in _lr_goto_items.items(): + for _x, _y in zip(_v[0], _v[1]): + if not _x in _lr_goto: _lr_goto[_x] = {} + _lr_goto[_x][_k] = _y +del _lr_goto_items +''') + else: + f.write('\n_lr_goto = { ') + for k, v in self.lr_goto.items(): + f.write('(%r,%r):%r,' % (k[0], k[1], v)) + f.write('}\n') + + # Write production table + f.write('_lr_productions = [\n') + for p in self.lr_productions: + if p.func: + f.write(' (%r,%r,%d,%r,%r,%d),\n' % (p.str, p.name, p.len, + p.func, os.path.basename(p.file), p.line)) + else: + f.write(' (%r,%r,%d,None,None,None),\n' % (str(p), p.name, p.len)) + f.write(']\n') + f.close() + + except IOError as e: + raise + + + # ----------------------------------------------------------------------------- + # pickle_table() + # + # This function pickles the LR parsing tables to a supplied file object + # ----------------------------------------------------------------------------- + + def pickle_table(self, filename, signature=''): + try: + import cPickle as pickle + except ImportError: + import pickle + with open(filename, 'wb') as outf: + pickle.dump(__tabversion__, outf, pickle_protocol) + pickle.dump(self.lr_method, outf, pickle_protocol) + pickle.dump(signature, outf, pickle_protocol) + pickle.dump(self.lr_action, outf, pickle_protocol) + pickle.dump(self.lr_goto, outf, pickle_protocol) + + outp = [] + for p in self.lr_productions: + if p.func: + outp.append((p.str, p.name, p.len, p.func, os.path.basename(p.file), p.line)) + else: + outp.append((str(p), p.name, p.len, None, None, None)) + pickle.dump(outp, outf, pickle_protocol) + +# ----------------------------------------------------------------------------- +# === INTROSPECTION === +# +# The following functions and classes are used to implement the PLY +# introspection features followed by the yacc() function itself. +# ----------------------------------------------------------------------------- + +# ----------------------------------------------------------------------------- +# get_caller_module_dict() +# +# This function returns a dictionary containing all of the symbols defined within +# a caller further down the call stack. This is used to get the environment +# associated with the yacc() call if none was provided. +# ----------------------------------------------------------------------------- + +def get_caller_module_dict(levels): + f = sys._getframe(levels) + ldict = f.f_globals.copy() + if f.f_globals != f.f_locals: + ldict.update(f.f_locals) + return ldict + +# ----------------------------------------------------------------------------- +# parse_grammar() +# +# This takes a raw grammar rule string and parses it into production data +# ----------------------------------------------------------------------------- +def parse_grammar(doc, file, line): + grammar = [] + # Split the doc string into lines + pstrings = doc.splitlines() + lastp = None + dline = line + for ps in pstrings: + dline += 1 + p = ps.split() + if not p: + continue + try: + if p[0] == '|': + # This is a continuation of a previous rule + if not lastp: + raise SyntaxError("%s:%d: Misplaced '|'" % (file, dline)) + prodname = lastp + syms = p[1:] + else: + prodname = p[0] + lastp = prodname + syms = p[2:] + assign = p[1] + if assign != ':' and assign != '::=': + raise SyntaxError("%s:%d: Syntax error. Expected ':'" % (file, dline)) + + grammar.append((file, dline, prodname, syms)) + except SyntaxError: + raise + except Exception: + raise SyntaxError('%s:%d: Syntax error in rule %r' % (file, dline, ps.strip())) + + return grammar + +# ----------------------------------------------------------------------------- +# ParserReflect() +# +# This class represents information extracted for building a parser including +# start symbol, error function, tokens, precedence list, action functions, +# etc. +# ----------------------------------------------------------------------------- +class ParserReflect(object): + def __init__(self, pdict, log=None): + self.pdict = pdict + self.start = None + self.error_func = None + self.tokens = None + self.modules = set() + self.grammar = [] + self.error = False + + if log is None: + self.log = PlyLogger(sys.stderr) + else: + self.log = log + + # Get all of the basic information + def get_all(self): + self.get_start() + self.get_error_func() + self.get_tokens() + self.get_precedence() + self.get_pfunctions() + + # Validate all of the information + def validate_all(self): + self.validate_start() + self.validate_error_func() + self.validate_tokens() + self.validate_precedence() + self.validate_pfunctions() + self.validate_modules() + return self.error + + # Compute a signature over the grammar + def signature(self): + parts = [] + try: + if self.start: + parts.append(self.start) + if self.prec: + parts.append(''.join([''.join(p) for p in self.prec])) + if self.tokens: + parts.append(' '.join(self.tokens)) + for f in self.pfuncs: + if f[3]: + parts.append(f[3]) + except (TypeError, ValueError): + pass + return ''.join(parts) + + # ----------------------------------------------------------------------------- + # validate_modules() + # + # This method checks to see if there are duplicated p_rulename() functions + # in the parser module file. Without this function, it is really easy for + # users to make mistakes by cutting and pasting code fragments (and it's a real + # bugger to try and figure out why the resulting parser doesn't work). Therefore, + # we just do a little regular expression pattern matching of def statements + # to try and detect duplicates. + # ----------------------------------------------------------------------------- + + def validate_modules(self): + # Match def p_funcname( + fre = re.compile(r'\s*def\s+(p_[a-zA-Z_0-9]*)\(') + + for module in self.modules: + try: + lines, linen = inspect.getsourcelines(module) + except IOError: + continue + + counthash = {} + for linen, line in enumerate(lines): + linen += 1 + m = fre.match(line) + if m: + name = m.group(1) + prev = counthash.get(name) + if not prev: + counthash[name] = linen + else: + filename = inspect.getsourcefile(module) + self.log.warning('%s:%d: Function %s redefined. Previously defined on line %d', + filename, linen, name, prev) + + # Get the start symbol + def get_start(self): + self.start = self.pdict.get('start') + + # Validate the start symbol + def validate_start(self): + if self.start is not None: + if not isinstance(self.start, string_types): + self.log.error("'start' must be a string") + + # Look for error handler + def get_error_func(self): + self.error_func = self.pdict.get('p_error') + + # Validate the error function + def validate_error_func(self): + if self.error_func: + if isinstance(self.error_func, types.FunctionType): + ismethod = 0 + elif isinstance(self.error_func, types.MethodType): + ismethod = 1 + else: + self.log.error("'p_error' defined, but is not a function or method") + self.error = True + return + + eline = self.error_func.__code__.co_firstlineno + efile = self.error_func.__code__.co_filename + module = inspect.getmodule(self.error_func) + self.modules.add(module) + + argcount = self.error_func.__code__.co_argcount - ismethod + if argcount != 1: + self.log.error('%s:%d: p_error() requires 1 argument', efile, eline) + self.error = True + + # Get the tokens map + def get_tokens(self): + tokens = self.pdict.get('tokens') + if not tokens: + self.log.error('No token list is defined') + self.error = True + return + + if not isinstance(tokens, (list, tuple)): + self.log.error('tokens must be a list or tuple') + self.error = True + return + + if not tokens: + self.log.error('tokens is empty') + self.error = True + return + + self.tokens = tokens + + # Validate the tokens + def validate_tokens(self): + # Validate the tokens. + if 'error' in self.tokens: + self.log.error("Illegal token name 'error'. Is a reserved word") + self.error = True + return + + terminals = set() + for n in self.tokens: + if n in terminals: + self.log.warning('Token %r multiply defined', n) + terminals.add(n) + + # Get the precedence map (if any) + def get_precedence(self): + self.prec = self.pdict.get('precedence') + + # Validate and parse the precedence map + def validate_precedence(self): + preclist = [] + if self.prec: + if not isinstance(self.prec, (list, tuple)): + self.log.error('precedence must be a list or tuple') + self.error = True + return + for level, p in enumerate(self.prec): + if not isinstance(p, (list, tuple)): + self.log.error('Bad precedence table') + self.error = True + return + + if len(p) < 2: + self.log.error('Malformed precedence entry %s. Must be (assoc, term, ..., term)', p) + self.error = True + return + assoc = p[0] + if not isinstance(assoc, string_types): + self.log.error('precedence associativity must be a string') + self.error = True + return + for term in p[1:]: + if not isinstance(term, string_types): + self.log.error('precedence items must be strings') + self.error = True + return + preclist.append((term, assoc, level+1)) + self.preclist = preclist + + # Get all p_functions from the grammar + def get_pfunctions(self): + p_functions = [] + for name, item in self.pdict.items(): + if not name.startswith('p_') or name == 'p_error': + continue + if isinstance(item, (types.FunctionType, types.MethodType)): + line = getattr(item, 'co_firstlineno', item.__code__.co_firstlineno) + module = inspect.getmodule(item) + p_functions.append((line, module, name, item.__doc__)) + + # Sort all of the actions by line number; make sure to stringify + # modules to make them sortable, since `line` may not uniquely sort all + # p functions + p_functions.sort(key=lambda p_function: ( + p_function[0], + str(p_function[1]), + p_function[2], + p_function[3])) + self.pfuncs = p_functions + + # Validate all of the p_functions + def validate_pfunctions(self): + grammar = [] + # Check for non-empty symbols + if len(self.pfuncs) == 0: + self.log.error('no rules of the form p_rulename are defined') + self.error = True + return + + for line, module, name, doc in self.pfuncs: + file = inspect.getsourcefile(module) + func = self.pdict[name] + if isinstance(func, types.MethodType): + reqargs = 2 + else: + reqargs = 1 + if func.__code__.co_argcount > reqargs: + self.log.error('%s:%d: Rule %r has too many arguments', file, line, func.__name__) + self.error = True + elif func.__code__.co_argcount < reqargs: + self.log.error('%s:%d: Rule %r requires an argument', file, line, func.__name__) + self.error = True + elif not func.__doc__: + self.log.warning('%s:%d: No documentation string specified in function %r (ignored)', + file, line, func.__name__) + else: + try: + parsed_g = parse_grammar(doc, file, line) + for g in parsed_g: + grammar.append((name, g)) + except SyntaxError as e: + self.log.error(str(e)) + self.error = True + + # Looks like a valid grammar rule + # Mark the file in which defined. + self.modules.add(module) + + # Secondary validation step that looks for p_ definitions that are not functions + # or functions that look like they might be grammar rules. + + for n, v in self.pdict.items(): + if n.startswith('p_') and isinstance(v, (types.FunctionType, types.MethodType)): + continue + if n.startswith('t_'): + continue + if n.startswith('p_') and n != 'p_error': + self.log.warning('%r not defined as a function', n) + if ((isinstance(v, types.FunctionType) and v.__code__.co_argcount == 1) or + (isinstance(v, types.MethodType) and v.__func__.__code__.co_argcount == 2)): + if v.__doc__: + try: + doc = v.__doc__.split(' ') + if doc[1] == ':': + self.log.warning('%s:%d: Possible grammar rule %r defined without p_ prefix', + v.__code__.co_filename, v.__code__.co_firstlineno, n) + except IndexError: + pass + + self.grammar = grammar + +# ----------------------------------------------------------------------------- +# yacc(module) +# +# Build a parser +# ----------------------------------------------------------------------------- + +def yacc(method='LALR', debug=yaccdebug, module=None, tabmodule=tab_module, start=None, + check_recursion=True, optimize=False, write_tables=True, debugfile=debug_file, + outputdir=None, debuglog=None, errorlog=None, picklefile=None): + + if tabmodule is None: + tabmodule = tab_module + + # Reference to the parsing method of the last built parser + global parse + + # If pickling is enabled, table files are not created + if picklefile: + write_tables = 0 + + if errorlog is None: + errorlog = PlyLogger(sys.stderr) + + # Get the module dictionary used for the parser + if module: + _items = [(k, getattr(module, k)) for k in dir(module)] + pdict = dict(_items) + # If no __file__ attribute is available, try to obtain it from the __module__ instead + if '__file__' not in pdict: + pdict['__file__'] = sys.modules[pdict['__module__']].__file__ + else: + pdict = get_caller_module_dict(2) + + if outputdir is None: + # If no output directory is set, the location of the output files + # is determined according to the following rules: + # - If tabmodule specifies a package, files go into that package directory + # - Otherwise, files go in the same directory as the specifying module + if isinstance(tabmodule, types.ModuleType): + srcfile = tabmodule.__file__ + else: + if '.' not in tabmodule: + srcfile = pdict['__file__'] + else: + parts = tabmodule.split('.') + pkgname = '.'.join(parts[:-1]) + exec('import %s' % pkgname) + srcfile = getattr(sys.modules[pkgname], '__file__', '') + outputdir = os.path.dirname(srcfile) + + # Determine if the module is package of a package or not. + # If so, fix the tabmodule setting so that tables load correctly + pkg = pdict.get('__package__') + if pkg and isinstance(tabmodule, str): + if '.' not in tabmodule: + tabmodule = pkg + '.' + tabmodule + + + + # Set start symbol if it's specified directly using an argument + if start is not None: + pdict['start'] = start + + # Collect parser information from the dictionary + pinfo = ParserReflect(pdict, log=errorlog) + pinfo.get_all() + + if pinfo.error: + raise YaccError('Unable to build parser') + + # Check signature against table files (if any) + signature = pinfo.signature() + + # Read the tables + try: + lr = LRTable() + if picklefile: + read_signature = lr.read_pickle(picklefile) + else: + read_signature = lr.read_table(tabmodule) + if optimize or (read_signature == signature): + try: + lr.bind_callables(pinfo.pdict) + parser = LRParser(lr, pinfo.error_func) + parse = parser.parse + return parser + except Exception as e: + errorlog.warning('There was a problem loading the table file: %r', e) + except VersionError as e: + errorlog.warning(str(e)) + except ImportError: + pass + + if debuglog is None: + if debug: + try: + debuglog = PlyLogger(open(os.path.join(outputdir, debugfile), 'w')) + except IOError as e: + errorlog.warning("Couldn't open %r. %s" % (debugfile, e)) + debuglog = NullLogger() + else: + debuglog = NullLogger() + + debuglog.info('Created by PLY version %s (http://www.dabeaz.com/ply)', __version__) + + errors = False + + # Validate the parser information + if pinfo.validate_all(): + raise YaccError('Unable to build parser') + + if not pinfo.error_func: + errorlog.warning('no p_error() function is defined') + + # Create a grammar object + grammar = Grammar(pinfo.tokens) + + # Set precedence level for terminals + for term, assoc, level in pinfo.preclist: + try: + grammar.set_precedence(term, assoc, level) + except GrammarError as e: + errorlog.warning('%s', e) + + # Add productions to the grammar + for funcname, gram in pinfo.grammar: + file, line, prodname, syms = gram + try: + grammar.add_production(prodname, syms, funcname, file, line) + except GrammarError as e: + errorlog.error('%s', e) + errors = True + + # Set the grammar start symbols + try: + if start is None: + grammar.set_start(pinfo.start) + else: + grammar.set_start(start) + except GrammarError as e: + errorlog.error(str(e)) + errors = True + + if errors: + raise YaccError('Unable to build parser') + + # Verify the grammar structure + undefined_symbols = grammar.undefined_symbols() + for sym, prod in undefined_symbols: + errorlog.error('%s:%d: Symbol %r used, but not defined as a token or a rule', prod.file, prod.line, sym) + errors = True + + unused_terminals = grammar.unused_terminals() + if unused_terminals: + debuglog.info('') + debuglog.info('Unused terminals:') + debuglog.info('') + for term in unused_terminals: + errorlog.warning('Token %r defined, but not used', term) + debuglog.info(' %s', term) + + # Print out all productions to the debug log + if debug: + debuglog.info('') + debuglog.info('Grammar') + debuglog.info('') + for n, p in enumerate(grammar.Productions): + debuglog.info('Rule %-5d %s', n, p) + + # Find unused non-terminals + unused_rules = grammar.unused_rules() + for prod in unused_rules: + errorlog.warning('%s:%d: Rule %r defined, but not used', prod.file, prod.line, prod.name) + + if len(unused_terminals) == 1: + errorlog.warning('There is 1 unused token') + if len(unused_terminals) > 1: + errorlog.warning('There are %d unused tokens', len(unused_terminals)) + + if len(unused_rules) == 1: + errorlog.warning('There is 1 unused rule') + if len(unused_rules) > 1: + errorlog.warning('There are %d unused rules', len(unused_rules)) + + if debug: + debuglog.info('') + debuglog.info('Terminals, with rules where they appear') + debuglog.info('') + terms = list(grammar.Terminals) + terms.sort() + for term in terms: + debuglog.info('%-20s : %s', term, ' '.join([str(s) for s in grammar.Terminals[term]])) + + debuglog.info('') + debuglog.info('Nonterminals, with rules where they appear') + debuglog.info('') + nonterms = list(grammar.Nonterminals) + nonterms.sort() + for nonterm in nonterms: + debuglog.info('%-20s : %s', nonterm, ' '.join([str(s) for s in grammar.Nonterminals[nonterm]])) + debuglog.info('') + + if check_recursion: + unreachable = grammar.find_unreachable() + for u in unreachable: + errorlog.warning('Symbol %r is unreachable', u) + + infinite = grammar.infinite_cycles() + for inf in infinite: + errorlog.error('Infinite recursion detected for symbol %r', inf) + errors = True + + unused_prec = grammar.unused_precedence() + for term, assoc in unused_prec: + errorlog.error('Precedence rule %r defined for unknown symbol %r', assoc, term) + errors = True + + if errors: + raise YaccError('Unable to build parser') + + # Run the LRGeneratedTable on the grammar + if debug: + errorlog.debug('Generating %s tables', method) + + lr = LRGeneratedTable(grammar, method, debuglog) + + if debug: + num_sr = len(lr.sr_conflicts) + + # Report shift/reduce and reduce/reduce conflicts + if num_sr == 1: + errorlog.warning('1 shift/reduce conflict') + elif num_sr > 1: + errorlog.warning('%d shift/reduce conflicts', num_sr) + + num_rr = len(lr.rr_conflicts) + if num_rr == 1: + errorlog.warning('1 reduce/reduce conflict') + elif num_rr > 1: + errorlog.warning('%d reduce/reduce conflicts', num_rr) + + # Write out conflicts to the output file + if debug and (lr.sr_conflicts or lr.rr_conflicts): + debuglog.warning('') + debuglog.warning('Conflicts:') + debuglog.warning('') + + for state, tok, resolution in lr.sr_conflicts: + debuglog.warning('shift/reduce conflict for %s in state %d resolved as %s', tok, state, resolution) + + already_reported = set() + for state, rule, rejected in lr.rr_conflicts: + if (state, id(rule), id(rejected)) in already_reported: + continue + debuglog.warning('reduce/reduce conflict in state %d resolved using rule (%s)', state, rule) + debuglog.warning('rejected rule (%s) in state %d', rejected, state) + errorlog.warning('reduce/reduce conflict in state %d resolved using rule (%s)', state, rule) + errorlog.warning('rejected rule (%s) in state %d', rejected, state) + already_reported.add((state, id(rule), id(rejected))) + + warned_never = [] + for state, rule, rejected in lr.rr_conflicts: + if not rejected.reduced and (rejected not in warned_never): + debuglog.warning('Rule (%s) is never reduced', rejected) + errorlog.warning('Rule (%s) is never reduced', rejected) + warned_never.append(rejected) + + # Write the table file if requested + if write_tables: + try: + lr.write_table(tabmodule, outputdir, signature) + except IOError as e: + errorlog.warning("Couldn't create %r. %s" % (tabmodule, e)) + + # Write a pickled version of the tables + if picklefile: + try: + lr.pickle_table(picklefile, signature) + except IOError as e: + errorlog.warning("Couldn't create %r. %s" % (picklefile, e)) + + # Build the parser + lr.bind_callables(pinfo.pdict) + parser = LRParser(lr, pinfo.error_func) + + parse = parser.parse + return parser diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pycparser/ply/ygen.py b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pycparser/ply/ygen.py new file mode 100644 index 0000000000000000000000000000000000000000..acf5ca1a37b69389256227c570c65eed96e3228e --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pycparser/ply/ygen.py @@ -0,0 +1,74 @@ +# ply: ygen.py +# +# This is a support program that auto-generates different versions of the YACC parsing +# function with different features removed for the purposes of performance. +# +# Users should edit the method LParser.parsedebug() in yacc.py. The source code +# for that method is then used to create the other methods. See the comments in +# yacc.py for further details. + +import os.path +import shutil + +def get_source_range(lines, tag): + srclines = enumerate(lines) + start_tag = '#--! %s-start' % tag + end_tag = '#--! %s-end' % tag + + for start_index, line in srclines: + if line.strip().startswith(start_tag): + break + + for end_index, line in srclines: + if line.strip().endswith(end_tag): + break + + return (start_index + 1, end_index) + +def filter_section(lines, tag): + filtered_lines = [] + include = True + tag_text = '#--! %s' % tag + for line in lines: + if line.strip().startswith(tag_text): + include = not include + elif include: + filtered_lines.append(line) + return filtered_lines + +def main(): + dirname = os.path.dirname(__file__) + shutil.copy2(os.path.join(dirname, 'yacc.py'), os.path.join(dirname, 'yacc.py.bak')) + with open(os.path.join(dirname, 'yacc.py'), 'r') as f: + lines = f.readlines() + + parse_start, parse_end = get_source_range(lines, 'parsedebug') + parseopt_start, parseopt_end = get_source_range(lines, 'parseopt') + parseopt_notrack_start, parseopt_notrack_end = get_source_range(lines, 'parseopt-notrack') + + # Get the original source + orig_lines = lines[parse_start:parse_end] + + # Filter the DEBUG sections out + parseopt_lines = filter_section(orig_lines, 'DEBUG') + + # Filter the TRACKING sections out + parseopt_notrack_lines = filter_section(parseopt_lines, 'TRACKING') + + # Replace the parser source sections with updated versions + lines[parseopt_notrack_start:parseopt_notrack_end] = parseopt_notrack_lines + lines[parseopt_start:parseopt_end] = parseopt_lines + + lines = [line.rstrip()+'\n' for line in lines] + with open(os.path.join(dirname, 'yacc.py'), 'w') as f: + f.writelines(lines) + + print('Updated yacc.py') + +if __name__ == '__main__': + main() + + + + + diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/America/Argentina/San_Juan b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/America/Argentina/San_Juan new file mode 100644 index 0000000000000000000000000000000000000000..2698495bb3f953685e45edb916798cd24f772664 Binary files /dev/null and b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/America/Argentina/San_Juan differ diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/America/Argentina/San_Luis b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/America/Argentina/San_Luis new file mode 100644 index 0000000000000000000000000000000000000000..fe50f6211cff908f21257cb42259fe2692abdc4e Binary files /dev/null and b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/America/Argentina/San_Luis differ diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/America/Argentina/Tucuman b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/America/Argentina/Tucuman new file mode 100644 index 0000000000000000000000000000000000000000..c954000ba9b28204cc3223628d13e9dcfa4b6eb0 Binary files /dev/null and b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/America/Argentina/Tucuman differ diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/America/Argentina/Ushuaia b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/America/Argentina/Ushuaia new file mode 100644 index 0000000000000000000000000000000000000000..3643628a24723239a13d61b2215c907cdba03985 Binary files /dev/null and b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/America/Argentina/Ushuaia differ diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/America/Indiana/Indianapolis b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/America/Indiana/Indianapolis new file mode 100644 index 0000000000000000000000000000000000000000..09511ccdcf97a5baa8e1b0eb75e040eee6b6e0c4 Binary files /dev/null and b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/America/Indiana/Indianapolis differ diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/America/Indiana/Knox b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/America/Indiana/Knox new file mode 100644 index 0000000000000000000000000000000000000000..fcd408d74df43310a9a85c475f83d545f6d75911 Binary files /dev/null and b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/America/Indiana/Knox differ diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Canada/Mountain b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Canada/Mountain new file mode 100644 index 0000000000000000000000000000000000000000..3fa0579891a9762b7c131ec5ece5d6d02495bfc0 Binary files /dev/null and b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Canada/Mountain differ diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Canada/Newfoundland b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Canada/Newfoundland new file mode 100644 index 0000000000000000000000000000000000000000..65a5b0c720dad151ffdcba3dbe91c8bd638845c6 Binary files /dev/null and b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Canada/Newfoundland differ diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Canada/Pacific b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Canada/Pacific new file mode 100644 index 0000000000000000000000000000000000000000..0f9f832821b6cff451b5ecccd0b6eac8e53a9190 Binary files /dev/null and b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Canada/Pacific differ diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Canada/Saskatchewan b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Canada/Saskatchewan new file mode 100644 index 0000000000000000000000000000000000000000..20c9c84df491e4072ec4c5d2c931a7433d9fd394 Binary files /dev/null and b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Canada/Saskatchewan differ diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Canada/Yukon b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Canada/Yukon new file mode 100644 index 0000000000000000000000000000000000000000..fb3cd71a69e3038f0d77e8ddd3290a08fb960d9c Binary files /dev/null and b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Canada/Yukon differ diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Chile/Continental b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Chile/Continental new file mode 100644 index 0000000000000000000000000000000000000000..816a0428188d99f437004312ee73c3860ee0f54f Binary files /dev/null and b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Chile/Continental differ diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Chile/EasterIsland b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Chile/EasterIsland new file mode 100644 index 0000000000000000000000000000000000000000..cae3744096402e8a452336544edf96ca9ae5ad8d Binary files /dev/null and b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Chile/EasterIsland differ diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Etc/GMT b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Etc/GMT new file mode 100644 index 0000000000000000000000000000000000000000..c63474664a289aa3c3c0d8b2ce06d484679754c0 Binary files /dev/null and b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Etc/GMT differ diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Etc/GMT+0 b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Etc/GMT+0 new file mode 100644 index 0000000000000000000000000000000000000000..c63474664a289aa3c3c0d8b2ce06d484679754c0 Binary files /dev/null and b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Etc/GMT+0 differ diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Etc/GMT+1 b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Etc/GMT+1 new file mode 100644 index 0000000000000000000000000000000000000000..4dab6f9005bea50a065c685ec8260b0da2bff921 Binary files /dev/null and b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Etc/GMT+1 differ diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Etc/GMT+10 b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Etc/GMT+10 new file mode 100644 index 0000000000000000000000000000000000000000..c749290af2f6b5fe22770c34eb1e8fc87cd85aff Binary files /dev/null and b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Etc/GMT+10 differ diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Etc/GMT+11 b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Etc/GMT+11 new file mode 100644 index 0000000000000000000000000000000000000000..d969982309e5ca7d32979a7dad814ca307d2cd8d Binary files /dev/null and b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Etc/GMT+11 differ diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Etc/GMT+12 b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Etc/GMT+12 new file mode 100644 index 0000000000000000000000000000000000000000..cdeec90973be28ee4075eadd22b8b574db2d7a5f Binary files /dev/null and b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Etc/GMT+12 differ diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Etc/GMT-7 b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Etc/GMT-7 new file mode 100644 index 0000000000000000000000000000000000000000..cefc9126c691060225ff2eee1241b1e5e9825fcd Binary files /dev/null and b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Etc/GMT-7 differ diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Etc/GMT-8 b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Etc/GMT-8 new file mode 100644 index 0000000000000000000000000000000000000000..afb093da00685297cb11347c4840acf3a8e2e2bf Binary files /dev/null and b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Etc/GMT-8 differ diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Etc/GMT-9 b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Etc/GMT-9 new file mode 100644 index 0000000000000000000000000000000000000000..9265fb7c2071ec0e66c657ad2ae42d5dd525fe97 Binary files /dev/null and b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Etc/GMT-9 differ diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Etc/GMT0 b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Etc/GMT0 new file mode 100644 index 0000000000000000000000000000000000000000..c63474664a289aa3c3c0d8b2ce06d484679754c0 Binary files /dev/null and b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Etc/GMT0 differ diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Etc/Greenwich b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Etc/Greenwich new file mode 100644 index 0000000000000000000000000000000000000000..c63474664a289aa3c3c0d8b2ce06d484679754c0 Binary files /dev/null and b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Etc/Greenwich differ diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Etc/UCT b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Etc/UCT new file mode 100644 index 0000000000000000000000000000000000000000..91558be0c2bf903b2364215ba26d5227d6126508 Binary files /dev/null and b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Etc/UCT differ diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Etc/UTC b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Etc/UTC new file mode 100644 index 0000000000000000000000000000000000000000..91558be0c2bf903b2364215ba26d5227d6126508 Binary files /dev/null and b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Etc/UTC differ diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Etc/Universal b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Etc/Universal new file mode 100644 index 0000000000000000000000000000000000000000..91558be0c2bf903b2364215ba26d5227d6126508 Binary files /dev/null and b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Etc/Universal differ diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Etc/Zulu b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Etc/Zulu new file mode 100644 index 0000000000000000000000000000000000000000..91558be0c2bf903b2364215ba26d5227d6126508 Binary files /dev/null and b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Etc/Zulu differ diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Europe/Amsterdam b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Europe/Amsterdam new file mode 100644 index 0000000000000000000000000000000000000000..c3ff07b436aedf662eae60f50668f5abcdb172b6 Binary files /dev/null and b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Europe/Amsterdam differ diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Europe/Andorra b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Europe/Andorra new file mode 100644 index 0000000000000000000000000000000000000000..5962550392fa78514061582e9371c32b9f1d929b Binary files /dev/null and b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Europe/Andorra differ diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Europe/Astrakhan b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Europe/Astrakhan new file mode 100644 index 0000000000000000000000000000000000000000..73a4d013fcb82c2beb6f885f359b9ca20da054e7 Binary files /dev/null and b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Europe/Astrakhan differ diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Europe/Athens b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Europe/Athens new file mode 100644 index 0000000000000000000000000000000000000000..9f3a0678d766881389e129c93def7fffd74f14f1 Binary files /dev/null and b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Europe/Athens differ diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Europe/Dublin b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Europe/Dublin new file mode 100644 index 0000000000000000000000000000000000000000..1d994902db21814a626e42639d7a96b18ee73756 Binary files /dev/null and b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Europe/Dublin differ diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Europe/Gibraltar b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Europe/Gibraltar new file mode 100644 index 0000000000000000000000000000000000000000..117aadb8364cd7901388098503f4538c7b445aeb Binary files /dev/null and b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Europe/Gibraltar differ diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Europe/Guernsey b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Europe/Guernsey new file mode 100644 index 0000000000000000000000000000000000000000..ac02a81440f47a67b9f01d3fbcdb085266d20894 Binary files /dev/null and b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Europe/Guernsey differ diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Europe/Helsinki b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Europe/Helsinki new file mode 100644 index 0000000000000000000000000000000000000000..b4f8f9cbb57450549933f83ac90dd56a2ca75344 Binary files /dev/null and b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Europe/Helsinki differ diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Europe/Isle_of_Man b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Europe/Isle_of_Man new file mode 100644 index 0000000000000000000000000000000000000000..ac02a81440f47a67b9f01d3fbcdb085266d20894 Binary files /dev/null and b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Europe/Isle_of_Man differ diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Europe/Istanbul b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Europe/Istanbul new file mode 100644 index 0000000000000000000000000000000000000000..10d4b21bfce12d020fda1af518d1aa04a2de6385 Binary files /dev/null and b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Europe/Istanbul differ diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Europe/Jersey b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Europe/Jersey new file mode 100644 index 0000000000000000000000000000000000000000..ac02a81440f47a67b9f01d3fbcdb085266d20894 Binary files /dev/null and b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Europe/Jersey differ diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Europe/Kaliningrad b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Europe/Kaliningrad new file mode 100644 index 0000000000000000000000000000000000000000..f774ffdb2bad4c40ebe217b95bf7c38b933d4cc0 Binary files /dev/null and b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Europe/Kaliningrad differ diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Europe/Kiev b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Europe/Kiev new file mode 100644 index 0000000000000000000000000000000000000000..9337c9ea27c0a61b1082f4be37cfb0f9484cf5e2 Binary files /dev/null and b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Europe/Kiev differ diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Europe/Kirov b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Europe/Kirov new file mode 100644 index 0000000000000000000000000000000000000000..a3b5320a0bd139c07b8642c4efd7b98f57c6e8dd Binary files /dev/null and b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Europe/Kirov differ diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Europe/Lisbon b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Europe/Lisbon new file mode 100644 index 0000000000000000000000000000000000000000..355817b52b1b05680bbb57e4dc8de358eff27a39 Binary files /dev/null and b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Europe/Lisbon differ diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Europe/Ljubljana b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Europe/Ljubljana new file mode 100644 index 0000000000000000000000000000000000000000..27de456f16ab549627b284a39e2265cbdb4ad8e9 Binary files /dev/null and b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Europe/Ljubljana differ diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Europe/London b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Europe/London new file mode 100644 index 0000000000000000000000000000000000000000..ac02a81440f47a67b9f01d3fbcdb085266d20894 Binary files /dev/null and b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Europe/London differ diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Europe/Luxembourg b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Europe/Luxembourg new file mode 100644 index 0000000000000000000000000000000000000000..c4ca733f5345df24e5286b70464a6c0498353372 Binary files /dev/null and b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Europe/Luxembourg differ diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Europe/Madrid b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Europe/Madrid new file mode 100644 index 0000000000000000000000000000000000000000..16f6420ab7efc7ceac3b0e42fe37836185cfc463 Binary files /dev/null and b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Europe/Madrid differ diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Europe/Malta b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Europe/Malta new file mode 100644 index 0000000000000000000000000000000000000000..bf2452da40314be196f61e6a7cdd48eaf5c426f3 Binary files /dev/null and b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Europe/Malta differ diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Europe/Mariehamn b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Europe/Mariehamn new file mode 100644 index 0000000000000000000000000000000000000000..b4f8f9cbb57450549933f83ac90dd56a2ca75344 Binary files /dev/null and b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Europe/Mariehamn differ diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Europe/Minsk b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Europe/Minsk new file mode 100644 index 0000000000000000000000000000000000000000..453306c07566a94c0c391024fb16ee36245a0a40 Binary files /dev/null and b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Europe/Minsk differ diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Europe/Monaco b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Europe/Monaco new file mode 100644 index 0000000000000000000000000000000000000000..686ae8831550bb0fe033409c8b4df460fcd61a04 Binary files /dev/null and b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Europe/Monaco differ diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Europe/Moscow b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Europe/Moscow new file mode 100644 index 0000000000000000000000000000000000000000..ddb3f4e99a1030f33b56fad986c8d9c16e59eb32 Binary files /dev/null and b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Europe/Moscow differ diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Europe/Nicosia b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Europe/Nicosia new file mode 100644 index 0000000000000000000000000000000000000000..f7f10ab7665e94ca44fd8cd98a362cd4b304eff1 Binary files /dev/null and b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Europe/Nicosia differ diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Europe/Oslo b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Europe/Oslo new file mode 100644 index 0000000000000000000000000000000000000000..15a34c3cedb7c9ca519c195f5ec0ce9d8d1885a5 Binary files /dev/null and b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Europe/Oslo differ diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Europe/Paris b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Europe/Paris new file mode 100644 index 0000000000000000000000000000000000000000..ca854351687d88b3919ff33138f0a71994356b29 Binary files /dev/null and b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Europe/Paris differ diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Europe/Podgorica b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Europe/Podgorica new file mode 100644 index 0000000000000000000000000000000000000000..27de456f16ab549627b284a39e2265cbdb4ad8e9 Binary files /dev/null and b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Europe/Podgorica differ diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Europe/Prague b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Europe/Prague new file mode 100644 index 0000000000000000000000000000000000000000..ce8f433ece44f0b96b18d3b5780730e7f9cad9f5 Binary files /dev/null and b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Europe/Prague differ diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Europe/Riga b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Europe/Riga new file mode 100644 index 0000000000000000000000000000000000000000..8db477d01736445cafce8af7a7085d226d81f546 Binary files /dev/null and b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Europe/Riga differ diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Europe/Rome b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Europe/Rome new file mode 100644 index 0000000000000000000000000000000000000000..ac4c16342b5bbfa4c58a26f57db33b95f5b3e533 Binary files /dev/null and b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Europe/Rome differ diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Europe/Simferopol b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Europe/Simferopol new file mode 100644 index 0000000000000000000000000000000000000000..432e8315bc9dfa74080467f9e08073d9fdcc833a Binary files /dev/null and b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Europe/Simferopol differ diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Europe/Skopje b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Europe/Skopje new file mode 100644 index 0000000000000000000000000000000000000000..27de456f16ab549627b284a39e2265cbdb4ad8e9 Binary files /dev/null and b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Europe/Skopje differ diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Europe/Sofia b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Europe/Sofia new file mode 100644 index 0000000000000000000000000000000000000000..0e4d879332d21c93c229fc25587205020eeb3127 Binary files /dev/null and b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Europe/Sofia differ diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Europe/Stockholm b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Europe/Stockholm new file mode 100644 index 0000000000000000000000000000000000000000..f3e0c7f0f25f0a7290e56281c91190e3611498a7 Binary files /dev/null and b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Europe/Stockholm differ diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Pacific/Nauru b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Pacific/Nauru new file mode 100644 index 0000000000000000000000000000000000000000..acec0429f147f40279107a48cb85c3b0e9f56c94 Binary files /dev/null and b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Pacific/Nauru differ diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Pacific/Niue b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Pacific/Niue new file mode 100644 index 0000000000000000000000000000000000000000..684b010e8b6bad56b084072403110b94e8cfe2dd Binary files /dev/null and b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Pacific/Niue differ diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Pacific/Norfolk b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Pacific/Norfolk new file mode 100644 index 0000000000000000000000000000000000000000..1f6d610ef16479da341be051e933016dcefe8121 Binary files /dev/null and b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Pacific/Norfolk differ diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Pacific/Noumea b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Pacific/Noumea new file mode 100644 index 0000000000000000000000000000000000000000..931a1a306f70eb0c7578a65425086270c6ea2b88 Binary files /dev/null and b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Pacific/Noumea differ diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Pacific/Pago_Pago b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Pacific/Pago_Pago new file mode 100644 index 0000000000000000000000000000000000000000..cb56709a77dedb471150f4907771bf38f1879ba4 Binary files /dev/null and b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Pacific/Pago_Pago differ diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Pacific/Palau b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Pacific/Palau new file mode 100644 index 0000000000000000000000000000000000000000..146b35152aaeffb5940d30910ba37703f4096285 Binary files /dev/null and b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Pacific/Palau differ diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Pacific/Pitcairn b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Pacific/Pitcairn new file mode 100644 index 0000000000000000000000000000000000000000..ef91b061bb145b2658d49fd5065ed74b1a6cf6f7 Binary files /dev/null and b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Pacific/Pitcairn differ diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Pacific/Pohnpei b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Pacific/Pohnpei new file mode 100644 index 0000000000000000000000000000000000000000..c298ddd4debb649220e5dfde60948591bc6a3501 Binary files /dev/null and b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Pacific/Pohnpei differ diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Pacific/Ponape b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Pacific/Ponape new file mode 100644 index 0000000000000000000000000000000000000000..c298ddd4debb649220e5dfde60948591bc6a3501 Binary files /dev/null and b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Pacific/Ponape differ diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Pacific/Port_Moresby b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Pacific/Port_Moresby new file mode 100644 index 0000000000000000000000000000000000000000..920ad27e629e350c1baac8537bb639a59fd19039 Binary files /dev/null and b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Pacific/Port_Moresby differ diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Pacific/Rarotonga b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Pacific/Rarotonga new file mode 100644 index 0000000000000000000000000000000000000000..da6b0fadea95ebd9d06a6ac997806993a4d7330d Binary files /dev/null and b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Pacific/Rarotonga differ diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Pacific/Saipan b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Pacific/Saipan new file mode 100644 index 0000000000000000000000000000000000000000..66490d25dff9bcc8f710b0141f1a02e64aeb32f3 Binary files /dev/null and b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Pacific/Saipan differ diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Pacific/Samoa b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Pacific/Samoa new file mode 100644 index 0000000000000000000000000000000000000000..cb56709a77dedb471150f4907771bf38f1879ba4 Binary files /dev/null and b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Pacific/Samoa differ diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Pacific/Tahiti b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Pacific/Tahiti new file mode 100644 index 0000000000000000000000000000000000000000..442b8eb5a438985092d8657ebcabe8859037482a Binary files /dev/null and b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Pacific/Tahiti differ diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Pacific/Tarawa b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Pacific/Tarawa new file mode 100644 index 0000000000000000000000000000000000000000..3db6c750333fa6dc1efc84b1abc24528fbc00b0b Binary files /dev/null and b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Pacific/Tarawa differ diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Pacific/Tongatapu b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Pacific/Tongatapu new file mode 100644 index 0000000000000000000000000000000000000000..5553c6009acd272cae012a08b618c2fd649dceae Binary files /dev/null and b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Pacific/Tongatapu differ diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Pacific/Truk b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Pacific/Truk new file mode 100644 index 0000000000000000000000000000000000000000..07c84b7110ad9589810b916390aedc7ef498f423 Binary files /dev/null and b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pytz/zoneinfo/Pacific/Truk differ diff --git a/benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.mathematics@1.1.0/Unity.Mathematics.Editor/PostNormalizedVectorDrawer.cs.meta b/benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.mathematics@1.1.0/Unity.Mathematics.Editor/PostNormalizedVectorDrawer.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..0e7fc53338e6d775ed031becb0dd36792b77e7e1 --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.mathematics@1.1.0/Unity.Mathematics.Editor/PostNormalizedVectorDrawer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 2c060766caf7a405bb18fa4ba02780ee +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.mathematics@1.1.0/Unity.Mathematics.Editor/PrimitiveVectorDrawer.cs b/benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.mathematics@1.1.0/Unity.Mathematics.Editor/PrimitiveVectorDrawer.cs new file mode 100644 index 0000000000000000000000000000000000000000..57b1b89e29b782c569713fc907ff5b155b31ed89 --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.mathematics@1.1.0/Unity.Mathematics.Editor/PrimitiveVectorDrawer.cs @@ -0,0 +1,77 @@ +using System; +using UnityEditor; +using UnityEngine; + +namespace Unity.Mathematics.Editor +{ + [CustomPropertyDrawer(typeof(bool2)), CustomPropertyDrawer(typeof(bool3)), CustomPropertyDrawer(typeof(bool4))] + [CustomPropertyDrawer(typeof(double2)), CustomPropertyDrawer(typeof(double3)), CustomPropertyDrawer(typeof(double4))] + [CustomPropertyDrawer(typeof(float2)), CustomPropertyDrawer(typeof(float3)), CustomPropertyDrawer(typeof(float4))] + [CustomPropertyDrawer(typeof(int2)), CustomPropertyDrawer(typeof(int3)), CustomPropertyDrawer(typeof(int4))] + [CustomPropertyDrawer(typeof(uint2)), CustomPropertyDrawer(typeof(uint3)), CustomPropertyDrawer(typeof(uint4))] + [CustomPropertyDrawer(typeof(DoNotNormalizeAttribute))] + class PrimitiveVectorDrawer : PropertyDrawer + { + static class Content + { + public static readonly string doNotNormalizeCompatibility = L10n.Tr( + $"{typeof(DoNotNormalizeAttribute).Name} only works with {typeof(quaternion)} and primitive vector types." + ); + public static readonly string doNotNormalizeTooltip = + L10n.Tr("This value is not normalized, which may produce unexpected results."); + + public static readonly GUIContent[] labels2 = { new GUIContent("X"), new GUIContent("Y") }; + public static readonly GUIContent[] labels3 = { new GUIContent("X"), new GUIContent("Y"), new GUIContent("Z") }; + public static readonly GUIContent[] labels4 = { new GUIContent("X"), new GUIContent("Y"), new GUIContent("Z"), new GUIContent("W") }; + } + + public override bool CanCacheInspectorGUI(SerializedProperty property) + { + return false; + } + + public override float GetPropertyHeight(SerializedProperty property, GUIContent label) + { + var height = EditorGUIUtility.singleLineHeight; + if (!EditorGUIUtility.wideMode) + height += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; + return height; + } + + public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) + { + var subLabels = Content.labels4; + var startIter = "x"; + switch (property.type[property.type.Length - 1]) + { + case '2': + subLabels = Content.labels2; + break; + case '3': + subLabels = Content.labels3; + break; + case '4': + subLabels = Content.labels4; + break; + default: + { + if (property.type == nameof(quaternion)) + startIter = "value.x"; + else if (attribute is DoNotNormalizeAttribute) + { + EditorGUI.HelpBox(EditorGUI.PrefixLabel(position, label), Content.doNotNormalizeCompatibility, MessageType.None); + return; + } + break; + } + } + + if (attribute is DoNotNormalizeAttribute && string.IsNullOrEmpty(label.tooltip)) + label.tooltip = Content.doNotNormalizeTooltip; + + EditorGUI.BeginProperty(position, label, property); + EditorGUI.MultiPropertyField(position, subLabels, property.FindPropertyRelative(startIter), label); + EditorGUI.EndProperty(); + } + } +} \ No newline at end of file diff --git a/benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.mathematics@1.1.0/Unity.Mathematics.Editor/PrimitiveVectorDrawer.cs.meta b/benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.mathematics@1.1.0/Unity.Mathematics.Editor/PrimitiveVectorDrawer.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..6bd358170169658093530e0ea0aaee740b6a0b28 --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.mathematics@1.1.0/Unity.Mathematics.Editor/PrimitiveVectorDrawer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 4ae914da3592740a58dd603fcb28b594 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.mathematics@1.1.0/Unity.Mathematics.Editor/QuaternionDrawer.cs b/benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.mathematics@1.1.0/Unity.Mathematics.Editor/QuaternionDrawer.cs new file mode 100644 index 0000000000000000000000000000000000000000..c8bb9a3f44de95ea001409cd6418d2229387d3c3 --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.mathematics@1.1.0/Unity.Mathematics.Editor/QuaternionDrawer.cs @@ -0,0 +1,18 @@ +using UnityEditor; + +namespace Unity.Mathematics.Editor +{ + [CustomPropertyDrawer(typeof(quaternion))] + class QuaternionDrawer : PostNormalizedVectorDrawer + { + protected override SerializedProperty GetVectorProperty(SerializedProperty property) + { + return property.FindPropertyRelative("value"); + } + + protected override double4 Normalize(double4 value) + { + return math.normalizesafe(new quaternion((float4)value)).value; + } + } +} \ No newline at end of file diff --git a/benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.mathematics@1.1.0/Unity.Mathematics.Editor/QuaternionDrawer.cs.meta b/benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.mathematics@1.1.0/Unity.Mathematics.Editor/QuaternionDrawer.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..270314de22141c1a636f630c58891aec70b0d0da --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.mathematics@1.1.0/Unity.Mathematics.Editor/QuaternionDrawer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: b78c76192c2e742779541501cfe4ca76 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.mathematics@1.1.0/Unity.Mathematics.Editor/Unity.Mathematics.Editor.asmdef b/benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.mathematics@1.1.0/Unity.Mathematics.Editor/Unity.Mathematics.Editor.asmdef new file mode 100644 index 0000000000000000000000000000000000000000..35c38c2045c3bf48d1813668b39f4bbf82d7a367 --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.mathematics@1.1.0/Unity.Mathematics.Editor/Unity.Mathematics.Editor.asmdef @@ -0,0 +1,12 @@ +{ + "name": "Unity.Mathematics.Editor", + "references": [ + "Unity.Mathematics" + ], + "optionalUnityReferences": [], + "includePlatforms": [ + "Editor" + ], + "excludePlatforms": [], + "allowUnsafeCode": true +} \ No newline at end of file diff --git a/benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.mathematics@1.1.0/Unity.Mathematics/rigid_transform.cs.meta b/benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.mathematics@1.1.0/Unity.Mathematics/rigid_transform.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..fd25cb981237d6df77e011eb45e38e68ec4a6feb --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.mathematics@1.1.0/Unity.Mathematics/rigid_transform.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 790a4c601e5714c18971af51ef3cbe71 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.mathematics@1.1.0/Unity.Mathematics/uint2.gen.cs b/benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.mathematics@1.1.0/Unity.Mathematics/uint2.gen.cs new file mode 100644 index 0000000000000000000000000000000000000000..1cd72ce1cc9b59da220959a3dbeb82c4692b37ee --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.mathematics@1.1.0/Unity.Mathematics/uint2.gen.cs @@ -0,0 +1,780 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ +using System; +using System.Runtime.CompilerServices; +using System.Diagnostics; + +#pragma warning disable 0660, 0661 + +namespace Unity.Mathematics +{ + [DebuggerTypeProxy(typeof(uint2.DebuggerProxy))] + [System.Serializable] + public partial struct uint2 : System.IEquatable, IFormattable + { + public uint x; + public uint y; + + /// uint2 zero value. + public static readonly uint2 zero; + + /// Constructs a uint2 vector from two uint values. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public uint2(uint x, uint y) + { + this.x = x; + this.y = y; + } + + /// Constructs a uint2 vector from a uint2 vector. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public uint2(uint2 xy) + { + this.x = xy.x; + this.y = xy.y; + } + + /// Constructs a uint2 vector from a single uint value by assigning it to every component. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public uint2(uint v) + { + this.x = v; + this.y = v; + } + + /// Constructs a uint2 vector from a single bool value by converting it to uint and assigning it to every component. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public uint2(bool v) + { + this.x = v ? 1u : 0u; + this.y = v ? 1u : 0u; + } + + /// Constructs a uint2 vector from a bool2 vector by componentwise conversion. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public uint2(bool2 v) + { + this.x = v.x ? 1u : 0u; + this.y = v.y ? 1u : 0u; + } + + /// Constructs a uint2 vector from a single int value by converting it to uint and assigning it to every component. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public uint2(int v) + { + this.x = (uint)v; + this.y = (uint)v; + } + + /// Constructs a uint2 vector from a int2 vector by componentwise conversion. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public uint2(int2 v) + { + this.x = (uint)v.x; + this.y = (uint)v.y; + } + + /// Constructs a uint2 vector from a single float value by converting it to uint and assigning it to every component. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public uint2(float v) + { + this.x = (uint)v; + this.y = (uint)v; + } + + /// Constructs a uint2 vector from a float2 vector by componentwise conversion. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public uint2(float2 v) + { + this.x = (uint)v.x; + this.y = (uint)v.y; + } + + /// Constructs a uint2 vector from a single double value by converting it to uint and assigning it to every component. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public uint2(double v) + { + this.x = (uint)v; + this.y = (uint)v; + } + + /// Constructs a uint2 vector from a double2 vector by componentwise conversion. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public uint2(double2 v) + { + this.x = (uint)v.x; + this.y = (uint)v.y; + } + + + /// Implicitly converts a single uint value to a uint2 vector by assigning it to every component. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static implicit operator uint2(uint v) { return new uint2(v); } + + /// Explicitly converts a single bool value to a uint2 vector by converting it to uint and assigning it to every component. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static explicit operator uint2(bool v) { return new uint2(v); } + + /// Explicitly converts a bool2 vector to a uint2 vector by componentwise conversion. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static explicit operator uint2(bool2 v) { return new uint2(v); } + + /// Explicitly converts a single int value to a uint2 vector by converting it to uint and assigning it to every component. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static explicit operator uint2(int v) { return new uint2(v); } + + /// Explicitly converts a int2 vector to a uint2 vector by componentwise conversion. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static explicit operator uint2(int2 v) { return new uint2(v); } + + /// Explicitly converts a single float value to a uint2 vector by converting it to uint and assigning it to every component. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static explicit operator uint2(float v) { return new uint2(v); } + + /// Explicitly converts a float2 vector to a uint2 vector by componentwise conversion. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static explicit operator uint2(float2 v) { return new uint2(v); } + + /// Explicitly converts a single double value to a uint2 vector by converting it to uint and assigning it to every component. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static explicit operator uint2(double v) { return new uint2(v); } + + /// Explicitly converts a double2 vector to a uint2 vector by componentwise conversion. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static explicit operator uint2(double2 v) { return new uint2(v); } + + + /// Returns the result of a componentwise multiplication operation on two uint2 vectors. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2 operator * (uint2 lhs, uint2 rhs) { return new uint2 (lhs.x * rhs.x, lhs.y * rhs.y); } + + /// Returns the result of a componentwise multiplication operation on a uint2 vector and a uint value. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2 operator * (uint2 lhs, uint rhs) { return new uint2 (lhs.x * rhs, lhs.y * rhs); } + + /// Returns the result of a componentwise multiplication operation on a uint value and a uint2 vector. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2 operator * (uint lhs, uint2 rhs) { return new uint2 (lhs * rhs.x, lhs * rhs.y); } + + + /// Returns the result of a componentwise addition operation on two uint2 vectors. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2 operator + (uint2 lhs, uint2 rhs) { return new uint2 (lhs.x + rhs.x, lhs.y + rhs.y); } + + /// Returns the result of a componentwise addition operation on a uint2 vector and a uint value. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2 operator + (uint2 lhs, uint rhs) { return new uint2 (lhs.x + rhs, lhs.y + rhs); } + + /// Returns the result of a componentwise addition operation on a uint value and a uint2 vector. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2 operator + (uint lhs, uint2 rhs) { return new uint2 (lhs + rhs.x, lhs + rhs.y); } + + + /// Returns the result of a componentwise subtraction operation on two uint2 vectors. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2 operator - (uint2 lhs, uint2 rhs) { return new uint2 (lhs.x - rhs.x, lhs.y - rhs.y); } + + /// Returns the result of a componentwise subtraction operation on a uint2 vector and a uint value. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2 operator - (uint2 lhs, uint rhs) { return new uint2 (lhs.x - rhs, lhs.y - rhs); } + + /// Returns the result of a componentwise subtraction operation on a uint value and a uint2 vector. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2 operator - (uint lhs, uint2 rhs) { return new uint2 (lhs - rhs.x, lhs - rhs.y); } + + + /// Returns the result of a componentwise division operation on two uint2 vectors. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2 operator / (uint2 lhs, uint2 rhs) { return new uint2 (lhs.x / rhs.x, lhs.y / rhs.y); } + + /// Returns the result of a componentwise division operation on a uint2 vector and a uint value. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2 operator / (uint2 lhs, uint rhs) { return new uint2 (lhs.x / rhs, lhs.y / rhs); } + + /// Returns the result of a componentwise division operation on a uint value and a uint2 vector. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2 operator / (uint lhs, uint2 rhs) { return new uint2 (lhs / rhs.x, lhs / rhs.y); } + + + /// Returns the result of a componentwise modulus operation on two uint2 vectors. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2 operator % (uint2 lhs, uint2 rhs) { return new uint2 (lhs.x % rhs.x, lhs.y % rhs.y); } + + /// Returns the result of a componentwise modulus operation on a uint2 vector and a uint value. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2 operator % (uint2 lhs, uint rhs) { return new uint2 (lhs.x % rhs, lhs.y % rhs); } + + /// Returns the result of a componentwise modulus operation on a uint value and a uint2 vector. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2 operator % (uint lhs, uint2 rhs) { return new uint2 (lhs % rhs.x, lhs % rhs.y); } + + + /// Returns the result of a componentwise increment operation on a uint2 vector. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2 operator ++ (uint2 val) { return new uint2 (++val.x, ++val.y); } + + + /// Returns the result of a componentwise decrement operation on a uint2 vector. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2 operator -- (uint2 val) { return new uint2 (--val.x, --val.y); } + + + /// Returns the result of a componentwise less than operation on two uint2 vectors. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool2 operator < (uint2 lhs, uint2 rhs) { return new bool2 (lhs.x < rhs.x, lhs.y < rhs.y); } + + /// Returns the result of a componentwise less than operation on a uint2 vector and a uint value. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool2 operator < (uint2 lhs, uint rhs) { return new bool2 (lhs.x < rhs, lhs.y < rhs); } + + /// Returns the result of a componentwise less than operation on a uint value and a uint2 vector. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool2 operator < (uint lhs, uint2 rhs) { return new bool2 (lhs < rhs.x, lhs < rhs.y); } + + + /// Returns the result of a componentwise less or equal operation on two uint2 vectors. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool2 operator <= (uint2 lhs, uint2 rhs) { return new bool2 (lhs.x <= rhs.x, lhs.y <= rhs.y); } + + /// Returns the result of a componentwise less or equal operation on a uint2 vector and a uint value. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool2 operator <= (uint2 lhs, uint rhs) { return new bool2 (lhs.x <= rhs, lhs.y <= rhs); } + + /// Returns the result of a componentwise less or equal operation on a uint value and a uint2 vector. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool2 operator <= (uint lhs, uint2 rhs) { return new bool2 (lhs <= rhs.x, lhs <= rhs.y); } + + + /// Returns the result of a componentwise greater than operation on two uint2 vectors. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool2 operator > (uint2 lhs, uint2 rhs) { return new bool2 (lhs.x > rhs.x, lhs.y > rhs.y); } + + /// Returns the result of a componentwise greater than operation on a uint2 vector and a uint value. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool2 operator > (uint2 lhs, uint rhs) { return new bool2 (lhs.x > rhs, lhs.y > rhs); } + + /// Returns the result of a componentwise greater than operation on a uint value and a uint2 vector. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool2 operator > (uint lhs, uint2 rhs) { return new bool2 (lhs > rhs.x, lhs > rhs.y); } + + + /// Returns the result of a componentwise greater or equal operation on two uint2 vectors. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool2 operator >= (uint2 lhs, uint2 rhs) { return new bool2 (lhs.x >= rhs.x, lhs.y >= rhs.y); } + + /// Returns the result of a componentwise greater or equal operation on a uint2 vector and a uint value. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool2 operator >= (uint2 lhs, uint rhs) { return new bool2 (lhs.x >= rhs, lhs.y >= rhs); } + + /// Returns the result of a componentwise greater or equal operation on a uint value and a uint2 vector. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool2 operator >= (uint lhs, uint2 rhs) { return new bool2 (lhs >= rhs.x, lhs >= rhs.y); } + + + /// Returns the result of a componentwise unary minus operation on a uint2 vector. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2 operator - (uint2 val) { return new uint2 ((uint)-val.x, (uint)-val.y); } + + + /// Returns the result of a componentwise unary plus operation on a uint2 vector. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2 operator + (uint2 val) { return new uint2 (+val.x, +val.y); } + + + /// Returns the result of a componentwise left shift operation on a uint2 vector by a number of bits specified by a single int. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2 operator << (uint2 x, int n) { return new uint2 (x.x << n, x.y << n); } + + /// Returns the result of a componentwise right shift operation on a uint2 vector by a number of bits specified by a single int. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2 operator >> (uint2 x, int n) { return new uint2 (x.x >> n, x.y >> n); } + + /// Returns the result of a componentwise equality operation on two uint2 vectors. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool2 operator == (uint2 lhs, uint2 rhs) { return new bool2 (lhs.x == rhs.x, lhs.y == rhs.y); } + + /// Returns the result of a componentwise equality operation on a uint2 vector and a uint value. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool2 operator == (uint2 lhs, uint rhs) { return new bool2 (lhs.x == rhs, lhs.y == rhs); } + + /// Returns the result of a componentwise equality operation on a uint value and a uint2 vector. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool2 operator == (uint lhs, uint2 rhs) { return new bool2 (lhs == rhs.x, lhs == rhs.y); } + + + /// Returns the result of a componentwise not equal operation on two uint2 vectors. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool2 operator != (uint2 lhs, uint2 rhs) { return new bool2 (lhs.x != rhs.x, lhs.y != rhs.y); } + + /// Returns the result of a componentwise not equal operation on a uint2 vector and a uint value. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool2 operator != (uint2 lhs, uint rhs) { return new bool2 (lhs.x != rhs, lhs.y != rhs); } + + /// Returns the result of a componentwise not equal operation on a uint value and a uint2 vector. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool2 operator != (uint lhs, uint2 rhs) { return new bool2 (lhs != rhs.x, lhs != rhs.y); } + + + /// Returns the result of a componentwise bitwise not operation on a uint2 vector. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2 operator ~ (uint2 val) { return new uint2 (~val.x, ~val.y); } + + + /// Returns the result of a componentwise bitwise and operation on two uint2 vectors. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2 operator & (uint2 lhs, uint2 rhs) { return new uint2 (lhs.x & rhs.x, lhs.y & rhs.y); } + + /// Returns the result of a componentwise bitwise and operation on a uint2 vector and a uint value. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2 operator & (uint2 lhs, uint rhs) { return new uint2 (lhs.x & rhs, lhs.y & rhs); } + + /// Returns the result of a componentwise bitwise and operation on a uint value and a uint2 vector. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2 operator & (uint lhs, uint2 rhs) { return new uint2 (lhs & rhs.x, lhs & rhs.y); } + + + /// Returns the result of a componentwise bitwise or operation on two uint2 vectors. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2 operator | (uint2 lhs, uint2 rhs) { return new uint2 (lhs.x | rhs.x, lhs.y | rhs.y); } + + /// Returns the result of a componentwise bitwise or operation on a uint2 vector and a uint value. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2 operator | (uint2 lhs, uint rhs) { return new uint2 (lhs.x | rhs, lhs.y | rhs); } + + /// Returns the result of a componentwise bitwise or operation on a uint value and a uint2 vector. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2 operator | (uint lhs, uint2 rhs) { return new uint2 (lhs | rhs.x, lhs | rhs.y); } + + + /// Returns the result of a componentwise bitwise exclusive or operation on two uint2 vectors. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2 operator ^ (uint2 lhs, uint2 rhs) { return new uint2 (lhs.x ^ rhs.x, lhs.y ^ rhs.y); } + + /// Returns the result of a componentwise bitwise exclusive or operation on a uint2 vector and a uint value. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2 operator ^ (uint2 lhs, uint rhs) { return new uint2 (lhs.x ^ rhs, lhs.y ^ rhs); } + + /// Returns the result of a componentwise bitwise exclusive or operation on a uint value and a uint2 vector. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2 operator ^ (uint lhs, uint2 rhs) { return new uint2 (lhs ^ rhs.x, lhs ^ rhs.y); } + + + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint4 xxxx + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint4(x, x, x, x); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint4 xxxy + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint4(x, x, x, y); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint4 xxyx + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint4(x, x, y, x); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint4 xxyy + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint4(x, x, y, y); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint4 xyxx + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint4(x, y, x, x); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint4 xyxy + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint4(x, y, x, y); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint4 xyyx + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint4(x, y, y, x); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint4 xyyy + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint4(x, y, y, y); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint4 yxxx + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint4(y, x, x, x); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint4 yxxy + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint4(y, x, x, y); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint4 yxyx + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint4(y, x, y, x); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint4 yxyy + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint4(y, x, y, y); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint4 yyxx + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint4(y, y, x, x); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint4 yyxy + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint4(y, y, x, y); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint4 yyyx + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint4(y, y, y, x); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint4 yyyy + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint4(y, y, y, y); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint3 xxx + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint3(x, x, x); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint3 xxy + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint3(x, x, y); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint3 xyx + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint3(x, y, x); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint3 xyy + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint3(x, y, y); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint3 yxx + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint3(y, x, x); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint3 yxy + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint3(y, x, y); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint3 yyx + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint3(y, y, x); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint3 yyy + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint3(y, y, y); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint2 xx + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint2(x, x); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint2 xy + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint2(x, y); } + [MethodImpl(MethodImplOptions.AggressiveInlining)] + set { x = value.x; y = value.y; } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint2 yx + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint2(y, x); } + [MethodImpl(MethodImplOptions.AggressiveInlining)] + set { y = value.x; x = value.y; } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint2 yy + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint2(y, y); } + } + + + + /// Returns the uint element at a specified index. + unsafe public uint this[int index] + { + get + { +#if ENABLE_UNITY_COLLECTIONS_CHECKS + if ((uint)index >= 2) + throw new System.ArgumentException("index must be between[0...1]"); +#endif + fixed (uint2* array = &this) { return ((uint*)array)[index]; } + } + set + { +#if ENABLE_UNITY_COLLECTIONS_CHECKS + if ((uint)index >= 2) + throw new System.ArgumentException("index must be between[0...1]"); +#endif + fixed (uint* array = &x) { array[index] = value; } + } + } + + /// Returns true if the uint2 is equal to a given uint2, false otherwise. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public bool Equals(uint2 rhs) { return x == rhs.x && y == rhs.y; } + + /// Returns true if the uint2 is equal to a given uint2, false otherwise. + public override bool Equals(object o) { return Equals((uint2)o); } + + + /// Returns a hash code for the uint2. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public override int GetHashCode() { return (int)math.hash(this); } + + + /// Returns a string representation of the uint2. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public override string ToString() + { + return string.Format("uint2({0}, {1})", x, y); + } + + /// Returns a string representation of the uint2 using a specified format and culture-specific format information. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public string ToString(string format, IFormatProvider formatProvider) + { + return string.Format("uint2({0}, {1})", x.ToString(format, formatProvider), y.ToString(format, formatProvider)); + } + + internal sealed class DebuggerProxy + { + public uint x; + public uint y; + public DebuggerProxy(uint2 v) + { + x = v.x; + y = v.y; + } + } + + } + + public static partial class math + { + /// Returns a uint2 vector constructed from two uint values. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2 uint2(uint x, uint y) { return new uint2(x, y); } + + /// Returns a uint2 vector constructed from a uint2 vector. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2 uint2(uint2 xy) { return new uint2(xy); } + + /// Returns a uint2 vector constructed from a single uint value by assigning it to every component. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2 uint2(uint v) { return new uint2(v); } + + /// Returns a uint2 vector constructed from a single bool value by converting it to uint and assigning it to every component. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2 uint2(bool v) { return new uint2(v); } + + /// Return a uint2 vector constructed from a bool2 vector by componentwise conversion. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2 uint2(bool2 v) { return new uint2(v); } + + /// Returns a uint2 vector constructed from a single int value by converting it to uint and assigning it to every component. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2 uint2(int v) { return new uint2(v); } + + /// Return a uint2 vector constructed from a int2 vector by componentwise conversion. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2 uint2(int2 v) { return new uint2(v); } + + /// Returns a uint2 vector constructed from a single float value by converting it to uint and assigning it to every component. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2 uint2(float v) { return new uint2(v); } + + /// Return a uint2 vector constructed from a float2 vector by componentwise conversion. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2 uint2(float2 v) { return new uint2(v); } + + /// Returns a uint2 vector constructed from a single double value by converting it to uint and assigning it to every component. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2 uint2(double v) { return new uint2(v); } + + /// Return a uint2 vector constructed from a double2 vector by componentwise conversion. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2 uint2(double2 v) { return new uint2(v); } + + /// Returns a uint hash code of a uint2 vector. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint hash(uint2 v) + { + return csum(v * uint2(0x4473BBB1u, 0xCBA11D5Fu)) + 0x685835CFu; + } + + /// + /// Returns a uint2 vector hash code of a uint2 vector. + /// When multiple elements are to be hashes together, it can more efficient to calculate and combine wide hash + /// that are only reduced to a narrow uint hash at the very end instead of at every step. + /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2 hashwide(uint2 v) + { + return (v * uint2(0xC3D32AE1u, 0xB966942Fu)) + 0xFE9856B3u; + } + + /// Returns the result of specified shuffling of the components from two uint2 vectors into a uint value. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint shuffle(uint2 a, uint2 b, ShuffleComponent x) + { + return select_shuffle_component(a, b, x); + } + + /// Returns the result of specified shuffling of the components from two uint2 vectors into a uint2 vector. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2 shuffle(uint2 a, uint2 b, ShuffleComponent x, ShuffleComponent y) + { + return uint2( + select_shuffle_component(a, b, x), + select_shuffle_component(a, b, y)); + } + + /// Returns the result of specified shuffling of the components from two uint2 vectors into a uint3 vector. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint3 shuffle(uint2 a, uint2 b, ShuffleComponent x, ShuffleComponent y, ShuffleComponent z) + { + return uint3( + select_shuffle_component(a, b, x), + select_shuffle_component(a, b, y), + select_shuffle_component(a, b, z)); + } + + /// Returns the result of specified shuffling of the components from two uint2 vectors into a uint4 vector. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint4 shuffle(uint2 a, uint2 b, ShuffleComponent x, ShuffleComponent y, ShuffleComponent z, ShuffleComponent w) + { + return uint4( + select_shuffle_component(a, b, x), + select_shuffle_component(a, b, y), + select_shuffle_component(a, b, z), + select_shuffle_component(a, b, w)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + internal static uint select_shuffle_component(uint2 a, uint2 b, ShuffleComponent component) + { + switch(component) + { + case ShuffleComponent.LeftX: + return a.x; + case ShuffleComponent.LeftY: + return a.y; + case ShuffleComponent.RightX: + return b.x; + case ShuffleComponent.RightY: + return b.y; + default: + throw new System.ArgumentException("Invalid shuffle component: " + component); + } + } + + } +} diff --git a/benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.mathematics@1.1.0/Unity.Mathematics/uint2.gen.cs.meta b/benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.mathematics@1.1.0/Unity.Mathematics/uint2.gen.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..88964915c50ddf7470e1068c8e3d066257c7f885 --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.mathematics@1.1.0/Unity.Mathematics/uint2.gen.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: cdcbf6c3d9b20634c90f40978594a52b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.mathematics@1.1.0/Unity.Mathematics/uint2x2.gen.cs b/benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.mathematics@1.1.0/Unity.Mathematics/uint2x2.gen.cs new file mode 100644 index 0000000000000000000000000000000000000000..0c0592a9a96cbe2334a419b7368684d7c30f28a2 --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.mathematics@1.1.0/Unity.Mathematics/uint2x2.gen.cs @@ -0,0 +1,494 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ +using System; +using System.Runtime.CompilerServices; + +#pragma warning disable 0660, 0661 + +namespace Unity.Mathematics +{ + [System.Serializable] + public partial struct uint2x2 : System.IEquatable, IFormattable + { + public uint2 c0; + public uint2 c1; + + /// uint2x2 identity transform. + public static readonly uint2x2 identity = new uint2x2(1u, 0u, 0u, 1u); + + /// uint2x2 zero value. + public static readonly uint2x2 zero; + + /// Constructs a uint2x2 matrix from two uint2 vectors. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public uint2x2(uint2 c0, uint2 c1) + { + this.c0 = c0; + this.c1 = c1; + } + + /// Constructs a uint2x2 matrix from 4 uint values given in row-major order. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public uint2x2(uint m00, uint m01, + uint m10, uint m11) + { + this.c0 = new uint2(m00, m10); + this.c1 = new uint2(m01, m11); + } + + /// Constructs a uint2x2 matrix from a single uint value by assigning it to every component. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public uint2x2(uint v) + { + this.c0 = v; + this.c1 = v; + } + + /// Constructs a uint2x2 matrix from a single bool value by converting it to uint and assigning it to every component. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public uint2x2(bool v) + { + this.c0 = math.select(new uint2(0u), new uint2(1u), v); + this.c1 = math.select(new uint2(0u), new uint2(1u), v); + } + + /// Constructs a uint2x2 matrix from a bool2x2 matrix by componentwise conversion. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public uint2x2(bool2x2 v) + { + this.c0 = math.select(new uint2(0u), new uint2(1u), v.c0); + this.c1 = math.select(new uint2(0u), new uint2(1u), v.c1); + } + + /// Constructs a uint2x2 matrix from a single int value by converting it to uint and assigning it to every component. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public uint2x2(int v) + { + this.c0 = (uint2)v; + this.c1 = (uint2)v; + } + + /// Constructs a uint2x2 matrix from a int2x2 matrix by componentwise conversion. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public uint2x2(int2x2 v) + { + this.c0 = (uint2)v.c0; + this.c1 = (uint2)v.c1; + } + + /// Constructs a uint2x2 matrix from a single float value by converting it to uint and assigning it to every component. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public uint2x2(float v) + { + this.c0 = (uint2)v; + this.c1 = (uint2)v; + } + + /// Constructs a uint2x2 matrix from a float2x2 matrix by componentwise conversion. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public uint2x2(float2x2 v) + { + this.c0 = (uint2)v.c0; + this.c1 = (uint2)v.c1; + } + + /// Constructs a uint2x2 matrix from a single double value by converting it to uint and assigning it to every component. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public uint2x2(double v) + { + this.c0 = (uint2)v; + this.c1 = (uint2)v; + } + + /// Constructs a uint2x2 matrix from a double2x2 matrix by componentwise conversion. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public uint2x2(double2x2 v) + { + this.c0 = (uint2)v.c0; + this.c1 = (uint2)v.c1; + } + + + /// Implicitly converts a single uint value to a uint2x2 matrix by assigning it to every component. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static implicit operator uint2x2(uint v) { return new uint2x2(v); } + + /// Explicitly converts a single bool value to a uint2x2 matrix by converting it to uint and assigning it to every component. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static explicit operator uint2x2(bool v) { return new uint2x2(v); } + + /// Explicitly converts a bool2x2 matrix to a uint2x2 matrix by componentwise conversion. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static explicit operator uint2x2(bool2x2 v) { return new uint2x2(v); } + + /// Explicitly converts a single int value to a uint2x2 matrix by converting it to uint and assigning it to every component. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static explicit operator uint2x2(int v) { return new uint2x2(v); } + + /// Explicitly converts a int2x2 matrix to a uint2x2 matrix by componentwise conversion. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static explicit operator uint2x2(int2x2 v) { return new uint2x2(v); } + + /// Explicitly converts a single float value to a uint2x2 matrix by converting it to uint and assigning it to every component. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static explicit operator uint2x2(float v) { return new uint2x2(v); } + + /// Explicitly converts a float2x2 matrix to a uint2x2 matrix by componentwise conversion. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static explicit operator uint2x2(float2x2 v) { return new uint2x2(v); } + + /// Explicitly converts a single double value to a uint2x2 matrix by converting it to uint and assigning it to every component. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static explicit operator uint2x2(double v) { return new uint2x2(v); } + + /// Explicitly converts a double2x2 matrix to a uint2x2 matrix by componentwise conversion. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static explicit operator uint2x2(double2x2 v) { return new uint2x2(v); } + + + /// Returns the result of a componentwise multiplication operation on two uint2x2 matrices. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2x2 operator * (uint2x2 lhs, uint2x2 rhs) { return new uint2x2 (lhs.c0 * rhs.c0, lhs.c1 * rhs.c1); } + + /// Returns the result of a componentwise multiplication operation on a uint2x2 matrix and a uint value. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2x2 operator * (uint2x2 lhs, uint rhs) { return new uint2x2 (lhs.c0 * rhs, lhs.c1 * rhs); } + + /// Returns the result of a componentwise multiplication operation on a uint value and a uint2x2 matrix. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2x2 operator * (uint lhs, uint2x2 rhs) { return new uint2x2 (lhs * rhs.c0, lhs * rhs.c1); } + + + /// Returns the result of a componentwise addition operation on two uint2x2 matrices. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2x2 operator + (uint2x2 lhs, uint2x2 rhs) { return new uint2x2 (lhs.c0 + rhs.c0, lhs.c1 + rhs.c1); } + + /// Returns the result of a componentwise addition operation on a uint2x2 matrix and a uint value. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2x2 operator + (uint2x2 lhs, uint rhs) { return new uint2x2 (lhs.c0 + rhs, lhs.c1 + rhs); } + + /// Returns the result of a componentwise addition operation on a uint value and a uint2x2 matrix. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2x2 operator + (uint lhs, uint2x2 rhs) { return new uint2x2 (lhs + rhs.c0, lhs + rhs.c1); } + + + /// Returns the result of a componentwise subtraction operation on two uint2x2 matrices. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2x2 operator - (uint2x2 lhs, uint2x2 rhs) { return new uint2x2 (lhs.c0 - rhs.c0, lhs.c1 - rhs.c1); } + + /// Returns the result of a componentwise subtraction operation on a uint2x2 matrix and a uint value. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2x2 operator - (uint2x2 lhs, uint rhs) { return new uint2x2 (lhs.c0 - rhs, lhs.c1 - rhs); } + + /// Returns the result of a componentwise subtraction operation on a uint value and a uint2x2 matrix. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2x2 operator - (uint lhs, uint2x2 rhs) { return new uint2x2 (lhs - rhs.c0, lhs - rhs.c1); } + + + /// Returns the result of a componentwise division operation on two uint2x2 matrices. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2x2 operator / (uint2x2 lhs, uint2x2 rhs) { return new uint2x2 (lhs.c0 / rhs.c0, lhs.c1 / rhs.c1); } + + /// Returns the result of a componentwise division operation on a uint2x2 matrix and a uint value. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2x2 operator / (uint2x2 lhs, uint rhs) { return new uint2x2 (lhs.c0 / rhs, lhs.c1 / rhs); } + + /// Returns the result of a componentwise division operation on a uint value and a uint2x2 matrix. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2x2 operator / (uint lhs, uint2x2 rhs) { return new uint2x2 (lhs / rhs.c0, lhs / rhs.c1); } + + + /// Returns the result of a componentwise modulus operation on two uint2x2 matrices. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2x2 operator % (uint2x2 lhs, uint2x2 rhs) { return new uint2x2 (lhs.c0 % rhs.c0, lhs.c1 % rhs.c1); } + + /// Returns the result of a componentwise modulus operation on a uint2x2 matrix and a uint value. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2x2 operator % (uint2x2 lhs, uint rhs) { return new uint2x2 (lhs.c0 % rhs, lhs.c1 % rhs); } + + /// Returns the result of a componentwise modulus operation on a uint value and a uint2x2 matrix. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2x2 operator % (uint lhs, uint2x2 rhs) { return new uint2x2 (lhs % rhs.c0, lhs % rhs.c1); } + + + /// Returns the result of a componentwise increment operation on a uint2x2 matrix. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2x2 operator ++ (uint2x2 val) { return new uint2x2 (++val.c0, ++val.c1); } + + + /// Returns the result of a componentwise decrement operation on a uint2x2 matrix. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2x2 operator -- (uint2x2 val) { return new uint2x2 (--val.c0, --val.c1); } + + + /// Returns the result of a componentwise less than operation on two uint2x2 matrices. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool2x2 operator < (uint2x2 lhs, uint2x2 rhs) { return new bool2x2 (lhs.c0 < rhs.c0, lhs.c1 < rhs.c1); } + + /// Returns the result of a componentwise less than operation on a uint2x2 matrix and a uint value. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool2x2 operator < (uint2x2 lhs, uint rhs) { return new bool2x2 (lhs.c0 < rhs, lhs.c1 < rhs); } + + /// Returns the result of a componentwise less than operation on a uint value and a uint2x2 matrix. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool2x2 operator < (uint lhs, uint2x2 rhs) { return new bool2x2 (lhs < rhs.c0, lhs < rhs.c1); } + + + /// Returns the result of a componentwise less or equal operation on two uint2x2 matrices. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool2x2 operator <= (uint2x2 lhs, uint2x2 rhs) { return new bool2x2 (lhs.c0 <= rhs.c0, lhs.c1 <= rhs.c1); } + + /// Returns the result of a componentwise less or equal operation on a uint2x2 matrix and a uint value. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool2x2 operator <= (uint2x2 lhs, uint rhs) { return new bool2x2 (lhs.c0 <= rhs, lhs.c1 <= rhs); } + + /// Returns the result of a componentwise less or equal operation on a uint value and a uint2x2 matrix. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool2x2 operator <= (uint lhs, uint2x2 rhs) { return new bool2x2 (lhs <= rhs.c0, lhs <= rhs.c1); } + + + /// Returns the result of a componentwise greater than operation on two uint2x2 matrices. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool2x2 operator > (uint2x2 lhs, uint2x2 rhs) { return new bool2x2 (lhs.c0 > rhs.c0, lhs.c1 > rhs.c1); } + + /// Returns the result of a componentwise greater than operation on a uint2x2 matrix and a uint value. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool2x2 operator > (uint2x2 lhs, uint rhs) { return new bool2x2 (lhs.c0 > rhs, lhs.c1 > rhs); } + + /// Returns the result of a componentwise greater than operation on a uint value and a uint2x2 matrix. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool2x2 operator > (uint lhs, uint2x2 rhs) { return new bool2x2 (lhs > rhs.c0, lhs > rhs.c1); } + + + /// Returns the result of a componentwise greater or equal operation on two uint2x2 matrices. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool2x2 operator >= (uint2x2 lhs, uint2x2 rhs) { return new bool2x2 (lhs.c0 >= rhs.c0, lhs.c1 >= rhs.c1); } + + /// Returns the result of a componentwise greater or equal operation on a uint2x2 matrix and a uint value. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool2x2 operator >= (uint2x2 lhs, uint rhs) { return new bool2x2 (lhs.c0 >= rhs, lhs.c1 >= rhs); } + + /// Returns the result of a componentwise greater or equal operation on a uint value and a uint2x2 matrix. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool2x2 operator >= (uint lhs, uint2x2 rhs) { return new bool2x2 (lhs >= rhs.c0, lhs >= rhs.c1); } + + + /// Returns the result of a componentwise unary minus operation on a uint2x2 matrix. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2x2 operator - (uint2x2 val) { return new uint2x2 (-val.c0, -val.c1); } + + + /// Returns the result of a componentwise unary plus operation on a uint2x2 matrix. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2x2 operator + (uint2x2 val) { return new uint2x2 (+val.c0, +val.c1); } + + + /// Returns the result of a componentwise left shift operation on a uint2x2 matrix by a number of bits specified by a single int. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2x2 operator << (uint2x2 x, int n) { return new uint2x2 (x.c0 << n, x.c1 << n); } + + /// Returns the result of a componentwise right shift operation on a uint2x2 matrix by a number of bits specified by a single int. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2x2 operator >> (uint2x2 x, int n) { return new uint2x2 (x.c0 >> n, x.c1 >> n); } + + /// Returns the result of a componentwise equality operation on two uint2x2 matrices. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool2x2 operator == (uint2x2 lhs, uint2x2 rhs) { return new bool2x2 (lhs.c0 == rhs.c0, lhs.c1 == rhs.c1); } + + /// Returns the result of a componentwise equality operation on a uint2x2 matrix and a uint value. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool2x2 operator == (uint2x2 lhs, uint rhs) { return new bool2x2 (lhs.c0 == rhs, lhs.c1 == rhs); } + + /// Returns the result of a componentwise equality operation on a uint value and a uint2x2 matrix. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool2x2 operator == (uint lhs, uint2x2 rhs) { return new bool2x2 (lhs == rhs.c0, lhs == rhs.c1); } + + + /// Returns the result of a componentwise not equal operation on two uint2x2 matrices. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool2x2 operator != (uint2x2 lhs, uint2x2 rhs) { return new bool2x2 (lhs.c0 != rhs.c0, lhs.c1 != rhs.c1); } + + /// Returns the result of a componentwise not equal operation on a uint2x2 matrix and a uint value. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool2x2 operator != (uint2x2 lhs, uint rhs) { return new bool2x2 (lhs.c0 != rhs, lhs.c1 != rhs); } + + /// Returns the result of a componentwise not equal operation on a uint value and a uint2x2 matrix. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool2x2 operator != (uint lhs, uint2x2 rhs) { return new bool2x2 (lhs != rhs.c0, lhs != rhs.c1); } + + + /// Returns the result of a componentwise bitwise not operation on a uint2x2 matrix. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2x2 operator ~ (uint2x2 val) { return new uint2x2 (~val.c0, ~val.c1); } + + + /// Returns the result of a componentwise bitwise and operation on two uint2x2 matrices. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2x2 operator & (uint2x2 lhs, uint2x2 rhs) { return new uint2x2 (lhs.c0 & rhs.c0, lhs.c1 & rhs.c1); } + + /// Returns the result of a componentwise bitwise and operation on a uint2x2 matrix and a uint value. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2x2 operator & (uint2x2 lhs, uint rhs) { return new uint2x2 (lhs.c0 & rhs, lhs.c1 & rhs); } + + /// Returns the result of a componentwise bitwise and operation on a uint value and a uint2x2 matrix. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2x2 operator & (uint lhs, uint2x2 rhs) { return new uint2x2 (lhs & rhs.c0, lhs & rhs.c1); } + + + /// Returns the result of a componentwise bitwise or operation on two uint2x2 matrices. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2x2 operator | (uint2x2 lhs, uint2x2 rhs) { return new uint2x2 (lhs.c0 | rhs.c0, lhs.c1 | rhs.c1); } + + /// Returns the result of a componentwise bitwise or operation on a uint2x2 matrix and a uint value. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2x2 operator | (uint2x2 lhs, uint rhs) { return new uint2x2 (lhs.c0 | rhs, lhs.c1 | rhs); } + + /// Returns the result of a componentwise bitwise or operation on a uint value and a uint2x2 matrix. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2x2 operator | (uint lhs, uint2x2 rhs) { return new uint2x2 (lhs | rhs.c0, lhs | rhs.c1); } + + + /// Returns the result of a componentwise bitwise exclusive or operation on two uint2x2 matrices. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2x2 operator ^ (uint2x2 lhs, uint2x2 rhs) { return new uint2x2 (lhs.c0 ^ rhs.c0, lhs.c1 ^ rhs.c1); } + + /// Returns the result of a componentwise bitwise exclusive or operation on a uint2x2 matrix and a uint value. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2x2 operator ^ (uint2x2 lhs, uint rhs) { return new uint2x2 (lhs.c0 ^ rhs, lhs.c1 ^ rhs); } + + /// Returns the result of a componentwise bitwise exclusive or operation on a uint value and a uint2x2 matrix. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2x2 operator ^ (uint lhs, uint2x2 rhs) { return new uint2x2 (lhs ^ rhs.c0, lhs ^ rhs.c1); } + + + + /// Returns the uint2 element at a specified index. + unsafe public ref uint2 this[int index] + { + get + { +#if ENABLE_UNITY_COLLECTIONS_CHECKS + if ((uint)index >= 2) + throw new System.ArgumentException("index must be between[0...1]"); +#endif + fixed (uint2x2* array = &this) { return ref ((uint2*)array)[index]; } + } + } + + /// Returns true if the uint2x2 is equal to a given uint2x2, false otherwise. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public bool Equals(uint2x2 rhs) { return c0.Equals(rhs.c0) && c1.Equals(rhs.c1); } + + /// Returns true if the uint2x2 is equal to a given uint2x2, false otherwise. + public override bool Equals(object o) { return Equals((uint2x2)o); } + + + /// Returns a hash code for the uint2x2. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public override int GetHashCode() { return (int)math.hash(this); } + + + /// Returns a string representation of the uint2x2. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public override string ToString() + { + return string.Format("uint2x2({0}, {1}, {2}, {3})", c0.x, c1.x, c0.y, c1.y); + } + + /// Returns a string representation of the uint2x2 using a specified format and culture-specific format information. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public string ToString(string format, IFormatProvider formatProvider) + { + return string.Format("uint2x2({0}, {1}, {2}, {3})", c0.x.ToString(format, formatProvider), c1.x.ToString(format, formatProvider), c0.y.ToString(format, formatProvider), c1.y.ToString(format, formatProvider)); + } + + } + + public static partial class math + { + /// Returns a uint2x2 matrix constructed from two uint2 vectors. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2x2 uint2x2(uint2 c0, uint2 c1) { return new uint2x2(c0, c1); } + + /// Returns a uint2x2 matrix constructed from from 4 uint values given in row-major order. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2x2 uint2x2(uint m00, uint m01, + uint m10, uint m11) + { + return new uint2x2(m00, m01, + m10, m11); + } + + /// Returns a uint2x2 matrix constructed from a single uint value by assigning it to every component. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2x2 uint2x2(uint v) { return new uint2x2(v); } + + /// Returns a uint2x2 matrix constructed from a single bool value by converting it to uint and assigning it to every component. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2x2 uint2x2(bool v) { return new uint2x2(v); } + + /// Return a uint2x2 matrix constructed from a bool2x2 matrix by componentwise conversion. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2x2 uint2x2(bool2x2 v) { return new uint2x2(v); } + + /// Returns a uint2x2 matrix constructed from a single int value by converting it to uint and assigning it to every component. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2x2 uint2x2(int v) { return new uint2x2(v); } + + /// Return a uint2x2 matrix constructed from a int2x2 matrix by componentwise conversion. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2x2 uint2x2(int2x2 v) { return new uint2x2(v); } + + /// Returns a uint2x2 matrix constructed from a single float value by converting it to uint and assigning it to every component. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2x2 uint2x2(float v) { return new uint2x2(v); } + + /// Return a uint2x2 matrix constructed from a float2x2 matrix by componentwise conversion. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2x2 uint2x2(float2x2 v) { return new uint2x2(v); } + + /// Returns a uint2x2 matrix constructed from a single double value by converting it to uint and assigning it to every component. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2x2 uint2x2(double v) { return new uint2x2(v); } + + /// Return a uint2x2 matrix constructed from a double2x2 matrix by componentwise conversion. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2x2 uint2x2(double2x2 v) { return new uint2x2(v); } + + /// Return the uint2x2 transpose of a uint2x2 matrix. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2x2 transpose(uint2x2 v) + { + return uint2x2( + v.c0.x, v.c0.y, + v.c1.x, v.c1.y); + } + + /// Returns a uint hash code of a uint2x2 vector. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint hash(uint2x2 v) + { + return csum(v.c0 * uint2(0xB36DE767u, 0x6FCA387Du) + + v.c1 * uint2(0xAF0F3103u, 0xE4A056C7u)) + 0x841D8225u; + } + + /// + /// Returns a uint2 vector hash code of a uint2x2 vector. + /// When multiple elements are to be hashes together, it can more efficient to calculate and combine wide hash + /// that are only reduced to a narrow uint hash at the very end instead of at every step. + /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2 hashwide(uint2x2 v) + { + return (v.c0 * uint2(0xC9393C7Du, 0xD42EAFA3u) + + v.c1 * uint2(0xD9AFD06Du, 0x97A65421u)) + 0x7809205Fu; + } + + } +} diff --git a/benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.mathematics@1.1.0/Unity.Mathematics/uint2x2.gen.cs.meta b/benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.mathematics@1.1.0/Unity.Mathematics/uint2x2.gen.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..2fb0e2ce7356e02c547579de4416e5eacc37c6f6 --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.mathematics@1.1.0/Unity.Mathematics/uint2x2.gen.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 93a63257a84804542ad359995ba0c1b1 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.mathematics@1.1.0/Unity.Mathematics/uint2x3.gen.cs b/benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.mathematics@1.1.0/Unity.Mathematics/uint2x3.gen.cs new file mode 100644 index 0000000000000000000000000000000000000000..75a42f9855442be38841da37c130df25f1dcdcc6 --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.mathematics@1.1.0/Unity.Mathematics/uint2x3.gen.cs @@ -0,0 +1,506 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ +using System; +using System.Runtime.CompilerServices; + +#pragma warning disable 0660, 0661 + +namespace Unity.Mathematics +{ + [System.Serializable] + public partial struct uint2x3 : System.IEquatable, IFormattable + { + public uint2 c0; + public uint2 c1; + public uint2 c2; + + /// uint2x3 zero value. + public static readonly uint2x3 zero; + + /// Constructs a uint2x3 matrix from three uint2 vectors. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public uint2x3(uint2 c0, uint2 c1, uint2 c2) + { + this.c0 = c0; + this.c1 = c1; + this.c2 = c2; + } + + /// Constructs a uint2x3 matrix from 6 uint values given in row-major order. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public uint2x3(uint m00, uint m01, uint m02, + uint m10, uint m11, uint m12) + { + this.c0 = new uint2(m00, m10); + this.c1 = new uint2(m01, m11); + this.c2 = new uint2(m02, m12); + } + + /// Constructs a uint2x3 matrix from a single uint value by assigning it to every component. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public uint2x3(uint v) + { + this.c0 = v; + this.c1 = v; + this.c2 = v; + } + + /// Constructs a uint2x3 matrix from a single bool value by converting it to uint and assigning it to every component. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public uint2x3(bool v) + { + this.c0 = math.select(new uint2(0u), new uint2(1u), v); + this.c1 = math.select(new uint2(0u), new uint2(1u), v); + this.c2 = math.select(new uint2(0u), new uint2(1u), v); + } + + /// Constructs a uint2x3 matrix from a bool2x3 matrix by componentwise conversion. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public uint2x3(bool2x3 v) + { + this.c0 = math.select(new uint2(0u), new uint2(1u), v.c0); + this.c1 = math.select(new uint2(0u), new uint2(1u), v.c1); + this.c2 = math.select(new uint2(0u), new uint2(1u), v.c2); + } + + /// Constructs a uint2x3 matrix from a single int value by converting it to uint and assigning it to every component. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public uint2x3(int v) + { + this.c0 = (uint2)v; + this.c1 = (uint2)v; + this.c2 = (uint2)v; + } + + /// Constructs a uint2x3 matrix from a int2x3 matrix by componentwise conversion. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public uint2x3(int2x3 v) + { + this.c0 = (uint2)v.c0; + this.c1 = (uint2)v.c1; + this.c2 = (uint2)v.c2; + } + + /// Constructs a uint2x3 matrix from a single float value by converting it to uint and assigning it to every component. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public uint2x3(float v) + { + this.c0 = (uint2)v; + this.c1 = (uint2)v; + this.c2 = (uint2)v; + } + + /// Constructs a uint2x3 matrix from a float2x3 matrix by componentwise conversion. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public uint2x3(float2x3 v) + { + this.c0 = (uint2)v.c0; + this.c1 = (uint2)v.c1; + this.c2 = (uint2)v.c2; + } + + /// Constructs a uint2x3 matrix from a single double value by converting it to uint and assigning it to every component. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public uint2x3(double v) + { + this.c0 = (uint2)v; + this.c1 = (uint2)v; + this.c2 = (uint2)v; + } + + /// Constructs a uint2x3 matrix from a double2x3 matrix by componentwise conversion. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public uint2x3(double2x3 v) + { + this.c0 = (uint2)v.c0; + this.c1 = (uint2)v.c1; + this.c2 = (uint2)v.c2; + } + + + /// Implicitly converts a single uint value to a uint2x3 matrix by assigning it to every component. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static implicit operator uint2x3(uint v) { return new uint2x3(v); } + + /// Explicitly converts a single bool value to a uint2x3 matrix by converting it to uint and assigning it to every component. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static explicit operator uint2x3(bool v) { return new uint2x3(v); } + + /// Explicitly converts a bool2x3 matrix to a uint2x3 matrix by componentwise conversion. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static explicit operator uint2x3(bool2x3 v) { return new uint2x3(v); } + + /// Explicitly converts a single int value to a uint2x3 matrix by converting it to uint and assigning it to every component. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static explicit operator uint2x3(int v) { return new uint2x3(v); } + + /// Explicitly converts a int2x3 matrix to a uint2x3 matrix by componentwise conversion. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static explicit operator uint2x3(int2x3 v) { return new uint2x3(v); } + + /// Explicitly converts a single float value to a uint2x3 matrix by converting it to uint and assigning it to every component. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static explicit operator uint2x3(float v) { return new uint2x3(v); } + + /// Explicitly converts a float2x3 matrix to a uint2x3 matrix by componentwise conversion. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static explicit operator uint2x3(float2x3 v) { return new uint2x3(v); } + + /// Explicitly converts a single double value to a uint2x3 matrix by converting it to uint and assigning it to every component. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static explicit operator uint2x3(double v) { return new uint2x3(v); } + + /// Explicitly converts a double2x3 matrix to a uint2x3 matrix by componentwise conversion. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static explicit operator uint2x3(double2x3 v) { return new uint2x3(v); } + + + /// Returns the result of a componentwise multiplication operation on two uint2x3 matrices. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2x3 operator * (uint2x3 lhs, uint2x3 rhs) { return new uint2x3 (lhs.c0 * rhs.c0, lhs.c1 * rhs.c1, lhs.c2 * rhs.c2); } + + /// Returns the result of a componentwise multiplication operation on a uint2x3 matrix and a uint value. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2x3 operator * (uint2x3 lhs, uint rhs) { return new uint2x3 (lhs.c0 * rhs, lhs.c1 * rhs, lhs.c2 * rhs); } + + /// Returns the result of a componentwise multiplication operation on a uint value and a uint2x3 matrix. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2x3 operator * (uint lhs, uint2x3 rhs) { return new uint2x3 (lhs * rhs.c0, lhs * rhs.c1, lhs * rhs.c2); } + + + /// Returns the result of a componentwise addition operation on two uint2x3 matrices. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2x3 operator + (uint2x3 lhs, uint2x3 rhs) { return new uint2x3 (lhs.c0 + rhs.c0, lhs.c1 + rhs.c1, lhs.c2 + rhs.c2); } + + /// Returns the result of a componentwise addition operation on a uint2x3 matrix and a uint value. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2x3 operator + (uint2x3 lhs, uint rhs) { return new uint2x3 (lhs.c0 + rhs, lhs.c1 + rhs, lhs.c2 + rhs); } + + /// Returns the result of a componentwise addition operation on a uint value and a uint2x3 matrix. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2x3 operator + (uint lhs, uint2x3 rhs) { return new uint2x3 (lhs + rhs.c0, lhs + rhs.c1, lhs + rhs.c2); } + + + /// Returns the result of a componentwise subtraction operation on two uint2x3 matrices. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2x3 operator - (uint2x3 lhs, uint2x3 rhs) { return new uint2x3 (lhs.c0 - rhs.c0, lhs.c1 - rhs.c1, lhs.c2 - rhs.c2); } + + /// Returns the result of a componentwise subtraction operation on a uint2x3 matrix and a uint value. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2x3 operator - (uint2x3 lhs, uint rhs) { return new uint2x3 (lhs.c0 - rhs, lhs.c1 - rhs, lhs.c2 - rhs); } + + /// Returns the result of a componentwise subtraction operation on a uint value and a uint2x3 matrix. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2x3 operator - (uint lhs, uint2x3 rhs) { return new uint2x3 (lhs - rhs.c0, lhs - rhs.c1, lhs - rhs.c2); } + + + /// Returns the result of a componentwise division operation on two uint2x3 matrices. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2x3 operator / (uint2x3 lhs, uint2x3 rhs) { return new uint2x3 (lhs.c0 / rhs.c0, lhs.c1 / rhs.c1, lhs.c2 / rhs.c2); } + + /// Returns the result of a componentwise division operation on a uint2x3 matrix and a uint value. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2x3 operator / (uint2x3 lhs, uint rhs) { return new uint2x3 (lhs.c0 / rhs, lhs.c1 / rhs, lhs.c2 / rhs); } + + /// Returns the result of a componentwise division operation on a uint value and a uint2x3 matrix. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2x3 operator / (uint lhs, uint2x3 rhs) { return new uint2x3 (lhs / rhs.c0, lhs / rhs.c1, lhs / rhs.c2); } + + + /// Returns the result of a componentwise modulus operation on two uint2x3 matrices. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2x3 operator % (uint2x3 lhs, uint2x3 rhs) { return new uint2x3 (lhs.c0 % rhs.c0, lhs.c1 % rhs.c1, lhs.c2 % rhs.c2); } + + /// Returns the result of a componentwise modulus operation on a uint2x3 matrix and a uint value. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2x3 operator % (uint2x3 lhs, uint rhs) { return new uint2x3 (lhs.c0 % rhs, lhs.c1 % rhs, lhs.c2 % rhs); } + + /// Returns the result of a componentwise modulus operation on a uint value and a uint2x3 matrix. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2x3 operator % (uint lhs, uint2x3 rhs) { return new uint2x3 (lhs % rhs.c0, lhs % rhs.c1, lhs % rhs.c2); } + + + /// Returns the result of a componentwise increment operation on a uint2x3 matrix. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2x3 operator ++ (uint2x3 val) { return new uint2x3 (++val.c0, ++val.c1, ++val.c2); } + + + /// Returns the result of a componentwise decrement operation on a uint2x3 matrix. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2x3 operator -- (uint2x3 val) { return new uint2x3 (--val.c0, --val.c1, --val.c2); } + + + /// Returns the result of a componentwise less than operation on two uint2x3 matrices. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool2x3 operator < (uint2x3 lhs, uint2x3 rhs) { return new bool2x3 (lhs.c0 < rhs.c0, lhs.c1 < rhs.c1, lhs.c2 < rhs.c2); } + + /// Returns the result of a componentwise less than operation on a uint2x3 matrix and a uint value. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool2x3 operator < (uint2x3 lhs, uint rhs) { return new bool2x3 (lhs.c0 < rhs, lhs.c1 < rhs, lhs.c2 < rhs); } + + /// Returns the result of a componentwise less than operation on a uint value and a uint2x3 matrix. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool2x3 operator < (uint lhs, uint2x3 rhs) { return new bool2x3 (lhs < rhs.c0, lhs < rhs.c1, lhs < rhs.c2); } + + + /// Returns the result of a componentwise less or equal operation on two uint2x3 matrices. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool2x3 operator <= (uint2x3 lhs, uint2x3 rhs) { return new bool2x3 (lhs.c0 <= rhs.c0, lhs.c1 <= rhs.c1, lhs.c2 <= rhs.c2); } + + /// Returns the result of a componentwise less or equal operation on a uint2x3 matrix and a uint value. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool2x3 operator <= (uint2x3 lhs, uint rhs) { return new bool2x3 (lhs.c0 <= rhs, lhs.c1 <= rhs, lhs.c2 <= rhs); } + + /// Returns the result of a componentwise less or equal operation on a uint value and a uint2x3 matrix. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool2x3 operator <= (uint lhs, uint2x3 rhs) { return new bool2x3 (lhs <= rhs.c0, lhs <= rhs.c1, lhs <= rhs.c2); } + + + /// Returns the result of a componentwise greater than operation on two uint2x3 matrices. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool2x3 operator > (uint2x3 lhs, uint2x3 rhs) { return new bool2x3 (lhs.c0 > rhs.c0, lhs.c1 > rhs.c1, lhs.c2 > rhs.c2); } + + /// Returns the result of a componentwise greater than operation on a uint2x3 matrix and a uint value. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool2x3 operator > (uint2x3 lhs, uint rhs) { return new bool2x3 (lhs.c0 > rhs, lhs.c1 > rhs, lhs.c2 > rhs); } + + /// Returns the result of a componentwise greater than operation on a uint value and a uint2x3 matrix. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool2x3 operator > (uint lhs, uint2x3 rhs) { return new bool2x3 (lhs > rhs.c0, lhs > rhs.c1, lhs > rhs.c2); } + + + /// Returns the result of a componentwise greater or equal operation on two uint2x3 matrices. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool2x3 operator >= (uint2x3 lhs, uint2x3 rhs) { return new bool2x3 (lhs.c0 >= rhs.c0, lhs.c1 >= rhs.c1, lhs.c2 >= rhs.c2); } + + /// Returns the result of a componentwise greater or equal operation on a uint2x3 matrix and a uint value. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool2x3 operator >= (uint2x3 lhs, uint rhs) { return new bool2x3 (lhs.c0 >= rhs, lhs.c1 >= rhs, lhs.c2 >= rhs); } + + /// Returns the result of a componentwise greater or equal operation on a uint value and a uint2x3 matrix. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool2x3 operator >= (uint lhs, uint2x3 rhs) { return new bool2x3 (lhs >= rhs.c0, lhs >= rhs.c1, lhs >= rhs.c2); } + + + /// Returns the result of a componentwise unary minus operation on a uint2x3 matrix. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2x3 operator - (uint2x3 val) { return new uint2x3 (-val.c0, -val.c1, -val.c2); } + + + /// Returns the result of a componentwise unary plus operation on a uint2x3 matrix. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2x3 operator + (uint2x3 val) { return new uint2x3 (+val.c0, +val.c1, +val.c2); } + + + /// Returns the result of a componentwise left shift operation on a uint2x3 matrix by a number of bits specified by a single int. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2x3 operator << (uint2x3 x, int n) { return new uint2x3 (x.c0 << n, x.c1 << n, x.c2 << n); } + + /// Returns the result of a componentwise right shift operation on a uint2x3 matrix by a number of bits specified by a single int. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2x3 operator >> (uint2x3 x, int n) { return new uint2x3 (x.c0 >> n, x.c1 >> n, x.c2 >> n); } + + /// Returns the result of a componentwise equality operation on two uint2x3 matrices. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool2x3 operator == (uint2x3 lhs, uint2x3 rhs) { return new bool2x3 (lhs.c0 == rhs.c0, lhs.c1 == rhs.c1, lhs.c2 == rhs.c2); } + + /// Returns the result of a componentwise equality operation on a uint2x3 matrix and a uint value. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool2x3 operator == (uint2x3 lhs, uint rhs) { return new bool2x3 (lhs.c0 == rhs, lhs.c1 == rhs, lhs.c2 == rhs); } + + /// Returns the result of a componentwise equality operation on a uint value and a uint2x3 matrix. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool2x3 operator == (uint lhs, uint2x3 rhs) { return new bool2x3 (lhs == rhs.c0, lhs == rhs.c1, lhs == rhs.c2); } + + + /// Returns the result of a componentwise not equal operation on two uint2x3 matrices. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool2x3 operator != (uint2x3 lhs, uint2x3 rhs) { return new bool2x3 (lhs.c0 != rhs.c0, lhs.c1 != rhs.c1, lhs.c2 != rhs.c2); } + + /// Returns the result of a componentwise not equal operation on a uint2x3 matrix and a uint value. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool2x3 operator != (uint2x3 lhs, uint rhs) { return new bool2x3 (lhs.c0 != rhs, lhs.c1 != rhs, lhs.c2 != rhs); } + + /// Returns the result of a componentwise not equal operation on a uint value and a uint2x3 matrix. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool2x3 operator != (uint lhs, uint2x3 rhs) { return new bool2x3 (lhs != rhs.c0, lhs != rhs.c1, lhs != rhs.c2); } + + + /// Returns the result of a componentwise bitwise not operation on a uint2x3 matrix. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2x3 operator ~ (uint2x3 val) { return new uint2x3 (~val.c0, ~val.c1, ~val.c2); } + + + /// Returns the result of a componentwise bitwise and operation on two uint2x3 matrices. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2x3 operator & (uint2x3 lhs, uint2x3 rhs) { return new uint2x3 (lhs.c0 & rhs.c0, lhs.c1 & rhs.c1, lhs.c2 & rhs.c2); } + + /// Returns the result of a componentwise bitwise and operation on a uint2x3 matrix and a uint value. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2x3 operator & (uint2x3 lhs, uint rhs) { return new uint2x3 (lhs.c0 & rhs, lhs.c1 & rhs, lhs.c2 & rhs); } + + /// Returns the result of a componentwise bitwise and operation on a uint value and a uint2x3 matrix. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2x3 operator & (uint lhs, uint2x3 rhs) { return new uint2x3 (lhs & rhs.c0, lhs & rhs.c1, lhs & rhs.c2); } + + + /// Returns the result of a componentwise bitwise or operation on two uint2x3 matrices. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2x3 operator | (uint2x3 lhs, uint2x3 rhs) { return new uint2x3 (lhs.c0 | rhs.c0, lhs.c1 | rhs.c1, lhs.c2 | rhs.c2); } + + /// Returns the result of a componentwise bitwise or operation on a uint2x3 matrix and a uint value. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2x3 operator | (uint2x3 lhs, uint rhs) { return new uint2x3 (lhs.c0 | rhs, lhs.c1 | rhs, lhs.c2 | rhs); } + + /// Returns the result of a componentwise bitwise or operation on a uint value and a uint2x3 matrix. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2x3 operator | (uint lhs, uint2x3 rhs) { return new uint2x3 (lhs | rhs.c0, lhs | rhs.c1, lhs | rhs.c2); } + + + /// Returns the result of a componentwise bitwise exclusive or operation on two uint2x3 matrices. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2x3 operator ^ (uint2x3 lhs, uint2x3 rhs) { return new uint2x3 (lhs.c0 ^ rhs.c0, lhs.c1 ^ rhs.c1, lhs.c2 ^ rhs.c2); } + + /// Returns the result of a componentwise bitwise exclusive or operation on a uint2x3 matrix and a uint value. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2x3 operator ^ (uint2x3 lhs, uint rhs) { return new uint2x3 (lhs.c0 ^ rhs, lhs.c1 ^ rhs, lhs.c2 ^ rhs); } + + /// Returns the result of a componentwise bitwise exclusive or operation on a uint value and a uint2x3 matrix. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2x3 operator ^ (uint lhs, uint2x3 rhs) { return new uint2x3 (lhs ^ rhs.c0, lhs ^ rhs.c1, lhs ^ rhs.c2); } + + + + /// Returns the uint2 element at a specified index. + unsafe public ref uint2 this[int index] + { + get + { +#if ENABLE_UNITY_COLLECTIONS_CHECKS + if ((uint)index >= 3) + throw new System.ArgumentException("index must be between[0...2]"); +#endif + fixed (uint2x3* array = &this) { return ref ((uint2*)array)[index]; } + } + } + + /// Returns true if the uint2x3 is equal to a given uint2x3, false otherwise. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public bool Equals(uint2x3 rhs) { return c0.Equals(rhs.c0) && c1.Equals(rhs.c1) && c2.Equals(rhs.c2); } + + /// Returns true if the uint2x3 is equal to a given uint2x3, false otherwise. + public override bool Equals(object o) { return Equals((uint2x3)o); } + + + /// Returns a hash code for the uint2x3. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public override int GetHashCode() { return (int)math.hash(this); } + + + /// Returns a string representation of the uint2x3. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public override string ToString() + { + return string.Format("uint2x3({0}, {1}, {2}, {3}, {4}, {5})", c0.x, c1.x, c2.x, c0.y, c1.y, c2.y); + } + + /// Returns a string representation of the uint2x3 using a specified format and culture-specific format information. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public string ToString(string format, IFormatProvider formatProvider) + { + return string.Format("uint2x3({0}, {1}, {2}, {3}, {4}, {5})", c0.x.ToString(format, formatProvider), c1.x.ToString(format, formatProvider), c2.x.ToString(format, formatProvider), c0.y.ToString(format, formatProvider), c1.y.ToString(format, formatProvider), c2.y.ToString(format, formatProvider)); + } + + } + + public static partial class math + { + /// Returns a uint2x3 matrix constructed from three uint2 vectors. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2x3 uint2x3(uint2 c0, uint2 c1, uint2 c2) { return new uint2x3(c0, c1, c2); } + + /// Returns a uint2x3 matrix constructed from from 6 uint values given in row-major order. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2x3 uint2x3(uint m00, uint m01, uint m02, + uint m10, uint m11, uint m12) + { + return new uint2x3(m00, m01, m02, + m10, m11, m12); + } + + /// Returns a uint2x3 matrix constructed from a single uint value by assigning it to every component. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2x3 uint2x3(uint v) { return new uint2x3(v); } + + /// Returns a uint2x3 matrix constructed from a single bool value by converting it to uint and assigning it to every component. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2x3 uint2x3(bool v) { return new uint2x3(v); } + + /// Return a uint2x3 matrix constructed from a bool2x3 matrix by componentwise conversion. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2x3 uint2x3(bool2x3 v) { return new uint2x3(v); } + + /// Returns a uint2x3 matrix constructed from a single int value by converting it to uint and assigning it to every component. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2x3 uint2x3(int v) { return new uint2x3(v); } + + /// Return a uint2x3 matrix constructed from a int2x3 matrix by componentwise conversion. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2x3 uint2x3(int2x3 v) { return new uint2x3(v); } + + /// Returns a uint2x3 matrix constructed from a single float value by converting it to uint and assigning it to every component. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2x3 uint2x3(float v) { return new uint2x3(v); } + + /// Return a uint2x3 matrix constructed from a float2x3 matrix by componentwise conversion. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2x3 uint2x3(float2x3 v) { return new uint2x3(v); } + + /// Returns a uint2x3 matrix constructed from a single double value by converting it to uint and assigning it to every component. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2x3 uint2x3(double v) { return new uint2x3(v); } + + /// Return a uint2x3 matrix constructed from a double2x3 matrix by componentwise conversion. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2x3 uint2x3(double2x3 v) { return new uint2x3(v); } + + /// Return the uint3x2 transpose of a uint2x3 matrix. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint3x2 transpose(uint2x3 v) + { + return uint3x2( + v.c0.x, v.c0.y, + v.c1.x, v.c1.y, + v.c2.x, v.c2.y); + } + + /// Returns a uint hash code of a uint2x3 vector. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint hash(uint2x3 v) + { + return csum(v.c0 * uint2(0xEF63C699u, 0x9001903Fu) + + v.c1 * uint2(0xA895B9CDu, 0x9D23B201u) + + v.c2 * uint2(0x4B01D3E1u, 0x7461CA0Du)) + 0x79725379u; + } + + /// + /// Returns a uint2 vector hash code of a uint2x3 vector. + /// When multiple elements are to be hashes together, it can more efficient to calculate and combine wide hash + /// that are only reduced to a narrow uint hash at the very end instead of at every step. + /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2 hashwide(uint2x3 v) + { + return (v.c0 * uint2(0xD6258E5Bu, 0xEE390C97u) + + v.c1 * uint2(0x9C8A2F05u, 0x4DDC6509u) + + v.c2 * uint2(0x7CF083CBu, 0x5C4D6CEDu)) + 0xF9137117u; + } + + } +} diff --git a/benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.mathematics@1.1.0/Unity.Mathematics/uint2x3.gen.cs.meta b/benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.mathematics@1.1.0/Unity.Mathematics/uint2x3.gen.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..33e817bc5a1c7e0acefc03ca478bdde1bf0e2bfb --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.mathematics@1.1.0/Unity.Mathematics/uint2x3.gen.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 5b7bf1463aaa942d98a29d05b88ebd4e +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.mathematics@1.1.0/Unity.Mathematics/uint2x4.gen.cs b/benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.mathematics@1.1.0/Unity.Mathematics/uint2x4.gen.cs new file mode 100644 index 0000000000000000000000000000000000000000..34e12e68eca48929604660a9c41e467e8a89f89a --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.mathematics@1.1.0/Unity.Mathematics/uint2x4.gen.cs @@ -0,0 +1,521 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ +using System; +using System.Runtime.CompilerServices; + +#pragma warning disable 0660, 0661 + +namespace Unity.Mathematics +{ + [System.Serializable] + public partial struct uint2x4 : System.IEquatable, IFormattable + { + public uint2 c0; + public uint2 c1; + public uint2 c2; + public uint2 c3; + + /// uint2x4 zero value. + public static readonly uint2x4 zero; + + /// Constructs a uint2x4 matrix from four uint2 vectors. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public uint2x4(uint2 c0, uint2 c1, uint2 c2, uint2 c3) + { + this.c0 = c0; + this.c1 = c1; + this.c2 = c2; + this.c3 = c3; + } + + /// Constructs a uint2x4 matrix from 8 uint values given in row-major order. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public uint2x4(uint m00, uint m01, uint m02, uint m03, + uint m10, uint m11, uint m12, uint m13) + { + this.c0 = new uint2(m00, m10); + this.c1 = new uint2(m01, m11); + this.c2 = new uint2(m02, m12); + this.c3 = new uint2(m03, m13); + } + + /// Constructs a uint2x4 matrix from a single uint value by assigning it to every component. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public uint2x4(uint v) + { + this.c0 = v; + this.c1 = v; + this.c2 = v; + this.c3 = v; + } + + /// Constructs a uint2x4 matrix from a single bool value by converting it to uint and assigning it to every component. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public uint2x4(bool v) + { + this.c0 = math.select(new uint2(0u), new uint2(1u), v); + this.c1 = math.select(new uint2(0u), new uint2(1u), v); + this.c2 = math.select(new uint2(0u), new uint2(1u), v); + this.c3 = math.select(new uint2(0u), new uint2(1u), v); + } + + /// Constructs a uint2x4 matrix from a bool2x4 matrix by componentwise conversion. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public uint2x4(bool2x4 v) + { + this.c0 = math.select(new uint2(0u), new uint2(1u), v.c0); + this.c1 = math.select(new uint2(0u), new uint2(1u), v.c1); + this.c2 = math.select(new uint2(0u), new uint2(1u), v.c2); + this.c3 = math.select(new uint2(0u), new uint2(1u), v.c3); + } + + /// Constructs a uint2x4 matrix from a single int value by converting it to uint and assigning it to every component. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public uint2x4(int v) + { + this.c0 = (uint2)v; + this.c1 = (uint2)v; + this.c2 = (uint2)v; + this.c3 = (uint2)v; + } + + /// Constructs a uint2x4 matrix from a int2x4 matrix by componentwise conversion. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public uint2x4(int2x4 v) + { + this.c0 = (uint2)v.c0; + this.c1 = (uint2)v.c1; + this.c2 = (uint2)v.c2; + this.c3 = (uint2)v.c3; + } + + /// Constructs a uint2x4 matrix from a single float value by converting it to uint and assigning it to every component. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public uint2x4(float v) + { + this.c0 = (uint2)v; + this.c1 = (uint2)v; + this.c2 = (uint2)v; + this.c3 = (uint2)v; + } + + /// Constructs a uint2x4 matrix from a float2x4 matrix by componentwise conversion. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public uint2x4(float2x4 v) + { + this.c0 = (uint2)v.c0; + this.c1 = (uint2)v.c1; + this.c2 = (uint2)v.c2; + this.c3 = (uint2)v.c3; + } + + /// Constructs a uint2x4 matrix from a single double value by converting it to uint and assigning it to every component. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public uint2x4(double v) + { + this.c0 = (uint2)v; + this.c1 = (uint2)v; + this.c2 = (uint2)v; + this.c3 = (uint2)v; + } + + /// Constructs a uint2x4 matrix from a double2x4 matrix by componentwise conversion. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public uint2x4(double2x4 v) + { + this.c0 = (uint2)v.c0; + this.c1 = (uint2)v.c1; + this.c2 = (uint2)v.c2; + this.c3 = (uint2)v.c3; + } + + + /// Implicitly converts a single uint value to a uint2x4 matrix by assigning it to every component. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static implicit operator uint2x4(uint v) { return new uint2x4(v); } + + /// Explicitly converts a single bool value to a uint2x4 matrix by converting it to uint and assigning it to every component. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static explicit operator uint2x4(bool v) { return new uint2x4(v); } + + /// Explicitly converts a bool2x4 matrix to a uint2x4 matrix by componentwise conversion. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static explicit operator uint2x4(bool2x4 v) { return new uint2x4(v); } + + /// Explicitly converts a single int value to a uint2x4 matrix by converting it to uint and assigning it to every component. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static explicit operator uint2x4(int v) { return new uint2x4(v); } + + /// Explicitly converts a int2x4 matrix to a uint2x4 matrix by componentwise conversion. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static explicit operator uint2x4(int2x4 v) { return new uint2x4(v); } + + /// Explicitly converts a single float value to a uint2x4 matrix by converting it to uint and assigning it to every component. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static explicit operator uint2x4(float v) { return new uint2x4(v); } + + /// Explicitly converts a float2x4 matrix to a uint2x4 matrix by componentwise conversion. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static explicit operator uint2x4(float2x4 v) { return new uint2x4(v); } + + /// Explicitly converts a single double value to a uint2x4 matrix by converting it to uint and assigning it to every component. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static explicit operator uint2x4(double v) { return new uint2x4(v); } + + /// Explicitly converts a double2x4 matrix to a uint2x4 matrix by componentwise conversion. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static explicit operator uint2x4(double2x4 v) { return new uint2x4(v); } + + + /// Returns the result of a componentwise multiplication operation on two uint2x4 matrices. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2x4 operator * (uint2x4 lhs, uint2x4 rhs) { return new uint2x4 (lhs.c0 * rhs.c0, lhs.c1 * rhs.c1, lhs.c2 * rhs.c2, lhs.c3 * rhs.c3); } + + /// Returns the result of a componentwise multiplication operation on a uint2x4 matrix and a uint value. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2x4 operator * (uint2x4 lhs, uint rhs) { return new uint2x4 (lhs.c0 * rhs, lhs.c1 * rhs, lhs.c2 * rhs, lhs.c3 * rhs); } + + /// Returns the result of a componentwise multiplication operation on a uint value and a uint2x4 matrix. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2x4 operator * (uint lhs, uint2x4 rhs) { return new uint2x4 (lhs * rhs.c0, lhs * rhs.c1, lhs * rhs.c2, lhs * rhs.c3); } + + + /// Returns the result of a componentwise addition operation on two uint2x4 matrices. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2x4 operator + (uint2x4 lhs, uint2x4 rhs) { return new uint2x4 (lhs.c0 + rhs.c0, lhs.c1 + rhs.c1, lhs.c2 + rhs.c2, lhs.c3 + rhs.c3); } + + /// Returns the result of a componentwise addition operation on a uint2x4 matrix and a uint value. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2x4 operator + (uint2x4 lhs, uint rhs) { return new uint2x4 (lhs.c0 + rhs, lhs.c1 + rhs, lhs.c2 + rhs, lhs.c3 + rhs); } + + /// Returns the result of a componentwise addition operation on a uint value and a uint2x4 matrix. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2x4 operator + (uint lhs, uint2x4 rhs) { return new uint2x4 (lhs + rhs.c0, lhs + rhs.c1, lhs + rhs.c2, lhs + rhs.c3); } + + + /// Returns the result of a componentwise subtraction operation on two uint2x4 matrices. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2x4 operator - (uint2x4 lhs, uint2x4 rhs) { return new uint2x4 (lhs.c0 - rhs.c0, lhs.c1 - rhs.c1, lhs.c2 - rhs.c2, lhs.c3 - rhs.c3); } + + /// Returns the result of a componentwise subtraction operation on a uint2x4 matrix and a uint value. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2x4 operator - (uint2x4 lhs, uint rhs) { return new uint2x4 (lhs.c0 - rhs, lhs.c1 - rhs, lhs.c2 - rhs, lhs.c3 - rhs); } + + /// Returns the result of a componentwise subtraction operation on a uint value and a uint2x4 matrix. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2x4 operator - (uint lhs, uint2x4 rhs) { return new uint2x4 (lhs - rhs.c0, lhs - rhs.c1, lhs - rhs.c2, lhs - rhs.c3); } + + + /// Returns the result of a componentwise division operation on two uint2x4 matrices. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2x4 operator / (uint2x4 lhs, uint2x4 rhs) { return new uint2x4 (lhs.c0 / rhs.c0, lhs.c1 / rhs.c1, lhs.c2 / rhs.c2, lhs.c3 / rhs.c3); } + + /// Returns the result of a componentwise division operation on a uint2x4 matrix and a uint value. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2x4 operator / (uint2x4 lhs, uint rhs) { return new uint2x4 (lhs.c0 / rhs, lhs.c1 / rhs, lhs.c2 / rhs, lhs.c3 / rhs); } + + /// Returns the result of a componentwise division operation on a uint value and a uint2x4 matrix. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2x4 operator / (uint lhs, uint2x4 rhs) { return new uint2x4 (lhs / rhs.c0, lhs / rhs.c1, lhs / rhs.c2, lhs / rhs.c3); } + + + /// Returns the result of a componentwise modulus operation on two uint2x4 matrices. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2x4 operator % (uint2x4 lhs, uint2x4 rhs) { return new uint2x4 (lhs.c0 % rhs.c0, lhs.c1 % rhs.c1, lhs.c2 % rhs.c2, lhs.c3 % rhs.c3); } + + /// Returns the result of a componentwise modulus operation on a uint2x4 matrix and a uint value. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2x4 operator % (uint2x4 lhs, uint rhs) { return new uint2x4 (lhs.c0 % rhs, lhs.c1 % rhs, lhs.c2 % rhs, lhs.c3 % rhs); } + + /// Returns the result of a componentwise modulus operation on a uint value and a uint2x4 matrix. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2x4 operator % (uint lhs, uint2x4 rhs) { return new uint2x4 (lhs % rhs.c0, lhs % rhs.c1, lhs % rhs.c2, lhs % rhs.c3); } + + + /// Returns the result of a componentwise increment operation on a uint2x4 matrix. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2x4 operator ++ (uint2x4 val) { return new uint2x4 (++val.c0, ++val.c1, ++val.c2, ++val.c3); } + + + /// Returns the result of a componentwise decrement operation on a uint2x4 matrix. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2x4 operator -- (uint2x4 val) { return new uint2x4 (--val.c0, --val.c1, --val.c2, --val.c3); } + + + /// Returns the result of a componentwise less than operation on two uint2x4 matrices. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool2x4 operator < (uint2x4 lhs, uint2x4 rhs) { return new bool2x4 (lhs.c0 < rhs.c0, lhs.c1 < rhs.c1, lhs.c2 < rhs.c2, lhs.c3 < rhs.c3); } + + /// Returns the result of a componentwise less than operation on a uint2x4 matrix and a uint value. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool2x4 operator < (uint2x4 lhs, uint rhs) { return new bool2x4 (lhs.c0 < rhs, lhs.c1 < rhs, lhs.c2 < rhs, lhs.c3 < rhs); } + + /// Returns the result of a componentwise less than operation on a uint value and a uint2x4 matrix. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool2x4 operator < (uint lhs, uint2x4 rhs) { return new bool2x4 (lhs < rhs.c0, lhs < rhs.c1, lhs < rhs.c2, lhs < rhs.c3); } + + + /// Returns the result of a componentwise less or equal operation on two uint2x4 matrices. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool2x4 operator <= (uint2x4 lhs, uint2x4 rhs) { return new bool2x4 (lhs.c0 <= rhs.c0, lhs.c1 <= rhs.c1, lhs.c2 <= rhs.c2, lhs.c3 <= rhs.c3); } + + /// Returns the result of a componentwise less or equal operation on a uint2x4 matrix and a uint value. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool2x4 operator <= (uint2x4 lhs, uint rhs) { return new bool2x4 (lhs.c0 <= rhs, lhs.c1 <= rhs, lhs.c2 <= rhs, lhs.c3 <= rhs); } + + /// Returns the result of a componentwise less or equal operation on a uint value and a uint2x4 matrix. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool2x4 operator <= (uint lhs, uint2x4 rhs) { return new bool2x4 (lhs <= rhs.c0, lhs <= rhs.c1, lhs <= rhs.c2, lhs <= rhs.c3); } + + + /// Returns the result of a componentwise greater than operation on two uint2x4 matrices. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool2x4 operator > (uint2x4 lhs, uint2x4 rhs) { return new bool2x4 (lhs.c0 > rhs.c0, lhs.c1 > rhs.c1, lhs.c2 > rhs.c2, lhs.c3 > rhs.c3); } + + /// Returns the result of a componentwise greater than operation on a uint2x4 matrix and a uint value. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool2x4 operator > (uint2x4 lhs, uint rhs) { return new bool2x4 (lhs.c0 > rhs, lhs.c1 > rhs, lhs.c2 > rhs, lhs.c3 > rhs); } + + /// Returns the result of a componentwise greater than operation on a uint value and a uint2x4 matrix. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool2x4 operator > (uint lhs, uint2x4 rhs) { return new bool2x4 (lhs > rhs.c0, lhs > rhs.c1, lhs > rhs.c2, lhs > rhs.c3); } + + + /// Returns the result of a componentwise greater or equal operation on two uint2x4 matrices. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool2x4 operator >= (uint2x4 lhs, uint2x4 rhs) { return new bool2x4 (lhs.c0 >= rhs.c0, lhs.c1 >= rhs.c1, lhs.c2 >= rhs.c2, lhs.c3 >= rhs.c3); } + + /// Returns the result of a componentwise greater or equal operation on a uint2x4 matrix and a uint value. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool2x4 operator >= (uint2x4 lhs, uint rhs) { return new bool2x4 (lhs.c0 >= rhs, lhs.c1 >= rhs, lhs.c2 >= rhs, lhs.c3 >= rhs); } + + /// Returns the result of a componentwise greater or equal operation on a uint value and a uint2x4 matrix. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool2x4 operator >= (uint lhs, uint2x4 rhs) { return new bool2x4 (lhs >= rhs.c0, lhs >= rhs.c1, lhs >= rhs.c2, lhs >= rhs.c3); } + + + /// Returns the result of a componentwise unary minus operation on a uint2x4 matrix. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2x4 operator - (uint2x4 val) { return new uint2x4 (-val.c0, -val.c1, -val.c2, -val.c3); } + + + /// Returns the result of a componentwise unary plus operation on a uint2x4 matrix. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2x4 operator + (uint2x4 val) { return new uint2x4 (+val.c0, +val.c1, +val.c2, +val.c3); } + + + /// Returns the result of a componentwise left shift operation on a uint2x4 matrix by a number of bits specified by a single int. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2x4 operator << (uint2x4 x, int n) { return new uint2x4 (x.c0 << n, x.c1 << n, x.c2 << n, x.c3 << n); } + + /// Returns the result of a componentwise right shift operation on a uint2x4 matrix by a number of bits specified by a single int. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2x4 operator >> (uint2x4 x, int n) { return new uint2x4 (x.c0 >> n, x.c1 >> n, x.c2 >> n, x.c3 >> n); } + + /// Returns the result of a componentwise equality operation on two uint2x4 matrices. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool2x4 operator == (uint2x4 lhs, uint2x4 rhs) { return new bool2x4 (lhs.c0 == rhs.c0, lhs.c1 == rhs.c1, lhs.c2 == rhs.c2, lhs.c3 == rhs.c3); } + + /// Returns the result of a componentwise equality operation on a uint2x4 matrix and a uint value. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool2x4 operator == (uint2x4 lhs, uint rhs) { return new bool2x4 (lhs.c0 == rhs, lhs.c1 == rhs, lhs.c2 == rhs, lhs.c3 == rhs); } + + /// Returns the result of a componentwise equality operation on a uint value and a uint2x4 matrix. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool2x4 operator == (uint lhs, uint2x4 rhs) { return new bool2x4 (lhs == rhs.c0, lhs == rhs.c1, lhs == rhs.c2, lhs == rhs.c3); } + + + /// Returns the result of a componentwise not equal operation on two uint2x4 matrices. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool2x4 operator != (uint2x4 lhs, uint2x4 rhs) { return new bool2x4 (lhs.c0 != rhs.c0, lhs.c1 != rhs.c1, lhs.c2 != rhs.c2, lhs.c3 != rhs.c3); } + + /// Returns the result of a componentwise not equal operation on a uint2x4 matrix and a uint value. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool2x4 operator != (uint2x4 lhs, uint rhs) { return new bool2x4 (lhs.c0 != rhs, lhs.c1 != rhs, lhs.c2 != rhs, lhs.c3 != rhs); } + + /// Returns the result of a componentwise not equal operation on a uint value and a uint2x4 matrix. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool2x4 operator != (uint lhs, uint2x4 rhs) { return new bool2x4 (lhs != rhs.c0, lhs != rhs.c1, lhs != rhs.c2, lhs != rhs.c3); } + + + /// Returns the result of a componentwise bitwise not operation on a uint2x4 matrix. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2x4 operator ~ (uint2x4 val) { return new uint2x4 (~val.c0, ~val.c1, ~val.c2, ~val.c3); } + + + /// Returns the result of a componentwise bitwise and operation on two uint2x4 matrices. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2x4 operator & (uint2x4 lhs, uint2x4 rhs) { return new uint2x4 (lhs.c0 & rhs.c0, lhs.c1 & rhs.c1, lhs.c2 & rhs.c2, lhs.c3 & rhs.c3); } + + /// Returns the result of a componentwise bitwise and operation on a uint2x4 matrix and a uint value. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2x4 operator & (uint2x4 lhs, uint rhs) { return new uint2x4 (lhs.c0 & rhs, lhs.c1 & rhs, lhs.c2 & rhs, lhs.c3 & rhs); } + + /// Returns the result of a componentwise bitwise and operation on a uint value and a uint2x4 matrix. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2x4 operator & (uint lhs, uint2x4 rhs) { return new uint2x4 (lhs & rhs.c0, lhs & rhs.c1, lhs & rhs.c2, lhs & rhs.c3); } + + + /// Returns the result of a componentwise bitwise or operation on two uint2x4 matrices. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2x4 operator | (uint2x4 lhs, uint2x4 rhs) { return new uint2x4 (lhs.c0 | rhs.c0, lhs.c1 | rhs.c1, lhs.c2 | rhs.c2, lhs.c3 | rhs.c3); } + + /// Returns the result of a componentwise bitwise or operation on a uint2x4 matrix and a uint value. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2x4 operator | (uint2x4 lhs, uint rhs) { return new uint2x4 (lhs.c0 | rhs, lhs.c1 | rhs, lhs.c2 | rhs, lhs.c3 | rhs); } + + /// Returns the result of a componentwise bitwise or operation on a uint value and a uint2x4 matrix. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2x4 operator | (uint lhs, uint2x4 rhs) { return new uint2x4 (lhs | rhs.c0, lhs | rhs.c1, lhs | rhs.c2, lhs | rhs.c3); } + + + /// Returns the result of a componentwise bitwise exclusive or operation on two uint2x4 matrices. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2x4 operator ^ (uint2x4 lhs, uint2x4 rhs) { return new uint2x4 (lhs.c0 ^ rhs.c0, lhs.c1 ^ rhs.c1, lhs.c2 ^ rhs.c2, lhs.c3 ^ rhs.c3); } + + /// Returns the result of a componentwise bitwise exclusive or operation on a uint2x4 matrix and a uint value. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2x4 operator ^ (uint2x4 lhs, uint rhs) { return new uint2x4 (lhs.c0 ^ rhs, lhs.c1 ^ rhs, lhs.c2 ^ rhs, lhs.c3 ^ rhs); } + + /// Returns the result of a componentwise bitwise exclusive or operation on a uint value and a uint2x4 matrix. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2x4 operator ^ (uint lhs, uint2x4 rhs) { return new uint2x4 (lhs ^ rhs.c0, lhs ^ rhs.c1, lhs ^ rhs.c2, lhs ^ rhs.c3); } + + + + /// Returns the uint2 element at a specified index. + unsafe public ref uint2 this[int index] + { + get + { +#if ENABLE_UNITY_COLLECTIONS_CHECKS + if ((uint)index >= 4) + throw new System.ArgumentException("index must be between[0...3]"); +#endif + fixed (uint2x4* array = &this) { return ref ((uint2*)array)[index]; } + } + } + + /// Returns true if the uint2x4 is equal to a given uint2x4, false otherwise. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public bool Equals(uint2x4 rhs) { return c0.Equals(rhs.c0) && c1.Equals(rhs.c1) && c2.Equals(rhs.c2) && c3.Equals(rhs.c3); } + + /// Returns true if the uint2x4 is equal to a given uint2x4, false otherwise. + public override bool Equals(object o) { return Equals((uint2x4)o); } + + + /// Returns a hash code for the uint2x4. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public override int GetHashCode() { return (int)math.hash(this); } + + + /// Returns a string representation of the uint2x4. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public override string ToString() + { + return string.Format("uint2x4({0}, {1}, {2}, {3}, {4}, {5}, {6}, {7})", c0.x, c1.x, c2.x, c3.x, c0.y, c1.y, c2.y, c3.y); + } + + /// Returns a string representation of the uint2x4 using a specified format and culture-specific format information. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public string ToString(string format, IFormatProvider formatProvider) + { + return string.Format("uint2x4({0}, {1}, {2}, {3}, {4}, {5}, {6}, {7})", c0.x.ToString(format, formatProvider), c1.x.ToString(format, formatProvider), c2.x.ToString(format, formatProvider), c3.x.ToString(format, formatProvider), c0.y.ToString(format, formatProvider), c1.y.ToString(format, formatProvider), c2.y.ToString(format, formatProvider), c3.y.ToString(format, formatProvider)); + } + + } + + public static partial class math + { + /// Returns a uint2x4 matrix constructed from four uint2 vectors. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2x4 uint2x4(uint2 c0, uint2 c1, uint2 c2, uint2 c3) { return new uint2x4(c0, c1, c2, c3); } + + /// Returns a uint2x4 matrix constructed from from 8 uint values given in row-major order. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2x4 uint2x4(uint m00, uint m01, uint m02, uint m03, + uint m10, uint m11, uint m12, uint m13) + { + return new uint2x4(m00, m01, m02, m03, + m10, m11, m12, m13); + } + + /// Returns a uint2x4 matrix constructed from a single uint value by assigning it to every component. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2x4 uint2x4(uint v) { return new uint2x4(v); } + + /// Returns a uint2x4 matrix constructed from a single bool value by converting it to uint and assigning it to every component. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2x4 uint2x4(bool v) { return new uint2x4(v); } + + /// Return a uint2x4 matrix constructed from a bool2x4 matrix by componentwise conversion. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2x4 uint2x4(bool2x4 v) { return new uint2x4(v); } + + /// Returns a uint2x4 matrix constructed from a single int value by converting it to uint and assigning it to every component. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2x4 uint2x4(int v) { return new uint2x4(v); } + + /// Return a uint2x4 matrix constructed from a int2x4 matrix by componentwise conversion. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2x4 uint2x4(int2x4 v) { return new uint2x4(v); } + + /// Returns a uint2x4 matrix constructed from a single float value by converting it to uint and assigning it to every component. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2x4 uint2x4(float v) { return new uint2x4(v); } + + /// Return a uint2x4 matrix constructed from a float2x4 matrix by componentwise conversion. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2x4 uint2x4(float2x4 v) { return new uint2x4(v); } + + /// Returns a uint2x4 matrix constructed from a single double value by converting it to uint and assigning it to every component. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2x4 uint2x4(double v) { return new uint2x4(v); } + + /// Return a uint2x4 matrix constructed from a double2x4 matrix by componentwise conversion. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2x4 uint2x4(double2x4 v) { return new uint2x4(v); } + + /// Return the uint4x2 transpose of a uint2x4 matrix. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint4x2 transpose(uint2x4 v) + { + return uint4x2( + v.c0.x, v.c0.y, + v.c1.x, v.c1.y, + v.c2.x, v.c2.y, + v.c3.x, v.c3.y); + } + + /// Returns a uint hash code of a uint2x4 vector. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint hash(uint2x4 v) + { + return csum(v.c0 * uint2(0x9DF50593u, 0xF18EEB85u) + + v.c1 * uint2(0x9E19BFC3u, 0x8196B06Fu) + + v.c2 * uint2(0xD24EFA19u, 0x7D8048BBu) + + v.c3 * uint2(0x713BD06Fu, 0x753AD6ADu)) + 0xD19764C7u; + } + + /// + /// Returns a uint2 vector hash code of a uint2x4 vector. + /// When multiple elements are to be hashes together, it can more efficient to calculate and combine wide hash + /// that are only reduced to a narrow uint hash at the very end instead of at every step. + /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2 hashwide(uint2x4 v) + { + return (v.c0 * uint2(0xB5D0BF63u, 0xF9102C5Fu) + + v.c1 * uint2(0x9881FB9Fu, 0x56A1530Du) + + v.c2 * uint2(0x804B722Du, 0x738E50E5u) + + v.c3 * uint2(0x4FC93C25u, 0xCD0445A5u)) + 0xD2B90D9Bu; + } + + } +} diff --git a/benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.mathematics@1.1.0/Unity.Mathematics/uint2x4.gen.cs.meta b/benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.mathematics@1.1.0/Unity.Mathematics/uint2x4.gen.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..058ceff31d8badeeeb1ab7bf87ff06bf9b97e225 --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.mathematics@1.1.0/Unity.Mathematics/uint2x4.gen.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 6acdbd744899541e28c4f19a9398b2b7 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.mathematics@1.1.0/Unity.Mathematics/uint3.gen.cs b/benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.mathematics@1.1.0/Unity.Mathematics/uint3.gen.cs new file mode 100644 index 0000000000000000000000000000000000000000..665d681c21ea3b4b7231b3d687868910c5201e75 --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.mathematics@1.1.0/Unity.Mathematics/uint3.gen.cs @@ -0,0 +1,1556 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ +using System; +using System.Runtime.CompilerServices; +using System.Diagnostics; + +#pragma warning disable 0660, 0661 + +namespace Unity.Mathematics +{ + [DebuggerTypeProxy(typeof(uint3.DebuggerProxy))] + [System.Serializable] + public partial struct uint3 : System.IEquatable, IFormattable + { + public uint x; + public uint y; + public uint z; + + /// uint3 zero value. + public static readonly uint3 zero; + + /// Constructs a uint3 vector from three uint values. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public uint3(uint x, uint y, uint z) + { + this.x = x; + this.y = y; + this.z = z; + } + + /// Constructs a uint3 vector from a uint value and a uint2 vector. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public uint3(uint x, uint2 yz) + { + this.x = x; + this.y = yz.x; + this.z = yz.y; + } + + /// Constructs a uint3 vector from a uint2 vector and a uint value. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public uint3(uint2 xy, uint z) + { + this.x = xy.x; + this.y = xy.y; + this.z = z; + } + + /// Constructs a uint3 vector from a uint3 vector. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public uint3(uint3 xyz) + { + this.x = xyz.x; + this.y = xyz.y; + this.z = xyz.z; + } + + /// Constructs a uint3 vector from a single uint value by assigning it to every component. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public uint3(uint v) + { + this.x = v; + this.y = v; + this.z = v; + } + + /// Constructs a uint3 vector from a single bool value by converting it to uint and assigning it to every component. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public uint3(bool v) + { + this.x = v ? 1u : 0u; + this.y = v ? 1u : 0u; + this.z = v ? 1u : 0u; + } + + /// Constructs a uint3 vector from a bool3 vector by componentwise conversion. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public uint3(bool3 v) + { + this.x = v.x ? 1u : 0u; + this.y = v.y ? 1u : 0u; + this.z = v.z ? 1u : 0u; + } + + /// Constructs a uint3 vector from a single int value by converting it to uint and assigning it to every component. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public uint3(int v) + { + this.x = (uint)v; + this.y = (uint)v; + this.z = (uint)v; + } + + /// Constructs a uint3 vector from a int3 vector by componentwise conversion. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public uint3(int3 v) + { + this.x = (uint)v.x; + this.y = (uint)v.y; + this.z = (uint)v.z; + } + + /// Constructs a uint3 vector from a single float value by converting it to uint and assigning it to every component. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public uint3(float v) + { + this.x = (uint)v; + this.y = (uint)v; + this.z = (uint)v; + } + + /// Constructs a uint3 vector from a float3 vector by componentwise conversion. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public uint3(float3 v) + { + this.x = (uint)v.x; + this.y = (uint)v.y; + this.z = (uint)v.z; + } + + /// Constructs a uint3 vector from a single double value by converting it to uint and assigning it to every component. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public uint3(double v) + { + this.x = (uint)v; + this.y = (uint)v; + this.z = (uint)v; + } + + /// Constructs a uint3 vector from a double3 vector by componentwise conversion. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public uint3(double3 v) + { + this.x = (uint)v.x; + this.y = (uint)v.y; + this.z = (uint)v.z; + } + + + /// Implicitly converts a single uint value to a uint3 vector by assigning it to every component. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static implicit operator uint3(uint v) { return new uint3(v); } + + /// Explicitly converts a single bool value to a uint3 vector by converting it to uint and assigning it to every component. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static explicit operator uint3(bool v) { return new uint3(v); } + + /// Explicitly converts a bool3 vector to a uint3 vector by componentwise conversion. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static explicit operator uint3(bool3 v) { return new uint3(v); } + + /// Explicitly converts a single int value to a uint3 vector by converting it to uint and assigning it to every component. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static explicit operator uint3(int v) { return new uint3(v); } + + /// Explicitly converts a int3 vector to a uint3 vector by componentwise conversion. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static explicit operator uint3(int3 v) { return new uint3(v); } + + /// Explicitly converts a single float value to a uint3 vector by converting it to uint and assigning it to every component. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static explicit operator uint3(float v) { return new uint3(v); } + + /// Explicitly converts a float3 vector to a uint3 vector by componentwise conversion. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static explicit operator uint3(float3 v) { return new uint3(v); } + + /// Explicitly converts a single double value to a uint3 vector by converting it to uint and assigning it to every component. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static explicit operator uint3(double v) { return new uint3(v); } + + /// Explicitly converts a double3 vector to a uint3 vector by componentwise conversion. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static explicit operator uint3(double3 v) { return new uint3(v); } + + + /// Returns the result of a componentwise multiplication operation on two uint3 vectors. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint3 operator * (uint3 lhs, uint3 rhs) { return new uint3 (lhs.x * rhs.x, lhs.y * rhs.y, lhs.z * rhs.z); } + + /// Returns the result of a componentwise multiplication operation on a uint3 vector and a uint value. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint3 operator * (uint3 lhs, uint rhs) { return new uint3 (lhs.x * rhs, lhs.y * rhs, lhs.z * rhs); } + + /// Returns the result of a componentwise multiplication operation on a uint value and a uint3 vector. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint3 operator * (uint lhs, uint3 rhs) { return new uint3 (lhs * rhs.x, lhs * rhs.y, lhs * rhs.z); } + + + /// Returns the result of a componentwise addition operation on two uint3 vectors. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint3 operator + (uint3 lhs, uint3 rhs) { return new uint3 (lhs.x + rhs.x, lhs.y + rhs.y, lhs.z + rhs.z); } + + /// Returns the result of a componentwise addition operation on a uint3 vector and a uint value. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint3 operator + (uint3 lhs, uint rhs) { return new uint3 (lhs.x + rhs, lhs.y + rhs, lhs.z + rhs); } + + /// Returns the result of a componentwise addition operation on a uint value and a uint3 vector. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint3 operator + (uint lhs, uint3 rhs) { return new uint3 (lhs + rhs.x, lhs + rhs.y, lhs + rhs.z); } + + + /// Returns the result of a componentwise subtraction operation on two uint3 vectors. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint3 operator - (uint3 lhs, uint3 rhs) { return new uint3 (lhs.x - rhs.x, lhs.y - rhs.y, lhs.z - rhs.z); } + + /// Returns the result of a componentwise subtraction operation on a uint3 vector and a uint value. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint3 operator - (uint3 lhs, uint rhs) { return new uint3 (lhs.x - rhs, lhs.y - rhs, lhs.z - rhs); } + + /// Returns the result of a componentwise subtraction operation on a uint value and a uint3 vector. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint3 operator - (uint lhs, uint3 rhs) { return new uint3 (lhs - rhs.x, lhs - rhs.y, lhs - rhs.z); } + + + /// Returns the result of a componentwise division operation on two uint3 vectors. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint3 operator / (uint3 lhs, uint3 rhs) { return new uint3 (lhs.x / rhs.x, lhs.y / rhs.y, lhs.z / rhs.z); } + + /// Returns the result of a componentwise division operation on a uint3 vector and a uint value. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint3 operator / (uint3 lhs, uint rhs) { return new uint3 (lhs.x / rhs, lhs.y / rhs, lhs.z / rhs); } + + /// Returns the result of a componentwise division operation on a uint value and a uint3 vector. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint3 operator / (uint lhs, uint3 rhs) { return new uint3 (lhs / rhs.x, lhs / rhs.y, lhs / rhs.z); } + + + /// Returns the result of a componentwise modulus operation on two uint3 vectors. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint3 operator % (uint3 lhs, uint3 rhs) { return new uint3 (lhs.x % rhs.x, lhs.y % rhs.y, lhs.z % rhs.z); } + + /// Returns the result of a componentwise modulus operation on a uint3 vector and a uint value. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint3 operator % (uint3 lhs, uint rhs) { return new uint3 (lhs.x % rhs, lhs.y % rhs, lhs.z % rhs); } + + /// Returns the result of a componentwise modulus operation on a uint value and a uint3 vector. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint3 operator % (uint lhs, uint3 rhs) { return new uint3 (lhs % rhs.x, lhs % rhs.y, lhs % rhs.z); } + + + /// Returns the result of a componentwise increment operation on a uint3 vector. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint3 operator ++ (uint3 val) { return new uint3 (++val.x, ++val.y, ++val.z); } + + + /// Returns the result of a componentwise decrement operation on a uint3 vector. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint3 operator -- (uint3 val) { return new uint3 (--val.x, --val.y, --val.z); } + + + /// Returns the result of a componentwise less than operation on two uint3 vectors. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool3 operator < (uint3 lhs, uint3 rhs) { return new bool3 (lhs.x < rhs.x, lhs.y < rhs.y, lhs.z < rhs.z); } + + /// Returns the result of a componentwise less than operation on a uint3 vector and a uint value. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool3 operator < (uint3 lhs, uint rhs) { return new bool3 (lhs.x < rhs, lhs.y < rhs, lhs.z < rhs); } + + /// Returns the result of a componentwise less than operation on a uint value and a uint3 vector. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool3 operator < (uint lhs, uint3 rhs) { return new bool3 (lhs < rhs.x, lhs < rhs.y, lhs < rhs.z); } + + + /// Returns the result of a componentwise less or equal operation on two uint3 vectors. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool3 operator <= (uint3 lhs, uint3 rhs) { return new bool3 (lhs.x <= rhs.x, lhs.y <= rhs.y, lhs.z <= rhs.z); } + + /// Returns the result of a componentwise less or equal operation on a uint3 vector and a uint value. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool3 operator <= (uint3 lhs, uint rhs) { return new bool3 (lhs.x <= rhs, lhs.y <= rhs, lhs.z <= rhs); } + + /// Returns the result of a componentwise less or equal operation on a uint value and a uint3 vector. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool3 operator <= (uint lhs, uint3 rhs) { return new bool3 (lhs <= rhs.x, lhs <= rhs.y, lhs <= rhs.z); } + + + /// Returns the result of a componentwise greater than operation on two uint3 vectors. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool3 operator > (uint3 lhs, uint3 rhs) { return new bool3 (lhs.x > rhs.x, lhs.y > rhs.y, lhs.z > rhs.z); } + + /// Returns the result of a componentwise greater than operation on a uint3 vector and a uint value. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool3 operator > (uint3 lhs, uint rhs) { return new bool3 (lhs.x > rhs, lhs.y > rhs, lhs.z > rhs); } + + /// Returns the result of a componentwise greater than operation on a uint value and a uint3 vector. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool3 operator > (uint lhs, uint3 rhs) { return new bool3 (lhs > rhs.x, lhs > rhs.y, lhs > rhs.z); } + + + /// Returns the result of a componentwise greater or equal operation on two uint3 vectors. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool3 operator >= (uint3 lhs, uint3 rhs) { return new bool3 (lhs.x >= rhs.x, lhs.y >= rhs.y, lhs.z >= rhs.z); } + + /// Returns the result of a componentwise greater or equal operation on a uint3 vector and a uint value. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool3 operator >= (uint3 lhs, uint rhs) { return new bool3 (lhs.x >= rhs, lhs.y >= rhs, lhs.z >= rhs); } + + /// Returns the result of a componentwise greater or equal operation on a uint value and a uint3 vector. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool3 operator >= (uint lhs, uint3 rhs) { return new bool3 (lhs >= rhs.x, lhs >= rhs.y, lhs >= rhs.z); } + + + /// Returns the result of a componentwise unary minus operation on a uint3 vector. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint3 operator - (uint3 val) { return new uint3 ((uint)-val.x, (uint)-val.y, (uint)-val.z); } + + + /// Returns the result of a componentwise unary plus operation on a uint3 vector. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint3 operator + (uint3 val) { return new uint3 (+val.x, +val.y, +val.z); } + + + /// Returns the result of a componentwise left shift operation on a uint3 vector by a number of bits specified by a single int. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint3 operator << (uint3 x, int n) { return new uint3 (x.x << n, x.y << n, x.z << n); } + + /// Returns the result of a componentwise right shift operation on a uint3 vector by a number of bits specified by a single int. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint3 operator >> (uint3 x, int n) { return new uint3 (x.x >> n, x.y >> n, x.z >> n); } + + /// Returns the result of a componentwise equality operation on two uint3 vectors. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool3 operator == (uint3 lhs, uint3 rhs) { return new bool3 (lhs.x == rhs.x, lhs.y == rhs.y, lhs.z == rhs.z); } + + /// Returns the result of a componentwise equality operation on a uint3 vector and a uint value. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool3 operator == (uint3 lhs, uint rhs) { return new bool3 (lhs.x == rhs, lhs.y == rhs, lhs.z == rhs); } + + /// Returns the result of a componentwise equality operation on a uint value and a uint3 vector. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool3 operator == (uint lhs, uint3 rhs) { return new bool3 (lhs == rhs.x, lhs == rhs.y, lhs == rhs.z); } + + + /// Returns the result of a componentwise not equal operation on two uint3 vectors. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool3 operator != (uint3 lhs, uint3 rhs) { return new bool3 (lhs.x != rhs.x, lhs.y != rhs.y, lhs.z != rhs.z); } + + /// Returns the result of a componentwise not equal operation on a uint3 vector and a uint value. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool3 operator != (uint3 lhs, uint rhs) { return new bool3 (lhs.x != rhs, lhs.y != rhs, lhs.z != rhs); } + + /// Returns the result of a componentwise not equal operation on a uint value and a uint3 vector. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool3 operator != (uint lhs, uint3 rhs) { return new bool3 (lhs != rhs.x, lhs != rhs.y, lhs != rhs.z); } + + + /// Returns the result of a componentwise bitwise not operation on a uint3 vector. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint3 operator ~ (uint3 val) { return new uint3 (~val.x, ~val.y, ~val.z); } + + + /// Returns the result of a componentwise bitwise and operation on two uint3 vectors. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint3 operator & (uint3 lhs, uint3 rhs) { return new uint3 (lhs.x & rhs.x, lhs.y & rhs.y, lhs.z & rhs.z); } + + /// Returns the result of a componentwise bitwise and operation on a uint3 vector and a uint value. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint3 operator & (uint3 lhs, uint rhs) { return new uint3 (lhs.x & rhs, lhs.y & rhs, lhs.z & rhs); } + + /// Returns the result of a componentwise bitwise and operation on a uint value and a uint3 vector. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint3 operator & (uint lhs, uint3 rhs) { return new uint3 (lhs & rhs.x, lhs & rhs.y, lhs & rhs.z); } + + + /// Returns the result of a componentwise bitwise or operation on two uint3 vectors. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint3 operator | (uint3 lhs, uint3 rhs) { return new uint3 (lhs.x | rhs.x, lhs.y | rhs.y, lhs.z | rhs.z); } + + /// Returns the result of a componentwise bitwise or operation on a uint3 vector and a uint value. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint3 operator | (uint3 lhs, uint rhs) { return new uint3 (lhs.x | rhs, lhs.y | rhs, lhs.z | rhs); } + + /// Returns the result of a componentwise bitwise or operation on a uint value and a uint3 vector. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint3 operator | (uint lhs, uint3 rhs) { return new uint3 (lhs | rhs.x, lhs | rhs.y, lhs | rhs.z); } + + + /// Returns the result of a componentwise bitwise exclusive or operation on two uint3 vectors. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint3 operator ^ (uint3 lhs, uint3 rhs) { return new uint3 (lhs.x ^ rhs.x, lhs.y ^ rhs.y, lhs.z ^ rhs.z); } + + /// Returns the result of a componentwise bitwise exclusive or operation on a uint3 vector and a uint value. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint3 operator ^ (uint3 lhs, uint rhs) { return new uint3 (lhs.x ^ rhs, lhs.y ^ rhs, lhs.z ^ rhs); } + + /// Returns the result of a componentwise bitwise exclusive or operation on a uint value and a uint3 vector. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint3 operator ^ (uint lhs, uint3 rhs) { return new uint3 (lhs ^ rhs.x, lhs ^ rhs.y, lhs ^ rhs.z); } + + + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint4 xxxx + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint4(x, x, x, x); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint4 xxxy + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint4(x, x, x, y); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint4 xxxz + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint4(x, x, x, z); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint4 xxyx + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint4(x, x, y, x); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint4 xxyy + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint4(x, x, y, y); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint4 xxyz + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint4(x, x, y, z); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint4 xxzx + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint4(x, x, z, x); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint4 xxzy + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint4(x, x, z, y); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint4 xxzz + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint4(x, x, z, z); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint4 xyxx + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint4(x, y, x, x); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint4 xyxy + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint4(x, y, x, y); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint4 xyxz + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint4(x, y, x, z); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint4 xyyx + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint4(x, y, y, x); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint4 xyyy + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint4(x, y, y, y); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint4 xyyz + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint4(x, y, y, z); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint4 xyzx + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint4(x, y, z, x); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint4 xyzy + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint4(x, y, z, y); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint4 xyzz + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint4(x, y, z, z); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint4 xzxx + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint4(x, z, x, x); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint4 xzxy + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint4(x, z, x, y); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint4 xzxz + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint4(x, z, x, z); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint4 xzyx + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint4(x, z, y, x); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint4 xzyy + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint4(x, z, y, y); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint4 xzyz + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint4(x, z, y, z); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint4 xzzx + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint4(x, z, z, x); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint4 xzzy + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint4(x, z, z, y); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint4 xzzz + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint4(x, z, z, z); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint4 yxxx + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint4(y, x, x, x); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint4 yxxy + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint4(y, x, x, y); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint4 yxxz + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint4(y, x, x, z); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint4 yxyx + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint4(y, x, y, x); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint4 yxyy + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint4(y, x, y, y); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint4 yxyz + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint4(y, x, y, z); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint4 yxzx + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint4(y, x, z, x); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint4 yxzy + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint4(y, x, z, y); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint4 yxzz + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint4(y, x, z, z); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint4 yyxx + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint4(y, y, x, x); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint4 yyxy + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint4(y, y, x, y); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint4 yyxz + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint4(y, y, x, z); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint4 yyyx + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint4(y, y, y, x); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint4 yyyy + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint4(y, y, y, y); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint4 yyyz + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint4(y, y, y, z); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint4 yyzx + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint4(y, y, z, x); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint4 yyzy + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint4(y, y, z, y); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint4 yyzz + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint4(y, y, z, z); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint4 yzxx + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint4(y, z, x, x); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint4 yzxy + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint4(y, z, x, y); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint4 yzxz + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint4(y, z, x, z); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint4 yzyx + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint4(y, z, y, x); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint4 yzyy + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint4(y, z, y, y); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint4 yzyz + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint4(y, z, y, z); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint4 yzzx + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint4(y, z, z, x); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint4 yzzy + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint4(y, z, z, y); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint4 yzzz + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint4(y, z, z, z); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint4 zxxx + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint4(z, x, x, x); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint4 zxxy + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint4(z, x, x, y); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint4 zxxz + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint4(z, x, x, z); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint4 zxyx + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint4(z, x, y, x); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint4 zxyy + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint4(z, x, y, y); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint4 zxyz + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint4(z, x, y, z); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint4 zxzx + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint4(z, x, z, x); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint4 zxzy + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint4(z, x, z, y); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint4 zxzz + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint4(z, x, z, z); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint4 zyxx + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint4(z, y, x, x); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint4 zyxy + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint4(z, y, x, y); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint4 zyxz + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint4(z, y, x, z); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint4 zyyx + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint4(z, y, y, x); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint4 zyyy + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint4(z, y, y, y); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint4 zyyz + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint4(z, y, y, z); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint4 zyzx + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint4(z, y, z, x); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint4 zyzy + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint4(z, y, z, y); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint4 zyzz + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint4(z, y, z, z); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint4 zzxx + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint4(z, z, x, x); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint4 zzxy + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint4(z, z, x, y); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint4 zzxz + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint4(z, z, x, z); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint4 zzyx + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint4(z, z, y, x); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint4 zzyy + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint4(z, z, y, y); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint4 zzyz + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint4(z, z, y, z); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint4 zzzx + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint4(z, z, z, x); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint4 zzzy + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint4(z, z, z, y); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint4 zzzz + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint4(z, z, z, z); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint3 xxx + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint3(x, x, x); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint3 xxy + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint3(x, x, y); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint3 xxz + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint3(x, x, z); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint3 xyx + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint3(x, y, x); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint3 xyy + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint3(x, y, y); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint3 xyz + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint3(x, y, z); } + [MethodImpl(MethodImplOptions.AggressiveInlining)] + set { x = value.x; y = value.y; z = value.z; } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint3 xzx + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint3(x, z, x); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint3 xzy + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint3(x, z, y); } + [MethodImpl(MethodImplOptions.AggressiveInlining)] + set { x = value.x; z = value.y; y = value.z; } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint3 xzz + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint3(x, z, z); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint3 yxx + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint3(y, x, x); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint3 yxy + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint3(y, x, y); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint3 yxz + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint3(y, x, z); } + [MethodImpl(MethodImplOptions.AggressiveInlining)] + set { y = value.x; x = value.y; z = value.z; } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint3 yyx + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint3(y, y, x); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint3 yyy + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint3(y, y, y); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint3 yyz + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint3(y, y, z); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint3 yzx + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint3(y, z, x); } + [MethodImpl(MethodImplOptions.AggressiveInlining)] + set { y = value.x; z = value.y; x = value.z; } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint3 yzy + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint3(y, z, y); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint3 yzz + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint3(y, z, z); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint3 zxx + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint3(z, x, x); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint3 zxy + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint3(z, x, y); } + [MethodImpl(MethodImplOptions.AggressiveInlining)] + set { z = value.x; x = value.y; y = value.z; } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint3 zxz + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint3(z, x, z); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint3 zyx + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint3(z, y, x); } + [MethodImpl(MethodImplOptions.AggressiveInlining)] + set { z = value.x; y = value.y; x = value.z; } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint3 zyy + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint3(z, y, y); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint3 zyz + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint3(z, y, z); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint3 zzx + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint3(z, z, x); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint3 zzy + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint3(z, z, y); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint3 zzz + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint3(z, z, z); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint2 xx + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint2(x, x); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint2 xy + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint2(x, y); } + [MethodImpl(MethodImplOptions.AggressiveInlining)] + set { x = value.x; y = value.y; } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint2 xz + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint2(x, z); } + [MethodImpl(MethodImplOptions.AggressiveInlining)] + set { x = value.x; z = value.y; } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint2 yx + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint2(y, x); } + [MethodImpl(MethodImplOptions.AggressiveInlining)] + set { y = value.x; x = value.y; } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint2 yy + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint2(y, y); } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint2 yz + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint2(y, z); } + [MethodImpl(MethodImplOptions.AggressiveInlining)] + set { y = value.x; z = value.y; } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint2 zx + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint2(z, x); } + [MethodImpl(MethodImplOptions.AggressiveInlining)] + set { z = value.x; x = value.y; } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint2 zy + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint2(z, y); } + [MethodImpl(MethodImplOptions.AggressiveInlining)] + set { z = value.x; y = value.y; } + } + + + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public uint2 zz + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { return new uint2(z, z); } + } + + + + /// Returns the uint element at a specified index. + unsafe public uint this[int index] + { + get + { +#if ENABLE_UNITY_COLLECTIONS_CHECKS + if ((uint)index >= 3) + throw new System.ArgumentException("index must be between[0...2]"); +#endif + fixed (uint3* array = &this) { return ((uint*)array)[index]; } + } + set + { +#if ENABLE_UNITY_COLLECTIONS_CHECKS + if ((uint)index >= 3) + throw new System.ArgumentException("index must be between[0...2]"); +#endif + fixed (uint* array = &x) { array[index] = value; } + } + } + + /// Returns true if the uint3 is equal to a given uint3, false otherwise. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public bool Equals(uint3 rhs) { return x == rhs.x && y == rhs.y && z == rhs.z; } + + /// Returns true if the uint3 is equal to a given uint3, false otherwise. + public override bool Equals(object o) { return Equals((uint3)o); } + + + /// Returns a hash code for the uint3. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public override int GetHashCode() { return (int)math.hash(this); } + + + /// Returns a string representation of the uint3. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public override string ToString() + { + return string.Format("uint3({0}, {1}, {2})", x, y, z); + } + + /// Returns a string representation of the uint3 using a specified format and culture-specific format information. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public string ToString(string format, IFormatProvider formatProvider) + { + return string.Format("uint3({0}, {1}, {2})", x.ToString(format, formatProvider), y.ToString(format, formatProvider), z.ToString(format, formatProvider)); + } + + internal sealed class DebuggerProxy + { + public uint x; + public uint y; + public uint z; + public DebuggerProxy(uint3 v) + { + x = v.x; + y = v.y; + z = v.z; + } + } + + } + + public static partial class math + { + /// Returns a uint3 vector constructed from three uint values. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint3 uint3(uint x, uint y, uint z) { return new uint3(x, y, z); } + + /// Returns a uint3 vector constructed from a uint value and a uint2 vector. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint3 uint3(uint x, uint2 yz) { return new uint3(x, yz); } + + /// Returns a uint3 vector constructed from a uint2 vector and a uint value. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint3 uint3(uint2 xy, uint z) { return new uint3(xy, z); } + + /// Returns a uint3 vector constructed from a uint3 vector. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint3 uint3(uint3 xyz) { return new uint3(xyz); } + + /// Returns a uint3 vector constructed from a single uint value by assigning it to every component. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint3 uint3(uint v) { return new uint3(v); } + + /// Returns a uint3 vector constructed from a single bool value by converting it to uint and assigning it to every component. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint3 uint3(bool v) { return new uint3(v); } + + /// Return a uint3 vector constructed from a bool3 vector by componentwise conversion. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint3 uint3(bool3 v) { return new uint3(v); } + + /// Returns a uint3 vector constructed from a single int value by converting it to uint and assigning it to every component. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint3 uint3(int v) { return new uint3(v); } + + /// Return a uint3 vector constructed from a int3 vector by componentwise conversion. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint3 uint3(int3 v) { return new uint3(v); } + + /// Returns a uint3 vector constructed from a single float value by converting it to uint and assigning it to every component. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint3 uint3(float v) { return new uint3(v); } + + /// Return a uint3 vector constructed from a float3 vector by componentwise conversion. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint3 uint3(float3 v) { return new uint3(v); } + + /// Returns a uint3 vector constructed from a single double value by converting it to uint and assigning it to every component. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint3 uint3(double v) { return new uint3(v); } + + /// Return a uint3 vector constructed from a double3 vector by componentwise conversion. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint3 uint3(double3 v) { return new uint3(v); } + + /// Returns a uint hash code of a uint3 vector. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint hash(uint3 v) + { + return csum(v * uint3(0xCD266C89u, 0xF1852A33u, 0x77E35E77u)) + 0x863E3729u; + } + + /// + /// Returns a uint3 vector hash code of a uint3 vector. + /// When multiple elements are to be hashes together, it can more efficient to calculate and combine wide hash + /// that are only reduced to a narrow uint hash at the very end instead of at every step. + /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint3 hashwide(uint3 v) + { + return (v * uint3(0xE191B035u, 0x68586FAFu, 0xD4DFF6D3u)) + 0xCB634F4Du; + } + + /// Returns the result of specified shuffling of the components from two uint3 vectors into a uint value. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint shuffle(uint3 a, uint3 b, ShuffleComponent x) + { + return select_shuffle_component(a, b, x); + } + + /// Returns the result of specified shuffling of the components from two uint3 vectors into a uint2 vector. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint2 shuffle(uint3 a, uint3 b, ShuffleComponent x, ShuffleComponent y) + { + return uint2( + select_shuffle_component(a, b, x), + select_shuffle_component(a, b, y)); + } + + /// Returns the result of specified shuffling of the components from two uint3 vectors into a uint3 vector. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint3 shuffle(uint3 a, uint3 b, ShuffleComponent x, ShuffleComponent y, ShuffleComponent z) + { + return uint3( + select_shuffle_component(a, b, x), + select_shuffle_component(a, b, y), + select_shuffle_component(a, b, z)); + } + + /// Returns the result of specified shuffling of the components from two uint3 vectors into a uint4 vector. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint4 shuffle(uint3 a, uint3 b, ShuffleComponent x, ShuffleComponent y, ShuffleComponent z, ShuffleComponent w) + { + return uint4( + select_shuffle_component(a, b, x), + select_shuffle_component(a, b, y), + select_shuffle_component(a, b, z), + select_shuffle_component(a, b, w)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + internal static uint select_shuffle_component(uint3 a, uint3 b, ShuffleComponent component) + { + switch(component) + { + case ShuffleComponent.LeftX: + return a.x; + case ShuffleComponent.LeftY: + return a.y; + case ShuffleComponent.LeftZ: + return a.z; + case ShuffleComponent.RightX: + return b.x; + case ShuffleComponent.RightY: + return b.y; + case ShuffleComponent.RightZ: + return b.z; + default: + throw new System.ArgumentException("Invalid shuffle component: " + component); + } + } + + } +}