]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
indent(1): rewrite the integer/floating constant scanning part of lexi.c
authorPiotr Pawel Stefaniak <pstef@FreeBSD.org>
Mon, 16 Jul 2018 05:46:50 +0000 (05:46 +0000)
committerPiotr Pawel Stefaniak <pstef@FreeBSD.org>
Mon, 16 Jul 2018 05:46:50 +0000 (05:46 +0000)
commit01c66110e17ad77765b90f07f6c6e357a1ba14b9
treee989b1a3bb855188a966e85e5f740370d554e0d5
parent158f9d1551e138985c45692f01b078640320dbe3
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