Version 6.3
Copyright © 2005 - 2012 Lowell D. Thomas
APG
  … ABNF Parser Generator
All Data Structures Files Functions Variables Typedefs Macros Pages
Functions
UdtLib.c File Reference

A small UDT callback function library. More...

#include "Apg.h"

Go to the source code of this file.

Functions

apg_uint uiUdtLib_e_owsp (APG_CBDATA *spData)
 
apg_uint uiUdtLib_u_wsp (APG_CBDATA *spData)
 
apg_uint uiUdtLib_u_lineend (APG_CBDATA *spData)
 
apg_uint uiUdtLib_e_any (APG_CBDATA *spData)
 
apg_uint uiUdtLib_u_semi_comment (APG_CBDATA *spData)
 
apg_uint uiUdtLib_u_cpp_comment (APG_CBDATA *spData)
 
apg_uint uiUdtLib_u_c_comment (APG_CBDATA *spData)
 
apg_uint uiUdtLib_u_alphanum (APG_CBDATA *spData)
 
apg_uint uiUdtLib_u_alphanum_hyphen (APG_CBDATA *spData)
 
apg_uint uiUdtLib_u_alphanum_under (APG_CBDATA *spData)
 
apg_uint uiUdtLib_u_decnum (APG_CBDATA *spData)
 
apg_uint uiUdtLib_u_hexnum (APG_CBDATA *spData)
 
apg_uint uiUdtLib_u_quotedstring (APG_CBDATA *spData)
 
apg_uint uiUdtLib_u_singlequotedstring (APG_CBDATA *spData)
 
apg_uint uiUdtLib_u_doublequotedstring (APG_CBDATA *spData)
 

Detailed Description

A small UDT callback function library.

All functions take an APG_CBDATA struct passed to them by the Parser as input. They return the result in the struct member uiPhraseLength. The returned value of uiPhraseLength is interpreted by the Parser as follows:

uiPhraseLength = 0,             an empty phrase was matched. Only returned by UDT functions beginning with "e_".
uiPhraseLength > 0,             a non-empty phrase was matched.
uiPhraseLength = APG_UNDEFINED, no phrase was matched
See also
APG_CBDATA
APG_CALLBACK

Definition in file UdtLib.c.

Function Documentation

◆ uiUdtLib_e_any()

apg_uint uiUdtLib_e_any ( APG_CBDATA spData)

Phrase recognizer for a string of any printing characters, including TAB.

Equivalent SABNF syntax:

ANY = *(%d9 / %d32-127)
Parameters
spDatadata struct passed to this function by the Parser
Returns
0 - return ignored by Parser

Definition at line 337 of file UdtLib.c.

◆ uiUdtLib_e_owsp()

apg_uint uiUdtLib_e_owsp ( APG_CBDATA spData)

Phrase recognizer for optional white space

Equivalent SABNF syntax:

WSP   = *(TAB / SPACE)
TAB   = %d9
SPACE = %d32

NOTE: see UdtLib.c for the static function uiWsp() for more options. Line continuations and various types of comments may also be easily included as white space.

Parameters
spDatadata struct passed to this function by the Parser
Returns
0 - return ignored by Parser

Definition at line 280 of file UdtLib.c.

◆ uiUdtLib_u_alphanum()

apg_uint uiUdtLib_u_alphanum ( APG_CBDATA spData)

Phrase recognizer for an alphanumeric string.

Equivalent SABNF syntax:

ALPHANUM = ALPHA *(ALPHA / DIGIT)
ALPHA    = %d65-90 / %d97-122
DIGIT    = %d48-57
Parameters
spDatadata struct passed to this function by the Parser
Returns
0 - return ignored by Parser

Definition at line 414 of file UdtLib.c.

◆ uiUdtLib_u_alphanum_hyphen()

apg_uint uiUdtLib_u_alphanum_hyphen ( APG_CBDATA spData)

Phrase recognizer for an alphanumeric string, including hyphen.

Equivalent SABNF syntax:

ALPHANUM = ALPHA *(ALPHA / DIGIT / HYPHEN)
ALPHA    = %d65-90 / %d97-122
DIGIT    = %d48-57
HYPHEN   = %d45
Parameters
spDatadata struct passed to this function by the Parser
Returns
0 - return ignored by Parser

Definition at line 434 of file UdtLib.c.

◆ uiUdtLib_u_alphanum_under()

apg_uint uiUdtLib_u_alphanum_under ( APG_CBDATA spData)

Phrase recognizer for an alphanumeric string, including underscore.

Equivalent SABNF syntax:

ALPHANUM = ALPHA *(ALPHA / DIGIT / UNDER)
ALPHA    = %d65-90 / %d97-122
DIGIT    = %d48-57
UNDER    = %d95
Parameters
spDatadata struct passed to this function by the Parser
Returns
0 - return ignored by Parser

Definition at line 454 of file UdtLib.c.

◆ uiUdtLib_u_c_comment()

apg_uint uiUdtLib_u_c_comment ( APG_CBDATA spData)

Phrase recognizer for a C-style comment. Comment runs from "/ *" to "* /".

Equivalent SABNF syntax:

CCOMMENT = BEGIN *(!END ANY) END
BEGIN    = %d47.42
END      = %d42.47
ANY      = TAB / CR / LF / %d32-127
TAB      = %d9
LF       = %d10
CF       = %d13
Parameters
spDatadata struct passed to this function by the Parser
Returns
0 - return ignored by Parser

Definition at line 395 of file UdtLib.c.

◆ uiUdtLib_u_cpp_comment()

apg_uint uiUdtLib_u_cpp_comment ( APG_CBDATA spData)

Phrase recognizer for a C++-style comment. Comment runs from "//" to end of line.

Equivalent SABNF syntax:

CPPCOMMENT = "//" ANY
ANY        = *(%d9 / %d32-127)
Parameters
spDatadata struct passed to this function by the Parser
Returns
0 - return ignored by Parser

Definition at line 372 of file UdtLib.c.

◆ uiUdtLib_u_decnum()

apg_uint uiUdtLib_u_decnum ( APG_CBDATA spData)

Phrase recognizer for a decimal number.

Equivalent SABNF syntax:

DECNUM = 1*DIGIT
DIGIT  = %d48-57
Parameters
spDatadata struct passed to this function by the Parser
Returns
0 - return ignored by Parser

Definition at line 472 of file UdtLib.c.

◆ uiUdtLib_u_doublequotedstring()

apg_uint uiUdtLib_u_doublequotedstring ( APG_CBDATA spData)

Phrase recognizer for a double-quoted string, a string beginning and ending with a double quote (").

Equivalent SABNF syntax:

DOUBLEQUOTE = %d34 *(%d9 / %d32-33 / %d35-127) %d34
Parameters
spDatadata struct passed to this function by the Parser
Returns
0 - return ignored by Parser

Definition at line 561 of file UdtLib.c.

◆ uiUdtLib_u_hexnum()

apg_uint uiUdtLib_u_hexnum ( APG_CBDATA spData)

Phrase recognizer for a hexidecimal number.

Equivalent SABNF syntax:

HEXNUM   = "0x" 1*HEXDIGIT
HEXDIGIT = %d48-57 / %d65-70 / %d97-102
Parameters
spDatadata struct passed to this function by the Parser
Returns
0 - return ignored by Parser

Definition at line 495 of file UdtLib.c.

◆ uiUdtLib_u_lineend()

apg_uint uiUdtLib_u_lineend ( APG_CBDATA spData)

Phrase recognizer for line ending. This is a "forgiving" line end allowing for the most commonly used values.

Equivalent SABNF syntax:

LINEEND = CR LF / CR / LF
CR      = %d13
LF      = %d10
Parameters
spDatadata struct passed to this function by the Parser
Returns
0 - return ignored by Parser

Definition at line 320 of file UdtLib.c.

◆ uiUdtLib_u_quotedstring()

apg_uint uiUdtLib_u_quotedstring ( APG_CBDATA spData)

Phrase recognizer for a quoted string, a string beginning and ending with a single (') or double (") quote.

Equivalent SABNF syntax:

QUOTEDSTRING = SINGLEQUOTE / DOUBLEQUOTE
SINGLEQUOTE  = %d39 *(%d9 / %d32-38 / %d40-127) %d39
DOUBLEQUOTE  = %d34 *(%d9 / %d32-33 / %d35-127) %d34
Parameters
spDatadata struct passed to this function by the Parser
Returns
0 - return ignored by Parser

Definition at line 525 of file UdtLib.c.

◆ uiUdtLib_u_semi_comment()

apg_uint uiUdtLib_u_semi_comment ( APG_CBDATA spData)

Phrase recognizer for a semicolon initialized comment. Comment runs from semicolon to end of line.

Equivalent SABNF syntax:

SEMICOMMENT = ";" ANY
ANY         = *(%d9 / %d32-127)
Parameters
spDatadata struct passed to this function by the Parser
Returns
0 - return ignored by Parser

Definition at line 354 of file UdtLib.c.

◆ uiUdtLib_u_singlequotedstring()

apg_uint uiUdtLib_u_singlequotedstring ( APG_CBDATA spData)

Phrase recognizer for a single-quoted string, a string beginning and ending with a single quote (').

Equivalent SABNF syntax:

SINGLEQUOTE = %d39 *(%d9 / %d32-38 / %d40-127) %d39
Parameters
spDatadata struct passed to this function by the Parser
Returns
0 - return ignored by Parser

Definition at line 544 of file UdtLib.c.

◆ uiUdtLib_u_wsp()

apg_uint uiUdtLib_u_wsp ( APG_CBDATA spData)

Phrase recognizer for required white space

Equivalent SABNF syntax:

WSP   = 1*(TAB / SPACE)
TAB   = %d9
SPACE = %d32

NOTE: see UdtLib.c for the static function uiWsp() for more options. Line continuations and various types of comments may also be easily included as white space.

Parameters
spDatadata struct passed to this function by the Parser
Returns
0 - return ignored by Parser

Definition at line 301 of file UdtLib.c.

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/licenses.html or write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.