Flutter Engine
The Flutter Engine
Public Types | Public Member Functions | Public Attributes | List of all members
NFAState Struct Reference

#include <NFAState.h>

Public Types

enum  Kind {
  kAccept_Kind , kChar_Kind , kDot_Kind , kRemapped_Kind ,
  kTable_Kind
}
 

Public Member Functions

 NFAState (Kind kind, std::vector< int > next)
 
 NFAState (char c, std::vector< int > next)
 
 NFAState (std::vector< int > states)
 
 NFAState (bool inverse, std::vector< bool > accepts, std::vector< int > next)
 
 NFAState (int token)
 
bool accept (char c) const
 

Public Attributes

Kind fKind
 
char fChar = 0
 
bool fInverse = false
 
std::vector< intfData
 
std::vector< intfNext
 

Detailed Description

Definition at line 16 of file NFAState.h.

Member Enumeration Documentation

◆ Kind

Enumerator
kAccept_Kind 
kChar_Kind 
kDot_Kind 
kRemapped_Kind 
kTable_Kind 

Definition at line 17 of file NFAState.h.

17 {
18 // represents an accept state - if the NFA ends up in this state, we have successfully
19 // matched the token indicated by fData[0]
21 // matches the single character fChar
23 // the regex '.'; matches any char but '\n'
25 // a state which serves as a placeholder for the states indicated in fData. When we
26 // transition to this state, we instead transition to all of the fData states.
28 // contains a list of true/false values in fData. fData[c] tells us whether we accept the
29 // character c.
31 };
@ kChar_Kind
Definition: NFAState.h:22
@ kTable_Kind
Definition: NFAState.h:30
@ kRemapped_Kind
Definition: NFAState.h:27
@ kDot_Kind
Definition: NFAState.h:24
@ kAccept_Kind
Definition: NFAState.h:20

Constructor & Destructor Documentation

◆ NFAState() [1/5]

NFAState::NFAState ( Kind  kind,
std::vector< int next 
)
inline

Definition at line 33 of file NFAState.h.

34 : fKind(kind)
35 , fNext(std::move(next)) {}
static float next(float f)
std::vector< int > fNext
Definition: NFAState.h:149
Kind fKind
Definition: NFAState.h:140

◆ NFAState() [2/5]

NFAState::NFAState ( char  c,
std::vector< int next 
)
inline

Definition at line 37 of file NFAState.h.

39 , fChar(c)
40 , fNext(std::move(next)) {}
char fChar
Definition: NFAState.h:142

◆ NFAState() [3/5]

NFAState::NFAState ( std::vector< int states)
inline

Definition at line 42 of file NFAState.h.

44 , fData(std::move(states)) {}
std::vector< int > fData
Definition: NFAState.h:146

◆ NFAState() [4/5]

NFAState::NFAState ( bool  inverse,
std::vector< bool >  accepts,
std::vector< int next 
)
inline

Definition at line 46 of file NFAState.h.

48 , fInverse(inverse)
49 , fNext(std::move(next)) {
50 for (bool b : accepts) {
51 fData.push_back(b);
52 }
53 }
static bool b
bool fInverse
Definition: NFAState.h:144

◆ NFAState() [5/5]

NFAState::NFAState ( int  token)
inline

Definition at line 55 of file NFAState.h.

57 fData.push_back(token);
58 }

Member Function Documentation

◆ accept()

bool NFAState::accept ( char  c) const
inline

Definition at line 60 of file NFAState.h.

60 {
61 switch (fKind) {
62 case kAccept_Kind:
63 return false;
64 case kChar_Kind:
65 return c == fChar;
66 case kDot_Kind:
67 return c != '\n';
68 case kTable_Kind: {
69 bool value;
70 if ((size_t) c < fData.size()) {
71 value = fData[c];
72 } else {
73 value = false;
74 }
75 return value != fInverse;
76 }
77 default:
79 }
80 }
#define SkUNREACHABLE
Definition: SkAssert.h:135
uint8_t value

Member Data Documentation

◆ fChar

char NFAState::fChar = 0

Definition at line 142 of file NFAState.h.

◆ fData

std::vector<int> NFAState::fData

Definition at line 146 of file NFAState.h.

◆ fInverse

bool NFAState::fInverse = false

Definition at line 144 of file NFAState.h.

◆ fKind

Kind NFAState::fKind

Definition at line 140 of file NFAState.h.

◆ fNext

std::vector<int> NFAState::fNext

Definition at line 149 of file NFAState.h.


The documentation for this struct was generated from the following file: