We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
In R 4.1, lambda \(args) { ... } is introduced as a shortcut of function(args) { ... }.
\(args) { ... }
function(args) { ... }
fun1 <- function(var1, var2) { var1 + var2 } fun2 <- \(var1, var2) { var1 + var2 }
but the parse data is only different at FUNCTION and \\\\:
FUNCTION
\\\\
> getParseData(e) line1 col1 line2 col2 id parent token terminal text 29 1 1 3 1 29 0 expr FALSE 1 1 1 1 4 1 3 SYMBOL TRUE fun1 3 1 1 1 4 3 29 expr FALSE 2 1 6 1 7 2 29 LEFT_ASSIGN TRUE <- 28 1 9 3 1 28 29 expr FALSE 4 1 9 1 16 4 28 FUNCTION TRUE function 5 1 17 1 17 5 28 '(' TRUE ( 6 1 18 1 21 6 28 SYMBOL_FORMALS TRUE var1 7 1 22 1 22 7 28 ',' TRUE , 9 1 24 1 27 9 28 SYMBOL_FORMALS TRUE var2 10 1 28 1 28 10 28 ')' TRUE ) 25 1 30 3 1 25 28 expr FALSE 12 1 30 1 30 12 25 '{' TRUE { 20 2 3 2 13 20 25 expr FALSE 14 2 3 2 6 14 16 SYMBOL TRUE var1 16 2 3 2 6 16 20 expr FALSE 15 2 8 2 8 15 20 '+' TRUE + 17 2 10 2 13 17 19 SYMBOL TRUE var2 19 2 10 2 13 19 20 expr FALSE 23 3 1 3 1 23 25 '}' TRUE } 62 5 1 7 1 62 0 expr FALSE 34 5 1 5 4 34 36 SYMBOL TRUE fun2 36 5 1 5 4 36 62 expr FALSE 35 5 6 5 7 35 62 LEFT_ASSIGN TRUE <- 61 5 9 7 1 61 62 expr FALSE 37 5 9 5 9 37 61 '\\\\' TRUE \\ 38 5 10 5 10 38 61 '(' TRUE ( 39 5 11 5 14 39 61 SYMBOL_FORMALS TRUE var1 40 5 15 5 15 40 61 ',' TRUE , 42 5 17 5 20 42 61 SYMBOL_FORMALS TRUE var2 43 5 21 5 21 43 61 ')' TRUE ) 58 5 23 7 1 58 61 expr FALSE 45 5 23 5 23 45 58 '{' TRUE { 53 6 3 6 13 53 58 expr FALSE 47 6 3 6 6 47 49 SYMBOL TRUE var1 49 6 3 6 6 49 53 expr FALSE 48 6 8 6 8 48 53 '+' TRUE + 50 6 10 6 13 50 52 SYMBOL TRUE var2 52 6 10 6 13 52 53 expr FALSE 56 7 1 7 1 56 58 '}' TRUE }
r-lib/xmlparsedata#18 also added support for OP-LAMBDA so that we could work with the XML parse data:
OP-LAMBDA
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> <exprlist> <expr line1="1" col1="1" line2="3" col2="1" start="32" end="94"> <expr line1="1" col1="1" line2="1" col2="4" start="32" end="35"> <SYMBOL line1="1" col1="1" line2="1" col2="4" start="32" end="35">fun1</SYMBOL> </expr> <LEFT_ASSIGN line1="1" col1="6" line2="1" col2="7" start="37" end="38"><-</LEFT_ASSIGN> <expr line1="1" col1="9" line2="3" col2="1" start="40" end="94"> <FUNCTION line1="1" col1="9" line2="1" col2="16" start="40" end="47">function</FUNCTION> <OP-LEFT-PAREN line1="1" col1="17" line2="1" col2="17" start="48" end="48">(</OP-LEFT-PAREN> <SYMBOL_FORMALS line1="1" col1="18" line2="1" col2="21" start="49" end="52">var1</SYMBOL_FORMALS> <OP-COMMA line1="1" col1="22" line2="1" col2="22" start="53" end="53">,</OP-COMMA> <SYMBOL_FORMALS line1="1" col1="24" line2="1" col2="27" start="55" end="58">var2</SYMBOL_FORMALS> <OP-RIGHT-PAREN line1="1" col1="28" line2="1" col2="28" start="59" end="59">)</OP-RIGHT-PAREN> <expr line1="1" col1="30" line2="3" col2="1" start="61" end="94"> <OP-LEFT-BRACE line1="1" col1="30" line2="1" col2="30" start="61" end="61">{</OP-LEFT-BRACE> <expr line1="2" col1="3" line2="2" col2="13" start="65" end="75"> <expr line1="2" col1="3" line2="2" col2="6" start="65" end="68"> <SYMBOL line1="2" col1="3" line2="2" col2="6" start="65" end="68">var1</SYMBOL> </expr> <OP-PLUS line1="2" col1="8" line2="2" col2="8" start="70" end="70">+</OP-PLUS> <expr line1="2" col1="10" line2="2" col2="13" start="72" end="75"> <SYMBOL line1="2" col1="10" line2="2" col2="13" start="72" end="75">var2</SYMBOL> </expr> </expr> <OP-RIGHT-BRACE line1="3" col1="1" line2="3" col2="1" start="94" end="94">}</OP-RIGHT-BRACE> </expr> </expr> </expr> <expr line1="5" col1="1" line2="7" col2="1" start="156" end="218"> <expr line1="5" col1="1" line2="5" col2="4" start="156" end="159"> <SYMBOL line1="5" col1="1" line2="5" col2="4" start="156" end="159">fun2</SYMBOL> </expr> <LEFT_ASSIGN line1="5" col1="6" line2="5" col2="7" start="161" end="162"><-</LEFT_ASSIGN> <expr line1="5" col1="9" line2="7" col2="1" start="164" end="218"> <OP-LAMBDA line1="5" col1="9" line2="5" col2="9" start="164" end="164">\</OP-LAMBDA> <OP-LEFT-PAREN line1="5" col1="10" line2="5" col2="10" start="165" end="165">(</OP-LEFT-PAREN> <SYMBOL_FORMALS line1="5" col1="11" line2="5" col2="14" start="166" end="169">var1</SYMBOL_FORMALS> <OP-COMMA line1="5" col1="15" line2="5" col2="15" start="170" end="170">,</OP-COMMA> <SYMBOL_FORMALS line1="5" col1="17" line2="5" col2="20" start="172" end="175">var2</SYMBOL_FORMALS> <OP-RIGHT-PAREN line1="5" col1="21" line2="5" col2="21" start="176" end="176">)</OP-RIGHT-PAREN> <expr line1="5" col1="23" line2="7" col2="1" start="178" end="218"> <OP-LEFT-BRACE line1="5" col1="23" line2="5" col2="23" start="178" end="178">{</OP-LEFT-BRACE> <expr line1="6" col1="3" line2="6" col2="13" start="189" end="199"> <expr line1="6" col1="3" line2="6" col2="6" start="189" end="192"> <SYMBOL line1="6" col1="3" line2="6" col2="6" start="189" end="192">var1</SYMBOL> </expr> <OP-PLUS line1="6" col1="8" line2="6" col2="8" start="194" end="194">+</OP-PLUS> <expr line1="6" col1="10" line2="6" col2="13" start="196" end="199"> <SYMBOL line1="6" col1="10" line2="6" col2="13" start="196" end="199">var2</SYMBOL> </expr> </expr> <OP-RIGHT-BRACE line1="7" col1="1" line2="7" col2="1" start="218" end="218">}</OP-RIGHT-BRACE> </expr> </expr> </expr> </exprlist>
Looks like we could extend all uses of FUNCTION to also support OP-LAMBDA in all XPaths used in the language providers.
The text was updated successfully, but these errors were encountered:
Successfully merging a pull request may close this issue.
In R 4.1, lambda
\(args) { ... }
is introduced as a shortcut offunction(args) { ... }
.but the parse data is only different at
FUNCTION
and\\\\
:r-lib/xmlparsedata#18 also added support for
OP-LAMBDA
so that we could work with the XML parse data:Looks like we could extend all uses of
FUNCTION
to also supportOP-LAMBDA
in all XPaths used in the language providers.The text was updated successfully, but these errors were encountered: