Requested Information - Grammar

To illustrate the grammar, some examples are given next:

Examples

Phone number required for passenger with a given id:

		passengerSpecifications[ee764ee0-55a1-11eb-ae93-0242ac130002].detail.contact.phoneNumber
	

First name and last name required with a given id:

		passengerSpecifications[ee764ee0-55a1-11eb-ae93-0242ac130004].detail.firstName AND passengerSpecifications[ee764ee0-55a1-11eb-ae93-0242ac130004].detail.lastName
	

More complex example:

		passengerSpecifications[ee764ee0-55a1-11eb-ae93-0242ac130006].detail.firstName AND passengerSpecifications[ee764ee0-55a1-11eb-ae93-0242ac130006].detail.lastName AND (passengerSpecifications[ee764ee0-55a1-11eb-ae93-0242ac130006].detail.contact.email OR passengerSpecifications[ee764ee0-55a1-11eb-ae93-0242ac130006].detail.contact.phoneNumber)
	

Grammar for Requested Information

Here is the grammar in ANTLR notation.

		grammar RequestedInformation;

		And_Operator : 'AND';
		Or_Operator : 'OR';
		Opening_Index_Bracket: '[';
		Closing_Index_Bracket: ']';
		Opening_Bracket: '(';
		Closing_Bracket: ')';
		Point: '.';
		
		requested_informations: requested_information+ EOF;
		
		requested_information
				: class_index_attribute
				| requested_information And_Operator requested_information
				| requested_information Or_Operator requested_information
				| Opening_Bracket requested_information Closing_Bracket
				;
		
		class_index_attribute
				: Attribute Opening_Index_Bracket Identifier Closing_Index_Bracket (Point Attribute)+
				;
		
		Attribute
				: [a-zA-Z_]+
				;
		
		Identifier
				: 'ANY'
				;
		
		boolean_operator
				: And_Operator
				| Or_Operator
				;
		
		WS
				: [ \t\r\n]+ -> skip
				;
		

		

Block

[A-Za-z0-9] [A-Za-z0-9] [A-Za-z0-9] [A-Za-z0-9]

Class

[A-Z] [a-z_] [a-z]

Attribute

[a-z_] [a-z]

Identifier

UUID 'ANY'

UUID

Block Block '-' Block '-' Block '-' Block '-' Block Block Block

Opening_Index_Bracket

'['

Closing_Index_Bracket

']'

Opening_Bracket

'('

Closing_Bracket

')'

And_Operator

'AND'

Or_Operator

'OR'

Point

'.'

requested_informations

requested_information boolean_operator requested_information boolean_expression

requested_information

boolean_expression_with_brackets boolean_operator boolean_expression_with_brackets

boolean_expression_with_brackets

Opening_Bracket boolean_expression Closing_Bracket

boolean_expression

class_index_attribute boolean_operator class_index_attribute

class_index_attribute

Class Opening_Index_Bracket Identifier Closing_Bracket Point Attribute

boolean_operator

And_Operator Or_Operator