cst: assign explicit values to SyntaxKind variants

This commit is contained in:
raf 2025-06-02 09:40:03 +03:00
commit 6f08d27a59
Signed by: NotAShelf
GPG key ID: 29D95B64378DB4BF

View file

@ -13,150 +13,150 @@ use thiserror::Error;
pub enum SyntaxKind { pub enum SyntaxKind {
// Root and containers // Root and containers
Root = 0, Root = 0,
Table, Table = 1,
Chain, Chain = 2,
Rule, Rule = 3,
Set, Set = 4,
Map, Map = 5,
Element, Element = 6,
// Expressions // Expressions
Expression, Expression = 7,
BinaryExpr, BinaryExpr = 8,
UnaryExpr, UnaryExpr = 9,
CallExpr, CallExpr = 10,
SetExpr, SetExpr = 11,
RangeExpr, RangeExpr = 12,
// Statements // Statements
Statement, Statement = 13,
IncludeStmt, IncludeStmt = 14,
DefineStmt, DefineStmt = 15,
FlushStmt, FlushStmt = 16,
AddStmt, AddStmt = 17,
DeleteStmt, DeleteStmt = 18,
// Literals and identifiers // Literals and identifiers
Identifier, Identifier = 19,
StringLiteral, StringLiteral = 20,
NumberLiteral, NumberLiteral = 21,
IpAddress, IpAddress = 22,
Ipv6Address, Ipv6Address = 23,
MacAddress, MacAddress = 24,
// Keywords // Keywords
TableKw, TableKw = 25,
ChainKw, ChainKw = 26,
RuleKw, RuleKw = 27,
SetKw, SetKw = 28,
MapKw, MapKw = 29,
ElementKw, ElementKw = 30,
IncludeKw, IncludeKw = 31,
DefineKw, DefineKw = 32,
FlushKw, FlushKw = 33,
AddKw, AddKw = 34,
DeleteKw, DeleteKw = 35,
InsertKw, InsertKw = 36,
ReplaceKw, ReplaceKw = 37,
// Chain types and hooks // Chain types and hooks
FilterKw, FilterKw = 38,
NatKw, NatKw = 39,
RouteKw, RouteKw = 40,
InputKw, InputKw = 41,
OutputKw, OutputKw = 42,
ForwardKw, ForwardKw = 43,
PreroutingKw, PreroutingKw = 44,
PostroutingKw, PostroutingKw = 45,
// Protocols and families // Protocols and families
IpKw, IpKw = 46,
Ip6Kw, Ip6Kw = 47,
InetKw, InetKw = 48,
ArpKw, ArpKw = 49,
BridgeKw, BridgeKw = 50,
NetdevKw, NetdevKw = 51,
TcpKw, TcpKw = 52,
UdpKw, UdpKw = 53,
IcmpKw, IcmpKw = 54,
Icmpv6Kw, Icmpv6Kw = 55,
// Match keywords // Match keywords
SportKw, SportKw = 56,
DportKw, DportKw = 57,
SaddrKw, SaddrKw = 58,
DaddrKw, DaddrKw = 59,
ProtocolKw, ProtocolKw = 60,
NexthdrKw, NexthdrKw = 61,
TypeKw, TypeKw = 62,
HookKw, HookKw = 63,
PriorityKw, PriorityKw = 64,
PolicyKw, PolicyKw = 65,
IifnameKw, IifnameKw = 66,
OifnameKw, OifnameKw = 67,
CtKw, CtKw = 68,
StateKw, StateKw = 69,
// Actions // Actions
AcceptKw, AcceptKw = 70,
DropKw, DropKw = 71,
RejectKw, RejectKw = 72,
ReturnKw, ReturnKw = 73,
JumpKw, JumpKw = 74,
GotoKw, GotoKw = 75,
ContinueKw, ContinueKw = 76,
LogKw, LogKw = 77,
CommentKw, CommentKw = 78,
// States // States
EstablishedKw, EstablishedKw = 79,
RelatedKw, RelatedKw = 80,
NewKw, NewKw = 81,
InvalidKw, InvalidKw = 82,
// Additional protocol keywords
VmapKw,
NdRouterAdvertKw,
NdNeighborSolicitKw,
NdNeighborAdvertKw,
EchoRequestKw,
DestUnreachableKw,
RouterAdvertisementKw,
TimeExceededKw,
ParameterProblemKw,
PacketTooBigKw,
// Operators // Operators
EqOp, EqOp = 83,
NeOp, NeOp = 84,
LeOp, LeOp = 85,
GeOp, GeOp = 86,
LtOp, LtOp = 87,
GtOp, GtOp = 88,
// Punctuation // Punctuation
LeftBrace, LeftBrace = 89,
RightBrace, RightBrace = 90,
LeftParen, LeftParen = 91,
RightParen, RightParen = 92,
LeftBracket, LeftBracket = 93,
RightBracket, RightBracket = 94,
Comma, Comma = 95,
Semicolon, Semicolon = 96,
Colon, Colon = 97,
Assign, Assign = 98,
Dash, Dash = 99,
Slash, Slash = 100,
Dot, Dot = 101,
// Trivia // Trivia
Whitespace, Whitespace = 102,
Newline, Newline = 103,
Comment, Comment = 104,
Shebang, Shebang = 105,
// Error recovery // Error recovery
Error, Error = 106,
// Additional protocol keywords
VmapKw = 107,
NdRouterAdvertKw = 108,
NdNeighborSolicitKw = 109,
NdNeighborAdvertKw = 110,
EchoRequestKw = 111,
DestUnreachableKw = 112,
RouterAdvertisementKw = 113,
TimeExceededKw = 114,
ParameterProblemKw = 115,
PacketTooBigKw = 116,
} }
impl From<TokenKind> for SyntaxKind { impl From<TokenKind> for SyntaxKind {