Skip to content

Commit

Permalink
Simplified hl parsing (#399)
Browse files Browse the repository at this point in the history
* Stop using global variables to share parse context with the lexer.

The lexer uses an unconventional strategy for parsing lexical categories
NUMBER (decimal numbers) and STRING (double-quoted strings) that involves
sharing the parse context with the lexer using global variables. There
are a couple of problems with that. First, the lexer is too complicated
for the simple tokenization it performs—it's hard to tell if it is
correct. Second, as @seanm points out, the shared global variables
spill into the namespace shared by other libraries and application
programs—e.g., VTK.

* Regenerate source files from *.[yl].

* Replace strndup, which isn't available on Windows, with a custom
routine, `trim_quotes`, that produces a copy of its `const char *`
argument with leading and trailing double quotes ('"') removed.

While I am here, remove the unnecessary statement `BEGIN INITIAL;`,
which I should have deleted in a previous commit.

* Regenerate .c from .l.

* You haven't programmed in C until you have programmed in High-Definition
(HD) C.

* \#include "H5private.h" for HD* definitions.

* Regenerate *.[ch] from *.[yl].
  • Loading branch information
gnuoyd authored Mar 15, 2021
1 parent 24c83cf commit f6d919a
Show file tree
Hide file tree
Showing 5 changed files with 1,879 additions and 1,889 deletions.
Loading

0 comments on commit f6d919a

Please sign in to comment.