Version 6.3
Copyright © 2005 - 2012 Lowell D. Thomas
APG
  … ABNF Parser Generator
All Data Structures Files Functions Variables Typedefs Macros Pages
Callbacks.c
Go to the documentation of this file.
1 /*******************************************************************************
2  APG Version 6.3
3  Copyright (C) 2005 - 2012 Lowell D. Thomas, all rights reserved
4 
5  author: Lowell D. Thomas
6  email: lowell@coasttocoastresearch.com
7  website: http://www.coasttocoastresearch.com
8 
9  This program is free software: you can redistribute it and/or modify
10  it under the terms of the GNU General Public License as published by
11  the Free Software Foundation, either version 2 of the License, or
12  (at your option) any later version.
13 
14  This program is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  GNU General Public License for more details.
18 
19  You should have received a copy of the GNU General Public License
20  along with this program. If not, see
21  <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>
22  or write to the Free Software Foundation, Inc.,
23  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
24 *******************************************************************************/
25 
26 #include "main.h"
27 #include "CallbacksGrammar.h"
30 //apg_uint uiFile(APG_CBDATA* spData);
38 
39 // callback functions
44 typedef struct{
45  FILE* spOut;
54  apg_uint uiaErrorLineNos[100];
56 
61 typedef struct{
62  FILE* spOut;
65 
70 void vIndent(FILE* spOut, apg_uint uiIndent){
71  apg_uint i = 0;
72  for(; i < uiIndent; i++){fprintf(spOut, " ");}
73 }
79  apg_uint uiRet = APG_FALSE;
80  PARSER_CALLBACK_DATA* spParserData = NULL;
81  switch(spData->uiState){
82  case PRE_PARSE:
83  spParserData = (PARSER_CALLBACK_DATA*)spData->vpUserData;
84  // pre-branch parse tree traversal (down)
85  // initialize data
86  FILE* spOut = spParserData->spOut;
87  fprintf(spParserData->spOut, "\n");
88  fprintf(spParserData->spOut, "uiFile: pre-parse processing\n");
89  fprintf(spParserData->spOut, "uiFile: initialize the callback data\n");
90  memset((void*)spParserData, 0, sizeof(PARSER_CALLBACK_DATA));
91  spParserData->spOut = spOut;
92  break;
93  case MATCH:
94  spParserData = (PARSER_CALLBACK_DATA*)spData->vpUserData;
95  fprintf(spParserData->spOut, "\n");
96  fprintf(spParserData->spOut, "uiFile: post-parse processing\n");
97  fprintf(spParserData->spOut, "uiFile: display the collected data\n");
98  fprintf(spParserData->spOut, "uiFile: state = %s\n", cpState2String(spData->uiState));
99  fprintf(spParserData->spOut, "uiFile: %3lu = lines\n", (printf_uint)spParserData->uiLineNo);
100  fprintf(spParserData->spOut, "uiFile: %3lu = blank lines\n", (printf_uint)spParserData->uiBlankLines);
101  fprintf(spParserData->spOut, "uiFile: %3lu = hexidecimal numbers rejected semantically\n", (printf_uint)spParserData->uiHexNumOverrides);
102  fprintf(spParserData->spOut, "uiFile: %3lu = SemiComments rejected\n", (printf_uint)spParserData->uiSemiCommentsRejected);
103  fprintf(spParserData->spOut, "uiFile: %3lu = SemiComments\n", (printf_uint)spParserData->uiSemiComments);
104  fprintf(spParserData->spOut, "uiFile: %3lu = CppComments\n", (printf_uint)spParserData->uiCppComments);
105  fprintf(spParserData->spOut, "uiFile: %3lu = CComments\n", (printf_uint)spParserData->uiCComments);
106  fprintf(spParserData->spOut, "uiFile: %3lu = errors\n", (printf_uint)spParserData->uiLineErrors);
107  if(spParserData->uiLineErrors){
108  apg_uint i;
109  fprintf(spParserData->spOut, "uiFile: errors at lines (one-based)\n");
110  for(i = 0; i < spParserData->uiLineErrors; i++){
111  fprintf(spParserData->spOut, "uiFile: %lu\n", (printf_uint)spParserData->uiaErrorLineNos[i]);
112  }
113  }
114  break;
115  case EMPTY:
116  spParserData = (PARSER_CALLBACK_DATA*)spData->vpUserData;
117  fprintf(spParserData->spOut, "uiFile: error: state = EMPTY\n");
118  break;
119  case NOMATCH:
120  spParserData = (PARSER_CALLBACK_DATA*)spData->vpUserData;
121  fprintf(spParserData->spOut, "uiFile: error: state = NOMATCH\n");
122  break;
123  default:
124  break;
125  }
126  return uiRet;
127 }
133  apg_uint uiRet = APG_FALSE;
134  AST_CALLBACK_DATA* spAstData = NULL;
135  switch(spData->uiState){
136  case PRE_AST:
137  spAstData = (AST_CALLBACK_DATA*)spData->vpUserData;
138  // pre-branch parse tree traversal (down)
139  // initialize data
140  FILE* spOut = spAstData->spOut;
141  memset((void*)spAstData, 0, sizeof(AST_CALLBACK_DATA));
142  spAstData->spOut = spOut;
143  fprintf(spAstData->spOut, "\n");
144  vIndent(spAstData->spOut, spAstData->uiAstDepth);
145  fprintf(spAstData->spOut, "uiFile: depth: %lu: PRE_AST translation\n", (printf_uint)spAstData->uiAstDepth);
146  spAstData->uiAstDepth++;
147  break;
148  case POST_AST:
149  spAstData = (AST_CALLBACK_DATA*)spData->vpUserData;
150  spAstData->uiAstDepth--;
151  vIndent(spAstData->spOut, spAstData->uiAstDepth);
152  fprintf(spAstData->spOut, "uiFile: depth: %lu: POST_AST translation\n", (printf_uint)spAstData->uiAstDepth);
153  break;
154  default:
155  break;
156  }
157  return uiRet;
158 }
164  apg_uint uiRet = APG_FALSE;
165  PARSER_CALLBACK_DATA* spParserData = (PARSER_CALLBACK_DATA*)spData->vpUserData;
166  if(spData->uiState == PRE_PARSE){
167  // pre-branch parse tree traversal (down)
168 
169  } else if(spData->uiState == MATCH){
170  // post-branch parse tree traversal (up)
171  // the grammar allows semi-comments, but here we are going to reject them semantically
172  spData->uiPhraseLength = APG_UNDEFINED; // indicate that no phrase was matched
173  uiRet = APG_TRUE; // override the normal syntax parsing of this rule
174  spParserData->uiSemiCommentsRejected++;
175  }
176  return uiRet;
177 }
183  apg_uint uiRet = APG_FALSE;
184  PARSER_CALLBACK_DATA* spParserData = (PARSER_CALLBACK_DATA*)spData->vpUserData;
185  if(spData->uiState == PRE_PARSE){
186  // pre-branch parse tree traversal (down)
187 
188  } else if(spData->uiState == MATCH){
189  // post-branch parse tree traversal (up)
190  spParserData->uiCppComments++;
191  }
192  return uiRet;
193 }
199  apg_uint uiRet = APG_FALSE;
200  PARSER_CALLBACK_DATA* spParserData = (PARSER_CALLBACK_DATA*)spData->vpUserData;
201  if(spData->uiState == PRE_PARSE){
202  // pre-branch parse tree traversal (down)
203 
204  } else if(spData->uiState == MATCH){
205  // post-branch parse tree traversal (up)
206  spParserData->uiCComments++;
207  }
208  return uiRet;
209 }
215  apg_uint uiRet = APG_FALSE;
216  PARSER_CALLBACK_DATA* spParserData;
217  AST_CALLBACK_DATA* spAstData;
218  const apg_achar* acpPhrase = spData->acpSrc + spData->uiPhraseOffset;
219  switch(spData->uiState){
220  case PRE_PARSE:
221  spParserData = (PARSER_CALLBACK_DATA*)spData->vpUserData;
222  // pre-branch parse tree traversal (down)
223  // make a quick decision about whether this is hexidecimal
224  if(acpPhrase[1] != (apg_achar)'x'){
225  // this is not hexidecimal - reject it semantically
226  spData->uiPhraseLength = APG_UNDEFINED; // indicates no phrase was matched
227  uiRet = APG_TRUE; // override the normal parsing of this rule
228  spParserData->uiHexNumOverrides++;
229  }
230  break;
231  case MATCH:
232  spParserData = (PARSER_CALLBACK_DATA*)spData->vpUserData;
233  // post-branch parse tree traversal (up)
234  spParserData->uiCComments++;
235  break;
236  case PRE_AST:
237  spAstData = (AST_CALLBACK_DATA*)spData->vpUserData;
238  vIndent(spAstData->spOut, spAstData->uiAstDepth);
239  fprintf(spAstData->spOut, "uiHexNum: depth: %lu: PRE_AST translation\n", (printf_uint)spAstData->uiAstDepth);
240  spAstData->uiAstDepth++;
241  break;
242  case POST_AST:
243  spAstData = (AST_CALLBACK_DATA*)spData->vpUserData;
244  spAstData->uiAstDepth--;
245  vIndent(spAstData->spOut, spAstData->uiAstDepth);
246  fprintf(spAstData->spOut, "uiHexNum: depth: %lu: POST_AST translation\n", (printf_uint)spAstData->uiAstDepth);
247  break;
248  default:
249  break;
250  }
251  return uiRet;
252 }
258  apg_uint uiRet = APG_FALSE;
259  AST_CALLBACK_DATA* spAstData;
260  switch(spData->uiState){
261  case PRE_AST:
262  spAstData = (AST_CALLBACK_DATA*)spData->vpUserData;
263  vIndent(spAstData->spOut, spAstData->uiAstDepth);
264  fprintf(spAstData->spOut, "uiDecNum: depth: %lu: PRE_AST translation\n", (printf_uint)spAstData->uiAstDepth);
265  spAstData->uiAstDepth++;
266  break;
267  case POST_AST:
268  spAstData = (AST_CALLBACK_DATA*)spData->vpUserData;
269  spAstData->uiAstDepth--;
270  vIndent(spAstData->spOut, spAstData->uiAstDepth);
271  fprintf(spAstData->spOut, "uiDecNum: depth: %lu: POST_AST translation\n", (printf_uint)spAstData->uiAstDepth);
272  break;
273  default:
274  break;
275  }
276  return uiRet;
277 }
283  apg_uint uiRet = APG_FALSE;
284  PARSER_CALLBACK_DATA* spParserData = (PARSER_CALLBACK_DATA*)spData->vpUserData;
285  if(spData->uiState == PRE_PARSE){
286  // pre-branch parse tree traversal (down)
287 
288  } else if(spData->uiState == MATCH){
289  // post-branch parse tree traversal (up)
290  spParserData->uiLineNo++;
291  }
292  return uiRet;
293 }
299  apg_uint uiRet = APG_FALSE;
300  PARSER_CALLBACK_DATA* spParserData = (PARSER_CALLBACK_DATA*)spData->vpUserData;
301  if(spData->uiState == PRE_PARSE){
302  // pre-branch parse tree traversal (down)
303 
304  } else if(spData->uiState == MATCH){
305  // post-branch parse tree traversal (up)
306  spParserData->uiBlankLines++;
307  }
308  return uiRet;
309 }
315  apg_uint uiRet = APG_FALSE;
316  PARSER_CALLBACK_DATA* spParserData;
317  AST_CALLBACK_DATA* spAstData;
318  const apg_achar* acpPhrase = spData->acpSrc + spData->uiPhraseOffset;
319  apg_uint uiPhraseLength = spData->uiSrcLen - spData->uiPhraseOffset;
320  apg_uint uiErrorLength;
321  apg_uint i;
322 
323  // when all else has failed,
324  // suck up everything up to and including the next line end
325  switch(spData->uiState){
326  case PRE_PARSE:
327  spParserData = (PARSER_CALLBACK_DATA*)spData->vpUserData;
328  if(uiPhraseLength == 0){
329  spData->uiPhraseLength = APG_UNDEFINED; // expect this when parser is discovering the EOS
330  } else{
331  uiErrorLength = 0;
332  for(i = 0; i < uiPhraseLength; i++){
333  if(acpPhrase[i] == (apg_achar)10){
334  uiErrorLength = i + 1;
335  break;
336  }
337  if(acpPhrase[i] == (apg_achar)13){
338  if(i+1<uiPhraseLength && acpPhrase[i+1] == (apg_achar)10){
339  uiErrorLength = i + 2;
340  break;
341  }
342  uiErrorLength = i + 1;
343  break;
344  }
345  }
346  if(uiErrorLength == 0){spData->uiPhraseLength = i;}
347  else{spData->uiPhraseLength = uiErrorLength;}
348 
349  // and report the error
350  spParserData->uiLineNo++;
351  spParserData->uiaErrorLineNos[spParserData->uiLineErrors] = spParserData->uiLineNo;
352  spParserData->uiLineErrors++;
353  }
354  break;
355  case PRE_AST:
356  spAstData = (AST_CALLBACK_DATA*)spData->vpUserData;
357  vIndent(spAstData->spOut, spAstData->uiAstDepth);
358  fprintf(spAstData->spOut, "uiUDT_u_LineError: depth: %lu: PRE_AST translation\n", (printf_uint)spAstData->uiAstDepth);
359  spAstData->uiAstDepth++;
360  break;
361  case POST_AST:
362  spAstData = (AST_CALLBACK_DATA*)spData->vpUserData;
363  spAstData->uiAstDepth--;
364  vIndent(spAstData->spOut, spAstData->uiAstDepth);
365  fprintf(spAstData->spOut, "uiUDT_u_LineError: depth: %lu: POST_AST translation\n", (printf_uint)spAstData->uiAstDepth);
366  break;
367  default:
368  break;
369  }
370  return uiRet; // ignored by parser for UDTs
371 }
372 
373 // NOTE: error handling is done with the statement:
374 // if(error){vTerminalAlert(__LINE__, __FILE__);}
375 // prints line and file where error was detected and exits
376 
392  apg_uint uiBufferSize = 256;
393  char caInputString[uiBufferSize];
394  apg_achar acaParserString[uiBufferSize];
395  apg_uint uiStrLen;
396  apg_uint uiTest;
397  APG_CALLBACK saRuleTranslations[RULE_COUNT_CALLBACKSGRAMMAR];
398  APG_CALLBACK saUdtTranslations[UDT_COUNT_CALLBACKSGRAMMAR];
399  APG_CALLBACK saRuleCallbacks[RULE_COUNT_CALLBACKSGRAMMAR];
400  APG_CALLBACK saUdtCallbacks[UDT_COUNT_CALLBACKSGRAMMAR];
401  PARSER_CALLBACK_DATA sParserData;
402  AST_CALLBACK_DATA sAstData;
403  void* vpParser = NULL;
404  char* cpInFile = "Callbacks.input";
405  char* cpOutFile = "Callbacks.output";
406  FILE* spOut = NULL;
407 
408  // redirects output
409  spOut = fopen(cpOutFile, "w");
410  if(spOut){
411  printf("%s - output redirect file for vDemoCallbacks\n", cpOutFile);
412  } else{
413  printf("could not open output file \"%s\" - using stdout instead\n", cpOutFile);
414  spOut = stdout;
415  }
416 
417  fprintf(spOut, "*** LICENSE NOTICE ***\n");
418  vLicenseNotice(spOut);
419 
420  fprintf(spOut, "\n*** DEMO CALLBACKS ***\n");
421  fprintf(spOut, " - parsing\n");
422  fprintf(spOut, " - adding callback functions to selected rules\n");
423  fprintf(spOut, " - overriding the syntax semantically\n");
424  fprintf(spOut, " - pre-branch syntax error detections\n");
425  fprintf(spOut, " - post-branch semantically overriding the syntax\n");
426  fprintf(spOut, " - adding the required callback functions for the UDTs defined in the grammar\n");
427  fprintf(spOut, " - Abstract Syntax Tree (AST) translation\n");
428  fprintf(spOut, " - translating rule AST nodes\n");
429  fprintf(spOut, " - translating UDT AST nodes\n");
430  fprintf(spOut, " - using the same callback function for both parsing and AST translation\n");
431  fprintf(spOut, " - using the different callback functions for parsing and AST translation\n");
432 
433  // construct the parser
434  vpParser = vpParserCtor(vpParserInit_CallbacksGrammar, vTerminalAlert);
435  if(!vpParser){vTerminalAlert(__LINE__, __FILE__);}
436 
437  // get the input string
438  memset((void*)&caInputString[0], 0, uiBufferSize);
439  uiStrLen = uiGetFileSize(cpInFile);
440  if(!uiStrLen){vTerminalAlert(__LINE__, __FILE__);}
441  if(uiStrLen > uiBufferSize){vTerminalAlert(__LINE__, __FILE__);}
442  uiTest = uiGetFile(cpInFile, (void*)&caInputString[0]);
443  if(uiTest != uiStrLen){vTerminalAlert(__LINE__, __FILE__);}
444  caInputString[uiStrLen] = 0;
445 
446  fprintf(spOut, "\n*** THE INPUT STRING\n");
447  vDisplayAscii(spOut, caInputString, uiStrLen);
448 
449  // convert the input string to alphabet characters
450  vCharToAChar(&acaParserString[0], &caInputString[0], uiStrLen);
451 
452  // setup for syntax callbacks
453  memset((void*)saRuleCallbacks, 0, sizeof(saRuleCallbacks));
454  memset((void*)saUdtCallbacks, 0, sizeof(saUdtCallbacks));
455  saRuleCallbacks[RULE_CALLBACKSGRAMMAR_FILE] = uiFileParser; // parser rule callback is different from AST callback
456  saRuleCallbacks[RULE_CALLBACKSGRAMMAR_BLANKLINE] = uiBlankLine;
457  saRuleCallbacks[RULE_CALLBACKSGRAMMAR_LINEEND] = uiLineEnd;
458  saRuleCallbacks[RULE_CALLBACKSGRAMMAR_HEXNUM] = uiHexNum;
459  saRuleCallbacks[RULE_CALLBACKSGRAMMAR_CCOMMENT] = uiCComment;
460  saRuleCallbacks[RULE_CALLBACKSGRAMMAR_CPPCOMMENT] = uiCppComment;
461  saRuleCallbacks[RULE_CALLBACKSGRAMMAR_SEMICOMMENT] = uiSemiComment;
462  saUdtCallbacks[UDT_CALLBACKSGRAMMAR_U_LINEERROR] = uiUDT_u_LineError;
463  uiParserSyntaxInitCallbacks(vpParser, &saRuleCallbacks[0], &saUdtCallbacks[0]);// parser UDT callback is same AST callback
464 
465  // set up for AST callbacks
466  memset((void*)saRuleTranslations, 0, sizeof(saRuleTranslations));
467  memset((void*)saUdtTranslations, 0, sizeof(saUdtTranslations));
468  // we are not interesed in translating these node
469  saRuleTranslations[RULE_CALLBACKSGRAMMAR_FILE] = uiFileAst; // AST rule callback is different from parser callback
470  saRuleTranslations[RULE_CALLBACKSGRAMMAR_HEXNUM] = uiHexNum; // AST rule callback is same as parser callback
471  saRuleTranslations[RULE_CALLBACKSGRAMMAR_DECNUM] = uiDecNum; // AST node not used during parsing
472  saUdtTranslations[UDT_CALLBACKSGRAMMAR_U_LINEERROR] = uiUDT_u_LineError; // AST UDT callback is same as parser callback
473  vParserAstInitCallbacks(vpParser, &saRuleTranslations[0], &saUdtTranslations[0]);
474 
475  // parse the string
476  sParserData.spOut = spOut;
477  sAstData.spOut = spOut;
478  uiTest = uiParserSyntaxAnalysis(vpParser, RULE_CALLBACKSGRAMMAR_FILE, &acaParserString[0], uiStrLen, &sParserData);
479  if(!uiTest){vTerminalAlert(__LINE__, __FILE__);}
480 
481  // examine the parser state
482  fprintf(spOut, "\n*** PARSER STATE\n");
483  vDisplayParserState(spOut, vpParser);
484 
485  // display the ast
486  // look at the parsed phrases (AST nodes)
487  fprintf(spOut, "\n*** AST NODES DISPLAY\n");
488  vDisplayAstRecords(spOut, vpParser);
489 
490  // translate the AST
491  fprintf(spOut, "\n*** AST TRANSLATIONS\n");
492  uiTest = uiParserAstTranslate(vpParser, NULL, NULL, &sAstData);
493  if(uiTest != 0){vTerminalAlert(__LINE__, __FILE__);}
494 
495 
496  fprintf(spOut, "\n*** DEMO CALLBACKS - test ended successfully ***\n");
497  if(spOut != stdout){fclose(spOut);}
498 }
vDisplayAscii
void vDisplayAscii(FILE *spOut, const char *cpSrc, apg_uint uiSrcLen)
Definition: Utilities.c:62
vDisplayParserState
void vDisplayParserState(FILE *spOut, void *vpParserCtx)
Definition: Utilities.c:373
uiParserAstTranslate
apg_uint uiParserAstTranslate(void *vpCtx, APG_CALLBACK *pfnRuleCallbacks, APG_CALLBACK *pfnUdtCallbacks, void *vpData)
Definition: Parser.c:361
vParserAstInitCallbacks
void vParserAstInitCallbacks(void *vpCtx, APG_CALLBACK *spRuleCallbacks, APG_CALLBACK *spUdtCallbacks)
Definition: Parser.c:316
uiUDT_u_LineError
apg_uint uiUDT_u_LineError(APG_CBDATA *spData)
Definition: Callbacks.c:314
uiFileParser
apg_uint uiFileParser(APG_CBDATA *spData)
Definition: Callbacks.c:78
POST_AST
#define POST_AST
Definition: Apg.h:556
APG_CBDATA::acpSrc
const apg_achar * acpSrc
Definition: Apg.h:455
uiCppComment
apg_uint uiCppComment(APG_CBDATA *spData)
Definition: Callbacks.c:182
PARSER_CALLBACK_DATA::uiCComments
apg_uint uiCComments
Definition: Callbacks.c:48
AST_CALLBACK_DATA::spOut
FILE * spOut
Definition: Callbacks.c:62
PARSER_CALLBACK_DATA::uiLineNo
apg_uint uiLineNo
Definition: Callbacks.c:51
apg_uint
unsigned int apg_uint
Definition: Apg.h:169
APG_CALLBACK
apg_uint(* APG_CALLBACK)(APG_CBDATA *spData)
Definition: Apg.h:515
uiDecNum
apg_uint uiDecNum(APG_CBDATA *spData)
Definition: Callbacks.c:257
vIndent
void vIndent(FILE *spOut, apg_uint uiIndent)
Definition: Callbacks.c:70
uiHexNum
apg_uint uiHexNum(APG_CBDATA *spData)
Definition: Callbacks.c:214
uiLineEnd
apg_uint uiLineEnd(APG_CBDATA *spData)
Definition: Callbacks.c:282
PARSER_CALLBACK_DATA::uiaErrorLineNos
apg_uint uiaErrorLineNos[100]
Definition: Callbacks.c:54
PARSER_CALLBACK_DATA
user data passed to the Parser
Definition: Callbacks.c:44
APG_CBDATA::uiPhraseOffset
apg_uint uiPhraseOffset
Definition: Apg.h:457
uiGetFileSize
apg_uint uiGetFileSize(const char *cpFileName)
Definition: Files.c:40
uiFileAst
apg_uint uiFileAst(APG_CBDATA *spData)
Definition: Callbacks.c:132
PRE_PARSE
#define PRE_PARSE
Definition: Apg.h:526
vDisplayAstRecords
void vDisplayAstRecords(FILE *spOut, void *vpParserCtx)
Definition: Utilities.c:183
uiParserSyntaxInitCallbacks
apg_uint uiParserSyntaxInitCallbacks(void *vpCtx, APG_CALLBACK *spRuleCallbacks, APG_CALLBACK *spUdtCallbacks)
Definition: Parser.c:187
uiCComment
apg_uint uiCComment(APG_CBDATA *spData)
Definition: Callbacks.c:198
APG_CBDATA::uiPhraseLength
apg_uint uiPhraseLength
Definition: Apg.h:459
EMPTY
#define EMPTY
Definition: Apg.h:538
APG_TRUE
#define APG_TRUE
Definition: Apg.h:187
vDemoCallbacks
void vDemoCallbacks()
Definition: Callbacks.c:391
PARSER_CALLBACK_DATA::uiSemiCommentsRejected
apg_uint uiSemiCommentsRejected
Definition: Callbacks.c:50
APG_CBDATA::uiState
apg_uint uiState
Definition: Apg.h:458
vLicenseNotice
void vLicenseNotice(FILE *spFile)
Definition: Utilities.c:442
uiSemiComment
apg_uint uiSemiComment(APG_CBDATA *spData)
Definition: Callbacks.c:163
apg_achar
unsigned char apg_achar
Definition: Apg.h:183
printf_uint
unsigned long int printf_uint
Definition: ApgUtilities.h:52
uiBlankLine
apg_uint uiBlankLine(APG_CBDATA *spData)
Definition: Callbacks.c:298
PARSER_CALLBACK_DATA::uiLineErrors
apg_uint uiLineErrors
Definition: Callbacks.c:53
AST_CALLBACK_DATA::uiAstDepth
apg_uint uiAstDepth
Definition: Callbacks.c:63
APG_CBDATA
The data structure passed to all syntax and AST callback functions, both rule and UDT.
Definition: Apg.h:453
vpParserCtor
void * vpParserCtor(void *vpParserInit, PFN_ALERT pfnAlertHandler)
Definition: Parser.c:58
APG_CBDATA::uiSrcLen
apg_uint uiSrcLen
Definition: Apg.h:456
APG_UNDEFINED
#define APG_UNDEFINED
Definition: Apg.h:194
PARSER_CALLBACK_DATA::uiSemiComments
apg_uint uiSemiComments
Definition: Callbacks.c:46
MATCH
#define MATCH
Definition: Apg.h:544
APG_CBDATA::vpUserData
void * vpUserData
Definition: Apg.h:460
APG_FALSE
#define APG_FALSE
Definition: Apg.h:190
uiGetFile
apg_uint uiGetFile(const char *cpFileName, void *vpBuffer)
Definition: Files.c:71
PARSER_CALLBACK_DATA::uiBlankLines
apg_uint uiBlankLines
Definition: Callbacks.c:52
PARSER_CALLBACK_DATA::uiCppComments
apg_uint uiCppComments
Definition: Callbacks.c:47
vCharToAChar
void vCharToAChar(apg_achar *acpAChars, const char *cpChars, apg_uint uiLen)
Definition: Tools.c:79
vTerminalAlert
void vTerminalAlert(unsigned int uiLine, const char *cpFile)
Definition: Utilities.c:557
PARSER_CALLBACK_DATA::uiHexNumOverrides
apg_uint uiHexNumOverrides
Definition: Callbacks.c:49
PRE_AST
#define PRE_AST
Definition: Apg.h:550
NOMATCH
#define NOMATCH
Definition: Apg.h:532
uiParserSyntaxAnalysis
apg_uint uiParserSyntaxAnalysis(void *vpCtx, apg_uint uiStartRule, const apg_achar *acpSrc, apg_uint uiSrcLen, void *vpData)
Definition: Parser.c:228
cpState2String
const char * cpState2String(apg_uint uiState)
Definition: Utilities.c:590
PARSER_CALLBACK_DATA::spOut
FILE * spOut
Definition: Callbacks.c:45
AST_CALLBACK_DATA
user data passed to the AST translator
Definition: Callbacks.c:61
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.