-
Notifications
You must be signed in to change notification settings - Fork 173
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make most of the C/C++ examples truly C compatible.
Some of the examples use C++ data structures like `std::ifstream`, `std::vector` etc. Leave them as is for now. Update docs. This addresses bug #484 "Example is not C".
- Loading branch information
Showing
25 changed files
with
421 additions
and
432 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,18 @@ | ||
// re2c $INPUT -o $OUTPUT -i --case-ranges | ||
#include <assert.h> | ||
|
||
bool lex(const char *s) { | ||
int lex(const char *s) { | ||
const char *YYCURSOR = s; | ||
/*!re2c | ||
re2c:yyfill:enable = 0; | ||
re2c:define:YYCTYPE = char; | ||
[1-9][0-9]* { return true; } | ||
* { return false; } | ||
[1-9][0-9]* { return 0; } | ||
* { return 1; } | ||
*/ | ||
} | ||
|
||
int main() { | ||
assert(lex("1234")); | ||
assert(lex("1234") == 0); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.