[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug-gperf] Add machine-readable output to gperf
From: |
Sei Lisa |
Subject: |
[bug-gperf] Add machine-readable output to gperf |
Date: |
Sun, 20 Nov 2016 20:25:29 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux i686; rv:24.0) Gecko/20100101 Icedove/24.7.0 |
I'm working on a project that incorporates an editor with syntax highlighting.
The project is written in a language that is not C, C++, ANSI-C nor KR-C. The
syntax highlighting is for yet another language which isn't any of these either.
This last language comprises about 1200 words that need to be highlighted, and
gperf is well suited for this purpose. The problem is that the only options for
output are in the form of a C or C++ program, sometimes with optimizations,
making the extraction of the hash function very cumbersome, relying on a syntax
that is not guaranteed to be stable in future versions of gperf.
To make things worse, there are additions to the language often, and rather
than release a full version every time there's a change, the highlighting files
need to be replaceable. Currently I need to include the generated C program
with the distribution for this purpose, and my program needs to parse it to
find the table, keys and alphas of the hash function. The keywords are not
necessary for this project, because the list that generated them is also
included.
This parsing would be greatly simplified with the addition of an easily
machine-readable, stable output format, with the parameters of the hash
function, including at least:
- Type of hash (there will presumably be only one, but just in case).
- asso_values array.
- Key positions (including '$' if present).
- Corresponding alpha values.
XML would work, but a simple ad-hoc format would work better. For example:
Gperf hash function
type: 1
table: 6741,6741,6741,6741,6741,...(256 elements)...,6741
keys: 1,3,7,8,9,10,11,13,15,22,23
alphas: 0,0,0,0,0,0,0,0,0,0,0
Regards,
Sei
- [bug-gperf] Add machine-readable output to gperf,
Sei Lisa <=