]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
indent(1): rewrite the integer/floating constant scanning part of lexi.c
authorpstef <pstef@FreeBSD.org>
Mon, 16 Jul 2018 05:46:50 +0000 (05:46 +0000)
committerpstef <pstef@FreeBSD.org>
Mon, 16 Jul 2018 05:46:50 +0000 (05:46 +0000)
commit04c77c18ada08a796cfe1d7545c0e76429e1d3dc
treee989b1a3bb855188a966e85e5f740370d554e0d5
parentf327aaf32d5d955201e0fbf6238a23b4d5afea47
indent(1): rewrite the integer/floating constant scanning part of lexi.c

Remove procedural code that did the scanning, which was faulty and didn't
support complex constants such as 0x1p-61. Replace it with a finite state
machine expressed as a transition table. The table was rewritten by hand
from lx's output, given parts of grammar expressed as regular expressions.

lx is Katherine Flavel's lexer generator, currently available at
https://github.com/katef/libfsm and the parts of grammar were taken from
http://quut.com/c/ANSI-C-grammar-l-2011.html and extended to support binary
integer constants which are a popular GCC extension.

Reported by: bde
usr.bin/indent/indent.c
usr.bin/indent/indent.h
usr.bin/indent/lexi.c
usr.bin/indent/tests/float.0
usr.bin/indent/tests/float.0.stdout