YAZ  5.34.0
Data Structures | Macros | Typedefs | Enumerations | Functions | Variables
cql.c File Reference

Implements CQL parser. More...

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <yaz/yaz-iconv.h>
#include <yaz/xmalloc.h>
#include <yaz/nmem.h>
#include <yaz/cql.h>
#include <limits.h>

Go to the source code of this file.

Data Structures

struct  token
 
struct  cql_parser
 
union  yyalloc
 

Macros

#define YYBISON   30802
 
#define YYBISON_VERSION   "3.8.2"
 
#define YYSKELETON_NAME   "yacc.c"
 
#define YYPURE   1
 
#define YYPUSH   0
 
#define YYPULL   1
 
#define yyparse   cql_parse
 
#define yylex   cql_lex
 
#define yyerror   cql_error
 
#define yydebug   cql_debug
 
#define yynerrs   cql_nerrs
 
#define YYSTYPE   token
 
#define YY_CAST(Type, Val)   ((Type) (Val))
 
#define YY_REINTERPRET_CAST(Type, Val)   ((Type) (Val))
 
#define YY_NULLPTR   ((void*)0)
 
#define YYDEBUG   0
 
#define YYTOKENTYPE
 
#define YYEMPTY   -2
 
#define YYEOF   0
 
#define YYerror   256
 
#define YYUNDEF   257
 
#define PREFIX_NAME   258
 
#define SIMPLE_STRING   259
 
#define AND   260
 
#define OR   261
 
#define NOT   262
 
#define PROX   263
 
#define GE   264
 
#define LE   265
 
#define NE   266
 
#define EXACT   267
 
#define SORTBY   268
 
#define YYPTRDIFF_T   long
 
#define YYPTRDIFF_MAXIMUM   LONG_MAX
 
#define YYSIZE_T   unsigned
 
#define YYSIZE_MAXIMUM
 
#define YYSIZEOF(X)   YY_CAST (YYPTRDIFF_T, sizeof (X))
 
#define YY_(Msgid)   Msgid
 
#define YY_ATTRIBUTE_PURE
 
#define YY_ATTRIBUTE_UNUSED
 
#define YY_USE(E)   ((void) (E))
 
#define YY_INITIAL_VALUE(Value)   Value
 
#define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
 
#define YY_IGNORE_MAYBE_UNINITIALIZED_END
 
#define YY_IGNORE_USELESS_CAST_BEGIN
 
#define YY_IGNORE_USELESS_CAST_END
 
#define YY_ASSERT(E)   ((void) (0 && (E)))
 
#define YYSTACK_ALLOC   YYMALLOC
 
#define YYSTACK_FREE   YYFREE
 
#define YYSTACK_ALLOC_MAXIMUM   YYSIZE_MAXIMUM
 
#define YYMALLOC   malloc
 
#define YYFREE   free
 
#define YYSTACK_GAP_MAXIMUM   (YYSIZEOF (union yyalloc) - 1)
 
#define YYSTACK_BYTES(N)
 
#define YYCOPY_NEEDED   1
 
#define YYSTACK_RELOCATE(Stack_alloc, Stack)
 
#define YYCOPY(Dst, Src, Count)
 
#define YYFINAL   3
 
#define YYLAST   103
 
#define YYNTOKENS   20
 
#define YYNNTS   22
 
#define YYNRULES   49
 
#define YYNSTATES   66
 
#define YYMAXUTOK   268
 
#define YYTRANSLATE(YYX)
 
#define YY_ACCESSING_SYMBOL(State)   YY_CAST (yysymbol_kind_t, yystos[State])
 
#define YYPACT_NINF   (-34)
 
#define yypact_value_is_default(Yyn)    ((Yyn) == YYPACT_NINF)
 
#define YYTABLE_NINF   (-43)
 
#define yytable_value_is_error(Yyn)    0
 
#define yyerrok   (yyerrstatus = 0)
 
#define yyclearin   (yychar = YYEMPTY)
 
#define YYACCEPT   goto yyacceptlab
 
#define YYABORT   goto yyabortlab
 
#define YYERROR   goto yyerrorlab
 
#define YYNOMEM   goto yyexhaustedlab
 
#define YYRECOVERING()   (!!yyerrstatus)
 
#define YYBACKUP(Token, Value)
 
#define YYERRCODE   YYUNDEF
 
#define YYDPRINTF(Args)   ((void) 0)
 
#define YY_SYMBOL_PRINT(Title, Kind, Value, Location)
 
#define YY_STACK_PRINT(Bottom, Top)
 
#define YY_REDUCE_PRINT(Rule)
 
#define YYINITDEPTH   200
 
#define YYMAXDEPTH   10000
 
#define YYPOPSTACK(N)   (yyvsp -= (N), yyssp -= (N))
 

Typedefs

typedef enum yytokentype yytoken_kind_t
 
typedef enum yysymbol_kind_t yysymbol_kind_t
 
typedef signed char yytype_int8
 
typedef short yytype_int16
 
typedef unsigned char yytype_uint8
 
typedef unsigned short yytype_uint16
 
typedef yytype_int8 yy_state_t
 
typedef int yy_state_fast_t
 

Enumerations

enum  yytokentype {
  YYEMPTY = -2 , YYEOF = 0 , YYerror = 256 , YYUNDEF = 257 ,
  PREFIX_NAME = 258 , SIMPLE_STRING = 259 , AND = 260 , OR = 261 ,
  NOT = 262 , PROX = 263 , GE = 264 , LE = 265 ,
  NE = 266 , EXACT = 267 , SORTBY = 268
}
 
enum  yysymbol_kind_t {
  YYSYMBOL_YYEMPTY = -2 , YYSYMBOL_YYEOF = 0 , YYSYMBOL_YYerror = 1 , YYSYMBOL_YYUNDEF = 2 ,
  YYSYMBOL_PREFIX_NAME = 3 , YYSYMBOL_SIMPLE_STRING = 4 , YYSYMBOL_AND = 5 , YYSYMBOL_OR = 6 ,
  YYSYMBOL_NOT = 7 , YYSYMBOL_PROX = 8 , YYSYMBOL_GE = 9 , YYSYMBOL_LE = 10 ,
  YYSYMBOL_NE = 11 , YYSYMBOL_EXACT = 12 , YYSYMBOL_SORTBY = 13 , YYSYMBOL_14_ = 14 ,
  YYSYMBOL_15_ = 15 , YYSYMBOL_16_ = 16 , YYSYMBOL_17_ = 17 , YYSYMBOL_18_ = 18 ,
  YYSYMBOL_19_ = 19 , YYSYMBOL_YYACCEPT = 20 , YYSYMBOL_top = 21 , YYSYMBOL_22_1 = 22 ,
  YYSYMBOL_sortby = 23 , YYSYMBOL_sortSpec = 24 , YYSYMBOL_singleSpec = 25 , YYSYMBOL_cqlQuery1 = 26 ,
  YYSYMBOL_cqlQuery = 27 , YYSYMBOL_28_2 = 28 , YYSYMBOL_29_3 = 29 , YYSYMBOL_scopedClause = 30 ,
  YYSYMBOL_31_4 = 31 , YYSYMBOL_searchClause = 32 , YYSYMBOL_33_5 = 33 , YYSYMBOL_34_6 = 34 ,
  YYSYMBOL_extraTerms = 35 , YYSYMBOL_boolean = 36 , YYSYMBOL_modifiers = 37 , YYSYMBOL_relation = 38 ,
  YYSYMBOL_relation_symbol = 39 , YYSYMBOL_index = 40 , YYSYMBOL_searchTerm = 41
}
 
enum  { YYENOMEM = -2 }
 

Functions

int yylex (YYSTYPE *lval, void *vp)
 
int yyerror (void *lval, char *msg)
 
int cql_parse (void *parm)
 
void * malloc (YYSIZE_T)
 
void free (void *)
 
static void yydestruct (const char *yymsg, yysymbol_kind_t yykind, YYSTYPE *yyvaluep, void *parm)
 
int yyparse (void *parm)
 
static void putb (YYSTYPE *lval, CQL_parser cp, int c)
 
int cql_parser_stream (CQL_parser cp, int(*getbyte)(void *client_data), void(*ungetbyte)(int b, void *client_data), void *client_data)
 parses CQL query (query stream) More...
 
CQL_parser cql_parser_create (void)
 creates a CQL parser. More...
 
void cql_parser_destroy (CQL_parser cp)
 destroys a CQL parser. More...
 
struct cql_nodecql_parser_result (CQL_parser cp)
 returns the parse tree of the most recently parsed CQL query. More...
 
void cql_parser_strict (CQL_parser cp, int mode)
 configures strict mode More...
 

Variables

static const yytype_int8 yytranslate []
 
static const yytype_int8 yypact []
 
static const yytype_int8 yydefact []
 
static const yytype_int8 yypgoto []
 
static const yytype_int8 yydefgoto []
 
static const yytype_int8 yytable []
 
static const yytype_int8 yycheck []
 
static const yytype_int8 yystos []
 
static const yytype_int8 yyr1 []
 
static const yytype_int8 yyr2 []
 

Detailed Description

Implements CQL parser.

This is a YACC parser, but since it must be reentrant, Bison is required. The original source file is cql.y.

Definition in file cql.c.

Macro Definition Documentation

◆ AND

#define AND   260

Definition at line 192 of file cql.c.

◆ EXACT

#define EXACT   267

Definition at line 199 of file cql.c.

◆ GE

#define GE   264

Definition at line 196 of file cql.c.

◆ LE

#define LE   265

Definition at line 197 of file cql.c.

◆ NE

#define NE   266

Definition at line 198 of file cql.c.

◆ NOT

#define NOT   262

Definition at line 194 of file cql.c.

◆ OR

#define OR   261

Definition at line 193 of file cql.c.

◆ PREFIX_NAME

#define PREFIX_NAME   258

Definition at line 190 of file cql.c.

◆ PROX

#define PROX   263

Definition at line 195 of file cql.c.

◆ SIMPLE_STRING

#define SIMPLE_STRING   259

Definition at line 191 of file cql.c.

◆ SORTBY

#define SORTBY   268

Definition at line 200 of file cql.c.

◆ YY_

#define YY_ (   Msgid)    Msgid

Definition at line 391 of file cql.c.

◆ YY_ACCESSING_SYMBOL

#define YY_ACCESSING_SYMBOL (   State)    YY_CAST (yysymbol_kind_t, yystos[State])

Accessing symbol of state STATE.

Definition at line 657 of file cql.c.

◆ YY_ASSERT

#define YY_ASSERT (   E)    ((void) (0 && (E)))

Definition at line 457 of file cql.c.

◆ YY_ATTRIBUTE_PURE

#define YY_ATTRIBUTE_PURE

Definition at line 400 of file cql.c.

◆ YY_ATTRIBUTE_UNUSED

#define YY_ATTRIBUTE_UNUSED

Definition at line 408 of file cql.c.

◆ YY_CAST

#define YY_CAST (   Type,
  Val 
)    ((Type) (Val))

Definition at line 137 of file cql.c.

◆ YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN

#define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN

Definition at line 437 of file cql.c.

◆ YY_IGNORE_MAYBE_UNINITIALIZED_END

#define YY_IGNORE_MAYBE_UNINITIALIZED_END

Definition at line 438 of file cql.c.

◆ YY_IGNORE_USELESS_CAST_BEGIN

#define YY_IGNORE_USELESS_CAST_BEGIN

Definition at line 452 of file cql.c.

◆ YY_IGNORE_USELESS_CAST_END

#define YY_IGNORE_USELESS_CAST_END

Definition at line 453 of file cql.c.

◆ YY_INITIAL_VALUE

#define YY_INITIAL_VALUE (   Value)    Value

Definition at line 434 of file cql.c.

◆ YY_NULLPTR

#define YY_NULLPTR   ((void*)0)

Definition at line 149 of file cql.c.

◆ YY_REDUCE_PRINT

#define YY_REDUCE_PRINT (   Rule)

Definition at line 963 of file cql.c.

◆ YY_REINTERPRET_CAST

#define YY_REINTERPRET_CAST (   Type,
  Val 
)    ((Type) (Val))

Definition at line 138 of file cql.c.

◆ YY_STACK_PRINT

#define YY_STACK_PRINT (   Bottom,
  Top 
)

Definition at line 962 of file cql.c.

◆ YY_SYMBOL_PRINT

#define YY_SYMBOL_PRINT (   Title,
  Kind,
  Value,
  Location 
)

Definition at line 961 of file cql.c.

◆ YY_USE

#define YY_USE (   E)    ((void) (E))

Definition at line 414 of file cql.c.

◆ YYABORT

#define YYABORT   goto yyabortlab

Definition at line 810 of file cql.c.

◆ YYACCEPT

#define YYACCEPT   goto yyacceptlab

Definition at line 809 of file cql.c.

◆ YYBACKUP

#define YYBACKUP (   Token,
  Value 
)
Value:
do \
if (yychar == YYEMPTY) \
{ \
yychar = (Token); \
yylval = (Value); \
YYPOPSTACK (yylen); \
yystate = *yyssp; \
goto yybackup; \
} \
else \
{ \
yyerror (parm, YY_("syntax error: cannot back up")); \
YYERROR; \
} \
while (0)
#define YY_(Msgid)
Definition: cql.c:391
#define YYEMPTY
Definition: cql.c:186

Definition at line 817 of file cql.c.

◆ YYBISON

#define YYBISON   30802

Definition at line 49 of file cql.c.

◆ YYBISON_VERSION

#define YYBISON_VERSION   "3.8.2"

Definition at line 52 of file cql.c.

◆ yyclearin

#define yyclearin   (yychar = YYEMPTY)

Definition at line 807 of file cql.c.

◆ YYCOPY

#define YYCOPY (   Dst,
  Src,
  Count 
)
Value:
do \
{ \
YYPTRDIFF_T yyi; \
for (yyi = 0; yyi < (Count); yyi++) \
(Dst)[yyi] = (Src)[yyi]; \
} \
while (0)

Definition at line 574 of file cql.c.

◆ YYCOPY_NEEDED

#define YYCOPY_NEEDED   1

Definition at line 546 of file cql.c.

◆ yydebug

#define yydebug   cql_debug

Definition at line 71 of file cql.c.

◆ YYDEBUG

#define YYDEBUG   0

Definition at line 156 of file cql.c.

◆ YYDPRINTF

#define YYDPRINTF (   Args)    ((void) 0)

Definition at line 960 of file cql.c.

◆ YYEMPTY

#define YYEMPTY   -2

Definition at line 186 of file cql.c.

◆ YYEOF

#define YYEOF   0

Definition at line 187 of file cql.c.

◆ YYERRCODE

#define YYERRCODE   YYUNDEF

Definition at line 836 of file cql.c.

◆ yyerrok

#define yyerrok   (yyerrstatus = 0)

Definition at line 806 of file cql.c.

◆ yyerror

#define yyerror   cql_error

Definition at line 70 of file cql.c.

◆ YYerror

#define YYerror   256

Definition at line 188 of file cql.c.

◆ YYERROR

#define YYERROR   goto yyerrorlab

Definition at line 811 of file cql.c.

◆ YYFINAL

#define YYFINAL   3

Definition at line 587 of file cql.c.

◆ YYFREE

#define YYFREE   free

Definition at line 518 of file cql.c.

◆ YYINITDEPTH

#define YYINITDEPTH   200

Definition at line 969 of file cql.c.

◆ YYLAST

#define YYLAST   103

Definition at line 589 of file cql.c.

◆ yylex

#define yylex   cql_lex

Definition at line 69 of file cql.c.

◆ YYMALLOC

#define YYMALLOC   malloc

Definition at line 512 of file cql.c.

◆ YYMAXDEPTH

#define YYMAXDEPTH   10000

Definition at line 980 of file cql.c.

◆ YYMAXUTOK

#define YYMAXUTOK   268

Definition at line 601 of file cql.c.

◆ yynerrs

#define yynerrs   cql_nerrs

Definition at line 72 of file cql.c.

◆ YYNNTS

#define YYNNTS   22

Definition at line 594 of file cql.c.

◆ YYNOMEM

#define YYNOMEM   goto yyexhaustedlab

Definition at line 812 of file cql.c.

◆ YYNRULES

#define YYNRULES   49

Definition at line 596 of file cql.c.

◆ YYNSTATES

#define YYNSTATES   66

Definition at line 598 of file cql.c.

◆ YYNTOKENS

#define YYNTOKENS   20

Definition at line 592 of file cql.c.

◆ YYPACT_NINF

#define YYPACT_NINF   (-34)

Definition at line 684 of file cql.c.

◆ yypact_value_is_default

#define yypact_value_is_default (   Yyn)     ((Yyn) == YYPACT_NINF)

Definition at line 686 of file cql.c.

◆ yyparse

#define yyparse   cql_parse

Definition at line 68 of file cql.c.

◆ YYPOPSTACK

#define YYPOPSTACK (   N)    (yyvsp -= (N), yyssp -= (N))

◆ YYPTRDIFF_MAXIMUM

#define YYPTRDIFF_MAXIMUM   LONG_MAX

Definition at line 351 of file cql.c.

◆ YYPTRDIFF_T

#define YYPTRDIFF_T   long

Definition at line 350 of file cql.c.

◆ YYPULL

#define YYPULL   1

Definition at line 64 of file cql.c.

◆ YYPURE

#define YYPURE   1

Definition at line 58 of file cql.c.

◆ YYPUSH

#define YYPUSH   0

Definition at line 61 of file cql.c.

◆ YYRECOVERING

#define YYRECOVERING ( )    (!!yyerrstatus)

Definition at line 815 of file cql.c.

◆ YYSIZE_MAXIMUM

#define YYSIZE_MAXIMUM
Value:
: YY_CAST (YYSIZE_T, -1)))
#define YYPTRDIFF_MAXIMUM
Definition: cql.c:351
#define YY_CAST(Type, Val)
Definition: cql.c:137
#define YYSIZE_T
Definition: cql.c:364
#define YYPTRDIFF_T
Definition: cql.c:350

Definition at line 368 of file cql.c.

◆ YYSIZE_T

#define YYSIZE_T   unsigned

Definition at line 364 of file cql.c.

◆ YYSIZEOF

#define YYSIZEOF (   X)    YY_CAST (YYPTRDIFF_T, sizeof (X))

Definition at line 374 of file cql.c.

◆ YYSKELETON_NAME

#define YYSKELETON_NAME   "yacc.c"

Definition at line 55 of file cql.c.

◆ YYSTACK_ALLOC

#define YYSTACK_ALLOC   YYMALLOC

Definition at line 498 of file cql.c.

◆ YYSTACK_ALLOC_MAXIMUM

#define YYSTACK_ALLOC_MAXIMUM   YYSIZE_MAXIMUM

Definition at line 501 of file cql.c.

◆ YYSTACK_BYTES

#define YYSTACK_BYTES (   N)
Value:
#define YYSTYPE
Definition: cql.c:124
#define YYSIZEOF(X)
Definition: cql.c:374
yytype_int8 yy_state_t
Definition: cql.c:378
#define YYSTACK_GAP_MAXIMUM
Definition: cql.c:538

Definition at line 542 of file cql.c.

◆ YYSTACK_FREE

#define YYSTACK_FREE   YYFREE

Definition at line 499 of file cql.c.

◆ YYSTACK_GAP_MAXIMUM

#define YYSTACK_GAP_MAXIMUM   (YYSIZEOF (union yyalloc) - 1)

Definition at line 538 of file cql.c.

◆ YYSTACK_RELOCATE

#define YYSTACK_RELOCATE (   Stack_alloc,
  Stack 
)
Value:
do \
{ \
YYPTRDIFF_T yynewbytes; \
YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
Stack = &yyptr->Stack_alloc; \
yynewbytes = yystacksize * YYSIZEOF (*Stack) + YYSTACK_GAP_MAXIMUM; \
yyptr += yynewbytes / YYSIZEOF (*yyptr); \
} \
while (0)

Definition at line 553 of file cql.c.

◆ YYSTYPE

#define YYSTYPE   token

Definition at line 124 of file cql.c.

◆ YYTABLE_NINF

#define YYTABLE_NINF   (-43)

Definition at line 689 of file cql.c.

◆ yytable_value_is_error

#define yytable_value_is_error (   Yyn)     0

Definition at line 691 of file cql.c.

◆ YYTOKENTYPE

#define YYTOKENTYPE

Definition at line 164 of file cql.c.

◆ YYTRANSLATE

#define YYTRANSLATE (   YYX)
Value:
(0 <= (YYX) && (YYX) <= YYMAXUTOK \
static const yytype_int8 yytranslate[]
Definition: cql.c:613
yysymbol_kind_t
Definition: cql.c:218
@ YYSYMBOL_YYUNDEF
Definition: cql.c:222
#define YYMAXUTOK
Definition: cql.c:601

Definition at line 606 of file cql.c.

◆ YYUNDEF

#define YYUNDEF   257

Definition at line 189 of file cql.c.

Typedef Documentation

◆ yy_state_fast_t

typedef int yy_state_fast_t

Definition at line 381 of file cql.c.

◆ yy_state_t

Definition at line 378 of file cql.c.

◆ yysymbol_kind_t

Definition at line 212 of file cql.c.

◆ yytoken_kind_t

Definition at line 127 of file cql.c.

◆ yytype_int16

typedef short yytype_int16

Definition at line 302 of file cql.c.

◆ yytype_int8

typedef signed char yytype_int8

Definition at line 294 of file cql.c.

◆ yytype_uint16

typedef unsigned short yytype_uint16

Definition at line 334 of file cql.c.

◆ yytype_uint8

typedef unsigned char yytype_uint8

Definition at line 323 of file cql.c.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
YYENOMEM 

Definition at line 804 of file cql.c.

◆ yysymbol_kind_t

Enumerator
YYSYMBOL_YYEMPTY 
YYSYMBOL_YYEOF 
YYSYMBOL_YYerror 
YYSYMBOL_YYUNDEF 
YYSYMBOL_PREFIX_NAME 
YYSYMBOL_SIMPLE_STRING 
YYSYMBOL_AND 
YYSYMBOL_OR 
YYSYMBOL_NOT 
YYSYMBOL_PROX 
YYSYMBOL_GE 
YYSYMBOL_LE 
YYSYMBOL_NE 
YYSYMBOL_EXACT 
YYSYMBOL_SORTBY 
YYSYMBOL_14_ 
YYSYMBOL_15_ 
YYSYMBOL_16_ 
YYSYMBOL_17_ 
YYSYMBOL_18_ 
YYSYMBOL_19_ 
YYSYMBOL_YYACCEPT 
YYSYMBOL_top 
YYSYMBOL_22_1 
YYSYMBOL_sortby 
YYSYMBOL_sortSpec 
YYSYMBOL_singleSpec 
YYSYMBOL_cqlQuery1 
YYSYMBOL_cqlQuery 
YYSYMBOL_28_2 
YYSYMBOL_29_3 
YYSYMBOL_scopedClause 
YYSYMBOL_31_4 
YYSYMBOL_searchClause 
YYSYMBOL_33_5 
YYSYMBOL_34_6 
YYSYMBOL_extraTerms 
YYSYMBOL_boolean 
YYSYMBOL_modifiers 
YYSYMBOL_relation 
YYSYMBOL_relation_symbol 
YYSYMBOL_index 
YYSYMBOL_searchTerm 

Definition at line 217 of file cql.c.

◆ yytokentype

Enumerator
YYEMPTY 
YYEOF 
YYerror 
YYUNDEF 
PREFIX_NAME 
SIMPLE_STRING 
AND 
OR 
NOT 
PROX 
GE 
LE 
NE 
EXACT 
SORTBY 

Definition at line 165 of file cql.c.

Function Documentation

◆ cql_parse()

int cql_parse ( void *  parm)

Referenced by cql_parser_stream().

◆ cql_parser_create()

CQL_parser cql_parser_create ( void  )

creates a CQL parser.

Returns
CCL parser

Returns CQL parser or NULL if parser could not be created.

Definition at line 1880 of file cql.c.

References cql_parser::client_data, cql_parser::getbyte, cql_parser::last_error, cql_parser::last_pos, cql_parser::nmem, nmem_create(), cql_parser::strict, cql_parser::top, cql_parser::ungetbyte, and xmalloc.

Referenced by cql2pqf().

◆ cql_parser_destroy()

void cql_parser_destroy ( CQL_parser  cp)

destroys a CQL parser.

Parameters
cpCQL parser

This function does nothing if NULL if received.

Definition at line 1895 of file cql.c.

References cql_node_destroy(), cql_parser::nmem, nmem_destroy(), cql_parser::top, and xfree.

Referenced by cql2pqf().

◆ cql_parser_result()

struct cql_node* cql_parser_result ( CQL_parser  cp)

returns the parse tree of the most recently parsed CQL query.

Parameters
cpCQL parser
Returns
CQL node or NULL for failure

Definition at line 1902 of file cql.c.

References cql_parser::top.

Referenced by cql2pqf().

◆ cql_parser_stream()

int cql_parser_stream ( CQL_parser  cp,
int(*)(void *client_data)  getbyte,
void(*)(int b, void *client_data)  ungetbyte,
void *  client_data 
)

parses CQL query (query stream)

Parameters
cpCQL parser
getbytefunction which reads one character from stream
ungetbytefunction which unreads one character from stream
client_datadata to be passed to stream functions
Return values
0success
!=0failure

This function is similar to cql_parser_string but takes a functions to read each query character from a stream.

The functions pointers getbytes, ungetbyte are similar to that known from stdios getc, ungetc.

Definition at line 1864 of file cql.c.

References cql_parser::client_data, cql_node_destroy(), cql_parse(), cql_parser::getbyte, cql_parser::nmem, nmem_reset(), cql_parser::top, and cql_parser::ungetbyte.

Referenced by cql_parser_stdio(), and cql_parser_string().

◆ cql_parser_strict()

void cql_parser_strict ( CQL_parser  cp,
int  mode 
)

configures strict mode

Parameters
cpCQL parser
mode1=enable strict mode, 0=disable strict mode

This function is similar to cql_parser_string but reads from stdio FILE handle instead.

Definition at line 1907 of file cql.c.

References cql_parser::strict.

◆ free()

void free ( void *  )

◆ malloc()

void* malloc ( YYSIZE_T  )

◆ putb()

static void putb ( YYSTYPE lval,
CQL_parser  cp,
int  c 
)
static

putb is a utility that puts one character to the string in current lexical token. This routine deallocates as necessary using NMEM.

Definition at line 1704 of file cql.c.

References cql_parser::nmem, and nmem_malloc().

Referenced by yylex().

◆ yydestruct()

static void yydestruct ( const char *  yymsg,
yysymbol_kind_t  yykind,
YYSTYPE yyvaluep,
void *  parm 
)
static

◆ yyerror()

int yyerror ( void *  lval,
char *  msg 
)

Definition at line 1693 of file cql.c.

◆ yylex()

int yylex ( YYSTYPE lval,
void *  vp 
)

yylex returns next token for Bison to be read. In this case one of the CQL terminals are returned.

Definition at line 1723 of file cql.c.

References AND, cql_parser::client_data, cql_strcmp(), EXACT, GE, cql_parser::getbyte, LE, NE, cql_parser::nmem, nmem_malloc(), NOT, OR, PREFIX_NAME, PROX, putb(), SIMPLE_STRING, SORTBY, cql_parser::strict, cql_parser::ungetbyte, and yaz_isspace.

◆ yyparse()

int yyparse ( void *  parm)

Variable Documentation

◆ yycheck

const yytype_int8 yycheck[]
static
Initial value:
=
{
11, 20, 15, 21, 0, 3, 4, 0, 1, 37,
21, 9, 10, 11, 12, 4, 14, 15, 46, 13,
13, 19, 17, 42, 57, 58, 44, 18, 44, 39,
41, 60, -1, 44, -1, 3, 5, 6, 7, 8,
59, 9, 10, 11, 12, 56, 14, 15, -1, -1,
-1, 19, -1, 64, 3, 4, 5, 6, 7, 8,
-1, -1, -1, -1, 13, 14, -1, 16, 3, 4,
5, 6, 7, 8, -1, -1, -1, -1, 13, -1,
-1, 16, 3, 4, 5, 6, 7, 8, -1, -1,
-1, -1, 13, 9, 10, 11, 12, -1, 14, 15,
-1, -1, -1, 19
}

Definition at line 755 of file cql.c.

Referenced by yyparse().

◆ yydefact

const yytype_int8 yydefact[]
static
Initial value:
=
{
2, 0, 0, 1, 44, 43, 45, 46, 47, 48,
49, 0, 19, 4, 0, 11, 16, 0, 25, 14,
0, 0, 3, 10, 26, 27, 28, 29, 32, 33,
38, 39, 40, 41, 36, 35, 37, 32, 34, 25,
21, 0, 0, 0, 5, 7, 32, 42, 17, 22,
24, 12, 15, 20, 6, 8, 0, 0, 0, 0,
30, 18, 23, 13, 0, 31
}

Definition at line 710 of file cql.c.

Referenced by yyparse().

◆ yydefgoto

const yytype_int8 yydefgoto[]
static
Initial value:
=
{
0, 1, 2, 22, 44, 45, 13, 14, 59, 42,
15, 57, 16, 20, 58, 40, 28, 48, 37, 38,
17, 18
}

Definition at line 730 of file cql.c.

Referenced by yyparse().

◆ yypact

const yytype_int8 yypact[]
static
Initial value:
=
{
-34, 4, 51, -34, -34, -34, -34, -34, -34, -34,
-34, 79, -34, 6, 7, 31, -34, 32, 2, -13,
51, 79, -34, -34, -34, -34, -34, -34, -34, -34,
-34, -34, -34, -34, -34, -34, -34, -34, -34, 11,
-34, 79, 51, 5, 79, -34, -34, -34, 9, 9,
-34, -34, -34, -34, -34, 9, 79, 65, 65, 51,
84, -34, -34, -34, 79, -34
}

Definition at line 696 of file cql.c.

Referenced by yyparse().

◆ yypgoto

const yytype_int8 yypgoto[]
static
Initial value:
=
{
-34, -34, -34, -34, -34, -16, -34, -19, -34, -34,
-34, -34, -33, -34, -34, -10, -34, -28, -34, -29,
-18, -11
}

Definition at line 722 of file cql.c.

Referenced by yyparse().

◆ yyr1

const yytype_int8 yyr1[]
static
Initial value:
=
{
0, 20, 22, 21, 23, 23, 24, 24, 25, 26,
26, 27, 28, 27, 29, 27, 30, 31, 30, 33,
32, 32, 34, 32, 35, 35, 36, 36, 36, 36,
37, 37, 37, 38, 38, 39, 39, 39, 39, 39,
39, 39, 40, 41, 41, 41, 41, 41, 41, 41
}

Definition at line 784 of file cql.c.

Referenced by yyparse().

◆ yyr2

const yytype_int8 yyr2[]
static
Initial value:
=
{
0, 2, 0, 3, 0, 2, 2, 1, 2, 1,
2, 1, 0, 6, 0, 4, 1, 0, 5, 0,
4, 2, 0, 5, 2, 0, 1, 1, 1, 1,
3, 5, 0, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1
}

Definition at line 794 of file cql.c.

Referenced by yyparse().

◆ yystos

const yytype_int8 yystos[]
static
Initial value:
=
{
0, 21, 22, 0, 3, 4, 5, 6, 7, 8,
13, 14, 16, 26, 27, 30, 32, 40, 41, 41,
33, 13, 23, 1, 5, 6, 7, 8, 36, 3,
9, 10, 11, 12, 14, 15, 19, 38, 39, 4,
35, 15, 29, 27, 24, 25, 40, 41, 37, 37,
35, 41, 27, 17, 25, 37, 18, 31, 34, 28,
41, 32, 32, 27, 39, 41
}

Definition at line 772 of file cql.c.

◆ yytable

const yytype_int8 yytable[]
static
Initial value:
=
{
19, 43, 41, 46, 3, -42, 39, -9, 23, 49,
47, -42, -42, -42, -42, 39, -42, -42, 55, 21,
-9, -42, 53, 52, 61, 62, 46, 56, 54, 50,
51, 64, 0, 47, 0, 29, 24, 25, 26, 27,
63, 30, 31, 32, 33, 60, 34, 35, 0, 0,
0, 36, 0, 65, 4, 5, 6, 7, 8, 9,
0, 0, 0, 0, 10, 11, 0, 12, 4, 5,
6, 7, 8, 9, 0, 0, 0, 0, 10, 0,
0, 12, 4, 5, 6, 7, 8, 9, 0, 0,
0, 0, 10, 30, 31, 32, 33, 0, 34, 35,
0, 0, 0, 36
}

Definition at line 740 of file cql.c.

Referenced by yyparse().

◆ yytranslate

const yytype_int8 yytranslate[]
static
Initial value:
=
{
0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
16, 17, 2, 2, 2, 2, 2, 18, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
19, 15, 14, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
5, 6, 7, 8, 9, 10, 11, 12, 13
}

Definition at line 613 of file cql.c.