Romain Francois wrote: > This is probably due to that in the gram.y file : > > case ':': > if (nextchar(':')) { > if (nextchar(':')) { > yylval = install(":::"); > return NS_GET_INT; > } > else { > yylval = install("::"); > return NS_GET; > } > } > if (nextchar('=')) { > yylval = install(":="); > return LEFT_ASSIGN; > } > yylval = install(":"); > return ':'; > which gives a meaning to ":=", so that parsing x := 2 makes sense. > > > parse( text = "x := 2" ) > expression(x := 2) > attr(,"srcfile") > <text>
thanks. so it seems to be intentionally parsable, though i wouldn't say that this gives a meaning to ':=' -- the operator has a syntactic category, but no semantics. the syntactic category does not imply any semantics, as in '<-' = function(a, b) NULL 1 <- a # NULL where '<-' is still parsed the original way (as a LEFT_ASSIGN, gram.y again), but has now a completely different semantics. it looks like a bug to me: ':=' is parsed on par with '<-' as a LEFT_ASSIGN, but apparently is not backed by any function. it's a zombie. (unless rvalues is used, that is.) vQ ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.