diff options
author | Joseph Langley <mightyjo@gmail.com> | 2021-06-02 20:17:38 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-02 20:17:38 -0400 |
commit | a297d520ae8f0d718a7aab5975550eb8dc1f2cae (patch) | |
tree | c2acd3a13e89d47ff7018a6914bbfda6db13108b /examples/manual/string1.lex | |
parent | 04c5b7c9209801aa1bdbf279ccdcde0d57874a55 (diff) | |
parent | 5d93876e2249adec9e3a1e8f02e28bdf9a64e4c1 (diff) | |
download | flex-git-a297d520ae8f0d718a7aab5975550eb8dc1f2cae.tar.gz |
Merge pull request #16 from eric-s-raymond/retargeting
Reviewing ESR's Retargeting branch from westes/flex
Diffstat (limited to 'examples/manual/string1.lex')
-rw-r--r-- | examples/manual/string1.lex | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/examples/manual/string1.lex b/examples/manual/string1.lex index b62ed88..3a3276d 100644 --- a/examples/manual/string1.lex +++ b/examples/manual/string1.lex @@ -1,5 +1,5 @@ /* - * string1.lex: Handling strings by using input() + * string1.lex: Handling strings by using yyinput() */ %{ @@ -27,13 +27,13 @@ void yyerror(char *message) buffer = malloc(ALLOC_SIZE); max_size = ALLOC_SIZE; - inch = input(); + inch = yyinput(); count = 0; while(inch != EOF && inch != '"' && inch != '\n'){ if(inch == '\\'){ - inch = input(); + inch = yyinput(); switch(inch){ - case '\n': inch = input(); break; + case '\n': inch = yyinput(); break; case 'b' : inch = '\b'; break; case 't' : inch = '\t'; break; case 'n' : inch = '\n'; break; @@ -41,10 +41,10 @@ void yyerror(char *message) case 'f' : inch = '\f'; break; case 'r' : inch = '\r'; break; case 'X' : - case 'x' : inch = input(); + case 'x' : inch = yyinput(); if(isxdigit(inch)){ temp = hextoint(toupper(inch)); - inch = input(); + inch = yyinput(); if(isxdigit(inch)){ temp = (temp << 4) + hextoint(toupper(inch)); } else { @@ -59,14 +59,14 @@ void yyerror(char *message) default: if(isodigit(inch)){ temp = inch - '0'; - inch = input(); + inch = yyinput(); if(isodigit(inch)){ temp = (temp << 3) + (inch - '0'); } else { unput(inch); goto done; } - inch = input(); + inch = yyinput(); if(isodigit(inch)){ temp = (temp << 3) + (inch - '0'); } else { @@ -82,7 +82,7 @@ void yyerror(char *message) buffer = realloc(buffer,max_size + ALLOC_SIZE); max_size += ALLOC_SIZE; } - inch = input(); + inch = yyinput(); } if(inch == EOF || inch == '\n'){ yyerror("Unterminated string."); |