anchor.diff:    ;
   
   row_separator :
  -     LINE_TERMINATOR filler*
  -  |  SEMICOLON filler*
  +     LINE_TERMINATOR FILLER?
  +  |  SEMICOLON FILLER?
     ;
   
   element_list :
  
positive.code: //all binary operators are left associative so no special handling is required
  expr :
       short_or_expr
    |  AT filler* input_params expr
    ;
  
  short_or_expr :
       short_and_expr (SHORTOR filler* short_and_expr)*
    ;
  
  short_and_expr :
       or_expr (SHORTAND filler* or_expr)*
  
    ;
  
  or_expr :
       and_expr (OR filler* and_expr)*
    ;
  
  and_expr :
       comp_expr (AND filler* comp_expr)*
    ;
  
  comp_expr :
       colon_expr ((LT | GT | LE | GE | EQ | NE) filler* colon_expr)*
    ;
  
  colon_expr :
       plus_expr (COLON filler* plus_expr (COLON filler* plus_expr)?)?
    ;
  
  plus_expr :
       binary_expr ((PLUS | MINUS) filler* binary_expr)*
    ;
  
  binary_expr :
       prefix_expr ((MTIMES | ETIMES | MDIV | EDIV | MLDIV | ELDIV) filler* prefix_expr)*
    ;
  
  prefix_expr :
       pow_expr
    |  NOT filler* prefix_expr
    |  PLUS filler* prefix_expr
    |  MINUS filler* prefix_expr
    ;
  
  pow_expr :
       postfix_expr ((MPOW | EPOW) filler* postfix_expr)*
    ;
  
  postfix_expr :
       primary_expr ((ARRAYTRANSPOSE | MTRANSPOSE) filler*)*
    ;
  
  primary_expr :
       literal
    |  LPAREN filler* expr RPAREN filler*
    |  matrix
    |  cell_array
    |  access
    |  AT filler* name
    ;
  
  access :
       cell_access (LPAREN filler* arg_list? RPAREN filler*)?
    ;
  
  cell_access :
       (var_access) (LCURLY filler* arg_list RCURLY filler*)*
    |  name AT filler* name
    ;
    
  var_access :
       (name) (DOT filler* name)*
    ;
  
  arg_list :	
       (arg) (COMMA filler* arg)*
    ;
    
  arg :
       expr
    |  COLON filler*
    ;
  
  literal :
       NUMBER filler*
    |  STRING filler*
    ;
  
  matrix :
       LSQUARE filler* optional_row_list RSQUARE filler*
    ;
  
  cell_array :
       LCURLY filler* optional_row_list RCURLY filler*
    ;
  
  optional_row_list :
  
negative.code: 
  fragment NOT_LINE_TERMINATOR : ~('\r' | '\n');
  COMMENT : '%' | '%' ~'{' NOT_LINE_TERMINATOR* { $channel=HIDDEN; };
  
  LINE_TERMINATOR : '\r' '\n' | '\r' | '\n';
  
  fragment ELLIPSIS_COMMENT : '...' NOT_LINE_TERMINATOR* LINE_TERMINATOR;
  fragment OTHER_WHITESPACE : (' ' | '\t' | '\f')+;
  FILLER : (ELLIPSIS_COMMENT | OTHER_WHITESPACE)+;
  