Add Support For Parsing Struct Field Access
Signed-off-by: Will Hawkins <hawkinsw@obs.cr>
This commit is contained in:
@@ -117,6 +117,7 @@ parser simple() {
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
=========================
|
||||
Simple Array Access
|
||||
=========================
|
||||
@@ -168,3 +169,107 @@ parser simple() {
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
=========================
|
||||
Simple Struct Access
|
||||
=========================
|
||||
parser simple() {
|
||||
state start {
|
||||
abc.xyz;
|
||||
transition accept;
|
||||
}
|
||||
};
|
||||
|
||||
---
|
||||
(p4program
|
||||
(declaration
|
||||
(parserDeclaration
|
||||
(parserType
|
||||
(parser)
|
||||
(identifier)
|
||||
)
|
||||
(parserStates
|
||||
(parserState
|
||||
(state)
|
||||
(identifier)
|
||||
(parserStatements
|
||||
(parserStatement
|
||||
(expressionStatement
|
||||
(expression
|
||||
(fieldAccessExpression
|
||||
(expression
|
||||
(identifier)
|
||||
)
|
||||
(field_access)
|
||||
(identifier)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(parserTransitionStatement
|
||||
(transition)
|
||||
(transitionSelectionExpression
|
||||
(identifier)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
=========================
|
||||
Nested Struct Access
|
||||
=========================
|
||||
parser simple() {
|
||||
state start {
|
||||
abc.cde.xyz;
|
||||
transition accept;
|
||||
}
|
||||
};
|
||||
|
||||
---
|
||||
(p4program
|
||||
(declaration
|
||||
(parserDeclaration
|
||||
(parserType
|
||||
(parser)
|
||||
(identifier)
|
||||
)
|
||||
(parserStates
|
||||
(parserState
|
||||
(state)
|
||||
(identifier)
|
||||
(parserStatements
|
||||
(parserStatement
|
||||
(expressionStatement
|
||||
(expression
|
||||
(fieldAccessExpression
|
||||
(expression
|
||||
(fieldAccessExpression
|
||||
(expression
|
||||
(identifier)
|
||||
)
|
||||
(field_access)
|
||||
(identifier)
|
||||
)
|
||||
)
|
||||
(field_access)
|
||||
(identifier)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(parserTransitionStatement
|
||||
(transition)
|
||||
(transitionSelectionExpression
|
||||
(identifier)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user