libxml2
Loading...
Searching...
No Matches
xmlautomata.h File Reference

API to build regexp automata. More...

Typedefs

typedef struct _xmlAutomata xmlAutomata
 A libxml automata description.
typedef struct _xmlAutomataState xmlAutomataState
 A state in the automata description.

Functions

xmlAutomataxmlNewAutomata (void)
 Create a new automata.
void xmlFreeAutomata (xmlAutomata *am)
 Free an automata.
xmlAutomataStatexmlAutomataGetInitState (xmlAutomata *am)
 Initial state lookup.
int xmlAutomataSetFinalState (xmlAutomata *am, xmlAutomataState *state)
 Makes that state a final state.
xmlAutomataStatexmlAutomataNewState (xmlAutomata *am)
 Create a new disconnected state in the automata.
xmlAutomataStatexmlAutomataNewTransition (xmlAutomata *am, xmlAutomataState *from, xmlAutomataState *to, const xmlChar *token, void *data)
 Add a transition.
xmlAutomataStatexmlAutomataNewTransition2 (xmlAutomata *am, xmlAutomataState *from, xmlAutomataState *to, const xmlChar *token, const xmlChar *token2, void *data)
 If to is NULL, this creates first a new target state in the automata and then adds a transition from the from state to the target state activated by the value of token
xmlAutomataStatexmlAutomataNewNegTrans (xmlAutomata *am, xmlAutomataState *from, xmlAutomataState *to, const xmlChar *token, const xmlChar *token2, void *data)
 If to is NULL, this creates first a new target state in the automata and then adds a transition from the from state to the target state activated by any value except (token,token2) Note that if token2 is not NULL, then (X, NULL) won't match to follow the semantic of XSD ##other.
xmlAutomataStatexmlAutomataNewCountTrans (xmlAutomata *am, xmlAutomataState *from, xmlAutomataState *to, const xmlChar *token, int min, int max, void *data)
 If to is NULL, this creates first a new target state in the automata and then adds a transition from the from state to the target state activated by a succession of input of value token and whose number is between min and max
xmlAutomataStatexmlAutomataNewCountTrans2 (xmlAutomata *am, xmlAutomataState *from, xmlAutomataState *to, const xmlChar *token, const xmlChar *token2, int min, int max, void *data)
 If to is NULL, this creates first a new target state in the automata and then adds a transition from the from state to the target state activated by a succession of input of value token and token2 and whose number is between min and max
xmlAutomataStatexmlAutomataNewOnceTrans (xmlAutomata *am, xmlAutomataState *from, xmlAutomataState *to, const xmlChar *token, int min, int max, void *data)
 If to is NULL, this creates first a new target state in the automata and then adds a transition from the from state to the target state activated by a succession of input of value token and whose number is between min and max, moreover that transition can only be crossed once.
xmlAutomataStatexmlAutomataNewOnceTrans2 (xmlAutomata *am, xmlAutomataState *from, xmlAutomataState *to, const xmlChar *token, const xmlChar *token2, int min, int max, void *data)
 If to is NULL, this creates first a new target state in the automata and then adds a transition from the from state to the target state activated by a succession of input of value token and token2 and whose number is between min and max, moreover that transition can only be crossed once.
xmlAutomataStatexmlAutomataNewAllTrans (xmlAutomata *am, xmlAutomataState *from, xmlAutomataState *to, int lax)
 If to is NULL, this creates first a new target state in the automata and then adds a an ALL transition from the from state to the target state.
xmlAutomataStatexmlAutomataNewEpsilon (xmlAutomata *am, xmlAutomataState *from, xmlAutomataState *to)
 If to is NULL, this creates first a new target state in the automata and then adds an epsilon transition from the from state to the target state.
xmlAutomataStatexmlAutomataNewCountedTrans (xmlAutomata *am, xmlAutomataState *from, xmlAutomataState *to, int counter)
 If to is NULL, this creates first a new target state in the automata and then adds an epsilon transition from the from state to the target state which will increment the counter provided.
xmlAutomataStatexmlAutomataNewCounterTrans (xmlAutomata *am, xmlAutomataState *from, xmlAutomataState *to, int counter)
 If to is NULL, this creates first a new target state in the automata and then adds an epsilon transition from the from state to the target state which will be allowed only if the counter is within the right range.
int xmlAutomataNewCounter (xmlAutomata *am, int min, int max)
 Create a new counter.
struct _xmlRegexp * xmlAutomataCompile (xmlAutomata *am)
 Compile the automata into a Reg Exp ready for being executed.
int xmlAutomataIsDeterminist (xmlAutomata *am)
 Checks if an automata is determinist.

Detailed Description

API to build regexp automata.

These are internal functions and shouldn't be used.

Author
Daniel Veillard

Typedef Documentation

◆ xmlAutomata

typedef struct _xmlAutomata xmlAutomata

A libxml automata description.

It can be compiled into a regexp

Function Documentation

◆ xmlAutomataCompile()

struct _xmlRegexp * xmlAutomataCompile ( xmlAutomata * am)

Compile the automata into a Reg Exp ready for being executed.

The automata should be free after this point.

Deprecated
Internal function, don't use.
Parameters
aman automata
Returns
the compiled regexp or NULL in case of error

◆ xmlAutomataGetInitState()

xmlAutomataState * xmlAutomataGetInitState ( xmlAutomata * am)

Initial state lookup.

Deprecated
Internal function, don't use.
Parameters
aman automata
Returns
the initial state of the automata

◆ xmlAutomataIsDeterminist()

int xmlAutomataIsDeterminist ( xmlAutomata * am)

Checks if an automata is determinist.

Deprecated
Internal function, don't use.
Parameters
aman automata
Returns
1 if true, 0 if not, and -1 in case of error

◆ xmlAutomataNewAllTrans()

xmlAutomataState * xmlAutomataNewAllTrans ( xmlAutomata * am,
xmlAutomataState * from,
xmlAutomataState * to,
int lax )

If to is NULL, this creates first a new target state in the automata and then adds a an ALL transition from the from state to the target state.

That transition is an epsilon transition allowed only when all transitions from the from node have been activated.

Deprecated
Internal function, don't use.
Parameters
aman automata
fromthe starting point of the transition
tothe target point of the transition or NULL
laxallow to transition if not all all transitions have been activated
Returns
the target state or NULL in case of error

◆ xmlAutomataNewCountedTrans()

xmlAutomataState * xmlAutomataNewCountedTrans ( xmlAutomata * am,
xmlAutomataState * from,
xmlAutomataState * to,
int counter )

If to is NULL, this creates first a new target state in the automata and then adds an epsilon transition from the from state to the target state which will increment the counter provided.

Deprecated
Internal function, don't use.
Parameters
aman automata
fromthe starting point of the transition
tothe target point of the transition or NULL
counterthe counter associated to that transition
Returns
the target state or NULL in case of error

◆ xmlAutomataNewCounter()

int xmlAutomataNewCounter ( xmlAutomata * am,
int min,
int max )

Create a new counter.

Deprecated
Internal function, don't use.
Parameters
aman automata
minthe minimal value on the counter
maxthe maximal value on the counter
Returns
the counter number or -1 in case of error

◆ xmlAutomataNewCounterTrans()

xmlAutomataState * xmlAutomataNewCounterTrans ( xmlAutomata * am,
xmlAutomataState * from,
xmlAutomataState * to,
int counter )

If to is NULL, this creates first a new target state in the automata and then adds an epsilon transition from the from state to the target state which will be allowed only if the counter is within the right range.

Deprecated
Internal function, don't use.
Parameters
aman automata
fromthe starting point of the transition
tothe target point of the transition or NULL
counterthe counter associated to that transition
Returns
the target state or NULL in case of error

◆ xmlAutomataNewCountTrans()

xmlAutomataState * xmlAutomataNewCountTrans ( xmlAutomata * am,
xmlAutomataState * from,
xmlAutomataState * to,
const xmlChar * token,
int min,
int max,
void * data )

If to is NULL, this creates first a new target state in the automata and then adds a transition from the from state to the target state activated by a succession of input of value token and whose number is between min and max

Deprecated
Internal function, don't use.
Parameters
aman automata
fromthe starting point of the transition
tothe target point of the transition or NULL
tokenthe input string associated to that transition
minthe minimum successive occurrences of token
maxthe maximum successive occurrences of token
datadata associated to the transition
Returns
the target state or NULL in case of error

◆ xmlAutomataNewCountTrans2()

xmlAutomataState * xmlAutomataNewCountTrans2 ( xmlAutomata * am,
xmlAutomataState * from,
xmlAutomataState * to,
const xmlChar * token,
const xmlChar * token2,
int min,
int max,
void * data )

If to is NULL, this creates first a new target state in the automata and then adds a transition from the from state to the target state activated by a succession of input of value token and token2 and whose number is between min and max

Deprecated
Internal function, don't use.
Parameters
aman automata
fromthe starting point of the transition
tothe target point of the transition or NULL
tokenthe input string associated to that transition
token2the second input string associated to that transition
minthe minimum successive occurrences of token
maxthe maximum successive occurrences of token
datadata associated to the transition
Returns
the target state or NULL in case of error

◆ xmlAutomataNewEpsilon()

xmlAutomataState * xmlAutomataNewEpsilon ( xmlAutomata * am,
xmlAutomataState * from,
xmlAutomataState * to )

If to is NULL, this creates first a new target state in the automata and then adds an epsilon transition from the from state to the target state.

Deprecated
Internal function, don't use.
Parameters
aman automata
fromthe starting point of the transition
tothe target point of the transition or NULL
Returns
the target state or NULL in case of error

◆ xmlAutomataNewNegTrans()

xmlAutomataState * xmlAutomataNewNegTrans ( xmlAutomata * am,
xmlAutomataState * from,
xmlAutomataState * to,
const xmlChar * token,
const xmlChar * token2,
void * data )

If to is NULL, this creates first a new target state in the automata and then adds a transition from the from state to the target state activated by any value except (token,token2) Note that if token2 is not NULL, then (X, NULL) won't match to follow the semantic of XSD ##other.

Deprecated
Internal function, don't use.
Parameters
aman automata
fromthe starting point of the transition
tothe target point of the transition or NULL
tokenthe first input string associated to that transition
token2the second input string associated to that transition
datadata passed to the callback function if the transition is activated
Returns
the target state or NULL in case of error

◆ xmlAutomataNewOnceTrans()

xmlAutomataState * xmlAutomataNewOnceTrans ( xmlAutomata * am,
xmlAutomataState * from,
xmlAutomataState * to,
const xmlChar * token,
int min,
int max,
void * data )

If to is NULL, this creates first a new target state in the automata and then adds a transition from the from state to the target state activated by a succession of input of value token and whose number is between min and max, moreover that transition can only be crossed once.

Deprecated
Internal function, don't use.
Parameters
aman automata
fromthe starting point of the transition
tothe target point of the transition or NULL
tokenthe input string associated to that transition
minthe minimum successive occurrences of token
maxthe maximum successive occurrences of token
datadata associated to the transition
Returns
the target state or NULL in case of error

◆ xmlAutomataNewOnceTrans2()

xmlAutomataState * xmlAutomataNewOnceTrans2 ( xmlAutomata * am,
xmlAutomataState * from,
xmlAutomataState * to,
const xmlChar * token,
const xmlChar * token2,
int min,
int max,
void * data )

If to is NULL, this creates first a new target state in the automata and then adds a transition from the from state to the target state activated by a succession of input of value token and token2 and whose number is between min and max, moreover that transition can only be crossed once.

Deprecated
Internal function, don't use.
Parameters
aman automata
fromthe starting point of the transition
tothe target point of the transition or NULL
tokenthe input string associated to that transition
token2the second input string associated to that transition
minthe minimum successive occurrences of token
maxthe maximum successive occurrences of token
datadata associated to the transition
Returns
the target state or NULL in case of error

◆ xmlAutomataNewState()

xmlAutomataState * xmlAutomataNewState ( xmlAutomata * am)

Create a new disconnected state in the automata.

Deprecated
Internal function, don't use.
Parameters
aman automata
Returns
the new state or NULL in case of error

◆ xmlAutomataNewTransition()

xmlAutomataState * xmlAutomataNewTransition ( xmlAutomata * am,
xmlAutomataState * from,
xmlAutomataState * to,
const xmlChar * token,
void * data )

Add a transition.

If to is NULL, this creates first a new target state in the automata and then adds a transition from the from state to the target state activated by the value of token

Deprecated
Internal function, don't use.
Parameters
aman automata
fromthe starting point of the transition
tothe target point of the transition or NULL
tokenthe input string associated to that transition
datadata passed to the callback function if the transition is activated
Returns
the target state or NULL in case of error

◆ xmlAutomataNewTransition2()

xmlAutomataState * xmlAutomataNewTransition2 ( xmlAutomata * am,
xmlAutomataState * from,
xmlAutomataState * to,
const xmlChar * token,
const xmlChar * token2,
void * data )

If to is NULL, this creates first a new target state in the automata and then adds a transition from the from state to the target state activated by the value of token

Deprecated
Internal function, don't use.
Parameters
aman automata
fromthe starting point of the transition
tothe target point of the transition or NULL
tokenthe first input string associated to that transition
token2the second input string associated to that transition
datadata passed to the callback function if the transition is activated
Returns
the target state or NULL in case of error

◆ xmlAutomataSetFinalState()

int xmlAutomataSetFinalState ( xmlAutomata * am,
xmlAutomataState * state )

Makes that state a final state.

Deprecated
Internal function, don't use.
Parameters
aman automata
statea state in this automata
Returns
0 or -1 in case of error

◆ xmlFreeAutomata()

void xmlFreeAutomata ( xmlAutomata * am)

Free an automata.

Deprecated
Internal function, don't use.
Parameters
aman automata

◆ xmlNewAutomata()

xmlAutomata * xmlNewAutomata ( void )

Create a new automata.

Deprecated
Internal function, don't use.
Returns
the new object or NULL in case of failure