libxml2: xmlautomata.h File Reference

libxml2

Loading...
Searching...
No Matches
Typedefs | Functions
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
xmlAutomata * | xmlNewAutomata (void)
| Create a new automata.
void | xmlFreeAutomata (xmlAutomata *am)
| Free an automata.
xmlAutomataState * | xmlAutomataGetInitState (xmlAutomata *am)
| Initial state lookup.
int | xmlAutomataSetFinalState (xmlAutomata *am, xmlAutomataState *state)
| Makes that state a final state.
xmlAutomataState * | xmlAutomataNewState (xmlAutomata *am)
| Create a new disconnected state in the automata.
xmlAutomataState * | xmlAutomataNewTransition (xmlAutomata *am, xmlAutomataState *from, xmlAutomataState *to, const xmlChar *token, void *data)
| Add a transition.
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`
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.
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`
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`
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.
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.
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.
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.
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.
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.
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.

Copyright
  See Copyright for the status of this software.

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

  am | an 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

  am | an 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

  am | an 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

  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

## ◆ 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

  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 | ( | xmlAutomata * | am,
|  | int | min,
|  | int | max
| ) |  |

Create a new counter.

Deprecated:
  Internal function, don't use.

Parameters

  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()

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

  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

## ◆ 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

  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 occurrences of token
  max | the maximum successive occurrences of token
  data | data 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

  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 occurrences of token
  max | the maximum successive occurrences of token
  data | data 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

  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()

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

  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()

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

  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 occurrences of token
  max | the maximum successive occurrences of token
  data | data 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

  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 occurrences of token
  max | the maximum successive occurrences of token
  data | data 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

  am | an 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

  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()

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

  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 | ( | xmlAutomata * | am,
|  | xmlAutomataState * | state
| ) |  |

Makes that state a final state.

Deprecated:
  Internal function, don't use.

Parameters

  am | an automata
  state | a 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

  am | an 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