Page MenuHomeFreeBSD

ddb(4): Add some support for lexing IPv6 addresses

Authored by cem on Sep 3 2019, 5:27 PM.



Allow commands to specify that (hex) numbers may start with A-F, by adding
the command-scoped CS_LEX_HEX flag. As before, numbers containing invalid
digits for the current radix are rejected.

Also, lex ':' and '::' tokens as tCOLON and tCOLONCOLON respectively.

There is a mild conflict here with lexed "identifiers" (tIDENT): ddb
identifiers may contain arbitrary colons, and the ddb lexer is greedy. So
the identifier lex will swallow any colons it finds inside identifiers, and
consumers are still unable to expect the token sequence 'tIDENT tCOLON'.
That limitation does not matter for IPv6 addresses, because the lexer always
attempts to lex numbers before identifiers.

Diff Detail

rS FreeBSD src repository
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

cem created this revision.Sep 3 2019, 5:27 PM
cem updated this revision to Diff 61633.Sep 4 2019, 12:25 AM

Switch to per-lex flags for the hexadecimal numbers mode (instead of a global).

markj accepted this revision.Sep 8 2019, 4:01 PM
This revision is now accepted and ready to land.Sep 8 2019, 4:01 PM
This revision was automatically updated to reflect the committed changes.