Testparser

  • Uploaded by: Madi
  • 0
  • 0
  • May 2020
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Testparser as PDF for free.

More details

  • Words: 113
  • Pages: 1
/* testparser.c

- test the parser object */

#include <stdio.h> #include static int lex(void *ls, void *yylval) { int *lexstate=(int *)ls; /* tokens: 3 "FOO" 4 "'?'" 5 "'a'" 6 "'b'" 7 "'/'" */ static short dummy[] = { /* a b ? / FOO a b FOO b a / ? / FOO */ 5, 6, 4, 7, 3, 5, 6, 3, 6, 5, 7, 4, 7, 3 }; int dummyinx = *lexstate; (*lexstate)++; return (dummyinx < sizeof(dummy)/sizeof(short)) ? dummy[dummyinx] : 0; } int main() { int lexstate = 0; class foo *p = new foo; parser::SetDebug( 1 ); printf("parser returns %d\n", (p)->Parse(lex, &lexstate)); exit(0); /* keep 'make' happy */ }

Related Documents

Testparser
May 2020 16

More Documents from "Madi"

Steam_o&m
November 2019 35
Learning Python
May 2020 36
Scene 1 Analysis.pdf
May 2020 14
Testparser
May 2020 16