I have a source that has embed information in comment. For example
//IP x = 3
//IP y = 20
Normally, "//" is marked for comment, but "//IP" is used for indicating set setup information.
How can I parse the comment to get value for x and y?
I may be able to have these lexer rules, but I'm not sure about the action part. Can I extract BASIC_IDENTIFIER values?
BASIC_IDENTIFIER
: ('a'..'z' | 'A'..'Z') ( '_' | ('a'..'z' | 'A'..'Z') | ('0'..'9') )*
;
IP_COMMENT
: '//IP' (BASIC_IDENTIFIER\s?'='\s?BASIC_IDENTIFIER) ( ~'\n' )* {???}
;
COMMENT
: '//' ( ~'\n' )* {$channel=HIDDEN;}
;