From 857026f7f06cc07f00786c08e86f82980f4d0a84 Mon Sep 17 00:00:00 2001 From: helly <helly@642ea486-5414-0410-9d7f-a0204ed87703> Date: Sat, 15 Apr 2006 19:31:26 +0000 Subject: [PATCH] - Add docu --- lessons/001_upn_calculator/calc_006.s.re | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lessons/001_upn_calculator/calc_006.s.re b/lessons/001_upn_calculator/calc_006.s.re index 8e16b25d..d7947ccf 100755 --- a/lessons/001_upn_calculator/calc_006.s.re +++ b/lessons/001_upn_calculator/calc_006.s.re @@ -29,6 +29,12 @@ arise when the second last character is a "0" and the last is any digit. if (l > 1 && s[l-2] == '0' && s[l-1] >= '0' && s[l-1] <= '9') return 2; + + However in this example the above check is only necessary if the input is + not terminated by a trailing zero check. In other words it would be used + when reading from a file and directly working on the read buffers. For + zero terminated string input the generated scanner will always find the + terminating zero. - optimizing the generated code by using -s command line switch of re2c . This tells re2c to generate code that uses if statements rather -- 2.40.0