]> granicus.if.org Git - re2c/commitdiff
- Fixes by Derick
authorhelly <helly@642ea486-5414-0410-9d7f-a0204ed87703>
Mon, 17 Apr 2006 20:16:15 +0000 (20:16 +0000)
committerhelly <helly@642ea486-5414-0410-9d7f-a0204ed87703>
Mon, 17 Apr 2006 20:16:15 +0000 (20:16 +0000)
20 files changed:
lessons/001_upn_calculator/calc_001.c
lessons/001_upn_calculator/calc_001.re
lessons/001_upn_calculator/calc_002.c
lessons/001_upn_calculator/calc_002.re
lessons/001_upn_calculator/calc_003.c
lessons/001_upn_calculator/calc_003.re
lessons/001_upn_calculator/calc_004.c
lessons/001_upn_calculator/calc_004.re
lessons/001_upn_calculator/calc_005.c
lessons/001_upn_calculator/calc_005.re
lessons/001_upn_calculator/calc_006.s.c
lessons/001_upn_calculator/calc_006.s.re
lessons/001_upn_calculator/calc_007.b.c
lessons/001_upn_calculator/calc_007.b.re
lessons/001_upn_calculator/windows/main.b.c
lessons/001_upn_calculator/windows/main.b.re
lessons/002_strip_comments/strip_001.s.re
lessons/002_strip_comments/strip_002.s.re
lessons/002_strip_comments/strip_003.b.re
lessons/readme.txt

index a4171120fa8d6501cb99425bc5026c4270a907d9..ab941e90b56f84570037e0d8224914384b71e33e 100755 (executable)
@@ -11,11 +11,11 @@ int scan(char *s, int l)
 {
        char *p = s;
        char *q = 0;
-       #define YYCTYPE         char
-       #define YYCURSOR        p
-       #define YYLIMIT         (s+l)
-       #define YYMARKER        q
-       #define YYFILL(n)
+#define YYCTYPE         char
+#define YYCURSOR        p
+#define YYLIMIT         (s+l)
+#define YYMARKER        q
+#define YYFILL(n)
        
        for(;;)
        {
index a810f18cd21e1435d534e702b7f32e688b1ec6b9..2b24404e67500099f875d6c7c3d83e048e45e30e 100755 (executable)
     in this lesson. In the next example we see one way to get rid of it.
   . We use a 'for(;;)'-loop around the scanner block. We could have used a
     'while(1)'-loop instead but some compilers generate a warning for it.
-  . To make the output more readable we use 're2c:indent:top' scanen
+  . To make the output more readable we use 're2c:indent:top' scanne
     configuration that configures re2c to prepend a single tab (the default)
     to the beginning of each output line.
   . The following lines are expressions and for each expression we output the 
     token name and continue the scanner loop.
   . The second last token detects the end of our input, the terminating zero in
-    out input string. In other scanners detecting the end of input may vary.
+    our input string. In other scanners detecting the end of input may vary.
     For example binary code may contain \0 as valid input.
   . The last expression accepts any input character. It tells re2c to accept 
     the opposit of the empty range. This includes numbers and our tokens but
@@ -49,11 +49,11 @@ int scan(char *s, int l)
 {
        char *p = s;
        char *q = 0;
-       #define YYCTYPE         char
-       #define YYCURSOR        p
-       #define YYLIMIT         (s+l)
-       #define YYMARKER        q
-       #define YYFILL(n)
+#define YYCTYPE         char
+#define YYCURSOR        p
+#define YYLIMIT         (s+l)
+#define YYMARKER        q
+#define YYFILL(n)
        
        for(;;)
        {
index b380d064eb8c0ef5d7d1e36dfdfaf06c87dd1300..9d5758bd76c022ffd79b8a50b6108649e131547d 100755 (executable)
@@ -19,11 +19,11 @@ int scan(char *s)
        char *p = s;
        char *l = s;
        char *q = 0;
-       #define YYCTYPE         char
-       #define YYCURSOR        p
-       #define YYLIMIT         l
-       #define YYMARKER        q
-       #define YYFILL(n)               { if (!fill(p, n, &l)) break; }
+#define YYCTYPE         char
+#define YYCURSOR        p
+#define YYLIMIT         l
+#define YYMARKER        q
+#define YYFILL(n)              { if (!fill(p, n, &l)) break; }
        
        for(;;)
        {
index 0f045241989791532680487a37f28cdb2630141e..9547cfaa98c8b0e9febceb3868afc333a4497995 100755 (executable)
@@ -33,11 +33,11 @@ int scan(char *s)
        char *p = s;
        char *l = s;
        char *q = 0;
-       #define YYCTYPE         char
-       #define YYCURSOR        p
-       #define YYLIMIT         l
-       #define YYMARKER        q
-       #define YYFILL(n)               { if (!fill(p, n, &l)) break; }
+#define YYCTYPE         char
+#define YYCURSOR        p
+#define YYLIMIT         l
+#define YYMARKER        q
+#define YYFILL(n)              { if (!fill(p, n, &l)) break; }
        
        for(;;)
        {
index 2a2e65ff7c5f10dc7b8cad40cb14ad2f29b38982..6f2dcdc6ef64bc83faaf3b5db923dff1ce3c0219 100755 (executable)
@@ -11,11 +11,11 @@ int scan(char *s, int l)
 {
        char *p = s;
        char *q = 0;
-       #define YYCTYPE         char
-       #define YYCURSOR        p
-       #define YYLIMIT         (s+l+2)
-       #define YYMARKER        q
-       #define YYFILL(n)               { printf("OOD\n"); return 2; }
+#define YYCTYPE         char
+#define YYCURSOR        p
+#define YYLIMIT         (s+l+2)
+#define YYMARKER        q
+#define YYFILL(n)              { printf("OOD\n"); return 2; }
        
        for(;;)
        {
index a868be55112e6f2e71a17eea60ad75bfd1b97f0e..b011fe97ac80f989f0d3a5c0bedfaff50425fb41 100755 (executable)
@@ -25,11 +25,11 @@ int scan(char *s, int l)
 {
        char *p = s;
        char *q = 0;
-       #define YYCTYPE         char
-       #define YYCURSOR        p
-       #define YYLIMIT         (s+l+2)
-       #define YYMARKER        q
-       #define YYFILL(n)               { printf("OOD\n"); return 2; }
+#define YYCTYPE         char
+#define YYCURSOR        p
+#define YYLIMIT         (s+l+2)
+#define YYMARKER        q
+#define YYFILL(n)              { printf("OOD\n"); return 2; }
        
        for(;;)
        {
index 0cff796b2f8f4db76be7f46a698682d00ef54865..03ba4d63f9462fd43ce5aeb53ff64c2edf62042b 100755 (executable)
@@ -22,11 +22,11 @@ int scan(char *s, int l)
        char *p = s;
        char *q = 0;
        char *t;
-       #define YYCTYPE         char
-       #define YYCURSOR        p
-       #define YYLIMIT         (s+l+2)
-       #define YYMARKER        q
-       #define YYFILL(n)               { printf("OOD\n"); return 2; }
+#define YYCTYPE         char
+#define YYCURSOR        p
+#define YYLIMIT         (s+l+2)
+#define YYMARKER        q
+#define YYFILL(n)              { printf("OOD\n"); return 2; }
        
        for(;;)
        {
index 885e8be3f8f06a12805756a62a037ad1fa8b28e8..9b621cef41ef095376a0c91c1cba6d5d35ea494d 100755 (executable)
@@ -37,11 +37,11 @@ int scan(char *s, int l)
        char *p = s;
        char *q = 0;
        char *t;
-       #define YYCTYPE         char
-       #define YYCURSOR        p
-       #define YYLIMIT         (s+l+2)
-       #define YYMARKER        q
-       #define YYFILL(n)               { printf("OOD\n"); return 2; }
+#define YYCTYPE         char
+#define YYCURSOR        p
+#define YYLIMIT         (s+l+2)
+#define YYMARKER        q
+#define YYFILL(n)              { printf("OOD\n"); return 2; }
        
        for(;;)
        {
index c7ff80bee35e66b07eaa2c79c95f628bf02b9eae..0be831e36e9152b46459f9e21ef0ce2245e3ee53 100755 (executable)
@@ -57,11 +57,11 @@ int scan(char *s, int l)
        char *t;
        int res = 0;
 
-       #define YYCTYPE         char
-       #define YYCURSOR        p
-       #define YYLIMIT         (s+l+1)
-       #define YYMARKER        q
-       #define YYFILL(n)               { return depth == 1 ? 0 : 2; }
+#define YYCTYPE         char
+#define YYCURSOR        p
+#define YYLIMIT         (s+l+1)
+#define YYMARKER        q
+#define YYFILL(n)              { return depth == 1 ? 0 : 2; }
        
        while(!res)
        {
index ae4c475592df65e1d189fd0dcdfc40a94a035eed..12cbee18475a8d3c99f243951440730b63f5ccf9 100755 (executable)
@@ -5,7 +5,7 @@
   . We are going to write an UPN calculator so we need an additional rule to
     ignore white space.
   . Then we need to store the scanned input somewhere and do our math on it.
-  . Also we need to scann all arguments since the main c code gets the input
+  . Also we need to scan all arguments since the main c code gets the input
     split up into chunks.
   . In contrast to what we did before we now add a variable res that holds the 
     scanner state. We initialize that variable to 0 and quit the loop when it
@@ -71,11 +71,11 @@ int scan(char *s, int l)
        char *t;
        int res = 0;
 
-       #define YYCTYPE         char
-       #define YYCURSOR        p
-       #define YYLIMIT         (s+l+1)
-       #define YYMARKER        q
-       #define YYFILL(n)               { return depth == 1 ? 0 : 2; }
+#define YYCTYPE         char
+#define YYCURSOR        p
+#define YYLIMIT         (s+l+1)
+#define YYMARKER        q
+#define YYFILL(n)              { return depth == 1 ? 0 : 2; }
        
        while(!res)
        {
index 941b94c7b6d45b75cc045af828409a453b3811b9..4c470e09d20fe7692a9c47eba52eb5e07ea87d0f 100755 (executable)
@@ -58,8 +58,8 @@ int scan(char *s)
        char *t;
        int res = 0;
        
-       #define YYCTYPE         char
-       #define YYCURSOR        p
+#define YYCTYPE         char
+#define YYCURSOR        p
        
        while(!res)
        {
index a49ef287259f8bfe0d794fb67fac1d83d38d7666..6790bee495010bfd885141e3372fdae99e14002f 100755 (executable)
@@ -87,8 +87,8 @@ int scan(char *s)
        char *t;
        int res = 0;
        
-       #define YYCTYPE         char
-       #define YYCURSOR        p
+#define YYCTYPE         char
+#define YYCURSOR        p
        
        while(!res)
        {
index 5ea4b19010b360815ce68e3471894362a8bedbbd..c60bfe29a1e380f06586447cd914f971cf66041c 100755 (executable)
@@ -58,8 +58,8 @@ int scan(char *s)
        char *t;
        int res = 0;
        
-       #define YYCTYPE         char
-       #define YYCURSOR        p
+#define YYCTYPE         char
+#define YYCURSOR        p
        
        while(!res)
        {
index 2526312033133ba3a85b63b0df41e0bc049a532a..3ebc919943ed33505409a7faaa010f59597c4db7 100755 (executable)
@@ -61,8 +61,8 @@ int scan(char *s)
        char *t;
        int res = 0;
        
-       #define YYCTYPE         char
-       #define YYCURSOR        p
+#define YYCTYPE         char
+#define YYCURSOR        p
        
        while(!res)
        {
index 71ea696d08d6a7d516383530911f52c3107f9b00..78d03fdb45adafb63bafa7022f44efa0323d5c9b 100755 (executable)
@@ -42,11 +42,11 @@ int ScanFullSpeed(char *pzStrToScan, size_t lenStrToScan)
 {
        char *pzCurScanPos = pzStrToScan;
        char *pzBacktrackInfo = 0;
-       #define YYCTYPE         char
-       #define YYCURSOR        pzCurScanPos
-       #define YYLIMIT         (pzStrToScan+lenStrToScan)
-       #define YYMARKER        pzBacktrackInfo
-       #define YYFILL(n)
+#define YYCTYPE         char
+#define YYCURSOR        pzCurScanPos
+#define YYLIMIT         (pzStrToScan+lenStrToScan)
+#define YYMARKER        pzBacktrackInfo
+#define YYFILL(n)
        
        for(;;)
        {
@@ -171,11 +171,11 @@ int scan(char *pzStrToScan, size_t lenStrToScan)
 {
        char *pzCurScanPos = pzStrToScan;
        char *pzBacktrackInfo = 0;
-       #define YYCTYPE         char
-       #define YYCURSOR        pzCurScanPos
-       #define YYLIMIT         (pzStrToScan+lenStrToScan)
-       #define YYMARKER        pzBacktrackInfo
-       #define YYFILL(n)
+#define YYCTYPE         char
+#define YYCURSOR        pzCurScanPos
+#define YYLIMIT         (pzStrToScan+lenStrToScan)
+#define YYMARKER        pzBacktrackInfo
+#define YYFILL(n)
        
        for(;;)
        {
index efee5d88afe744f3497a895775f79d67b8ce9f34..3e2abf80ae4af9cc2ae50ab9b5bc065423b4cbf6 100755 (executable)
     in this lesson. In the next example we see one way to get rid of it.
   . We use a 'for(;;)'-loop around the scanner block. We could have used a
     'while(1)'-loop instead but some compilers generate a warning for it.
-  . To make the output more readable we use 're2c:indent:top' scanen
+  . To make the output more readable we use 're2c:indent:top' scanne
     configuration that configures re2c to prepend a single tab (the default)
     to the beginning of each output line.
   . The following lines are expressions and for each expression we output the 
     token name and continue the scanner loop.
   . The second last token detects the end of our input, the terminating zero in
-    out input string. In other scanners detecting the end of input may vary.
+    our input string. In other scanners detecting the end of input may vary.
     For example binary code may contain \0 as valid input.
   . The last expression accepts any input character. It tells re2c to accept 
     the opposit of the empty range. This includes numbers and our tokens but
@@ -80,11 +80,11 @@ int ScanFullSpeed(char *pzStrToScan, size_t lenStrToScan)
 {
        char *pzCurScanPos = pzStrToScan;
        char *pzBacktrackInfo = 0;
-       #define YYCTYPE         char
-       #define YYCURSOR        pzCurScanPos
-       #define YYLIMIT         (pzStrToScan+lenStrToScan)
-       #define YYMARKER        pzBacktrackInfo
-       #define YYFILL(n)
+#define YYCTYPE         char
+#define YYCURSOR        pzCurScanPos
+#define YYLIMIT         (pzStrToScan+lenStrToScan)
+#define YYMARKER        pzBacktrackInfo
+#define YYFILL(n)
        
        for(;;)
        {
@@ -107,11 +107,11 @@ int scan(char *pzStrToScan, size_t lenStrToScan)
 {
        char *pzCurScanPos = pzStrToScan;
        char *pzBacktrackInfo = 0;
-       #define YYCTYPE         char
-       #define YYCURSOR        pzCurScanPos
-       #define YYLIMIT         (pzStrToScan+lenStrToScan)
-       #define YYMARKER        pzBacktrackInfo
-       #define YYFILL(n)
+#define YYCTYPE         char
+#define YYCURSOR        pzCurScanPos
+#define YYLIMIT         (pzStrToScan+lenStrToScan)
+#define YYMARKER        pzBacktrackInfo
+#define YYFILL(n)
        
        for(;;)
        {
index ca7351800144d142f53696da4b08b5b05d10fd2b..5466fcea46fb69bae228d36b9ec2ba45a0a96193 100755 (executable)
@@ -20,7 +20,7 @@
 
 - multiple scanner blocks
   . We use a main scanner block that outputs every input character unless the
-    input is two /s or a / followed by a *. In the lattertwo cases we switch
+    input is two /s or a / followed by a *. In the latter two cases we switch
     to a special c++ comment and a comment block respectively.
   . Both special blocks simply detect their end ignore any other character.
   . The c++ block is a bit special. Since the terminating new line needs to
index 21f11d0b32aa88f8bed3701f1282b4ee85fdeed3..c18d378455ea28b968feec3474d5b06ad7773ae9 100755 (executable)
@@ -2,7 +2,7 @@
 /*!ignore:re2c
 
 - complexity
-  . When a comemnt is preceeded by a new line and followed by whitespace and a 
+  . When a comment is preceeded by a new line and followed by whitespace and a 
     new line then we can drop the trailing whitespace and new line.
   . Additional to what we strip out already what about two consequtive comment 
     blocks? When two comments are only separated by whitespace we want to drop 
index 065d31ab43b4de2e371d2edd58ed28614d97b691..b53cee05f1e5424f94bdc6eae74d5d7b3b2fbdbc 100755 (executable)
 - formatting
   . Until now we only used single line expression code and we always had the 
     opening { on the same line as the rule itself. If we have multiline rule
-    code and care for formatting we can nolonger rely on re2c. Now we have 
+    code and care for formatting we can no longer rely on re2c. Now we have 
     to indent the rule code ourself. Also we need to take care of the opening
     {. If we keep it on the same line as the rule then re2c will indent it 
     correctly and the emitted #line informations will be correct. If we place
-    it on the next line then the #line directivy will also point to that line
+    it on the next line then the #line directive will also point to that line
     and not to the rule.
 */
 
index 2d26179c10a6a761cccd1628ab051764aec45251..d445a0d433a3397932952c0001a1c41074886d45 100755 (executable)
@@ -2,19 +2,19 @@ re2c lessons, (c) M. Boerger 2006
 
 001_upn_calculator
 
-       This lesson gets you started with re2c. In the end you will have an easy UPN
-       calculator for use at command line.
+       This lesson gets you started with re2c. In the end you will have an easy 
+       RPN calculator for use at command line.
 
-       You will learn about the basic interface of re2c when scanning input strings. 
-       How to detect the end of the input and use that to stop scanning in order to
-       avoid problems.
+       You will learn about the basic interface of re2c when scanning input 
+       strings. How to detect the end of the input and use that to stop scanning 
+       in order to     avoid problems.
 
        The lesson also contains a windows subdirectory to get you started in the 
        Microsoft world.
 
 002_strip_comments
 
-       In this lesson you will learn how to use multiple scanner blocks and how to 
-       read the input from a file instead of a zero terminated string. In the end you
-       will have a scanner that filters comments out of c source files but keeps re2c
-       comments.
+       In this lesson you will learn how to use multiple scanner blocks and how 
+       to read the input from a file instead of a zero terminated string. In the 
+       end you will have a scanner that filters comments out of c source files 
+       but keeps re2c comments.