Back to Turicreate

xmlautomata: API to build regexp automata

deps/src/libxml2-2.9.1/doc/devhelp/libxml2-xmlautomata.html

6.4.119.6 KB
Original Source

| | | | | libxml2 Reference Manual |

xmlautomata

xmlautomata - API to build regexp automata

the API to build regexp automata

Author(s): Daniel Veillard

Synopsis

typedef[xmlAutomataState](libxml2-xmlautomata.html#xmlAutomataState)*[xmlAutomataStatePtr](#xmlAutomataStatePtr);
typedef struct _xmlAutomata[xmlAutomata](#xmlAutomata);
typedef[xmlAutomata](libxml2-xmlautomata.html#xmlAutomata)*[xmlAutomataPtr](#xmlAutomataPtr);
typedef struct _xmlAutomataState[xmlAutomataState](#xmlAutomataState);
void[xmlFreeAutomata](#xmlFreeAutomata)([xmlAutomataPtr](libxml2-xmlautomata.html#xmlAutomataPtr)am);
int[xmlAutomataNewCounter](#xmlAutomataNewCounter)([xmlAutomataPtr](libxml2-xmlautomata.html#xmlAutomataPtr)am,
int min,
int max);[xmlAutomataStatePtr](libxml2-xmlautomata.html#xmlAutomataStatePtr)[xmlAutomataGetInitState](#xmlAutomataGetInitState)([xmlAutomataPtr](libxml2-xmlautomata.html#xmlAutomataPtr)am);[xmlAutomataStatePtr](libxml2-xmlautomata.html#xmlAutomataStatePtr)[xmlAutomataNewTransition2](#xmlAutomataNewTransition2)([xmlAutomataPtr](libxml2-xmlautomata.html#xmlAutomataPtr)am,
[xmlAutomataStatePtr](libxml2-xmlautomata.html#xmlAutomataStatePtr)from,
[xmlAutomataStatePtr](libxml2-xmlautomata.html#xmlAutomataStatePtr)to,
const[xmlChar](libxml2-xmlstring.html#xmlChar)* token,
const[xmlChar](libxml2-xmlstring.html#xmlChar)* token2,
void * data);[xmlAutomataStatePtr](libxml2-xmlautomata.html#xmlAutomataStatePtr)[xmlAutomataNewState](#xmlAutomataNewState)([xmlAutomataPtr](libxml2-xmlautomata.html#xmlAutomataPtr)am);[xmlAutomataStatePtr](libxml2-xmlautomata.html#xmlAutomataStatePtr)[xmlAutomataNewCountTrans](#xmlAutomataNewCountTrans)([xmlAutomataPtr](libxml2-xmlautomata.html#xmlAutomataPtr)am,
[xmlAutomataStatePtr](libxml2-xmlautomata.html#xmlAutomataStatePtr)from,
[xmlAutomataStatePtr](libxml2-xmlautomata.html#xmlAutomataStatePtr)to,
const[xmlChar](libxml2-xmlstring.html#xmlChar)* token,
int min,
int max,
void * data);[xmlAutomataStatePtr](libxml2-xmlautomata.html#xmlAutomataStatePtr)[xmlAutomataNewOnceTrans2](#xmlAutomataNewOnceTrans2)([xmlAutomataPtr](libxml2-xmlautomata.html#xmlAutomataPtr)am,
[xmlAutomataStatePtr](libxml2-xmlautomata.html#xmlAutomataStatePtr)from,
[xmlAutomataStatePtr](libxml2-xmlautomata.html#xmlAutomataStatePtr)to,
const[xmlChar](libxml2-xmlstring.html#xmlChar)* token,
const[xmlChar](libxml2-xmlstring.html#xmlChar)* token2,
int min,
int max,
void * data);[xmlAutomataStatePtr](libxml2-xmlautomata.html#xmlAutomataStatePtr)[xmlAutomataNewAllTrans](#xmlAutomataNewAllTrans)([xmlAutomataPtr](libxml2-xmlautomata.html#xmlAutomataPtr)am,
[xmlAutomataStatePtr](libxml2-xmlautomata.html#xmlAutomataStatePtr)from,
[xmlAutomataStatePtr](libxml2-xmlautomata.html#xmlAutomataStatePtr)to,
int lax);[xmlAutomataStatePtr](libxml2-xmlautomata.html#xmlAutomataStatePtr)[xmlAutomataNewCountedTrans](#xmlAutomataNewCountedTrans)([xmlAutomataPtr](libxml2-xmlautomata.html#xmlAutomataPtr)am,
[xmlAutomataStatePtr](libxml2-xmlautomata.html#xmlAutomataStatePtr)from,
[xmlAutomataStatePtr](libxml2-xmlautomata.html#xmlAutomataStatePtr)to,
int counter);[xmlAutomataStatePtr](libxml2-xmlautomata.html#xmlAutomataStatePtr)[xmlAutomataNewCounterTrans](#xmlAutomataNewCounterTrans)([xmlAutomataPtr](libxml2-xmlautomata.html#xmlAutomataPtr)am,
[xmlAutomataStatePtr](libxml2-xmlautomata.html#xmlAutomataStatePtr)from,
[xmlAutomataStatePtr](libxml2-xmlautomata.html#xmlAutomataStatePtr)to,
int counter);[xmlRegexpPtr](libxml2-xmlregexp.html#xmlRegexpPtr)[xmlAutomataCompile](#xmlAutomataCompile)([xmlAutomataPtr](libxml2-xmlautomata.html#xmlAutomataPtr)am);[xmlAutomataStatePtr](libxml2-xmlautomata.html#xmlAutomataStatePtr)[xmlAutomataNewNegTrans](#xmlAutomataNewNegTrans)([xmlAutomataPtr](libxml2-xmlautomata.html#xmlAutomataPtr)am,
[xmlAutomataStatePtr](libxml2-xmlautomata.html#xmlAutomataStatePtr)from,
[xmlAutomataStatePtr](libxml2-xmlautomata.html#xmlAutomataStatePtr)to,
const[xmlChar](libxml2-xmlstring.html#xmlChar)* token,
const[xmlChar](libxml2-xmlstring.html#xmlChar)* token2,
void * data);[xmlAutomataStatePtr](libxml2-xmlautomata.html#xmlAutomataStatePtr)[xmlAutomataNewEpsilon](#xmlAutomataNewEpsilon)([xmlAutomataPtr](libxml2-xmlautomata.html#xmlAutomataPtr)am,
[xmlAutomataStatePtr](libxml2-xmlautomata.html#xmlAutomataStatePtr)from,
[xmlAutomataStatePtr](libxml2-xmlautomata.html#xmlAutomataStatePtr)to);[xmlAutomataStatePtr](libxml2-xmlautomata.html#xmlAutomataStatePtr)[xmlAutomataNewCountTrans2](#xmlAutomataNewCountTrans2)([xmlAutomataPtr](libxml2-xmlautomata.html#xmlAutomataPtr)am,
[xmlAutomataStatePtr](libxml2-xmlautomata.html#xmlAutomataStatePtr)from,
[xmlAutomataStatePtr](libxml2-xmlautomata.html#xmlAutomataStatePtr)to,
const[xmlChar](libxml2-xmlstring.html#xmlChar)* token,
const[xmlChar](libxml2-xmlstring.html#xmlChar)* token2,
int min,
int max,
void * data);[xmlAutomataPtr](libxml2-xmlautomata.html#xmlAutomataPtr)[xmlNewAutomata](#xmlNewAutomata)(void);
int[xmlAutomataSetFinalState](#xmlAutomataSetFinalState)([xmlAutomataPtr](libxml2-xmlautomata.html#xmlAutomataPtr)am,
[xmlAutomataStatePtr](libxml2-xmlautomata.html#xmlAutomataStatePtr)state);[xmlAutomataStatePtr](libxml2-xmlautomata.html#xmlAutomataStatePtr)[xmlAutomataNewOnceTrans](#xmlAutomataNewOnceTrans)([xmlAutomataPtr](libxml2-xmlautomata.html#xmlAutomataPtr)am,
[xmlAutomataStatePtr](libxml2-xmlautomata.html#xmlAutomataStatePtr)from,
[xmlAutomataStatePtr](libxml2-xmlautomata.html#xmlAutomataStatePtr)to,
const[xmlChar](libxml2-xmlstring.html#xmlChar)* token,
int min,
int max,
void * data);[xmlAutomataStatePtr](libxml2-xmlautomata.html#xmlAutomataStatePtr)[xmlAutomataNewTransition](#xmlAutomataNewTransition)([xmlAutomataPtr](libxml2-xmlautomata.html#xmlAutomataPtr)am,
[xmlAutomataStatePtr](libxml2-xmlautomata.html#xmlAutomataStatePtr)from,
[xmlAutomataStatePtr](libxml2-xmlautomata.html#xmlAutomataStatePtr)to,
const[xmlChar](libxml2-xmlstring.html#xmlChar)* token,
void * data);
int[xmlAutomataIsDeterminist](#xmlAutomataIsDeterminist)([xmlAutomataPtr](libxml2-xmlautomata.html#xmlAutomataPtr)am);

Description

Details

Structure xmlAutomata

struct _xmlAutomata {
The content of this structure is not made public by the API.
} xmlAutomata;

Typedef xmlAutomataPtr

[xmlAutomata](libxml2-xmlautomata.html#xmlAutomata)* xmlAutomataPtr;

A libxml automata description, It can be compiled into a regexp


Structure xmlAutomataState

struct _xmlAutomataState {
The content of this structure is not made public by the API.
} xmlAutomataState;

Typedef xmlAutomataStatePtr

[xmlAutomataState](libxml2-xmlautomata.html#xmlAutomataState)* xmlAutomataStatePtr;

A state int the automata description,


xmlAutomataCompile ()

[xmlRegexpPtr](libxml2-xmlregexp.html#xmlRegexpPtr)xmlAutomataCompile	([xmlAutomataPtr](libxml2-xmlautomata.html#xmlAutomataPtr)am)

Compile the automata into a Reg Exp ready for being executed. The automata should be free after this point.

| am: | an automata | | Returns: | the compiled regexp or NULL in case of error |


xmlAutomataGetInitState ()

[xmlAutomataStatePtr](libxml2-xmlautomata.html#xmlAutomataStatePtr)xmlAutomataGetInitState	([xmlAutomataPtr](libxml2-xmlautomata.html#xmlAutomataPtr)am)

Initial state lookup

| am: | an automata | | Returns: | the initial state of the automata |


xmlAutomataIsDeterminist ()

int	xmlAutomataIsDeterminist	([xmlAutomataPtr](libxml2-xmlautomata.html#xmlAutomataPtr)am)

Checks if an automata is determinist.

| am: | an automata | | Returns: | 1 if true, 0 if not, and -1 in case of error |


xmlAutomataNewAllTrans ()

[xmlAutomataStatePtr](libxml2-xmlautomata.html#xmlAutomataStatePtr)xmlAutomataNewAllTrans	([xmlAutomataPtr](libxml2-xmlautomata.html#xmlAutomataPtr)am,
[xmlAutomataStatePtr](libxml2-xmlautomata.html#xmlAutomataStatePtr)from,
[xmlAutomataStatePtr](libxml2-xmlautomata.html#xmlAutomataStatePtr)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.

| am: | an automata | | from: | the starting point of the transition | | to: | the target point of the transition or NULL | | lax: | allow to transition if not all all transitions have been activated | | Returns: | the target state or NULL in case of error |


xmlAutomataNewCountTrans ()

[xmlAutomataStatePtr](libxml2-xmlautomata.html#xmlAutomataStatePtr)xmlAutomataNewCountTrans	([xmlAutomataPtr](libxml2-xmlautomata.html#xmlAutomataPtr)am,
[xmlAutomataStatePtr](libxml2-xmlautomata.html#xmlAutomataStatePtr)from,
[xmlAutomataStatePtr](libxml2-xmlautomata.html#xmlAutomataStatePtr)to,
const[xmlChar](libxml2-xmlstring.html#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

| am: | an automata | | from: | the starting point of the transition | | to: | the target point of the transition or NULL | | token: | the input string associated to that transition | | min: | the minimum successive occurences of token | | max: | the maximum successive occurences of token | | data: | data associated to the transition | | Returns: | the target state or NULL in case of error |


xmlAutomataNewCountTrans2 ()

[xmlAutomataStatePtr](libxml2-xmlautomata.html#xmlAutomataStatePtr)xmlAutomataNewCountTrans2	([xmlAutomataPtr](libxml2-xmlautomata.html#xmlAutomataPtr)am,
[xmlAutomataStatePtr](libxml2-xmlautomata.html#xmlAutomataStatePtr)from,
[xmlAutomataStatePtr](libxml2-xmlautomata.html#xmlAutomataStatePtr)to,
const[xmlChar](libxml2-xmlstring.html#xmlChar)* token,
const[xmlChar](libxml2-xmlstring.html#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

| am: | an automata | | from: | the starting point of the transition | | to: | the target point of the transition or NULL | | token: | the input string associated to that transition | | token2: | the second input string associated to that transition | | min: | the minimum successive occurences of token | | max: | the maximum successive occurences of token | | data: | data associated to the transition | | Returns: | the target state or NULL in case of error |


xmlAutomataNewCountedTrans ()

[xmlAutomataStatePtr](libxml2-xmlautomata.html#xmlAutomataStatePtr)xmlAutomataNewCountedTrans	([xmlAutomataPtr](libxml2-xmlautomata.html#xmlAutomataPtr)am,
[xmlAutomataStatePtr](libxml2-xmlautomata.html#xmlAutomataStatePtr)from,
[xmlAutomataStatePtr](libxml2-xmlautomata.html#xmlAutomataStatePtr)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

| am: | an automata | | from: | the starting point of the transition | | to: | the target point of the transition or NULL | | counter: | the counter associated to that transition | | Returns: | the target state or NULL in case of error |


xmlAutomataNewCounter ()

int	xmlAutomataNewCounter ([xmlAutomataPtr](libxml2-xmlautomata.html#xmlAutomataPtr)am,
int min,
int max)

Create a new counter

| am: | an automata | | min: | the minimal value on the counter | | max: | the maximal value on the counter | | Returns: | the counter number or -1 in case of error |


xmlAutomataNewCounterTrans ()

[xmlAutomataStatePtr](libxml2-xmlautomata.html#xmlAutomataStatePtr)xmlAutomataNewCounterTrans	([xmlAutomataPtr](libxml2-xmlautomata.html#xmlAutomataPtr)am,
[xmlAutomataStatePtr](libxml2-xmlautomata.html#xmlAutomataStatePtr)from,
[xmlAutomataStatePtr](libxml2-xmlautomata.html#xmlAutomataStatePtr)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.

| am: | an automata | | from: | the starting point of the transition | | to: | the target point of the transition or NULL | | counter: | the counter associated to that transition | | Returns: | the target state or NULL in case of error |


xmlAutomataNewEpsilon ()

[xmlAutomataStatePtr](libxml2-xmlautomata.html#xmlAutomataStatePtr)xmlAutomataNewEpsilon	([xmlAutomataPtr](libxml2-xmlautomata.html#xmlAutomataPtr)am,
[xmlAutomataStatePtr](libxml2-xmlautomata.html#xmlAutomataStatePtr)from,
[xmlAutomataStatePtr](libxml2-xmlautomata.html#xmlAutomataStatePtr)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

| am: | an automata | | from: | the starting point of the transition | | to: | the target point of the transition or NULL | | Returns: | the target state or NULL in case of error |


xmlAutomataNewNegTrans ()

[xmlAutomataStatePtr](libxml2-xmlautomata.html#xmlAutomataStatePtr)xmlAutomataNewNegTrans	([xmlAutomataPtr](libxml2-xmlautomata.html#xmlAutomataPtr)am,
[xmlAutomataStatePtr](libxml2-xmlautomata.html#xmlAutomataStatePtr)from,
[xmlAutomataStatePtr](libxml2-xmlautomata.html#xmlAutomataStatePtr)to,
const[xmlChar](libxml2-xmlstring.html#xmlChar)* token,
const[xmlChar](libxml2-xmlstring.html#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

| am: | an automata | | from: | the starting point of the transition | | to: | the target point of the transition or NULL | | token: | the first input string associated to that transition | | token2: | the second input string associated to that transition | | data: | data passed to the callback function if the transition is activated | | Returns: | the target state or NULL in case of error |


xmlAutomataNewOnceTrans ()

[xmlAutomataStatePtr](libxml2-xmlautomata.html#xmlAutomataStatePtr)xmlAutomataNewOnceTrans	([xmlAutomataPtr](libxml2-xmlautomata.html#xmlAutomataPtr)am,
[xmlAutomataStatePtr](libxml2-xmlautomata.html#xmlAutomataStatePtr)from,
[xmlAutomataStatePtr](libxml2-xmlautomata.html#xmlAutomataStatePtr)to,
const[xmlChar](libxml2-xmlstring.html#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.

| am: | an automata | | from: | the starting point of the transition | | to: | the target point of the transition or NULL | | token: | the input string associated to that transition | | min: | the minimum successive occurences of token | | max: | the maximum successive occurences of token | | data: | data associated to the transition | | Returns: | the target state or NULL in case of error |


xmlAutomataNewOnceTrans2 ()

[xmlAutomataStatePtr](libxml2-xmlautomata.html#xmlAutomataStatePtr)xmlAutomataNewOnceTrans2	([xmlAutomataPtr](libxml2-xmlautomata.html#xmlAutomataPtr)am,
[xmlAutomataStatePtr](libxml2-xmlautomata.html#xmlAutomataStatePtr)from,
[xmlAutomataStatePtr](libxml2-xmlautomata.html#xmlAutomataStatePtr)to,
const[xmlChar](libxml2-xmlstring.html#xmlChar)* token,
const[xmlChar](libxml2-xmlstring.html#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.

| am: | an automata | | from: | the starting point of the transition | | to: | the target point of the transition or NULL | | token: | the input string associated to that transition | | token2: | the second input string associated to that transition | | min: | the minimum successive occurences of token | | max: | the maximum successive occurences of token | | data: | data associated to the transition | | Returns: | the target state or NULL in case of error |


xmlAutomataNewState ()

[xmlAutomataStatePtr](libxml2-xmlautomata.html#xmlAutomataStatePtr)xmlAutomataNewState	([xmlAutomataPtr](libxml2-xmlautomata.html#xmlAutomataPtr)am)

Create a new disconnected state in the automata

| am: | an automata | | Returns: | the new state or NULL in case of error |


xmlAutomataNewTransition ()

[xmlAutomataStatePtr](libxml2-xmlautomata.html#xmlAutomataStatePtr)xmlAutomataNewTransition	([xmlAutomataPtr](libxml2-xmlautomata.html#xmlAutomataPtr)am,
[xmlAutomataStatePtr](libxml2-xmlautomata.html#xmlAutomataStatePtr)from,
[xmlAutomataStatePtr](libxml2-xmlautomata.html#xmlAutomataStatePtr)to,
const[xmlChar](libxml2-xmlstring.html#xmlChar)* token,
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

| am: | an automata | | from: | the starting point of the transition | | to: | the target point of the transition or NULL | | token: | the input string associated to that transition | | data: | data passed to the callback function if the transition is activated | | Returns: | the target state or NULL in case of error |


xmlAutomataNewTransition2 ()

[xmlAutomataStatePtr](libxml2-xmlautomata.html#xmlAutomataStatePtr)xmlAutomataNewTransition2	([xmlAutomataPtr](libxml2-xmlautomata.html#xmlAutomataPtr)am,
[xmlAutomataStatePtr](libxml2-xmlautomata.html#xmlAutomataStatePtr)from,
[xmlAutomataStatePtr](libxml2-xmlautomata.html#xmlAutomataStatePtr)to,
const[xmlChar](libxml2-xmlstring.html#xmlChar)* token,
const[xmlChar](libxml2-xmlstring.html#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

| am: | an automata | | from: | the starting point of the transition | | to: | the target point of the transition or NULL | | token: | the first input string associated to that transition | | token2: | the second input string associated to that transition | | data: | data passed to the callback function if the transition is activated | | Returns: | the target state or NULL in case of error |


xmlAutomataSetFinalState ()

int	xmlAutomataSetFinalState	([xmlAutomataPtr](libxml2-xmlautomata.html#xmlAutomataPtr)am,
[xmlAutomataStatePtr](libxml2-xmlautomata.html#xmlAutomataStatePtr)state)

Makes that state a final state

| am: | an automata | | state: | a state in this automata | | Returns: | 0 or -1 in case of error |


xmlFreeAutomata ()

void	xmlFreeAutomata ([xmlAutomataPtr](libxml2-xmlautomata.html#xmlAutomataPtr)am)

Free an automata

| am: | an automata |


xmlNewAutomata ()

[xmlAutomataPtr](libxml2-xmlautomata.html#xmlAutomataPtr)xmlNewAutomata (void)

Create a new automata

| Returns: | the new object or NULL in case of failure |