title: Parsing "->" assignment operator in R
body: <p>My question is about parsing expressions in R language. Let me jump right into an example:</p>
  
  <pre><code>fun_text &lt;- c("
  0 -&gt; var
  f1 &lt;- function()
  {
      0 -&gt; sum_var
      sum_var2 = 0
      sum_var3 &lt;- 0
  }
  
  (function()
  {
      0 -&gt; sum_var
      sum_var2 = 0
      sum_var3 &lt;- 0
  })-&gt;f2
  
  f3 = function(x)
  {
    0 -&gt; sum_var
    sum_var2 = 0
    sum_var3 &lt;- 0
  }
  
  ")
  
  fun_tree &lt;- parse(text=fun_text)
  fun_tree 
  fun_tree[[1]]
  fun_tree[[2]]
  fun_tree[[3]]
  fun_tree[[4]]
  </code></pre>
  
  <p>After that, we obtain those results:</p>
  
  <pre><code>expression(0 -&gt; var, f1 &lt;- function()
  {
      0 -&gt; sum_var
      sum_var2 = 0
      sum_var3 &lt;- 0
  }, (function()
  {
      0 -&gt; sum_var
      sum_var2 = 0
      sum_var3 &lt;- 0
  })-&gt;f2, f3 = function(x)
  {
      0 -&gt; sum_var
      sum_var2 = 0
      sum_var3 &lt;- 0
  })
  </code></pre>
  
  <p>and</p>
  
  <pre><code>var &lt;- 0
  </code></pre>
  
  <p>and</p>
  
  <pre><code>f1 &lt;- function() {
      sum_var &lt;- 0
      sum_var2 = 0
      sum_var3 &lt;- 0
  }
  </code></pre>
  
  <p>and</p>
  
  <pre><code>f2 &lt;- (function() {
      sum_var &lt;- 0
      sum_var2 = 0
      sum_var3 &lt;- 0
  })
  </code></pre>
  
  <p>and</p>
  
  <pre><code>f3 = function(x) {
      sum_var &lt;- 0
      sum_var2 = 0
      sum_var3 &lt;- 0
  }
  </code></pre>
  
  <p>As you can see, all "->" assignment operators are changed to "&lt;-", but not in the first example ("fun_tree" only). My question is: why is that? and can I be sure that I always get "&lt;-" operator in syntax tree, so I can do not bother myself in implementing "->" case?</p>