summaryrefslogtreecommitdiff
path: root/src/scan.l
Commit message (Collapse)AuthorAge
* scanner: Include flexdef.h at %top block of scan.lExplorer092017-09-03
| | | | | | | | | | | | | | | | | | | | config.h may define macros that alter the API of the standard library funtions, and so it should be included before any other standard header, even before the skeleton's standard header inclusion. For example: config.h may #define _GNU_SOURCE that would expose the reallocarray() prototype from <stdlib.h> on glibc 2.26+ systems. If we include <stdlib.h> before config.h, reallocarray() would not be available for use in lex file since the second include doesn't help due to header guard. For now our config.h might `#define malloc rpl_malloc` -- this substitution must work before including stdlib.h, or else the compiler will complain about missing prototypes, and may result in incorrect code in scan.l (gcc warning: return makes pointer from integer without a cast [-Wint-conversion]). Fixes #247.
* scanner: finish support for noyy{get,set}_column.Will Estes2017-05-13
| | | | Unattributed patch carried over from sourceforge bug tracker.
* scanner: Check for 0 bracecount when EOL ends quoted literal.Demi Obenour2017-05-03
| | | | | This can happen in the case of // comments (which Flex doesn't handle specially).
* scanner: when bracelevel is negative, treat as zero.Demi Obenour2017-05-03
| | | | | This really should never happen, but this at least fixes the breakage on Verilator.
* scanner: Use strncpyChristos Zoulas2017-01-23
|
* scanner: join symbol list.luistung2017-01-11
| | | | | | | | | Removed a newline that caused a problem building the scanner in some circumstances. Specifically: 'bad character' error when executing /bin/sh ../build-aux/ylwrap scan.l lex.yy.c scan.c -- flex
* Fixes a major bug in Flex's own lexing of literals.Demi Obenour2016-11-08
| | | | | | | My changes caused Flex to mishandle string and character literals in line comments. This commit fixes them. Fixes #113.
* Fix another escaping bugDemi Obenour2016-11-01
| | | | | | in non-indented verbatim section 2 code. I also did some reformatting.
* Fix M4 quotation in section 2 prologue and refactor duplicated codeDemi Obenour2016-10-23
|
* Improved M4 quotationDemi Obenour2016-10-19
| | | | | | | | | | | This fixes M4 quotation of certain strings beginning with `yy` (in section 3 of the input file only) and character literals. The new quotation method is also less brittle and faster. Tests that relied on the old behavior were fixed. Also, `yyconst` is no longer defined; use `const` (which it unconditionally was defined to) instead.
* Fix M4 quoting of section 3.Demi Obenour2016-10-05
| | | | | | | | | | This fixes M4 quoting of section 3 of the input file, including escape sequences and character constants. Tests were added to verify the behavior in section 3 with respect to quoting. Both escaping of quotes and quoting of potential macro-start characters are tested. Existing tests were also fixed to account for the new -- and now correct -- behavior. Many tests relied on the old behavior of expanding M4 macros in section 3. They needed to be updated for the new behavior.
* scanner: M4 quoting fixesDemi Obenour2016-09-25
|
* no longer generate K&R C scannersDemi Obenour2016-09-25
|
* Fix escaping of `[[` and `]]` in stringsDemi Obenour2016-09-04
| | | | | | | | Previously, `[[` and `]]` were not escaped in strings, which led to bad interactions with m4. Also, don't break strings on newline, as GCC et al support whitespace between a backslash and the subsequent newline.
* scan.l, rewrite two loops to avoid unneccesairy castingrlar2016-03-12
|
* cast to get rid of warningsrlar2016-03-08
|
* avoid warning, POSIX says yyless() has an `int' argumentrlar2016-03-01
|
* add (int) casts to some strlen() invocations to prevent warningsrlar2016-02-29
|
* ndlookup(), char *, to get rid of casts and warningsrlar2016-02-29
|
* ndinstal(), char *, to get rid of casts and warningsrlar2016-02-29
|
* cclinstal() and ccllookup(), char *, to get rid of casts and warningsrlar2016-02-29
|
* unification, rename some morerlar2016-02-28
| | | | | rename these too for improved similiarity: OPTION_OP OPT_HEADER OPT_EXTRA_TYPE OPT_TABLES
* fix name clash, OPT_OUTFILE from parse.y and from options.hrlar2016-02-28
| | | | | | these collide: OPT_OUTFILE OPT_PREFIX OPT_YYCLASS rename them TOK_... in the parser
* Allow '%option noline' in flex input file, resolves gh#56.Tobias Klauser2016-02-24
| | | | | | | Allow specifying '%option noline' in the input file, leading to the same effect as calling flex with the command line option --noline. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
* Converted K&R style function definitions to ANSI C styleTobias Klauser2016-02-16
| | | | | Consistently make use of the ANSI C function definition style instead of the K&R style.
* Removed flex_free()i, corrected buf_destroy logic.Michael McConville2015-12-09
| | | | | | | As with flex_alloc(), replace with direct calls to free(). The function buf_destroy is now null safe and the logic was corrected to free() correctly.
* Removed flex_realloc().Michael McConville2015-12-09
| | | | | As with flex_alloc(), replace calls to flex_realloc(), which was just a wrapper around realloc().
* Removed flex_alloc; cleaned up style.Michael McConville2015-12-09
| | | | | | | | | | | The function flex_alloc() was just a wrapper around malloc(). Since this only added unclarity, and the flex_alloc() function is likely a legacy of olden times, remove it in favor of calls to malloc() directly. Style elements cleaned up: * superfluous spacing around parentheses * non-constant initialization in variable declarations * needless casts * almost all uses of assignments as subexpressions
* Remove allocation castsMichael McConville2015-12-07
|
* Use NULL rather than (type *) 0.Michael McConville2015-12-05
|
* Made string copying more standard.Michael McConville2015-12-02
| | | | | copy_string() was a clone of the stdlib's strdup(). For safety, simplicity, and speed, we should use that instead. We introduce xstrdup() which wraps strdup() in a failure upon memory allocation errors.
* Error on unbalanced parentheses in rules section.Serguey Parkhomovsky2015-11-30
|
* Replaced CHAR macro with unsigned char type.Mightyjo2015-11-29
| | | | | | | | Thanks to Michael McConville for pointing out that the old Char macro causes problems with static analysis. The macro has been removed and replaced with 'unsigned char' throughout the flex sources. The macro is not needed at best and was confusing at worst. It was not used in any of the example files nor was it mentioned in the manual at all.
* Switch function definitions from mixed K&R to consistent ANSI C.Stefan Reinauer2015-11-19
| | | | | | | | flex was using K&R function definitions for some functions and ANSI C style in others, sometimes even in the same file. Change the code to consistently use ANSI C. Signed-off-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
* Fix `label unused` warningMariusz PluciƄski2014-11-26
|
* NetBSD downstream patches.Christos Zoulas2014-11-11
| | | | | | | | | | | | | | | | const fixes. -Wconversion fixes for the skeleton files. param namespace protection (add _ to inline function parameters). unused variable/code removal. rename warn to lwarn to avoid conflict with <err.h>. ctype.h function argument correction. merged the error functions lerrif and lerrsf -> lerr.
* Removed deprecated 'register' storage class specifier.Yuri2014-07-25
| | | | clang-3.5.0 now complains about them: warning: 'register' storage class specifier is deprecated [-Wdeprecated-register]
* move flex program sources into src/ directoryWill Estes2014-02-16
The *.[chly] sources are now in the src directory. This implies a bunch of changes in Makefile.am and friends to account for the new location. The .gitignore files are now more local to places where various object files and generated source files occur.