From 220bfe283bb90fde649d2a6de98b528c30b42ccc Mon Sep 17 00:00:00 2001 From: sam bacha Date: Fri, 5 May 2023 22:10:20 -0700 Subject: [PATCH] feat: grammar.g4 initial grammar outline --- grammar.g4 | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 grammar.g4 diff --git a/grammar.g4 b/grammar.g4 new file mode 100644 index 0000000..21fb1fa --- /dev/null +++ b/grammar.g4 @@ -0,0 +1,43 @@ +issues : '[' issue (',' issue)* ']' +issue : '{' swc ',' severity, ',' description ',' locations '}' + +swc : '{' 'SWC-ID' ':' STRING + ( ',' 'SWC-title:' STRING ) ? + ( ',', 'SWC-description:' STRING ) ? + '}' + +severity : [0-4] + | 'informational' + | 'warning' + | 'error' + | 'fatal' + +description : 'description:' string + | 'description-lead': string ( ',' 'description-rest' ) ? + +locations : srcmap + | offsets + | ids + | line_column_length_files + +offsets : 'offset:' '[' offset (',' offset ) * ']' + | 'offset:' offset + +offset : NUMBER + +ids : 'id:' '[' id (',' id ) * ']' + | 'id:' id + +id: NUMBER + +line_column_lengths_files : '[' line_column_length_file (',' line_column_length_file ) * ']' + | line_column_length_file + +line_column_length_file : 'line:' NUMBER + ( ',' 'column:' NUMBER ) ? + ( ',' 'length:' NUMBER ) ? + ',' 'filename:' string ) + + +STRING: '"" ~('"')+ '"' +NUMBER [0-9]+