Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

incorrect code generated when using -b #27

Closed
skvadrik opened this issue Apr 29, 2006 · 2 comments

Comments

@skvadrik
Copy link
Owner

commented Apr 29, 2006

This bug was reported by Matt Sergeant (msergeant at
startechgroup.co.uk):

Anyway take a look at this. It produces the correct
code if run without the -b flag, but incorrect code
(i.e. it doesn’t match) if you run with -b.

(this will probably wrap, unfortunately I don’t have a
way to send it without wrapping right now)

#define NULL ((char*) 0)
#define YYCTYPE char
#define YYCURSOR p
#define YYLIMIT p
#define YYMARKER q
#define YYFILL
#define YYDEBUG debug

#include <stdio.h>

void debug(int state, char curr) {
printf(“State: %d, Curr: %c\n”, state, curr);
}

char scan281(char *p){
char *q;
start:
/
!re2c
( “adsl” | “adslppp” | “bdsl” | “cdsl” |
“dslgw4pool” | “dslppp” | “edsl” | “fdsl” | “ldsl” |
“pool” | “pppdsl” | “premiumC” | “vdsl” | “xsttldsl”
)[0-9a-k\-]\+ “.”.+ “.uswest.net” {return
“dsl”;}
( “dhcp” | “dorms” | “rh” ).* “-”[0-9]\+ “-”[0-9]+
“.”.+ “.resnet.pitt.edu” {return “resnet”;}
[0-9]\+ “-”[0-9]\+ “-”[0-9]\+ “-”[0-9]\+ “.”( “dhcp” |
.* “modem” | “bothell” ).* “.washington.edu”
{return “edu”;}
[\001-\377] { goto start; }
[\000] {return NULL; }
*/
}

int main(int argc, char **argv) {
char *v = “D-128-208-46-51.dhcp4.washington.edu”;
printf(“%s\n”, scan281(v));
return 0;
}

Original comment by: nuffer

@skvadrik

This comment has been minimized.

Copy link
Owner Author

commented May 1, 2006

Logged In: YES
user_id=271023

Your code needs more than 8 tables and the generation for
more than 8 tables was wrong.

Original comment by: helly

@skvadrik

This comment has been minimized.

Copy link
Owner Author

commented May 1, 2006

- priority: 5 —> 7
- assigned_to: nobody —> helly
- status: open —> closed-fixed

Original comment by: helly

@skvadrik skvadrik self-assigned this Jul 23, 2015

@skvadrik skvadrik closed this Jul 23, 2015

skvadrik added a commit that referenced this issue Aug 16, 2015

skvadrik added a commit that referenced this issue Nov 21, 2015

Merge branch 'master' into simplified_codegen.
* master:
  Updated version to 0.14.4.dev
  Release 0.14.3.
  Added simple test for yacc-style brackets (see patch #27)
  Fixed '#27 re2c crashes reading files containing %{ %}' (patch by Rui)
  Makefile.am: dropped distfiles for MSVC (they are broken anyway)
  Added full another test for bug #57.
  Updated version to 0.14.3.dev
  Release 0.14.2.
  Fixed bug #57: Wrong result only if another rule is present
  Updated version to 0.14.2.dev
  Release 0.14.1.
  Pad version with '0' instead of nulls
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.