Skip to content

Commit

Permalink
fixes for breaking downstream interface changes
Browse files Browse the repository at this point in the history
  • Loading branch information
elstehle committed Jul 16, 2022
1 parent 237456d commit 4aaf595
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions cpp/src/io/json/nested_json_gpu.cu
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,13 @@ namespace gpu {
//------------------------------------------------------------------------------
namespace to_stack_op {

// Type used to represent the target state in the transition table
using StateT = char;

/**
* @brief Definition of the DFA's states
*/
enum DFA_STATES {
enum DFA_STATES : StateT {
// The state being active while being outside of a string. When encountering an opening bracket
// or curly brace, we push it onto the stack. When encountering a closing bracket or brace, we
// pop from the stack.
Expand Down Expand Up @@ -74,7 +77,7 @@ enum DFA_SGID {
const std::vector<std::string> symbol_groups = {"{", "[", "}", "]", "\"", "\\"};

// Transition table
const std::vector<std::vector<int32_t>> transition_table = {
const std::vector<std::vector<StateT>> transition_table = {
/* IN_STATE { [ } ] " \ OTHER */
/* TT_OOS */ {TT_OOS, TT_OOS, TT_OOS, TT_OOS, TT_STR, TT_OOS, TT_OOS},
/* TT_STR */ {TT_STR, TT_STR, TT_STR, TT_STR, TT_OOS, TT_STR, TT_STR},
Expand All @@ -96,6 +99,9 @@ constexpr int32_t start_state = TT_OOS;
//------------------------------------------------------------------------------
namespace tokenizer_pda {

// Type used to represent the target state in the transition table
using StateT = char;

/**
* @brief Symbol groups for the input alphabet for the pushdown automaton
*/
Expand Down Expand Up @@ -183,7 +189,7 @@ struct PdaSymbolToSymbolGroupId {
};

// The states defined by the pushdown automaton
enum pda_state_t : int32_t {
enum pda_state_t : StateT {
PD_BOV,
PD_BOA,
PD_LON,
Expand All @@ -199,19 +205,19 @@ enum pda_state_t : int32_t {
};

// The starting state of the pushdown automaton
constexpr int32_t start_state = PD_BOV;
constexpr StateT start_state = PD_BOV;

// Identity symbol to symbol group lookup table
const std::vector<std::vector<char>> pda_sgids{
{0}, {1}, {2}, {3}, {4}, {5}, {6}, {7}, {8}, {9}, {10}, {11}, {12}, {13}, {14},
{15}, {16}, {17}, {18}, {19}, {20}, {21}, {22}, {23}, {24}, {25}, {26}, {27}, {28}, {29}};

/**
* @brief Getting the transition table
* @brief Getting the transition table
*/
std::vector<std::vector<int32_t>> get_transition_table()
std::vector<std::vector<StateT>> get_transition_table()
{
std::vector<std::vector<int32_t>> pda_tt(PD_NUM_STATES);
std::vector<std::vector<StateT>> pda_tt(PD_NUM_STATES);
pda_tt[PD_BOV] = {PD_BOA, PD_BOA, PD_ERR, PD_ERR, PD_STR, PD_ERR, PD_ERR, PD_ERR, PD_BOV, PD_LON,
PD_BOA, PD_BOA, PD_ERR, PD_ERR, PD_STR, PD_ERR, PD_ERR, PD_ERR, PD_BOV, PD_LON,
PD_BOA, PD_BOA, PD_ERR, PD_ERR, PD_STR, PD_ERR, PD_ERR, PD_ERR, PD_BOV, PD_LON};
Expand Down Expand Up @@ -249,7 +255,7 @@ std::vector<std::vector<int32_t>> get_transition_table()
}

/**
* @brief Getting the translation table
* @brief Getting the translation table
*/
std::vector<std::vector<std::vector<char>>> get_translation_table()
{
Expand Down

0 comments on commit 4aaf595

Please sign in to comment.